123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>兑换券划拨-产品中心-创业帮</title>
- <meta name="keywords" content="兑换券划拨-产品中心-创业帮">
- <meta name="description" content="兑换券划拨-产品中心-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="兑换券划拨-产品中心-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- <style>
- .machine-list .van-cell__value{
- flex:.4;
- }
- .mall-bottom{padding:0 .3733rem;height:54px;}
- .mall-bottom button{border-radius:999px !important; height:80% !important;}
- .ismeng{font-size:4px;border:.5px solid #FFD6D6;color:#FF7D7D;padding:0 2px;margin-right:5px;}
- </style>
- </head>
- <body class="h100p pt0 pb0" style="padding-top:0;">
- <div class="machine-tag" id="app" v-cloak>
- <van-nav-bar class="user_rank_explan_title user_title_normal titlef16" left-arrow :title="'机具划拨-'+title" v-if="toptitleisshow" @click-left="goback" @click-right="dialoutrecord">
- <template #left><img src="./static/images/left.png" alt=""></template>
- <template #right>
- <div class="f12">划拨记录</div>
- </template>
- </van-nav-bar>
- <van-sticky v-cloak></van-sticky>
- <van-tabs v-model="active" swipeable animated @change="changetab">
- <van-tab class="bgcfff" :title="'电签兑换券(' + notUseCount + ')'">
- <div class="ovh-x" ref="wrapper2" v-if="active === 0">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="transactions.length === 0 ? 'isnodata':''" style="height:100%;">
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <van-cell class="alltransfer" title="全选" clickable @click="toggleSelectAll" style="position:sticky; top:0; z-index:999">
- <template #icon>
- <van-checkbox class="mr16" name="selectedNum" v-model="SelectedAll" checked-color="#ec5e3b"></van-checkbox>
- </template>
- <template #default>
- <div class="f12">已选{{result.length}}张</div>
- </template>
- </van-cell>
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="transactions.length === 0"></van-empty>
- <van-checkbox-group v-model="result">
- <van-cell-group>
- <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="index" value-class="f14 c333" @click="toggle(index,'')">
- <template #default>
- <div class="f14">{{item.Kind === 1 ? '电签兑换券' : '大机兑换券'}}</div>
- </template>
- <template #title>
- <div class="f14 c333"><span class="ismeng" v-if="item.IsLeader === 1">盟</span><span class="vm">兑换码:</span><span class="vm pr6" :id="'sn'+index">{{item.ExchangeCode}}</span><span class="dib vm" :data-clipboard-text="item.ExchangeCode" data-clipboard-action="copy" :data-clipboard-target="'#sn'+index" :ref="'copy'+index" @click.stop="copySN(index)" @mouseenter="copySN(index)"><img src="./static/images/icon-copy.png" alt="" width="14" height="14"></span></div>
- </template>
- <template #icon>
- <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#ec5e3b"></van-checkbox>
- </template>
- <template #label></template>
- </van-cell>
- </van-cell-group>
- </van-checkbox-group>
- </van-list>
- </van-pull-refresh>
- </div>
- </van-tab>
- <van-tab class="bgcfff" :title="'大机兑换券(' + notUseCount2 + ')'">
- <div class="ovh-x" ref="wrapper2" v-if="active === 1">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="transactions.length === 0 ? 'isnodata':''" style="height:100%;">
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <van-cell class="alltransfer" title="全选" clickable @click="toggleSelectAll" style="position:sticky; top:0; z-index:999">
- <template #icon>
- <van-checkbox class="mr16" name="selectedNum" v-model="SelectedAll" checked-color="#ec5e3b"></van-checkbox>
- </template>
- <template #default>
- <div class="f12">已选{{result.length}}张</div>
- </template>
- </van-cell>
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="transactions.length === 0"></van-empty>
- <van-checkbox-group v-model="result">
- <van-cell-group>
- <van-cell class="machine-list" v-for="item,index in transactions" clickable :key="index" value-class="f14 c333" @click="toggle(index,'')">
- <template #default>
- <div class="f14">{{item.Kind === 1 ? '电签兑换券' : '大机兑换券'}}</div>
- </template>
- <template #title>
- <div class="f14 c333"><span class="ismeng" v-if="item.IsLeader === 1">盟</span><span class="vm">兑换码:</span><span class="vm pr6" :id="'sn'+index">{{item.ExchangeCode}}</span><span class="dib vm" :data-clipboard-text="item.ExchangeCode" data-clipboard-action="copy" :data-clipboard-target="'#sn'+index" :ref="'copy'+index" @click.stop="copySN(index)" @mouseenter="copySN(index)"><img src="./static/images/icon-copy.png" alt="" width="14" height="14"></span></div>
- </template>
- <template #icon>
- <van-checkbox class="mr16" :name="item" ref="checkboxes" checked-color="#ec5e3b"></van-checkbox>
- </template>
- <template #label></template>
- </van-cell>
- </van-cell-group>
- </van-checkbox-group>
- </van-list>
- </van-pull-refresh>
- </div>
- </van-tab>
- </van-tabs>
- <van-popup v-model="checkscreenisshow" round position="bottom" :style="{ height: '50%' }" v-cloak>
- <div class="rel" style="height:95%;margin:16px;margin-bottom:0;">
- <div class="title mt8 pb16 c999">请选择活动类型</div>
- <div class="brandlistcard tc mb12" v-for="item,index in brandlist" :key="item.Id" :class="brandischeck === item.Id ? 'spbrandlistcard':''" @click="brandcheckbtn(item.Id)">{{item.Name}}</div>
- </div>
- </van-popup>
- <van-goods-action class="mall-bottom">
- <van-goods-action-button class="kxs-btn" type="default" color="#FFD500" style="color:#333;" text="划拨" @click="transfer"></van-goods-action-button>
- </van-goods-action>
- <van-overlay :show="nextshow" @click="closenextshow">
- <div class="unbindpop cm">
- <div class="unbindcard tc" @click.stop>
- <div class="f12 tc c666 title">总共划拨{{result.length}}台,请仔细核对SN号及姓名是否正确</div>
- <input type="text" v-model="createercode" placeholder="请输入创客编号" @focus="inputbtn">
- <div class="f12 tc c333 title" v-if="createrinfo.RealName !== ''">姓名:{{createrinfo.RealName}}</div>
- <div class="nextbutton cfff cm mt16 f14" @click="diaolignextbtn" style="color:#333;">{{createrinfo.RealName === ''? '下一步' : '确认无误划拨'}}</div>
- </div>
- </div>
- </van-overlay>
- </div>
- <script src="./static/js/clipboard.min.js"></script>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"></script>
- <script>
- function OnStart(){
- if(PublicLib.getCookieInfo('isallbacktransfer') === 'true'){
- PublicLib.putCookieInfo('isallbacktransfer', '');
- //- app.pageinfo.PageNum = 1;
- //- app.getmachinelist('refresh');
- };
- };
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
-
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- active:0,
- loading: false,
- finished: false,
- refreshing:false,
- issetcount:false,
- isnodata:false,
- toptitleisshow:false,
- nextshow:false,
- changeactiveid:'',
- checkscreenisshow:false,
- createercode:'',
- copyBtn: {},
- result: [],
- productId:'',
- brandlist:[
- {Id:'',Name:'全部'}
- ],
- brandchecklist:[
- ],
- brandischeck:'',
- transactions: [
- ],
- pageinfo:{
- PageSize:20,
- PageNum:1
- },
- loading: false,
- finished: false,
- refreshing: false,
- createrinfo:{
- RealName:'',
- Id:'',
- },
- SelectedAll: false,
- title:'',
- is200:false,
- notUseCount:0,
- usedCount:0,
- notUseCount2:0,
- usedCount2:0,
- ischecked:false,
- };
- },
- created() {
- this.productId = PublicLib.getCookieInfo('productMachineId');
- this.title=PublicLib.getCookieInfo('productMachineType');
- this.toptitleisshow = toptitleisshow;
- if(this.productId === '1' || this.productId === '2'){
- this.is200 = true;
- }else{
- this.is200 === false
- };
- PublicLib.SetTitle({Title:'机具券划拨-'+ PublicLib.getCookieInfo('productMachineType')});
- this.getexchangelist('refresh');
- },
- beforeUpdate(){
- this.$nextTick(() => {
- this.$refs.wrapper2.style.height = `${document.documentElement.clientHeight - 95}px`;
- });
- },
- methods: {
- changetab(){
- const that = this;
- that.finished = false;
- that.SelectedAll = false;
- that.ischecked = true;
- that.result = [];
- that.transactions = [];
- that.pageinfo.PageNum = 1;
- that.getexchangelist('refresh');
- },
- onRefresh() {
- const that = this;
- that.pageinfo.PageNum = 1;
- // 清空列表数据
- that.finished = false;
- that.ischecked = true;
- //- that.transactions = [];
- that.SelectedAll = false; //下拉刷新时,清空全选状态
- // 重新加载数据
- // 将 loading 设置为 true,表示处于加载状态
- that.getexchangelist('refresh');
-
- },
- onLoad() {
- const that = this;
- if(that.ischecked){
- return;
- };
- that.pageinfo.PageNum += 1;
- that.getexchangelist();
- // 加载更多数据后,将全选状态清空
- if(that.pageinfo.PageNum !== 1){
- setTimeout(() => {
- if(that.result.length == that.transactions.length && that.transactions.length !== 0){
- that.SelectedAll = true;
- }else{
- that.SelectedAll = false;
- };
- }, 10);
- }else{
- that.SelectedAll = false;
- };
- },
- //- 全选按钮
- toggleSelectAll(){
- const that = this;
- that.SelectedAll = !that.SelectedAll;
- if(that.SelectedAll){
- that.result = that.transactions;
- }else{
- that.result = [];
- };
- },
- brandchangebtn(id){
- this.changeactiveid = id;
- },
- inputbtn(){
- this.createrinfo.RealName = '';
- },
- giveToast(str){
- vant.Toast(str);
- },
- copySN(index){
- const that = this;
- this.$nextTick(() => {
- that.copyBtn = new ClipboardJS(this.$refs['copy'+index][0]);
- const clipboard = that.copyBtn;
- clipboard.on('success', function(e) {
- that.giveToast('复制成功');
- });
- clipboard.on('error', function(e) {
- that.giveToast('复制失败,请手动选择复制!');
- });
- });
- },
- //- 全选反选
- toggle(index,type) {
- const that = this;
- if(type === '赠送机') return;
- this.$refs.checkboxes[index].toggle();
- setTimeout(() => {
- if(that.result.length == that.transactions.length){
- that.SelectedAll = true;
- }else{
- that.SelectedAll = false;
- };
- }, 10);
- },
- transfer(){
- if(PublicLib.getCookieInfo('userId') === '124473'){
- return tips('账号异常,请联系客服');
- };
- if(this.result.length === 0){
- return tips('请至少选择1台机具!');
- };
- const ischeck = this.result.find(item=>{
- //- console.log(item.PosSnType)
- return item.PosSnType === '赠送机';
- });
- if(ischeck){
- return tips('赠送机不可划拨,请重新选择')
- };
- this.nextshow = true;
- },
- closenextshow(){
- this.nextshow = false;
- this.createercode = '';
- this.createrinfo.RealName = '';
- },
- onClickButton() {
- PublicLib.putCookieInfo('machinesearchType', 'whole');
- PublicLib.Goto({Url:'product-machine-all-transfer'});
- },
- goback(){
- PublicLib.GoBack({Level:1});
- },
- gosearch(){
- PublicLib.putCookieInfo('machinesearchType', 'unbind');
- PublicLib.Goto({Url:'product-machine-search'});
- },
- //- 品牌筛选
- brandcheckbtn(id){
- this.brandischeck = id;
- this.checkscreenisshow = false;
- //- this.transactions = [];
- this.pageinfo.PageNum = 1;
- this.getmachinelist('refresh');
- },
- async getexchangelist(type = 'onload'){
- const that = this;
- const Kind = that.active === 0 ? 1 : 2;
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/pos/poscoupons/exchangecoupons?t='+Math.random(6),JSON.stringify({...that.pageinfo,UserId,Kind}));
- if(res.status !== '1')return tips('兑换码列表获取失败!');
- if(res.data.length < that.pageinfo.PageSize) {
- that.finished = true;
- };
- if(type === 'refresh'){
- that.result = [];
- that.transactions = res.data;
- that.ischecked = false;
- that.refreshing = false;
- }else{
- that.transactions.push(...res.data);
- }
- // 设置loading为false,表示加载完毕,可再次加载数据
- that.loading = false;
- if(that.pageinfo.PageNum === 1){
- that.notUseCount = res.other.NotUseCount;
- that.notUseCount2 = res.other.NotUseCount2;
- };
- if(that.transactions.length === 0) {that.isnodata = true}else{that.isnodata = false};
- },
- diaolignextbtn:undebounce(async function(){
- if(this.createercode === '') return tips('请输入创客编号');
- if(this.createrinfo.RealName === '') {
- const res = await getRequest('api/v1/users/forcode?t='+Math.random(6),JSON.stringify({MakerCode:this.createercode}));
- if(res.status !== '1')return tips(res.info);
- this.createrinfo = res.data;
- } else{
- if(!this.createrinfo.RealName){
- return tips('请输入正确的创客编号!');
- };
- const CouponIds = this.result.map(item=>{
- return item.Id;
- }).join(',');
- //- 1:200 2:300
- const Kind = this.active === 0 ? 1 : 2;
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await postRequest('/api/v1/pos/poscouponrecord/add?t='+Math.random(6),JSON.stringify({UserId,CouponIds,ToUserId:this.createrinfo.Id,Kind}));
- if(res.status === '-1' && res.info === '请输入正确的创客编号') return tips('请输入同一创客体系内的创客编码');
- if(res.status !== '1')return tips(res.info);
- tips('兑换券划拨申请提交成功!');
- this.nextshow = false;
- this.createrinfo = {RealName:'',Id:''};
- this.createercode = '';
- this.result.forEach(item=>{
- this.transactions.forEach((obj,index)=>{
- if(item.Id === obj.Id){
- this.transactions.splice(index,1);
- };
- });
- });
- //- this.transactions = [];
- this.result=[];
- this.SelectedAll = false;
- this.pageinfo.PageNum = 1;
- this.getexchangelist('refresh');
- }
- }),
- dialoutrecord(){
- if(this.active === 0){
- PublicLib.putCookieInfo('transkind','true');
- }else{
- PublicLib.putCookieInfo('transkind','');
- };
- PublicLib.Goto({Url:'product-profit-dialoutrecord-trans'});
- }
- }
- });
- </script>
- </body>
- </html>
|