From b3eccf66e62a7b6c5668ad128f3e764f79ec4bc9 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 25 四月 2022 11:42:56 +0800
Subject: [PATCH] #

---
 pages/basics/checkout.vue |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index 7c591fd..8b26d47 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -8,7 +8,8 @@
 				</view>
 				<view class="square-content">
 					<view class="content-input">
-						<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" @input="findBarcode()">
+						<input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" 
+						@input="findBarcode()" :focus="barcodeFocus" @focus="focuss">
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
 					</view>
 				</view>
@@ -36,7 +37,8 @@
 						<uni-combox  emptyTips="鏆傛棤鏁版嵁" :candidates="staNoList" v-model="staNo" placeholder="绔欏彴鍙�"></uni-combox>
 					</view>
 					<view class="content-input-combox">
-						<input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()">
+						<input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()"
+						:focus="focus" @focus="focuss">
 						<uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
 					</view>
 				</view>
@@ -97,6 +99,8 @@
 		data() {
 			return {
 				barcode: '',
+				barcodeFocus:true,
+				focus:false,
 				type: 'center',
 				searchBox: 'hide',
 				pick:'hide',
@@ -115,6 +119,9 @@
 			this.getOutBound();
 		},
 		methods: {
+			focuss() {
+				uni.hideKeyboard()
+			},
 			resst() {
 				this.matList = []
 				this.barcode = ''
@@ -124,10 +131,18 @@
 			removeBarcode() {
 				this.barcode = ''
 				uni.vibrateShort();
+				this.barcodeFocus = false;
+				this.$nextTick(function() {
+					this.barcodeFocus = true;
+				});
 			},
 			removeMatnr() {
 				this.matnr = ''
 				uni.vibrateShort();
+				this.focus = false;
+				this.$nextTick(function() {
+					this.focus = true;
+				});
 			},
 			remove(item,index) {
 				this.matList.splice(index,1)
@@ -214,6 +229,20 @@
 					}
 				});
 			},
+			addMatList(mat) {
+				let barcode = this.mat.barcode
+				let toUnshift = true
+				for (var i = 0; i < this.matList.length; i++) {
+					if (barcode === this.matList[i].barcode) {
+						this.messageToggle('warn')
+						this.messageText = barcode + '宸茬粡鎵弿锛岃鍕块噸澶嶆壂鎻�'
+						toUnshift = false
+					}
+				}
+				if (toUnshift) {
+					this.matList.unshift(mat)
+				}
+			},
 			findBarcode() {
 				let that = this
 				uni.request({

--
Gitblit v1.9.1