From 112c71dbe86fdffffe3dceb13fc7881e7fbe7881 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期一, 26 五月 2025 18:18:49 +0800 Subject: [PATCH] 123 --- pages/basics/order.vue | 171 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 139 insertions(+), 32 deletions(-) diff --git a/pages/basics/order.vue b/pages/basics/order.vue index 54ea69d..0647679 100644 --- a/pages/basics/order.vue +++ b/pages/basics/order.vue @@ -29,20 +29,34 @@ </view> </view> + <view class="square-2"> + <view class="square-title"> + <view class="title-sign"><view class="sign"></view></view> + <view class="title-text"><text>鐗╂枡鏉$爜</text></view> + </view> + <view class="square-content"> + <view class="content-input"> + <input v-model="tiaoma" type="text" placeholder="鎵爜 / 杈撳叆" @input="findTiaoMa()" + :focus="tmfocus" placeholder-style="line-height: 85rpx;"> + <uni-icons type="closeempty" size="20" color="#dadada" @click="removeTm()"></uni-icons> + </view> + </view> + </view> + <view class="square-1"> <view class="square-title"> <view class="title-sign"><view class="sign"></view></view> <view class="title-text"><text>鍟嗗搧鍒楄〃</text></view> <view v-show="matList.length != 0" class="lable"> - <label class="label-btn" style="width: 170rpx;line-height: 95rpx;" > + <!-- <label class="label-btn" style="width: 170rpx;line-height: 95rpx;" > <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox> - </label> - <label class="label-btn" > + </label> --> + <!-- <label class="label-btn" > <text @click="reChecked()">鍙嶉��</text> </label> <label > <uni-icons type="trash" size="25" color="#a5a5a5" @click="remove()"></uni-icons> - </label> + </label> --> </view> </view> @@ -52,16 +66,19 @@ </view> <checkbox-group @change="checkbox"> - <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" > - <label class="left-check-box"> - <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" /> + <view v-for="(item,index) in matList" :key="index" v-if="item.anfme>0" class="data-list bg-false" :class="'bg-'+item.checked" > + <label class="left-check-box" > + <checkbox :value="item.id+''" :checked="true" style="display: block;" /> </label> - <view class="data-list-left"> - <view class="matnr"><text style="width: 700rpx;">缂栫爜锛歿{item.matnr}}</text></view> + <view class="data-list-left" > + <view class="matnr"><text style="width: 700rpx;">鍝佸彿锛歿{item.matnr}}</text></view> <view><text style="width: 700rpx;">鍝佸悕锛歿{item.maktx}}</text></view> <view><text style="width: 700rpx;">鎵瑰彿锛歿{item.batch}}</text></view> <view> - <text style="width: 700rpx;">鏁伴噺锛歿{item.anfme}}</text> + <text style="width: 700rpx;">鎬绘暟閲忥細{{item.count}}</text> + </view> + <view> + <text style="width: 700rpx;">鍙粍鎵樻渶澶ф暟閲忥細{{item.anfme}}</text> </view> </view> <view class="data-list-right"> @@ -125,14 +142,18 @@ export default { data() { return { + commonUrl:null, barcode: '', barcodeFocus:true, + tmfocus:false, focus:false, type: 'center', searchBox: 'hide', pick:'hide', order:null, orderNo:null, + tiaoma:null, + tiaomas:[], matList:[], result: '', count:'', @@ -150,8 +171,15 @@ this.baseIP = UIP; const UPORT = uni.getStorageSync('UPORT'); this.basePORT = UPORT + const PROJ = uni.getStorageSync('UPROJ'); + this.baseUrl = PROJ + this.getUrl() }, methods: { + // 鑾峰彇url + getUrl() { + this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl + }, // barcode input 浜嬩欢 barcodeInput() { var len = this.barcode.length @@ -208,13 +236,20 @@ this.focus = true; }); }, + removeTm() { + this.tiaoma = '' + uni.vibrateShort(); + this.tmfocus = false; + this.$nextTick(function() { + this.focus = true; + }); + }, eject(type) { this.type = type // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� this.$refs.revise.open(type) }, initAnfme() { - for (var i = 0; i < this.matList.length; i++) { this.matList[i].anfme = 0 } @@ -263,7 +298,11 @@ comb() { uni.vibrateShort(); let that = this; - if (that.barcode === '') { + if (!that.orderNo) { + uni.showToast({title: '璇锋壂鎻忓崟鎹彿', icon: "none", position: 'top'}); + return; + } + if (!that.barcode) { uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'}); return; } @@ -271,23 +310,24 @@ uni.showToast({title: '鎵樼洏鐮佸繀椤讳负8浣�', icon: "none", position: 'top'}); return; } - if (that.matList.length === 0) { + let mats =that.matList.filter(mat =>mat.anfme>0); + if (mats.length === 0) { uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'}); return; } - for (var i = 0; i < that.matList.length; i++) { - if (that.matList[i].anfme === 0) { - uni.showToast({title: '鍟嗗搧缁勬墭鏁伴噺涓�0涓嶈兘缁勬墭', icon: "none", position: 'top'}); - return; - } - } + // for (var i = 0; i < mats.length; i++) { + // if (that.matList[i].anfme === 0) { + // uni.showToast({title: '鍟嗗搧缁勬墭鏁伴噺涓�0涓嶈兘缁勬墭', icon: "none", position: 'top'}); + // return; + // } + // } uni.showLoading(); uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth', + url: that.commonUrl + '/mobile/comb/auth', data: JSON.stringify({ orderNo: that.orderNo, barcode: that.barcode, - combMats: that.matList + combMats: mats }), method: 'POST', header: { @@ -319,7 +359,7 @@ findOrder() { let that = this uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/order/search/orderNo/auth', + url: that.commonUrl + '/mobile/order/search/orderNo/auth', data: { orderNo: that.order }, @@ -327,16 +367,23 @@ 'token':uni.getStorageSync('token') }, success(result) { + console.log("result锛�"); console.log(result) let res = result.data - if (res.code === 200) { - if(res.data) { - uni.showLoading(); - that.matList = res.data; - that.orderNo = that.order - that.initAnfme() - console.log(that.matList) - } + if (res.code === 200 && res.data) { + uni.showLoading(); + that.orderNo = that.order + // that.matList = res.data.map(item => ({ + // ...item, + // combMats: typeof item.combMats === 'string' ? + // JSON.parse(item.combMats) : item.combMats // 纭繚瀵硅薄缁撴瀯[1,2](@ref) + // })); + that.matList = res.data.combMats + that.initAnfme(); + + console.log("that.matList锛�"); + console.log(that.matList) + } else if (res.code == 403) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) setTimeout(() => { @@ -348,6 +395,66 @@ uni.showToast({title: res.msg, icon: "none",position: 'top'}) } } + }); + }, + findTiaoMa() { + let that = this + if (!that.orderNo) { + uni.showToast({title: '璇锋壂鎻忓崟鎹彿', icon: "none", position: 'top'}); + return; + } + uni.request({ + url: that.commonUrl + '/mobile/mat/search/auth', + data: { + matnr: that.tiaoma + }, + header: { + 'token':uni.getStorageSync('token') + }, + success(result) { + console.log("result锛�"); + console.log(result) + let res = result.data + if (res.code === 200 && res.data) { + that.checkMat(res.data) + //this.tiaomas.unshift(that.tiaoma) + } 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'}) + } + } + }); + }, + checkMat(mat) { + var len = this.matList.length + var add = true + for (var i = 0; i < len; i++) { + if (mat.matnr == this.matList[i].matnr) { + if ( mat.batch){ + if( mat.batch == this.matList[i].batch){ + this.matList[i].anfme += mat.anfme + this.$forceUpdate() // 寮哄埗鍒锋柊 + add = false + } + }else{ + this.matList[i].anfme += mat.anfme + this.$forceUpdate() // 寮哄埗鍒锋柊 + add = false + } + + } + } + this.tiaoma = '' + uni.vibrateShort(); + this.focus = false; + this.$nextTick(function() { + this.focus = true; }); }, change(e) { @@ -534,8 +641,8 @@ } .data-list { border-bottom: 1px solid #d8d8d8; - height: 180rpx; - margin: 15rpx; + height: 210rpx; + margin: 15rpx auto auto auto; border-radius: 20rpx; } .data-list:first-child { -- Gitblit v1.9.1