From 36fc4fa64ba5a7fd9f23b33c94c918d4b3ca70e3 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 24 八月 2022 12:17:37 +0800
Subject: [PATCH] Merge branch 'jkwms' of http://47.97.1.152:5880/r/~whycq/wms-app into jkwms

---
 pages/basics/checkout.vue |   59 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index dd4f473..c2a8ef5 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -9,7 +9,7 @@
 				<view class="square-content">
 					<view class="content-input">
 						<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" 
-						@input="findBarcode()" :focus="barcodeFocus" @focus="focuss" >
+						@input="findBarcode()" :focus="barcodeFocus" >
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
 					</view>
 				</view>
@@ -22,7 +22,7 @@
 				<view class="square-content">
 					<view class="content-input-combox" style="width: 94%;">
 						<input style="width: 90%;" type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()":focus="focus"
-						 @focus="focuss">
+						>
 						<!-- @focus="focuss" -->
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
 					</view>
@@ -132,7 +132,12 @@
 				// this.listLen = this.matList.length;
 			},
 			focuss() {
-				// uni.hideKeyboard()
+				let that = this;
+				that.barcodeFocus = false;
+				setTimeout(()=>{
+					that.barcode = ''
+					that.barcodeFocus = true;
+				}, 100);
 			},
 			resst() {
 				this.matList = []
@@ -231,6 +236,7 @@
 							}, 1000);
 						} else {
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+							that.focuss()
 						}
 						
 					}
@@ -239,6 +245,14 @@
 			},
 			findMat() {
 				let that = this
+				if(that.barcode == '') {
+					uni.showToast({title: '璇峰厛鎵弿鎵樼洏鐮侊紒', icon: "none",position: 'top'})
+					that.focuss()
+					setTimeout(function() {
+						that.matnr = ''
+					}, 100);
+					return;
+				}
 				uni.request({
 				    url: that.commonUrl + '/mobile/pakout/confirm/pick/auth',
 				    data: {
@@ -251,32 +265,23 @@
 					success(result) {
 						var res = result.data;
 						if(res.code === 200 ) {
-							if(res.data) {
-								if (that.matList.length == 0) {
-									that.matList.push(res.data)
+							var add = true
+							if(res.data) { 
+								console.log(that.matnr);
+								for(let i = 0;i < that.matList.length; i++) {
+									var matnr = that.matList[i].matnr + '-' +  that.matList[i].batch
+									console.log(matnr);
+									if (matnr === that.matnr) {
+										that.messageToggle('warn');
+										that.messageText = '璇ュ晢鍝佸凡娣诲姞';
+										that.foucss();
+										add = false
+									}
+								}
+								if (add) {
+									that.matList.unshift(res.data);
 									that.listLen = that.matList.length;
 									that.foucss();
-									return;
-								}
-								for(let i = 0;i<that.matList.length;i++) {
-									if (that.matList.length < that.matCount){
-										if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data)) {
-											that.messageToggle('warn');
-											that.messageText = '璇ュ晢鍝佸凡娣诲姞';
-											that.foucss();
-											return;
-										} else {
-											that.matList.unshift(res.data);
-											that.listLen = that.matList.length;
-											that.foucss();
-											return;
-										}
-									} else {
-										that.messageToggle('warn');
-										that.messageText = '宸插嚭鍏ㄩ儴鍟嗗搧锛岃纭鍑哄簱';
-										that.foucss();
-										return;
-									}
 								}
 							}
 						} else if (res.code == 403) {

--
Gitblit v1.9.1