From 3dc1c36cc46adda3ade2777e94cb5c6de3a87e15 Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期四, 12 五月 2022 21:02:05 +0800 Subject: [PATCH] # --- pages/basics/checkout.vue | 262 ++++++++++++++++++++++----------------------------- 1 files changed, 113 insertions(+), 149 deletions(-) diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue index 30ec00b..b23f032 100644 --- a/pages/basics/checkout.vue +++ b/pages/basics/checkout.vue @@ -36,7 +36,7 @@ </view> </view> <view class="square-none" v-show="matList.length === 0"> - <view class="v-show">鏆傛棤鏇村鏁版嵁...</view> + <view class="v-show">璇锋壂鐮侀�夊彇 {{matCount}} 浠跺晢鍝�</view> </view> <checkbox-group @change="checkbox"> <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" > @@ -79,8 +79,8 @@ searchBox: 'hide', pick:'hide', matnr:'', - matList:[{matnr:'1101842-10000',batch:'22047515999',color:{color:'red'}}], - // matList:[], + // matList:[{matnr:'1101842-10000',batch:'22047515999',color:{color:'red'}}], + matList:[], result: '', siteList:[], desc:'', @@ -89,7 +89,8 @@ listLen:0, msgType: 'success', messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�', - fontColor:{color:'red'} + fontColor:{color:'red'}, + matCount:'0' } }, onReady() { @@ -103,7 +104,6 @@ this.baseIP = UIP; const UPORT = uni.getStorageSync('UPORT'); this.basePORT = UPORT - this.getOutBound(); }, methods: { @@ -155,10 +155,118 @@ this.messageText = '鍒犻櫎鎴愬姛' uni.vibrateShort(); }, + + selectMat() { + let that = this + uni.vibrateShort(); + uni.showLoading(); + uni.navigateTo({ + url: "matSelect", + events: { + // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� + acceptDataFromOpenedPage: function(data) { + that.matnr = data.data + that.findMat(that.matnr) + }, + }, + success: function(res) { + // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� + res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) + } + }); + that.matnr = '' + }, + findBarcode() { + let that = this + uni.request({ + url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2', + data: { + barcode:that.barcode + }, + header: { + 'token':uni.getStorageSync('token'), + }, + success(result) { + var res = result.data; + if (res.code === 200) { + if (res.data) { + that.matCount = res.data.length + } + } else if (res.code === 403) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + uni.showToast({title: res.msg, icon: "none",position: 'top'}) + } + + } + }); + + }, + findMat() { + let that = this + uni.request({ + url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2', + data: { + staNo:that.staNo, + matnr:that.matnr + }, + header: { + 'token':uni.getStorageSync('token') + }, + success(result) { + var res = result.data; + if(res.code === 200 ) { + if(res.data) { + for(let i = 0;i<that.matList.length;i++) { + for (let j = 0;j < res.data.length; j++) { + if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) { + res.data.splice(j,1) + } + } + } + if (that.matList.length < that.matCount) { + that.matList = res.data.concat(that.matList) + that.listLen = that.matList.length; + that.focus = false; + that.$nextTick(function() { + that.focus = true; + }); + that.matnr = '' + } else { + that.messageToggle('warn') + that.messageText = '鍟嗗搧宸插叏閮ㄦ坊鍔�' + } + + } + } else if (res.code == 403) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + uni.showToast({title: res.msg, icon: "none",position: 'top'}) + } + + } + }); + }, comb() { uni.vibrateShort(); let that = this; uni.showLoading(); + if (that.matList.length < that.matCount) { + var len = that.matCount - that.matList.length + that.messageToggle('error') + that.messageText = '杩樺墿' + len + '浠舵湭鎵弿' + return; + } uni.request({ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth', data: that.matList, @@ -192,150 +300,6 @@ } }); }, - selectMat() { - let that = this - uni.vibrateShort(); - uni.showLoading(); - uni.navigateTo({ - url: "matSelect", - events: { - // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� - acceptDataFromOpenedPage: function(data) { - that.matnr = data.data - that.findMat(that.matnr) - }, - }, - success: function(res) { - // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� - res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) - } - }); - that.matnr = '' - }, - findMat() { - let that = this - uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth', - data: { - staNo:that.staNo, - matnr:that.matnr - }, - header: { - 'token':uni.getStorageSync('token') - }, - success(result) { - var res = result.data; - if(res.code === 200 ) { - if(res.data) { - for(let i = 0;i<that.matList.length;i++) { - for (let j = 0;j < res.data.length; j++) { - if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) { - res.data.splice(j,1) - } - } - } - that.matList = res.data.concat(that.matList) - that.listLen = that.matList.length; - that.focus = false; - that.$nextTick(function() { - that.focus = true; - }); - that.matnr = '' - } - } else if (res.code == 403) { - uni.showToast({title: res.msg, icon: "none", position: 'top'}) - setTimeout(() => { - uni.reLaunch({ - url: '../login/login' - }); - }, 1000); - } else { - uni.showToast({title: res.msg, icon: "none",position: 'top'}) - } - - } - }); - }, - addMatList(mat) { - console.log(mat) - if (this.matList.length == 0){ - - // this.matList.push(mat[0]) - // this.matList.prototype.push.apply(mat) - } else { - - let toUnshift = true - for (var i = 0; i < this.matList.length; i++) { - let matnr = this.matList[i].matnr - if (matnr == this.matList[i].matnr) { - // this.messageToggle('warn') - // this.messageText = matnr + '宸茬粡鎵弿锛岃鍕块噸澶嶆壂鎻�' - toUnshift = false - } - } - if (toUnshift) { - this.matList.unshift(mat[0]) - } - - } - console.log(this.matList) - }, - findBarcode() { - let that = this - uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth', - data: { - barcode:that.barcode - }, - header: { - 'token':uni.getStorageSync('token'), - - }, - success(result) { - var res = result.data; - if(res.data) { - for(let i = 0;i<that.matList.length;i++) { - for (let j = 0;j < res.data.length; j++) { - if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) { - res.data.splice(j,1) - } - } - } - that.matList = res.data.concat(that.matList) - } - that.listLen = that.matList.length; - } - }); - - }, - getOutBound() { // 鑾峰彇鍑哄簱鍙� - let that = this - uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/site', - method: 'POST', - header: { - 'token':uni.getStorageSync('token') - }, - success(result) { - var res = result.data - if (res.code === 200) { - for (var i = 0; i < res.data.length; i++){ - that.siteList.push(res.data[i].desc) - } - that.staNoList = res.data - } else if (res.code == 403) { - uni.showToast({title: res.msg, icon: "none", position: 'top'}) - setTimeout(() => { - uni.reLaunch({ - url: '../login/login' - }); - }, 1000); - } else { - uni.showToast({title: res.msg, icon: "none",position: 'top'}) - } - }, - }); - }, // getOutBound getCheckDetl() { // 鑾峰彇鍑哄簱鍙h揣鐗╀俊鎭� let that = this -- Gitblit v1.9.1