From a84ed18ebca6d113fa9c52a36fc71e3a106fd729 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期四, 26 九月 2024 12:49:23 +0800
Subject: [PATCH] #

---
 pages/pakin/pakin.vue |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/pages/pakin/pakin.vue b/pages/pakin/pakin.vue
index 5612110..1abc6d6 100644
--- a/pages/pakin/pakin.vue
+++ b/pages/pakin/pakin.vue
@@ -223,21 +223,41 @@
 				}, 200)
 			},
 			asBarcodeInput() {
-				// this.asBarcode = this.asBarcode.replace(/\s+/g, '')
+				this.asBarcode = this.asBarcode.replace(/\s+/g, '')
 				setTimeout(() => {
-					// var len = this.asBarcode.length
-					// if (len != 12) {
-					// 	uni.showToast({
-					// 		title: 'AS400鏈夎璇烽噸璇�',
-					// 		icon: "none",
-					// 		position: 'top'
-					// 	});
-					// 	this.asBarcodeFocuss()
-					// 	return;
-					// }
+					var len = this.asBarcode.length
+					if (this.checkCode(this.asBarcode)) {
+						// && this.asBarcode.length != 8
+						
+						uni.showToast({
+							title: 'AS400鏈夎璇烽噸璇�',
+							icon: "none",
+							position: 'top'
+						});
+						this.asBarcodeFocuss()
+						return;
+					}
 					this.focuss()
 				}, 200)
 			},
+			checkCode(code) {
+				// console.log(this.isNum(code.substring(0, 1)))
+				// console.log(!this.isNum(code.substring(1, 2)))
+				// console.log(code.length == 8,code.length)
+				let flag = true
+				if (code.substring(0, 2) == 'PM' ) {
+					flag = false
+				} else if (
+					this.isNum(code.substring(0, 1)) 
+					&& !this.isNum(code.substring(1, 2)) 
+					&& code.length == 8 ) {
+					flag = false
+				}
+				return flag
+			},
+			isNum(value) {
+				return typeof value === 'string' ? /^\d+$/.test(value) : typeof value === 'number' && !isNaN(value);
+			},
 			// 鎵樼洏鐮佹湁璇噸缃�
 			barcodeFocuss() {
 				let that = this;

--
Gitblit v1.9.1