From 7af9529188258a1d118609f86b19b558e80c2664 Mon Sep 17 00:00:00 2001 From: whycq <you@example.com> Date: 星期日, 02 四月 2023 14:43:38 +0800 Subject: [PATCH] # --- pages/mat/matSelected.vue | 4 - pages/mat/matQuery.vue | 5 -- pages/pakin/pakin.vue | 66 +++++++++++++++++++++++++++++--- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/pages/mat/matQuery.vue b/pages/mat/matQuery.vue index 2525afc..1b69771 100644 --- a/pages/mat/matQuery.vue +++ b/pages/mat/matQuery.vue @@ -76,7 +76,6 @@ 'token':uni.getStorageSync('token'), }, success(result) { - console.log(result) that.tagList = null that.matList = null var res = result.data @@ -96,7 +95,6 @@ } else { uni.showToast({title: res.msg, icon: "none",position: 'top'}) } - uni.hideLoading(); } }); }, @@ -115,15 +113,12 @@ 'token':uni.getStorageSync('token'), }, success(result) { - console.log(result) that.tagList = null var res = result.data if (res.code === 200) { if (res.data != null && res.data.length > 0) { that.matList = res.data that.baColor = "background-color: #1cbbb4;" - } else { - // that.tagId = parentId } } else if (res.code === 403 ) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) diff --git a/pages/mat/matSelected.vue b/pages/mat/matSelected.vue index d4fe196..730e632 100644 --- a/pages/mat/matSelected.vue +++ b/pages/mat/matSelected.vue @@ -44,7 +44,7 @@ maktx: null, specs: null, batch: null, - anfme: null, + anfme: 0, }, baseIP:'', basePORT:'', @@ -78,13 +78,11 @@ this.mat.anfme = value }, back() { - console.log(this.mat.anfme); if (this.mat.anfme === 0) { uni.showToast({title: '璇疯緭鍏ユ暟閲�', icon: "none", position: 'top'}); return; } this.getOpenerEventChannel().emit('matList', {data: this.mat}); - uni.vibrateShort(); uni.navigateBack({ }) diff --git a/pages/pakin/pakin.vue b/pages/pakin/pakin.vue index 73ce360..61269ea 100644 --- a/pages/pakin/pakin.vue +++ b/pages/pakin/pakin.vue @@ -43,7 +43,7 @@ </view> <view class="list-left-item"> <view class="desc">鏁伴噺锛�</view> - <view class="left-item"><uni-tag :text="item.anfme"></uni-tag></view> + <view class="left-item">{{item.anfme}}</view> </view> </view> <view class="list-right"> @@ -211,9 +211,8 @@ }, // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� events: { - dataList: function(data) { + matList: function(data) { that.checkMat(data.data) - // that.matList.push(data.data) }, }, }); @@ -225,7 +224,6 @@ }); }, 1000); } else { - console.log(res); uni.showToast({title: res.msg, icon: "none",position: 'top'}) } @@ -259,6 +257,7 @@ var add = true for (var i = 0; i < len; i++) { if (mat.matnr == this.dataList[i].matnr) { + console.log(typeof mat.anfme); this.dataList[i].anfme += mat.anfme this.$forceUpdate() // 寮哄埗鍒锋柊 add = false @@ -320,8 +319,55 @@ this.$refs.combConfirm.close() }, comb() { - this.messageText = "缁勬墭鎴愬姛" - this.messageToggle('success') + uni.vibrateShort(); + let that = this; + if (that.barcode === '') { + this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�" + this.messageToggle('error') + return; + } + if (that.dataList.length === 0) { + this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�" + this.messageToggle('error') + return; + } + for (var i = 0; i < that.dataList.length; i++) { + if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') { + this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0' + this.messageToggle('error') + return; + } + } + uni.request({ + url: that.baseUrl + '/mobile/comb/auth', + data: JSON.stringify({ + barcode: that.barcode, + combMats: that.dataList + }), + method: 'POST', + header: { + 'token':uni.getStorageSync('token') + }, + success(result) { + var res = result.data + if (res.code === 200) { + that.resst(); + that.messageText = "缁勬墭鎴愬姛" + that.messageToggle('success') + } else if (res.code == 403) { + that.messageText = res.msg + that.messageToggle('error') + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + that.messageText = res.msg + that.messageToggle('error') + } + } + }); }, reset(type) { this.msgType = type @@ -338,7 +384,13 @@ // 鍙栨秷閲嶇疆 resetClose() { - } + }, + // 娓呯┖ + resst() { + this.dataList = [] + this.barcode = '' + this.barcodeFocuss() + }, } } </script> -- Gitblit v1.9.1