From 2b937bcd3e418b29b321df06becac94c423ebaa4 Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期四, 27 六月 2024 09:49:36 +0800 Subject: [PATCH] # --- pages/mat/matSelected.vue | 11 ++++- pages/pakin/bomPakin.vue | 77 +++++++++++++++++++++++++++++++++----- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/pages/mat/matSelected.vue b/pages/mat/matSelected.vue index a0d2b69..8b35956 100644 --- a/pages/mat/matSelected.vue +++ b/pages/mat/matSelected.vue @@ -24,7 +24,7 @@ <view class="form-item"> <view class="form-item-desc"><text>鏁伴噺</text></view> <view class="form-item-content"> - <uni-number-box :value="mat.anfme" :max="99999999" :step='1' color="#747474" @change="changeValue" /> + <uni-number-box :value="mat.anfme" :max="max" :step='1' color="#747474" @change="changeValue" /> </view> </view> </view> @@ -48,6 +48,7 @@ }, baseIP:'', basePORT:'', + max: 99999999 } }, onLoad(option) { @@ -62,7 +63,13 @@ // 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� eventChannel.on('mat', function(data) { that.mat = data.data - that.mat.anfme = 0 + console.log(data.data); + if (data.data.maxNum) { + that.mat.anfme = data.data.maxNum + } else { + that.mat.anfme = 0 + } + }) diff --git a/pages/pakin/bomPakin.vue b/pages/pakin/bomPakin.vue index 0a5a612..426c5fb 100644 --- a/pages/pakin/bomPakin.vue +++ b/pages/pakin/bomPakin.vue @@ -4,7 +4,7 @@ <view class="item"> <view class="code-decs">bom鍙�:</view> <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="bomCode" :focus="bomCodeFocus" - @input="bomInput()"> + @confirm="bomInput()"> </view> <view class="item"> <view class="code-decs">鎵樼洏鐮�:</view> @@ -98,7 +98,7 @@ <view class="popup-item"> <view class="popup-item-left">鏁伴噺:</view> <view class="popup-item-right" style="border: none;justify-content: center;"> - <uni-number-box :value="count" :step='0.01' :max="9999999" color="#747474" @change="changeValue" /> + <uni-number-box :value="count" :step='1' :max="maxAn" color="#747474" @change="changeValue" /> </view> </view> <view class="btn"> @@ -157,12 +157,13 @@ messageText: '', title: '', content: '', - barcodeFocus: true, + barcodeFocus: false, matFocus: false, matData: '', removeNum: 0, bomCode: '', - bomCodeFocus: false + bomCodeFocus: true, + maxAn: 0 } }, onLoad() { @@ -178,7 +179,17 @@ this.$refs.message.open() }, bomInput() { - + setTimeout(() => { + this.barcodeFocuss() + }, 200) + }, + bomFocuss() { + let that = this; + that.bomCodeFocus = false; + setTimeout(() => { + that.bomCode = ''; + that.bomCodeFocus = true; + }, 100); }, // barcode input 浜嬩欢 barcodeInput() { @@ -219,15 +230,43 @@ checkBom() { let _this = this uni.request({ - url: that.baseUrl + '/mobile/comb/checkBom', + url: _this.baseUrl + '/mobile/comb/checkBom', data: JSON.stringify({ - bomCode: that.bomCode, - matnr: that.matnr + bomCode: _this.bomCode, + matnr: _this.matnr }), method: 'POST', header: { 'token': uni.getStorageSync('token') }, success(res) { console.log(res); + res = res.data + if (res.code === 200) { + if (res.data) { + _this.maxAnfme = res.data.zpalletAnfme + _this.findMat() + } else { + _this.findMat() + } + } else if (res.code == 403) { + uni.showToast({ + title: res.msg, + icon: "none", + position: 'top' + }) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + _this.matnr = '' + uni.showToast({ + title: res.msg, + icon: "none", + position: 'top' + }) + } + } }) }, @@ -248,6 +287,9 @@ that.matData = result.data that.matnr = '' that.matData['batch'] = '' + if (that.maxAnfme) { + that.matData['maxNum'] = that.maxAnfme + } uni.navigateTo({ url: "../mat/matSelected", // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� @@ -330,16 +372,26 @@ } else { // 鐩稿悓鐗╂枡鐩稿悓鎵瑰彿 鏁伴噺绱姞 - this.dataList[i].anfme += mat.anfme + + if (this.maxAnfme) { + this.dataList[i].anfme = this.maxAnfme + } else { + this.dataList[i].anfme += mat.anfme + } this.$forceUpdate() // 寮哄埗鍒锋柊 add = false } } } if (add) { + if (this.maxAnfme) { + mat['maxAnfme'] = this.maxAnfme + mat.anfme = this.maxAnfme + } this.dataList.unshift(mat) } this.$forceUpdate() // 寮哄埗鍒锋柊 + this.maxAnfme = '' }, // 淇敼鎵瑰彿 revise(item, i) { @@ -347,6 +399,7 @@ this.count = this.dataList[i].anfme this.batch = this.dataList[i].batch this.weight = this.dataList[i].weight + this.maxAn = this.dataList[i].maxNum this.rowNum = i this.eject() }, @@ -459,8 +512,11 @@ // 纭閲嶇疆 resetConfirm() { this.dataList = [] + this.barcode = '' + this.bomCode = '' this.messageText = "閲嶇疆瀹屾垚" this.messageToggle('success') + this.bomFocuss() }, // 鍙栨秷閲嶇疆 resetClose() { @@ -470,7 +526,8 @@ resst() { this.dataList = [] this.barcode = '' - this.barcodeFocuss() + this.bomCode = '' + this.bomFocuss() }, } } -- Gitblit v1.9.1