From e21e9d7464f1e4e8f4730fc4c8456099651e7371 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Sat, 17 Oct 2026 18:03:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=AE=A2=E5=8D=95=E5=A4=8D=E6=A0=B8):=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AF=BB=E7=A7=A4=E6=89=93=E5=BC=80=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=97=B6=E5=AE=9E=E6=97=B6=E9=87=8D=E9=87=8F=E6=9C=AA?= =?UTF-8?q?=E5=9B=9E=E5=A1=AB=E7=A7=B0=E9=87=8D=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 抽取 tryAutoFillWeighFromScale() 复用自动回填逻辑 - 称重弹窗打开且「已连接+自动读秤」时立即回填当前重量, 修复秤在弹窗打开前已稳定读数时 scaleWeight 不再变化、 watcher 不再触发导致「实时重量有值但输入框未回填」的问题 - 版本号 1.0.125 → 1.0.127 --- package.json | 2 +- src/manifest.json | 2 +- src/pages/work/order/order-review.vue | 41 ++++++++++++++++----------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 64ac094..abd3b4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wms-pda", - "version": "1.0.125", + "version": "1.0.127", "private": true, "description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)", "scripts": { diff --git a/src/manifest.json b/src/manifest.json index 38c3418..a949b8a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "name" : "WMS_PDA", "appid" : "__UNI__0B3DAD3", "description" : "多平台快速开发的UI框架", - "versionName" : "1.0.125", + "versionName" : "1.0.127", "versionCode" : 1000123, "transformPx" : false, "app-plus" : { diff --git a/src/pages/work/order/order-review.vue b/src/pages/work/order/order-review.vue index 969c59b..90e51ef 100644 --- a/src/pages/work/order/order-review.vue +++ b/src/pages/work/order/order-review.vue @@ -815,6 +815,9 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; // 蓝牙秤已连接且开启自动读秤时不聚焦输入框,避免键盘反复弹出闪烁;其余情况保持历史聚焦行为 if (this.isScaleConnected && this.autoReadScale) { this.weighInputFocused = false; + // 立即用当前已有重量回填:若秤在弹窗打开前已稳定读数,scaleWeight 不再变化, + // watcher 不会再次触发,导致「实时重量有值但输入框未回填」 + this.tryAutoFillWeighFromScale(); } else { this._programmaticFocus = true; this.weighInputFocused = false; @@ -827,23 +830,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; } }, scaleWeight(val) { - if (!this.autoReadScale || !this.showWeighPopup || !this.isScaleConnected || val === null || val === undefined) return; - // 用户正在手动编辑时不打断输入 - if (this.weightEditing) return; - const g = this.scaleWeightInGrams(); - if (g === '') return; - const gNum = Math.round(Number(g)); - if (String(gNum) === String(this.weighWeight)) return; - // 阈值保护:重量变化未超过阈值时不回填,避免秤抖动反复覆盖 - if (this.lastAutoWeight !== '' && !isNaN(gNum) && Math.abs(gNum - Number(this.lastAutoWeight)) < this.autoReadThresholdG) { - return; - } - this.lastAutoWeight = String(g); - // App 端聚焦中的原生 input 不响应数据更新,先失焦再回填 - this.weighInputFocused = false; - this.$nextTick(() => { - this.weighWeight = gNum; - }); + if (val === null || val === undefined) return; + this.tryAutoFillWeighFromScale(); } }, onLoad(options) { @@ -3340,6 +3328,25 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; onWeighInputBlur() { this.weightEditing = false; }, + tryAutoFillWeighFromScale() { + if (!this.autoReadScale || !this.showWeighPopup || !this.isScaleConnected) return; + // 用户正在手动编辑时不打断输入 + if (this.weightEditing) return; + const g = this.scaleWeightInGrams(); + if (g === '') return; + const gNum = Math.round(Number(g)); + if (String(gNum) === String(this.weighWeight)) return; + // 阈值保护:重量变化未超过阈值时不回填,避免秤抖动反复覆盖 + if (this.lastAutoWeight !== '' && !isNaN(gNum) && Math.abs(gNum - Number(this.lastAutoWeight)) < this.autoReadThresholdG) { + return; + } + this.lastAutoWeight = String(g); + // App 端聚焦中的原生 input 不响应数据更新,先失焦再回填 + this.weighInputFocused = false; + this.$nextTick(() => { + this.weighWeight = gNum; + }); + }, scaleWeightInGrams() { const raw = this.scaleWeight; if (raw === null || raw === undefined || raw === '') return '';