From 748c5e49a29920ca0a7f9b7d0845c93c81085046 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期一, 09 二月 2026 09:33:14 +0800
Subject: [PATCH] 快速拣货-
---
pages/outbound/fastPicking.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/pages/outbound/fastPicking.vue b/pages/outbound/fastPicking.vue
index 44fa013..2bac7c0 100644
--- a/pages/outbound/fastPicking.vue
+++ b/pages/outbound/fastPicking.vue
@@ -3,9 +3,8 @@
<form>
<view class="cu-form-group" v-show="!isconfirm">
<view class="title">瀹瑰櫒鐮�</view>
- <input placeholder="璇锋壂鎻忓鍣ㄧ爜" v-model="barcode" focus></input>
+ <input placeholder="璇锋壂鎻忓鍣ㄧ爜" v-model="barcode" focus @input="onBarcodeInput"></input>
<text class='cuIcon-close text-gray margin-right-xs' v-show="barcode!==''" @click="clearCode"></text>
- <text class='cuIcon-search text-blue' @click="search"></text>
</view>
</form>
@@ -109,7 +108,9 @@
backgroundColor: '#42b983',
borderColor: '#42b983'
},
- repeatClick: false
+ repeatClick: false,
+ searchTimer: null, // 闃叉姈瀹氭椂鍣�
+ isClearing: false // 鏍囪鏄惁姝e湪娓呯┖
}
},
computed: {
@@ -118,8 +119,30 @@
return this.list.reduce((acc, row) => +row.receiptQty + acc, 0)
}
},
+ watch: {
+ // 鐩戝惉瀹瑰櫒鐮佸彉鍖栵紝鑷姩鏌ヨ
+ barcode(newVal, oldVal) {
+ // 濡傛灉姝e湪娓呯┖锛屼笉瑙﹀彂鏌ヨ
+ if (this.isClearing) {
+ return;
+ }
+ // 娓呴櫎涔嬪墠鐨勫畾鏃跺櫒
+ if (this.searchTimer) {
+ clearTimeout(this.searchTimer);
+ }
+ // 濡傛灉瀹瑰櫒鐮佷笉涓虹┖锛屽欢杩�300ms鍚庤嚜鍔ㄦ煡璇紙闃叉姈澶勭悊锛�
+ if (newVal && newVal.trim() !== '') {
+ this.searchTimer = setTimeout(() => {
+ this.search();
+ }, 300);
+ } else {
+ // 瀹瑰櫒鐮佷负绌烘椂锛屾竻绌哄垪琛�
+ this.list = [];
+ }
+ }
+ },
mounted() {
- this.search()
+ // 绉婚櫎鑷姩鏌ヨ锛屾敼涓虹洃鍚緭鍏ヨ嚜鍔ㄦ煡璇�
},
methods: {
clickTaskItem(index){
@@ -134,9 +157,12 @@
this.typeSelect = e.value
this.search()
},
+ onBarcodeInput(e) {
+ // 杈撳叆浜嬩欢鐢眞atch澶勭悊锛岃繖閲屽彲浠ユ坊鍔犻澶栭�昏緫
+ },
async search() {
this.list = []
- if(this.barcode === '' || this.barcode ===null){
+ if(this.barcode === '' || this.barcode ===null || this.barcode.trim() === ''){
return ;
}
const {
@@ -198,6 +224,7 @@
title: msg,
icon: "success"
})
+ // 纭鍚庢竻绌猴紝鏀寔鍐嶆鎵弿
that.clear()
}else if(code == 401){
@@ -218,14 +245,25 @@
},
clearCode() {
- this.barcode = ''
+ this.isClearing = true;
+ this.barcode = '';
+ this.list = [];
+ // 娓呯┖鍚庨噸缃爣璁帮紝鍏佽涓嬫鎵弿
+ this.$nextTick(() => {
+ this.isClearing = false;
+ });
},
remove(index) {
this.list.splice(index, 1);
},
clear() {
- this.list = []
- this.barcode = ''
+ this.isClearing = true;
+ this.list = [];
+ this.barcode = '';
+ // 娓呯┖鍚庨噸缃爣璁帮紝鍏佽涓嬫鎵弿
+ this.$nextTick(() => {
+ this.isClearing = false;
+ });
},
next() {
if (this.list.length) {
@@ -285,6 +323,12 @@
DateChange(e, item) {
item.prodTime = e.detail.value
}
+ },
+ beforeDestroy() {
+ // 缁勪欢閿�姣佸墠娓呴櫎瀹氭椂鍣�
+ if (this.searchTimer) {
+ clearTimeout(this.searchTimer);
+ }
}
}
</script>
--
Gitblit v1.9.1