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 '';