From 75291ece8be07085269e56210e2d3fe10adb4735 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 31 七月 2024 14:56:16 +0800
Subject: [PATCH] #

---
 pages/order/orderPakin.vue |   80 +++++++++++++++++++++++++++++++++-------
 1 files changed, 66 insertions(+), 14 deletions(-)

diff --git a/pages/order/orderPakin.vue b/pages/order/orderPakin.vue
index aac0638..5700e13 100644
--- a/pages/order/orderPakin.vue
+++ b/pages/order/orderPakin.vue
@@ -4,7 +4,7 @@
 			<view class="item">
 				<view class="code-decs">鎵樼洏鐮�:</view>
 				<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus"
-					@confirm="barcodeInput()">
+					@input="barcodeInput()">
 			</view>
 			<view class="item">
 				<view class="code-decs">鐗╂枡鐮�:</view>
@@ -52,12 +52,12 @@
 							<uni-tag :text="item.batch" type="warning"></uni-tag>
 						</view>
 					</view>
-					<view class="list-left-item">
+					<!-- <view class="list-left-item">
 						<view class="desc">閲嶉噺锛�</view>
 						<view class="left-item">
 							<uni-tag :text="item.weight" type="warning"></uni-tag>
 						</view>
-					</view>
+					</view> -->
 					<view class="list-left-item">
 						<view class="desc">鏁伴噺锛�</view>
 						<view class="left-item">{{item.anfme}}</view>
@@ -92,10 +92,10 @@
 						<view class="popup-item-left">鎵瑰彿:</view>
 						<view class="popup-item-right"><input type="text" v-model="batch"></view>
 					</view> -->
-					<view class="popup-item">
+					<!-- <view class="popup-item">
 						<view class="popup-item-left">閲嶉噺:</view>
 						<view class="popup-item-right"><input type="text" v-model="weight"></view>
-					</view>
+					</view> -->
 					<view class="popup-item">
 						<view class="popup-item-left">鏁伴噺:</view>
 						<view class="popup-item-right" style="border: none;justify-content: center;">
@@ -159,6 +159,7 @@
 				rowNum: '',
 				matnr: '',
 				matnr1: '',
+				anfme: '',
 				batch: '',
 				weight: '',
 				msgType1: 'success',
@@ -181,12 +182,52 @@
 				this.msgType1 = type
 				this.$refs.message.open()
 			},
+			barcodeInput() {
+				// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
+				setTimeout(() => {
+					var len = this.barcode.length
+					if (len != 8) {
+						uni.showToast({
+							title: '鎵樼洏鐮佹湁璇閲嶈瘯',
+							icon: "none",
+							position: 'top'
+						});
+						this.barcodeFocuss()
+						return;
+					}
+					this.focuss()
+				}, 200)
+			},
+			// 鎵樼洏鐮佹湁璇噸缃�
+			barcodeFocuss() {
+				let that = this;
+				that.barcodeFocus = false;
+				setTimeout(() => {
+					that.barcode = '';
+					that.barcodeFocus = true;
+				}, 100);
+			},
+			// 鍟嗗搧鍏夋爣娓呯┖閲嶇疆
+			focuss() {
+				this.matFocus = false;
+				setTimeout(() => {
+					this.matnr = '';
+					this.matFocus = true;
+				}, 100);
+			},
 			// 鎼滅储鐗╂枡
 			findMat() {
 				let that = this
 				var matnr =  that.matnr.split(";")
-				that.order = matnr[0]
-				that.matnr = matnr[1]
+				if (matnr[1]) {
+					that.order = matnr[0]
+					that.matnr = matnr[1]
+					if (matnr[2] === null) {
+						that.batch = ''
+						matnr[2] = ''
+					}
+					that.anfme = matnr[3]
+				} 
 				uni.request({
 					url: that.baseUrl + '/mat/auth',
 					data: {
@@ -197,14 +238,24 @@
 					},
 					success(result) {
 						result = result.data
-						if (result.code === 200 && result.data) {
+						if (result.code === 200) {
+							if (result.data === null) {
+								uni.showToast({
+									title: '鏃犵墿鏂�',
+									icon: "error",
+									position: 'top'
+								})
+								that.focuss()
+								return
+							}
 							that.matData = result.data
 							that.matnr = ''
 							that.matData['batch'] = ''
-							// if (matnr[2] === null) {
-							// 	matnr[2] = ''
-							// }
-							result.data.batch = matnr[2]
+							that.matData['anfme'] = ''
+							if (matnr[2] === null) {
+								result.data.batch = ''
+							}
+							result.data.anfme = matnr[3]
 							uni.navigateTo({
 								url: "../mat/matSelected",
 								// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
@@ -422,12 +473,13 @@
 		display: flex;
 		min-height: 80rpx;
 		background-color: #FFF;
-		margin: auto 20rpx;
+		padding: 10rpx;
+		margin: 30rpx 20rpx;
 		border-radius: 20rpx;
 		box-shadow: 0px 0px 30px 0px rgba(0,0,0,0.2);
 	}
 	.list:first-child {
-		margin-top: 410rpx;
+		margin-top: 340rpx;
 	}
 	.list:last-child {
 		margin-bottom: 120rpx;

--
Gitblit v1.9.1