From 0d248a85132ffb06b70d1a659ac5cafc815e2258 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期六, 23 四月 2022 15:17:04 +0800
Subject: [PATCH] #

---
 pages/basics/order.vue |   71 ++++++++++++++++++++++++++++-------
 1 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/pages/basics/order.vue b/pages/basics/order.vue
index c0745b7..341e37a 100644
--- a/pages/basics/order.vue
+++ b/pages/basics/order.vue
@@ -7,7 +7,7 @@
 					<text class="title">鎵樼洏鏉$爜</text>
 				</view>
 				<view class="box-buttom">
-					<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆">
+					<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8">
 					<view class="search-icon">
 						<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeBarcode()"></uni-icons>
 					</view>
@@ -19,9 +19,9 @@
 					<text class="title">鍗曟嵁缂栧彿</text>
 				</view>
 				<view class="box-buttom">
-					<input v-model="orderNo" type="text" placeholder="鎵爜 / 杈撳叆" @input="findOrder()">
+					<input v-model="order" type="text" placeholder="鎵爜 / 杈撳叆" @input="findOrder()">
 					<view class="search-icon">
-						<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeOrderNo()"></uni-icons>
+						<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeOrder()"></uni-icons>
 					</view>
 				</view>
 			</view>
@@ -61,11 +61,14 @@
 		</view>
 		<view>
 			<!-- 淇敼鏁伴噺 -->
-			<uni-popup ref="revise" background-color="#FFF" @change="change">
+			<uni-popup ref="revise" background-color="#fff" @change="change">
 				<view class="revise-box">
 					<view class="revise-box-top">
 						<view class="color-block-blue"></view>
 						<text class="title">缁勬墭鏁伴噺</text>
+					</view>
+					<view class="text-box">
+						<text>鍙粍鏁伴噺锛歿{enableQty}}</text>
 					</view>
 					<view class="changeBox">
 						<view class="num-box">
@@ -93,6 +96,7 @@
 				type: 'center',
 				searchBox: 'hide',
 				pick:'hide',
+				order:null,
 				orderNo:null,
 				orderList:[],
 				result: '',
@@ -100,6 +104,8 @@
 				minCount:0,
 				maxCount:'',
 				rowNum:'',
+				enableQty:'',
+				
 			}
 		},
 		mounted(){
@@ -112,15 +118,15 @@
 			resst() {
 				this.orderList = []
 				this.barcode = ''
-				this.orderNo = ''
+				this.order = ''
 				uni.vibrateShort();
 			},
 			removeBarcode() {
 				this.barcode = ''
 				uni.vibrateShort();
 			},
-			removeOrderNo() {
-				this.orderNo = ''
+			removeOrder() {
+				this.order = ''
 				uni.vibrateShort();
 			},
 			eject(type) {
@@ -128,11 +134,19 @@
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴��
 				this.$refs.revise.open(type)
 			},
+			initAnfme() {
+			
+				for (var i = 0; i < this.orderList.length; i++) {
+					this.orderList[i].anfme = 0
+				}
+				uni.hideLoading();
+			},
 			revise(item,index) {
 				var maxCount = this.orderList[index].maxCount
 				if (maxCount == undefined ) {
-					this.orderList[index]["maxCount"] = item.anfme
+					this.orderList[index]["maxCount"] = item.enableQty
 				} 
+				this.enableQty = item.enableQty
 				this.count = this.minCount
 				this.maxCount = item.maxCount
 				this.rowNum = index
@@ -156,14 +170,25 @@
 					uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
 					return;
 				}
+				if (that.barcode.length !== 8) {
+					uni.showToast({title: '鎵樼洏鐮佸繀椤讳负8浣�', icon: "none", position: 'top'});
+					return;
+				}
 				if (that.orderList.length === 0) {
 					uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
 					return;
+				}
+				for (var i = 0; i < that.orderList.length; i++) {
+					if (that.orderList[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',
 				    data: JSON.stringify({
+						orderNo: that.orderNo,
 						barcode: that.barcode,
 						combMats: that.orderList
 					}),
@@ -182,6 +207,7 @@
 							});
 							that.barcode = ''
 							that.orderNo = ''
+							that.order = ''
 							that.orderList = []
 						} else if (res.code == 403) {
 							uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -201,7 +227,7 @@
 				uni.request({
 				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/order/search/orderNo/auth',
 				    data: {
-						orderNo: that.orderNo
+						orderNo: that.order
 				    },
 				    header: {
 						'token':uni.getStorageSync('token')
@@ -210,7 +236,11 @@
 						let res = result.data
 						if (res.code === 200) {
 							if(res.data) {
-								that.orderList = res.data
+									uni.showLoading();
+								that.orderList = res.data;
+								that.orderNo = that.order
+								that.initAnfme()
+								console.log(that.orderList)
 							}
 						} else if (res.code == 403) {
 							uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -368,7 +398,7 @@
 	}
 	.revise-box {
 		width: 500rpx;
-		height: 360rpx;
+		height: 500rpx;
 	}
 	.revise-box-top {
 		width: 100%;
@@ -378,14 +408,25 @@
 	}
 	.changeBox {
 		width: 100%;
-		height: 120rpx;
-		line-height: 150rpx;
+		height: 100rpx;
+		line-height: 120rpx;
 		text-align: center;
-		background-color: #FFFFFF;
+		background-color: #FFF;
 		margin-top: 20rpx;
+		border-bottom: 1px solid #e3e3e3;
+	}
+	.text-box {
+		width: 100%;
+		height: 100rpx;
+		line-height: 120rpx;
+		text-align: center;
+		/* padding-left: 120rpx; */
+		background-color: #FFF;
+		margin-top: 20rpx;
+		border-bottom: 1px solid #e3e3e3;
 	}
 	.changeBox .num-box {
-		display: inline-block;
+		display:  inline-block;
 	}
 	.revise-box-buttom {
 		position: absolute;

--
Gitblit v1.9.1