From 16945499e9e1c870e21fc0bd05b2daae56bc3a29 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期二, 21 六月 2022 16:09:59 +0800
Subject: [PATCH] #

---
 pages/basics/pakin.vue |   67 ++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/pages/basics/pakin.vue b/pages/basics/pakin.vue
index 2b421c9..e836540 100644
--- a/pages/basics/pakin.vue
+++ b/pages/basics/pakin.vue
@@ -8,8 +8,8 @@
 				</view>
 				<view class="square-content">
 					<view class="content-input">
-						<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8"
-						:focus="barcodeFocus" @focus="nextInput">
+						<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="10" 
+						:focus="barcodeFocus" @input="barcodeInput">
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
 					</view>
 				</view>
@@ -116,13 +116,12 @@
 				rowNum:'',
 			}
 		},
-		// onLoad() {
-		// 	// #ifdef APP
-		// 	setInterval(()=>{
-		// 		uni.hideKeyboard()
-		// 	},20)
-		// 	// #endif
-		// },
+		onShow() {
+			setTimeout(()=>{
+				this.focuss()
+			}, 100);
+			
+		},
 		mounted(){
 			const UIP = uni.getStorageSync('UIP');
 			this.baseIP = UIP;
@@ -130,17 +129,36 @@
 			this.basePORT = UPORT
 		},
 		methods: {
-			nextInput() {
-				if (this.barcode.length == 8) {
+			// barcode input 浜嬩欢
+			barcodeInput() {
+				var len = this.barcode.length
+				if (len != 8) {
+					uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'});
+					this.barcodeFocuss()
+					return;
+				}
+				if (len == 8) {
 					this.focuss()
 				}
 			},
+			// 鎵樼洏鐮佹湁璇噸缃�
+			barcodeFocuss() {
+				// #ifdef APP
+				let that = this;
+				that.barcodeFocus = false;
+				setTimeout(()=>{
+					that.barcode = '';
+					that.barcodeFocus = true;
+				}, 100);
+				// #endif
+			},
+			// 鍟嗗搧鍏夋爣娓呯┖閲嶇疆
 			focuss() {
 				// #ifdef APP
 				let that = this;
 				that.focus = false;
 				setTimeout(()=>{
-					that.matnrId = '';
+					that.matnr = '';
 					that.focus = true;
 				}, 100);
 				// #endif
@@ -148,7 +166,7 @@
 			resst() {
 				this.matList = []
 				this.barcode = ''
-				this.matnr = ''
+				this.focuss()
 				uni.vibrateShort();
 			},
 			removeBarcode() {
@@ -227,11 +245,12 @@
 							that.matnr = data.data
 							that.findMat(that.matnr)
 					    },
-					  },
-					  success: function(res) {
+					},
+					success: function(res) {
 					    // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
 					    res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT })
-					  }
+					},
+					
 				});
 				that.matnr = ''
 			},
@@ -250,24 +269,26 @@
 						let res = result.data
 						if (res.code === 200 && res.data) {
 							that.matData = res.data
+							that.matnr = ''
 							uni.navigateTo({
 								url: "matQuery",
 								events: {
 								    // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
 								    matList: function(data) {
 										that.matList.push(data.data)
-										console.log(that.matList)
-								    },
-								  },
-								  success: function(res) {
-								    // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
-								    res.eventChannel.emit('matData', { data: that.matData })
-								  }
+										
+									},
+								},
+								success: function(res) {
+									// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+									res.eventChannel.emit('matData', { data: that.matData })
+								},
 							});
 						}
 						
 					}
 				});
+				
 			},
 		
 			change(e) {

--
Gitblit v1.9.1