From fbbbc66329808249c7a0689f2efca6c79a6bf892 Mon Sep 17 00:00:00 2001 From: lty <876263681@qq.com> Date: 星期四, 28 八月 2025 08:37:11 +0800 Subject: [PATCH] # --- pages/basics/order.vue | 152 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 128 insertions(+), 24 deletions(-) diff --git a/pages/basics/order.vue b/pages/basics/order.vue index 752f385..e04b1fe 100644 --- a/pages/basics/order.vue +++ b/pages/basics/order.vue @@ -9,30 +9,47 @@ <view class="square-content"> <view class="content-input"> <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="10" - :focus="barcodeFocus" @input="barcodeInput"> + :focus="barcodeFocus" @input="barcodeInput" placeholder-style="line-height: 85rpx;"> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> </view> </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 class="square-3"> + <!-- 鏍囬閮ㄥ垎 --> + <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" style="display: flex; align-items: center;"> + <!-- 涓嬫媺杈撳叆妗� --> + <view class="content-input" style="flex: 1;"> + <uni-combox + v-model="orderNo" + :candidates="orderNoList" + placeholder="璇疯緭鍏� / 閫夋嫨璁㈠崟鍙�" + placeholderStyle="line-height: 60rpx; font-size: 30rpx; color: #999;" + @input="getOrderDet" + @change="onOrderSelect" + /> </view> - <view class="square-content"> - <view class="content-input"> - <input v-model="order" type="text" placeholder="鎵爜 / 杈撳叆" @input="findOrder()" - :focus="focus"> - <uni-icons type="closeempty" size="20" color="#dadada" @click="removeOrder()"></uni-icons> - </view> + + <!-- 妫�绱㈡寜閽� --> + <view style="width: 80px; display: flex; align-items: center; justify-content: center; margin-left: 10rpx;"> + <button size="mini" type="primary" @click="getOrderDetlByOrderNo()">妫�绱�</button> </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 class="title-text" style="width: 200rpx;"><text>鍟嗗搧鍒楄〃</text></view> <view v-show="matList.length != 0" class="lable"> <label class="label-btn" style="width: 170rpx;line-height: 95rpx;" > <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox> @@ -59,7 +76,7 @@ <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.specs}}</text></view> <view> <text style="width: 700rpx;">鏁伴噺锛歿{item.anfme}}</text> </view> @@ -125,6 +142,7 @@ export default { data() { return { + commonUrl:null, barcode: '', barcodeFocus:true, focus:false, @@ -132,7 +150,6 @@ searchBox: 'hide', pick:'hide', order:null, - orderNo:null, matList:[], result: '', count:'', @@ -143,6 +160,9 @@ check:false, checkText:'鍏ㄩ��', checkedData:[], + orderNo: '', + orderNoList: [], + showDropdown: false } }, mounted(){ @@ -150,8 +170,85 @@ this.baseIP = UIP; const UPORT = uni.getStorageSync('UPORT'); this.basePORT = UPORT + const PROJ = uni.getStorageSync('UPROJ'); + this.baseUrl = PROJ + this.getUrl() }, methods: { + getOrderDet(orderNo) { + if (!orderNo || orderNo.trim() === '') return; + uni.request({ + url: this.commonUrl + '/mobile/order/search/orderNoList/auth', + method: 'GET', + data: { orderNo }, + header: { + token: uni.getStorageSync('token') + }, + success: res => { + const list = res.data.data || []; + this.orderNoList = list.map(o => o.orderNo); + } + }); + }, + + onOrderSelect(order) { + this.orderNo = order; + // 鍙�夛細鑷姩瑙﹀彂鏌ヨ + // this.getOrderDetlByOrderNo(); + }, + getOrderDetlByOrderNo() { + if (!this.orderNo) { + uni.showToast({ title: '璇烽�夋嫨璁㈠崟', icon: 'none' }); + return; + } + let that = this; + uni.request({ + url: that.commonUrl + '/mobile/order/search/orderNo/auth', + data: { + orderNo: that.orderNo + }, + header: { + token: uni.getStorageSync('token') + }, + success(result) { + let res = result.data; + console.log(res.data[0]); + if (res.code === 200) { + if (res.data) { + uni.showLoading(); + that.matList = res.data[0].combMats; + that.initAnfme(); + console.log(that.matList); + } + } 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' }); + } + } + }); + }, + + + + selectOrder(orderNo) { + this.order = orderNo + this.showDropdown = false + }, + removeOrder() { + this.order = '' + this.orderSuggestions = [] + this.showDropdown = false + }, + // 鑾峰彇url + getUrl() { + this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl + }, // barcode input 浜嬩欢 barcodeInput() { var len = this.barcode.length @@ -189,6 +286,7 @@ this.matList = [] this.barcode = '' this.order = '' + this.orderNo = ''; this.barcodeFocuss() uni.vibrateShort(); }, @@ -216,6 +314,7 @@ initAnfme() { for (var i = 0; i < this.matList.length; i++) { + this.matList[i].enableQty = this.matList[i].anfme this.matList[i].anfme = 0 } uni.hideLoading(); @@ -283,15 +382,16 @@ } 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({ + billNo: that.orderNo, orderNo: that.orderNo, barcode: that.barcode, combMats: that.matList }), method: 'POST', header: { - 'token':uni.getStorageSync('token') + 'token':uni.getStorageSync('token'), }, success(result) { uni.showLoading(); @@ -299,13 +399,10 @@ if (res.code === 200) { uni.showToast({ title: res.msg, - position: 'bottom', + position: 'top', duration: 1000 }); - that.barcode = '' - that.orderNo = '' - that.order = '' - that.matList = [] + that.resst() } else if (res.code == 403) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) setTimeout(() => { @@ -322,7 +419,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 }, @@ -330,12 +427,12 @@ 'token':uni.getStorageSync('token') }, success(result) { - console.log(result) let res = result.data + console.log(res.data[0]) if (res.code === 200) { if(res.data) { uni.showLoading(); - that.matList = res.data; + that.matList = res.data[0].combMats; that.orderNo = that.order that.initAnfme() console.log(that.matList) @@ -634,5 +731,12 @@ bottom: 0; text-align: center; } + + + + + + + </style> -- Gitblit v1.9.1