From 470a474d70270f1cc8a47d2026bbd2f51023277e Mon Sep 17 00:00:00 2001 From: HongxuanG <1359774872@qq.com> Date: Fri, 4 Sep 2026 09:44:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(storegoods):=20=E4=BF=AE=E5=A4=8D=E9=87=8D?= =?UTF-8?q?=E6=89=AB=E4=BB=93=E4=BD=8D=E6=97=B6=E6=97=A7=E7=A0=81=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .../storegoods/storeGoodsProcessInMixin.js | 17 +++++++++++++---- .../storeGoodsProcessReturnInMixin.js | 17 +++++++++++++---- .../storegoods/storeGoodsPurchaseInMixin.js | 17 +++++++++++++---- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/pages/storegoods/storeGoodsProcessInMixin.js b/src/pages/storegoods/storeGoodsProcessInMixin.js index 2e33303..ecaafb5 100644 --- a/src/pages/storegoods/storeGoodsProcessInMixin.js +++ b/src/pages/storegoods/storeGoodsProcessInMixin.js @@ -132,6 +132,16 @@ export default { this.warehouseBinName = ''; this.phoneContinuousScan = false; }, + /** 重扫仓位:先清空输入框再填入,避免残留旧码拼接 */ + applyWarehouseBinScan(scanResult) { + const code = String(scanResult || '').trim().replace(/[\r\n]/g, ''); + if (!code) return; + this.warehouseBinCode = ''; + this.$nextTick(() => { + this.warehouseBinCode = code; + this.$nextTick(() => this.resolveWarehouseBin()); + }); + }, handleBinPhoneScan() { if (!this.canScan || !this.orderId) { this.showError('请先提交保存后再扫码'); @@ -141,8 +151,7 @@ export default { this.phoneScanTarget = 'bin'; this.openPhoneScan({ callback: (scanResult) => { - this.warehouseBinCode = String(scanResult || '').trim().replace(/[\r\n]/g, ''); - this.$nextTick(() => this.resolveWarehouseBin()); + this.applyWarehouseBinScan(scanResult); }, fail: () => {}, }); @@ -191,8 +200,7 @@ export default { if (!code) return; // 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位 if (!this.BarCodeDelStatus && !this.warehouseBinId) { - this.warehouseBinCode = code; - this.$nextTick(() => this.resolveWarehouseBin()); + this.applyWarehouseBinScan(code); return; } this.QRBarCode = code; @@ -239,6 +247,7 @@ export default { .catch((e) => { uni.hideLoading(); this.warehouseBinId = 0; + this.warehouseBinCode = ''; this.warehouseBinName = ''; this.showError(e.message || '仓位识别失败'); }); diff --git a/src/pages/storegoods/storeGoodsProcessReturnInMixin.js b/src/pages/storegoods/storeGoodsProcessReturnInMixin.js index 700f70e..8095354 100644 --- a/src/pages/storegoods/storeGoodsProcessReturnInMixin.js +++ b/src/pages/storegoods/storeGoodsProcessReturnInMixin.js @@ -121,6 +121,16 @@ export default { this.warehouseBinName = ''; this.phoneContinuousScan = false; }, + /** 重扫仓位:先清空输入框再填入,避免残留旧码拼接 */ + applyWarehouseBinScan(scanResult) { + const code = String(scanResult || '').trim().replace(/[\r\n]/g, ''); + if (!code) return; + this.warehouseBinCode = ''; + this.$nextTick(() => { + this.warehouseBinCode = code; + this.$nextTick(() => this.resolveWarehouseBin()); + }); + }, handleBinPhoneScan() { if (!this.canScan || !this.orderId) { this.showError('请先提交保存后再扫码'); @@ -130,8 +140,7 @@ export default { this.phoneScanTarget = 'bin'; this.openPhoneScan({ callback: (scanResult) => { - this.warehouseBinCode = String(scanResult || '').trim().replace(/[\r\n]/g, ''); - this.$nextTick(() => this.resolveWarehouseBin()); + this.applyWarehouseBinScan(scanResult); }, fail: () => {}, }); @@ -180,8 +189,7 @@ export default { if (!code) return; // 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位 if (!this.BarCodeDelStatus && !this.warehouseBinId) { - this.warehouseBinCode = code; - this.$nextTick(() => this.resolveWarehouseBin()); + this.applyWarehouseBinScan(code); return; } this.QRBarCode = code; @@ -228,6 +236,7 @@ export default { .catch((e) => { uni.hideLoading(); this.warehouseBinId = 0; + this.warehouseBinCode = ''; this.warehouseBinName = ''; this.showError(e.message || '仓位识别失败'); }); diff --git a/src/pages/storegoods/storeGoodsPurchaseInMixin.js b/src/pages/storegoods/storeGoodsPurchaseInMixin.js index 172705b..1814a8e 100644 --- a/src/pages/storegoods/storeGoodsPurchaseInMixin.js +++ b/src/pages/storegoods/storeGoodsPurchaseInMixin.js @@ -134,6 +134,16 @@ export default { this.warehouseBinName = ''; this.phoneContinuousScan = false; }, + /** 重扫仓位:先清空输入框再填入,避免残留旧码拼接 */ + applyWarehouseBinScan(scanResult) { + const code = String(scanResult || '').trim().replace(/[\r\n]/g, ''); + if (!code) return; + this.warehouseBinCode = ''; + this.$nextTick(() => { + this.warehouseBinCode = code; + this.$nextTick(() => this.resolveWarehouseBin()); + }); + }, handleBinPhoneScan() { if (!this.canScan || !this.orderId) { this.showError('请先提交保存后再扫码'); @@ -143,8 +153,7 @@ export default { this.phoneScanTarget = 'bin'; this.openPhoneScan({ callback: (scanResult) => { - this.warehouseBinCode = String(scanResult || '').trim().replace(/[\r\n]/g, ''); - this.$nextTick(() => this.resolveWarehouseBin()); + this.applyWarehouseBinScan(scanResult); }, fail: () => {}, }); @@ -193,8 +202,7 @@ export default { if (!code) return; // 删除模式:直接按布匹码删除;未扫仓位时枪扫优先解析为仓位 if (!this.BarCodeDelStatus && !this.warehouseBinId) { - this.warehouseBinCode = code; - this.$nextTick(() => this.resolveWarehouseBin()); + this.applyWarehouseBinScan(code); return; } this.QRBarCode = code; @@ -241,6 +249,7 @@ export default { .catch((e) => { uni.hideLoading(); this.warehouseBinId = 0; + this.warehouseBinCode = ''; this.warehouseBinName = ''; this.showError(e.message || '仓位识别失败'); });