From ffece4dfd172247c1f61fe7154619bf72a43e219 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期二, 02 十二月 2025 15:46:10 +0800
Subject: [PATCH] #

---
 pages/basics/order.vue |  245 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 179 insertions(+), 66 deletions(-)

diff --git a/pages/basics/order.vue b/pages/basics/order.vue
index 5c0b039..23f66d3 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;"
+					
+					@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>
@@ -57,12 +74,13 @@
 						<checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
 					</label>
 					<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>
-						</view>
+						<view class="matnr"><text style="width: 500rpx;">缂栫爜锛歿{item.matnr}}</text>
+						<text style="margin-left: 100rpx;">鍚嶇О锛歿{item.maktx}}</text></view>
+						<view><text style="width: 500rpx;">PO锛歿{item.standby1}}</text>
+						<text style="margin-left: 100rpx;">SKU锛歿{item.standby3}}</text></view>
+						<view><text style="width: 500rpx;">UPC锛歿{item.standby2}}</text></view>
+						<view><text style="width: 500rpx;">閲囪喘鍗曪細{{item.boxType3}}</text>
+						<text style="margin-left: 100rpx;">鏁伴噺锛歿{item.anfme}}</text></view>
 					</view>
 					<view class="data-list-right">
 						<label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons></label>
@@ -83,10 +101,10 @@
 				<text  @click="reChecked()">鍙嶉��</text>
 			</label> -->
 			
-			<label class="label-btn" style="width: 150rpx;">
+			<label class="label-btn flex justify-center align-center">
 				<button class="cu-btn" @click="resst()">閲嶇疆</button>
 			</label>
-			<label class="label-btn">
+			<label class="label-btn flex justify-center align-center">
 				<button class="cu-btn bg-blue " @click="comb()">缁勬墭</button>
 			</label>
 		</view>
@@ -125,6 +143,7 @@
 	export default {
 		data() {
 			return {
+				commonUrl:null,
 				barcode: '',
 				barcodeFocus:true,
 				focus:false,
@@ -132,7 +151,6 @@
 				searchBox: 'hide',
 				pick:'hide',
 				order:null,
-				orderNo:null,
 				matList:[],
 				result: '',
 				count:'',
@@ -143,6 +161,9 @@
 				check:false,
 				checkText:'鍏ㄩ��',
 				checkedData:[],
+				orderNo: '',
+				orderNoList: [], 
+				showDropdown: false
 			}
 		},
 		mounted(){
@@ -150,17 +171,94 @@
 			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
-				if (len != 8) {
+				if (len != 6) {
 					uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'});
 					this.barcodeFocuss()
 					return;
 				}
-				if (len == 8) {
+				if (len == 6) {
 					this.focuss()
 				}
 			},
@@ -189,6 +287,7 @@
 				this.matList = []
 				this.barcode = ''
 				this.order = ''
+				this.orderNo = ''; 
 				this.barcodeFocuss()
 				uni.vibrateShort();
 			},
@@ -216,6 +315,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();
@@ -263,63 +363,71 @@
 			comb() {
 				uni.vibrateShort();
 				let that = this;
+
 				if (that.barcode === '') {
-					uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
+					uni.showToast({ title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top' });
 					return;
 				}
-				if (that.barcode.length !== 8) {
-					uni.showToast({title: '鎵樼洏鐮佸繀椤讳负8浣�', icon: "none", position: 'top'});
+				if (that.barcode.length !== 6) {
+					uni.showToast({ title: '鎵樼洏鐮佸繀椤讳负6浣�', icon: "none", position: 'top' });
 					return;
 				}
 				if (that.matList.length === 0) {
-					uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
+					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;
-					}
+
+				// 杩囨护鍑烘暟閲忓ぇ浜�0鐨勫晢鍝�
+				const validMats = that.matList.filter(item => item.anfme > 0);
+
+				if (validMats.length === 0) {
+					uni.showToast({ title: '鎵�鏈夊晢鍝佺粍鎵樻暟閲忎负0锛屾棤娉曠粍鎵�', icon: "none", position: 'top' });
+					return;
 				}
+
+				// 鍒犻櫎鏁伴噺涓�0鐨勫晢鍝�
+				that.matList = validMats;
+
 				uni.showLoading();
+
 				uni.request({
-				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth',
-				    data: JSON.stringify({
+					url: that.commonUrl + '/mobile/comb/auth',
+					data: JSON.stringify({
+						billNo: that.orderNo,
 						orderNo: that.orderNo,
 						barcode: that.barcode,
-						combMats: that.matList
+						combMats: validMats
 					}),
 					method: 'POST',
-				    header: {
-						'token':uni.getStorageSync('token')
-				    },
+					header: {
+						'token': uni.getStorageSync('token'),
+					},
 					success(result) {
 						uni.showLoading();
-						var res = result.data
+						var res = result.data;
 						if (res.code === 200) {
 							uni.showToast({
 								title: res.msg,
-								position: 'bottom',
+								position: 'top',
 								duration: 1000
 							});
-							that.resst()
+							that.resst();
 						} else if (res.code == 403) {
-							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							uni.showToast({ title: res.msg, icon: "none", position: 'top' });
 							setTimeout(() => {
-								uni.reLaunch({
-									url: '../login/login'
-								});
+								uni.reLaunch({ url: '../login/login' });
 							}, 1000);
 						} else {
-							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+							uni.showToast({ title: res.msg, icon: "none", position: 'top' });
 						}
 					}
 				});
 			},
+
 			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,12 +435,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)
@@ -359,27 +467,25 @@
 				this.$refs.goodsSearch.open(type)
 			},
 			// 鍒楄〃閫夋嫨
-			checkbox: function (e) {
-				var items = this.matList,
-					values = e.detail.value;
-				for (var i = 0, lenI = items.length; i < lenI; ++i) {
-					const item = items[i]
-					item.id = item.id + ''
-					if(values.indexOf(item.id) >= 0){
-						this.$set(item,'checked',true)
-					}else{
-						this.$set(item,'checked',false)
-					}
-				}
-				if (values.length == items.length) {
-					this.check = true
-					this.checkText = "鍙栨秷鍏ㄩ��"
+			checkbox(e) {
+				const values = e.detail.value;
+				this.matList.forEach(item => {
+					// 纭繚 item.id 鏄瓧绗︿覆
+					const itemId = item.id + '';
+					item.checked = values.includes(itemId);
+				});
+
+				if (values.length === this.matList.length) {
+					this.check = true;
+					this.checkText = "鍙栨秷鍏ㄩ��";
 				} else {
-					this.check = false
-					this.checkText = "鍏ㄩ��"
+					this.check = false;
+					this.checkText = "鍏ㄩ��";
 				}
+
 				uni.vibrateShort();
 			},
+
 			// 鍒楄〃鍙嶉��
 			reChecked() { 
 				if (this.matList.length == 0) {
@@ -631,5 +737,12 @@
 		bottom: 0;
 		text-align: center;
 	}
+
+
+	
+
+
+
+
 	
 </style>

--
Gitblit v1.9.1