fix(订单复核): 软键盘弹出又隐藏/遮挡修复 + 称重语音播报 + 语音串行队列
- 键盘: 修复称重/包材弹窗软键盘「弹出又自动隐藏」——登录页遗留窗口级 ALWAYS_HIDDEN(3),订单页新增 restoreSoftInputMode()(setSoftInputMode 48) 与 showSoftKeyboard()(showSoftInput SHOW_FORCED) 恢复并强制唤出键盘 - 键盘: 称重弹窗打开后延迟聚焦(weighDialogVisible watcher);包材弹窗焦点 改为复用「复核设置→包材软键盘」开关,默认不自动聚焦 - 键盘: 称重/包材弹窗固定屏幕上部(weigh-mask--keyboard),避免键盘遮挡输入框 与底部按钮;回退 adjust-position/cursor-spacing 动态方案(旧 WebView 会失焦) - 语音: 称重操作新增播报「称重成功:X 克」「称重失败」 - 语音: core/voice.js 改 FIFO 串行队列,连续播报按触发顺序一条播完再下一条, 消除交叉打断 - 样式: 推荐包材标签与值无间隔修复(老 WebView 不支持 flex gap,改 margin-left) - 登录页: reLaunch 切回时延迟重注册扫码接收,避免 plus.key 监听被误删 - 调试: electron/main.js 渲染进程 console 转发到主进程终端
This commit is contained in:
parent
66529cd5f2
commit
5de57baa2c
@ -116,6 +116,13 @@ async function createWindow() {
|
|||||||
win.loadURL(`http://127.0.0.1:${port}/`)
|
win.loadURL(`http://127.0.0.1:${port}/`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 渲染进程 console 转发到主进程终端:开发时无需开 DevTools 也能看 [order-scan] 等日志
|
||||||
|
win.webContents.on('console-message', (event, level, message) => {
|
||||||
|
const lvl = (event && event.level) || level || 'info'
|
||||||
|
const msg = (event && event.message) || message || ''
|
||||||
|
console.log(`[renderer:${lvl}] ${msg}`)
|
||||||
|
})
|
||||||
|
|
||||||
// 不显示窗口标题栏下的菜单
|
// 不显示窗口标题栏下的菜单
|
||||||
win.removeMenu()
|
win.removeMenu()
|
||||||
|
|
||||||
|
|||||||
@ -11,16 +11,34 @@ class Voice {
|
|||||||
constructor() {
|
constructor() {
|
||||||
// 每次播放都会重建音频实例,这里仅占位
|
// 每次播放都会重建音频实例,这里仅占位
|
||||||
this.audio = null
|
this.audio = null
|
||||||
|
// 播报队列:FIFO 串行播放,避免连续提示(称重成功/所有订单复核完成等)互相打断交叉播报
|
||||||
|
this.queue = []
|
||||||
|
this.playing = false
|
||||||
|
this.finishTimer = null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 仅播放语音(不弹 toast,避免与全局 showToast 拦截器互相递归) */
|
/** 仅播放语音(不弹 toast,避免与全局 showToast 拦截器互相递归);多条按 FIFO 串行 */
|
||||||
play(msg) {
|
play(msg) {
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.queue.push(String(msg))
|
||||||
|
this.scheduleNext()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从队列取一条播放;正在播放时直接返回,播完再取下一条 */
|
||||||
|
scheduleNext() {
|
||||||
|
if (this.playing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const text = this.queue.shift()
|
||||||
|
if (!text) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.playing = true
|
||||||
// 末字补句号(两个以加长停顿)+ 下载到本地再播:与打包页 speakViaHttp 行为一致,
|
// 末字补句号(两个以加长停顿)+ 下载到本地再播:与打包页 speakViaHttp 行为一致,
|
||||||
// 避免部分 Android 设备播放远程 MP3 时解码丢尾帧导致末字截断
|
// 避免部分 Android 设备播放远程 MP3 时解码丢尾帧导致末字截断
|
||||||
const ttsText = String(msg) + '。。'
|
const ttsText = text + '。。'
|
||||||
uni.request({
|
uni.request({
|
||||||
url: VOICE_API + encodeURIComponent(ttsText),
|
url: VOICE_API + encodeURIComponent(ttsText),
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -28,19 +46,31 @@ class Voice {
|
|||||||
header: { 'content-type': 'text/xml; charset=utf-8' },
|
header: { 'content-type': 'text/xml; charset=utf-8' },
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (!res || !res.data || !res.data.audio) {
|
if (!res || !res.data || !res.data.audio) {
|
||||||
|
this.onPlayFinish()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const src = VOICE_BASE + res.data.audio
|
const src = VOICE_BASE + res.data.audio
|
||||||
this.downloadVoiceAudio(src)
|
this.downloadVoiceAudio(src)
|
||||||
.then((localSrc) => this.playVoiceAudio(localSrc))
|
.then((localSrc) => this.playVoiceAudio(localSrc, () => this.onPlayFinish()))
|
||||||
.catch(() => this.playVoiceAudio(src))
|
.catch(() => this.playVoiceAudio(src, () => this.onPlayFinish()))
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.log('[voice] request fail:', err)
|
console.log('[voice] request fail:', err)
|
||||||
|
this.onPlayFinish()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 一条播完(成功/失败/兜底超时)后继续下一条 */
|
||||||
|
onPlayFinish() {
|
||||||
|
this.playing = false
|
||||||
|
if (this.finishTimer) {
|
||||||
|
clearTimeout(this.finishTimer)
|
||||||
|
this.finishTimer = null
|
||||||
|
}
|
||||||
|
this.scheduleNext()
|
||||||
|
}
|
||||||
|
|
||||||
/** 下载音频到本地临时文件;失败拒绝,由调用方回退远程地址 */
|
/** 下载音频到本地临时文件;失败拒绝,由调用方回退远程地址 */
|
||||||
downloadVoiceAudio(src) {
|
downloadVoiceAudio(src) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -62,8 +92,8 @@ class Voice {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 每次新建音频实例:等缓冲就绪再播放,500ms 兜底 */
|
/** 每次新建音频实例:等缓冲就绪再播放,500ms 兜底;播完回调 onFinish 以串行下一条 */
|
||||||
playVoiceAudio(src) {
|
playVoiceAudio(src, onFinish) {
|
||||||
try {
|
try {
|
||||||
if (this.audio) {
|
if (this.audio) {
|
||||||
try {
|
try {
|
||||||
@ -78,6 +108,15 @@ class Voice {
|
|||||||
this.audio = audio
|
this.audio = audio
|
||||||
let playStarted = false
|
let playStarted = false
|
||||||
let finished = false
|
let finished = false
|
||||||
|
const finish = () => {
|
||||||
|
if (finished) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
finished = true
|
||||||
|
if (onFinish) {
|
||||||
|
onFinish()
|
||||||
|
}
|
||||||
|
}
|
||||||
const doPlay = () => {
|
const doPlay = () => {
|
||||||
if (playStarted || finished) {
|
if (playStarted || finished) {
|
||||||
return
|
return
|
||||||
@ -91,21 +130,31 @@ class Voice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
audio.onError((e) => {
|
audio.onError((e) => {
|
||||||
finished = true
|
|
||||||
console.log('[voice] audio error:', e)
|
console.log('[voice] audio error:', e)
|
||||||
|
finish()
|
||||||
})
|
})
|
||||||
audio.onEnded(() => {
|
audio.onEnded(() => {
|
||||||
finished = true
|
|
||||||
console.log('[voice] 播放结束,总时长:', audio.duration, 's,实际播到:', audio.currentTime, 's')
|
console.log('[voice] 播放结束,总时长:', audio.duration, 's,实际播到:', audio.currentTime, 's')
|
||||||
|
finish()
|
||||||
})
|
})
|
||||||
audio.onCanplay(() => {
|
audio.onCanplay(() => {
|
||||||
console.log('[voice] 音频可播放,总时长:', audio.duration, 's,来源:', String(src).startsWith('http') ? '远程' : '本地')
|
console.log('[voice] 音频可播放,总时长:', audio.duration, 's,来源:', String(src).startsWith('http') ? '远程' : '本地')
|
||||||
|
// 按音频真实时长设兜底,避免 onEnded 未触发时队列卡死
|
||||||
|
if (audio.duration && audio.duration > 0) {
|
||||||
|
if (this.finishTimer) {
|
||||||
|
clearTimeout(this.finishTimer)
|
||||||
|
}
|
||||||
|
this.finishTimer = setTimeout(() => this.onPlayFinish(), Math.min(15000, audio.duration * 1000 + 3000))
|
||||||
|
}
|
||||||
doPlay()
|
doPlay()
|
||||||
})
|
})
|
||||||
audio.src = src
|
audio.src = src
|
||||||
setTimeout(doPlay, 500)
|
setTimeout(doPlay, 500)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('[voice] 创建音频上下文异常:', e)
|
console.log('[voice] 创建音频上下文异常:', e)
|
||||||
|
if (onFinish) {
|
||||||
|
onFinish()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,6 +267,8 @@ export default {
|
|||||||
// ---- 检查更新优先于鉴权跳转 ----
|
// ---- 检查更新优先于鉴权跳转 ----
|
||||||
updateChecked: false, // 更新检测是否已完成(无论有无更新)
|
updateChecked: false, // 更新检测是否已完成(无论有无更新)
|
||||||
pendingAutoEnter: false, // 更新检测完成前被挂起的自动进入打包模式
|
pendingAutoEnter: false, // 更新检测完成前被挂起的自动进入打包模式
|
||||||
|
// reLaunch 从其它页切回时,延迟重注册扫码接收的定时器(兜底重挂 plus.key 监听)
|
||||||
|
scanReRegisterTimer: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
@ -282,6 +284,7 @@ export default {
|
|||||||
this.clearKeyboardSuppressTimers()
|
this.clearKeyboardSuppressTimers()
|
||||||
this.clearHiddenRefocusTimer()
|
this.clearHiddenRefocusTimer()
|
||||||
this.clearAutoEnterPackTimer()
|
this.clearAutoEnterPackTimer()
|
||||||
|
this.clearScanReRegisterTimer()
|
||||||
this.scanBadgeSubmitting = false
|
this.scanBadgeSubmitting = false
|
||||||
stopScanSelfHeal()
|
stopScanSelfHeal()
|
||||||
diagPersistNow()
|
diagPersistNow()
|
||||||
@ -303,6 +306,17 @@ export default {
|
|||||||
diagNote('lifecycle', { hook: 'onShow' })
|
diagNote('lifecycle', { hook: 'onShow' })
|
||||||
this.setupScanCaptureMode()
|
this.setupScanCaptureMode()
|
||||||
this.registerScanCapture()
|
this.registerScanCapture()
|
||||||
|
// reLaunch 从订单复核页切回时,旧页面(复核页)的 beforeUnmount 在 onShow 之后才执行,
|
||||||
|
// 其 removePlusKeyboardListener 会误删本页 core/scan.js 的 plus.key 监听;
|
||||||
|
// 延迟重注册一次兜底,确保 plus.key 监听最终挂载在本页。
|
||||||
|
this.clearScanReRegisterTimer()
|
||||||
|
this.scanReRegisterTimer = setTimeout(() => {
|
||||||
|
this.scanReRegisterTimer = null
|
||||||
|
if (this.pageActive) {
|
||||||
|
console.log('[login-scan] re-register after page leave')
|
||||||
|
this.registerScanCapture()
|
||||||
|
}
|
||||||
|
}, 600)
|
||||||
startScanSelfHeal()
|
startScanSelfHeal()
|
||||||
this.suppressSoftKeyboardBurst()
|
this.suppressSoftKeyboardBurst()
|
||||||
this.scheduleScanInputFocus(320)
|
this.scheduleScanInputFocus(320)
|
||||||
@ -325,6 +339,7 @@ export default {
|
|||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
this.clearHiddenRefocusTimer()
|
this.clearHiddenRefocusTimer()
|
||||||
this.clearAutoEnterPackTimer()
|
this.clearAutoEnterPackTimer()
|
||||||
|
this.clearScanReRegisterTimer()
|
||||||
this.scanHiddenFocused = false
|
this.scanHiddenFocused = false
|
||||||
this.scanInputFocus = false
|
this.scanInputFocus = false
|
||||||
stopScanSelfHeal()
|
stopScanSelfHeal()
|
||||||
@ -345,6 +360,7 @@ export default {
|
|||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
this.clearGlobalKeyTimer()
|
this.clearGlobalKeyTimer()
|
||||||
this.clearAutoEnterPackTimer()
|
this.clearAutoEnterPackTimer()
|
||||||
|
this.clearScanReRegisterTimer()
|
||||||
this.scanBadgeSubmitting = false
|
this.scanBadgeSubmitting = false
|
||||||
this.scanHiddenFocused = false
|
this.scanHiddenFocused = false
|
||||||
this.scanInputFocus = false
|
this.scanInputFocus = false
|
||||||
@ -545,9 +561,11 @@ export default {
|
|||||||
},
|
},
|
||||||
// 注册/注销通用全局扫码接收(捕获与最小长度过滤由 src/core/scan.js 统一处理)
|
// 注册/注销通用全局扫码接收(捕获与最小长度过滤由 src/core/scan.js 统一处理)
|
||||||
registerScanCapture() {
|
registerScanCapture() {
|
||||||
|
console.log('[login-scan] registerScanCapture')
|
||||||
registerScanReceiver({
|
registerScanReceiver({
|
||||||
scope: 'login',
|
scope: 'login',
|
||||||
onScanCode: (code, meta) => {
|
onScanCode: (code, meta) => {
|
||||||
|
console.log('[login-scan] onScanCode code=', code, 'loginMode=', this.loginMode, 'pageActive=', this.pageActive)
|
||||||
if (!this.isPageActive()) {
|
if (!this.isPageActive()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -860,6 +878,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 离开页面前释放全局键盘/扫码监听,确保下一页面能重新“切换”为唯一监听者
|
// 离开页面前释放全局键盘/扫码监听,确保下一页面能重新“切换”为唯一监听者
|
||||||
releaseScanListenersBeforeLeave() {
|
releaseScanListenersBeforeLeave() {
|
||||||
|
// 置 pageActive=false:防止 onShow 的延迟重注册 timer 在跳转后仍触发,
|
||||||
|
// 在订单复核页再挂载 core/scan.js 的 plus.key 监听与复核页自身监听冲突
|
||||||
|
this.pageActive = false
|
||||||
this.unregisterScanCapture()
|
this.unregisterScanCapture()
|
||||||
this.clearScanFocusResumeTimer()
|
this.clearScanFocusResumeTimer()
|
||||||
this.clearKeyboardSuppressTimers()
|
this.clearKeyboardSuppressTimers()
|
||||||
@ -867,6 +888,7 @@ export default {
|
|||||||
this.clearHiddenScanTimer()
|
this.clearHiddenScanTimer()
|
||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
this.clearGlobalKeyTimer()
|
this.clearGlobalKeyTimer()
|
||||||
|
this.clearScanReRegisterTimer()
|
||||||
},
|
},
|
||||||
ensureScanInputFocus() {
|
ensureScanInputFocus() {
|
||||||
if (!this.isPageActive()) {
|
if (!this.isPageActive()) {
|
||||||
@ -1438,6 +1460,12 @@ export default {
|
|||||||
this.autoEnterPackTimer = null
|
this.autoEnterPackTimer = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
clearScanReRegisterTimer() {
|
||||||
|
if (this.scanReRegisterTimer) {
|
||||||
|
clearTimeout(this.scanReRegisterTimer)
|
||||||
|
this.scanReRegisterTimer = null
|
||||||
|
}
|
||||||
|
},
|
||||||
autoEnterPackMode() {
|
autoEnterPackMode() {
|
||||||
if (!this.isPageActive()) {
|
if (!this.isPageActive()) {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
:focus="searchFocus"
|
:focus="searchFocus"
|
||||||
:adjust-position="false"
|
:adjust-position="false"
|
||||||
confirm-type="search"
|
confirm-type="search"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleSearchInputConfirm"
|
||||||
@focus="handleSearchFocus"
|
@focus="handleSearchFocus"
|
||||||
@blur="handleSearchBlur"
|
@blur="handleSearchBlur"
|
||||||
/>
|
/>
|
||||||
@ -206,7 +206,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 称重弹窗 -->
|
<!-- 称重弹窗 -->
|
||||||
<view v-if="weighDialogVisible" class="weigh-mask" @click.self="closeWeighDialog">
|
<view v-if="weighDialogVisible" class="weigh-mask weigh-mask--keyboard" @click.self="closeWeighDialog">
|
||||||
<view class="weigh-dialog">
|
<view class="weigh-dialog">
|
||||||
<view class="weigh-dialog-header">
|
<view class="weigh-dialog-header">
|
||||||
<text class="weigh-dialog-title">{{ weighDialogTitle }}</text>
|
<text class="weigh-dialog-title">{{ weighDialogTitle }}</text>
|
||||||
@ -223,11 +223,13 @@
|
|||||||
class="weigh-input"
|
class="weigh-input"
|
||||||
v-model="weighInputValue"
|
v-model="weighInputValue"
|
||||||
type="digit"
|
type="digit"
|
||||||
|
:focus="weighInputFocus"
|
||||||
:adjust-position="false"
|
:adjust-position="false"
|
||||||
focus
|
|
||||||
placeholder="请输入重量(g)"
|
placeholder="请输入重量(g)"
|
||||||
placeholder-class="weigh-input-placeholder"
|
placeholder-class="weigh-input-placeholder"
|
||||||
confirm-type="done"
|
confirm-type="done"
|
||||||
|
@focus="onWeighInputFocus"
|
||||||
|
@blur="onWeighInputBlur"
|
||||||
@confirm="confirmWeigh"
|
@confirm="confirmWeigh"
|
||||||
/>
|
/>
|
||||||
<view class="weigh-step-btn" @click="handleWeighPlus">+</view>
|
<view class="weigh-step-btn" @click="handleWeighPlus">+</view>
|
||||||
@ -241,7 +243,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 包材绑定弹窗(仅团购波次,order.bindExpressPackageMaterialByWaybill) -->
|
<!-- 包材绑定弹窗(仅团购波次,order.bindExpressPackageMaterialByWaybill) -->
|
||||||
<view v-if="packageMaterialDialogVisible" class="weigh-mask" @click.self="closePackageMaterialDialog">
|
<view v-if="packageMaterialDialogVisible" class="weigh-mask weigh-mask--keyboard" @click.self="closePackageMaterialDialog">
|
||||||
<view class="weigh-dialog">
|
<view class="weigh-dialog">
|
||||||
<view class="weigh-dialog-header">
|
<view class="weigh-dialog-header">
|
||||||
<text class="weigh-dialog-title">包材绑定</text>
|
<text class="weigh-dialog-title">包材绑定</text>
|
||||||
@ -258,8 +260,8 @@
|
|||||||
<input
|
<input
|
||||||
class="weigh-input"
|
class="weigh-input"
|
||||||
v-model="packageMaterialInput"
|
v-model="packageMaterialInput"
|
||||||
|
:focus="settingPmKeyboard"
|
||||||
:adjust-position="false"
|
:adjust-position="false"
|
||||||
focus
|
|
||||||
placeholder="扫描/输入包材条码"
|
placeholder="扫描/输入包材条码"
|
||||||
placeholder-class="weigh-input-placeholder"
|
placeholder-class="weigh-input-placeholder"
|
||||||
confirm-type="search"
|
confirm-type="search"
|
||||||
@ -576,6 +578,7 @@ import {
|
|||||||
sendPrint,
|
sendPrint,
|
||||||
} from '@/api/order'
|
} from '@/api/order'
|
||||||
import { diagAnomaly, diagDrop, diagNote } from '@/core/scan-diag'
|
import { diagAnomaly, diagDrop, diagNote } from '@/core/scan-diag'
|
||||||
|
import { getVoice } from '@/core/voice'
|
||||||
|
|
||||||
// 扫码枪识别参数
|
// 扫码枪识别参数
|
||||||
// 无回车结束符时:停止输入超过该毫秒数视为一次完整扫码,自动提交
|
// 无回车结束符时:停止输入超过该毫秒数视为一次完整扫码,自动提交
|
||||||
@ -745,6 +748,8 @@ export default {
|
|||||||
// 复核前自动称重模式:商品全部扫完且“是否称重=称重”时自动弹出的称重弹窗(标题“称重(复核前)”,保存后直接复核)
|
// 复核前自动称重模式:商品全部扫完且“是否称重=称重”时自动弹出的称重弹窗(标题“称重(复核前)”,保存后直接复核)
|
||||||
weighReviewMode: false,
|
weighReviewMode: false,
|
||||||
weighInputValue: '',
|
weighInputValue: '',
|
||||||
|
// 称重输入框聚焦控制:弹窗打开后延迟置 true 弹出软键盘(称重需手动输入,弹出后不自动隐藏)
|
||||||
|
weighInputFocus: false,
|
||||||
// 包材绑定弹窗(order.bindExpressPackageMaterialByWaybill,仅团购波次)
|
// 包材绑定弹窗(order.bindExpressPackageMaterialByWaybill,仅团购波次)
|
||||||
packageMaterialDialogVisible: false,
|
packageMaterialDialogVisible: false,
|
||||||
// 扫描/输入包材条码
|
// 扫描/输入包材条码
|
||||||
@ -817,6 +822,8 @@ export default {
|
|||||||
noRecheckAutoAdvanceHandled: false,
|
noRecheckAutoAdvanceHandled: false,
|
||||||
// 散单复核后称重:保存成功后据此切下一个未复核订单
|
// 散单复核后称重:保存成功后据此切下一个未复核订单
|
||||||
weighAfterReviewKey: '',
|
weighAfterReviewKey: '',
|
||||||
|
// 进入详情播报免复核商品打包要求的串行链(避免多条语音互相打断)
|
||||||
|
recheckSpeakChain: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -891,8 +898,7 @@ export default {
|
|||||||
return rows.every((order) => {
|
return rows.every((order) => {
|
||||||
const qty = Number(order?.quantity) || 0
|
const qty = Number(order?.quantity) || 0
|
||||||
const scanned = Number(order?.scannedQty) || 0
|
const scanned = Number(order?.scannedQty) || 0
|
||||||
const exempt = String(order?.needRecheck || '').trim().toUpperCase() === 'N'
|
return qty <= 0 || this.isRecheckExempt(order) || scanned >= qty
|
||||||
return qty <= 0 || exempt || scanned >= qty
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// pick_mode=3 散单分播模式:商品明细显示“篮号”列(位置在总数列前)
|
// pick_mode=3 散单分播模式:商品明细显示“篮号”列(位置在总数列前)
|
||||||
@ -973,11 +979,34 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
hasSelection(val) {
|
hasSelection(val) {
|
||||||
// 进入商品条码流程(已选中订单)时,激活条码输入框(真机不自动聚焦,避免误弹软键盘)
|
// 进入商品条码流程(已选中订单)时,激活条码输入框(移动端/真机不自动聚焦,避免误弹软键盘)
|
||||||
if (val && !this.enableHiddenInputCapture && !this.isAppPlus()) {
|
if (val && !this.enableHiddenInputCapture && !this.isRealDevice()) {
|
||||||
this.activateSearchInput()
|
this.activateSearchInput()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 称重弹窗打开:延迟到渲染完成后再聚焦,弹出软键盘且不被焦点竞争/上一弹窗销毁隐藏
|
||||||
|
weighDialogVisible(val) {
|
||||||
|
this.clearWeighFocusTimer()
|
||||||
|
if (val) {
|
||||||
|
this.restoreSoftInputMode()
|
||||||
|
this.weighInputFocus = false
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.weighFocusTimer = setTimeout(() => {
|
||||||
|
if (this.weighDialogVisible && this.isPageActive()) {
|
||||||
|
this.weighInputFocus = true
|
||||||
|
// 聚焦后延迟再强制唤出软键盘(窗口模式已恢复,仍兜底强制 show,避免个别 ROM 不弹)
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.weighDialogVisible && this.isPageActive()) {
|
||||||
|
this.showSoftKeyboard()
|
||||||
|
}
|
||||||
|
}, 250)
|
||||||
|
}
|
||||||
|
}, 320)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.weighInputFocus = false
|
||||||
|
}
|
||||||
|
},
|
||||||
// 输入内容变化时清除批量复核内联错误,并隐藏上一次结果
|
// 输入内容变化时清除批量复核内联错误,并隐藏上一次结果
|
||||||
batchReviewInput() {
|
batchReviewInput() {
|
||||||
if (this.batchReviewError) {
|
if (this.batchReviewError) {
|
||||||
@ -998,6 +1027,10 @@ export default {
|
|||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
|
// 免复核商品判定:need_recheck 去空白转大写后为 'N'(缺失按需复核处理)
|
||||||
|
isRecheckExempt(order) {
|
||||||
|
return String(order?.needRecheck || '').trim().toUpperCase() === 'N'
|
||||||
|
},
|
||||||
// 把条码值统一展开成字符串数组:支持 barcodes[] 数组,以及 "a;b;c" / "a,b,c" / "a,b,c" / "a|b" 等多值串
|
// 把条码值统一展开成字符串数组:支持 barcodes[] 数组,以及 "a;b;c" / "a,b,c" / "a,b,c" / "a|b" 等多值串
|
||||||
normalizeBarcodeList(value) {
|
normalizeBarcodeList(value) {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
@ -1030,9 +1063,16 @@ export default {
|
|||||||
const barcodeExtra = barcodeList.length > 5 ? `+${barcodeList.length - 5}` : ''
|
const barcodeExtra = barcodeList.length > 5 ? `+${barcodeList.length - 5}` : ''
|
||||||
const rawImage = this.getRowValue(row, ['images', 'image', 'image_url', 'imageUrl'])
|
const rawImage = this.getRowValue(row, ['images', 'image', 'image_url', 'imageUrl'])
|
||||||
const image = Array.isArray(rawImage) ? (rawImage[0] || '') : rawImage
|
const image = Array.isArray(rawImage) ? (rawImage[0] || '') : rawImage
|
||||||
|
// 免复核判定:need_recheck 去空白转大写后为 'N'(缺失按需复核处理)
|
||||||
|
const needRecheck = this.getRowValue(row, ['need_recheck', 'needRecheck']) || ''
|
||||||
|
const exemptRecheck = String(needRecheck).trim().toUpperCase() === 'N'
|
||||||
|
const quantity = this.getRowValue(row, ['plan_qty', 'quantity', 'qty', 'num', 'count'])
|
||||||
|
const rawScanned = this.getRowValue(row, ['scanned_qty', 'scannedQty', 'scan_qty', 'scanQty', 'scanned_count', 'scannedCount']) || 0
|
||||||
|
// 免复核商品:已扫数量直接等于计划数量(不参与扫码、无需复核)
|
||||||
|
const scannedQty = exemptRecheck ? Number(quantity) || 0 : rawScanned
|
||||||
return {
|
return {
|
||||||
blueNo: this.getRowValue(row, ['blueNo', 'blue_no', 'lanhao', 'lan_hao', 'blue_no_code', 'stock_id', 'item_code']),
|
blueNo: this.getRowValue(row, ['blueNo', 'blue_no', 'lanhao', 'lan_hao', 'blue_no_code', 'stock_id', 'item_code']),
|
||||||
quantity: this.getRowValue(row, ['plan_qty', 'quantity', 'qty', 'num', 'count']),
|
quantity,
|
||||||
scanMark: this.getRowValue(row, ['scanMark', 'scan_mark', 'scanStatus', 'scan_status']),
|
scanMark: this.getRowValue(row, ['scanMark', 'scan_mark', 'scanStatus', 'scan_status']),
|
||||||
barcode,
|
barcode,
|
||||||
barcodeList,
|
barcodeList,
|
||||||
@ -1044,12 +1084,12 @@ export default {
|
|||||||
image,
|
image,
|
||||||
packingRequirements: this.getRowValue(row, ['recheck_requirements', 'recheckRequirements']),
|
packingRequirements: this.getRowValue(row, ['recheck_requirements', 'recheckRequirements']),
|
||||||
// 免验标记:need_recheck=N 表示无需复核(对齐 WMS_PDA,缺失按需复核处理)
|
// 免验标记:need_recheck=N 表示无需复核(对齐 WMS_PDA,缺失按需复核处理)
|
||||||
needRecheck: this.getRowValue(row, ['need_recheck', 'needRecheck']) || '',
|
needRecheck,
|
||||||
// 篮号(pick_mode=3 散单分播,明细行 box_no 等字段)
|
// 篮号(pick_mode=3 散单分播,明细行 box_no 等字段)
|
||||||
basketNo: this.getRowValue(row, ['box_no', 'boxNo', 'basket_no', 'basketNo', 'seed_no', 'seedNo']),
|
basketNo: this.getRowValue(row, ['box_no', 'boxNo', 'basket_no', 'basketNo', 'seed_no', 'seedNo']),
|
||||||
// 共享条码:库内存在相同条码的其它商品(has_shared_barcode,布尔)
|
// 共享条码:库内存在相同条码的其它商品(has_shared_barcode,布尔)
|
||||||
hasSharedBarcode: !!this.getRowValue(row, ['has_shared_barcode', 'hasSharedBarcode']),
|
hasSharedBarcode: !!this.getRowValue(row, ['has_shared_barcode', 'hasSharedBarcode']),
|
||||||
scannedQty: this.getRowValue(row, ['scanned_qty', 'scannedQty', 'scan_qty', 'scanQty', 'scanned_count', 'scannedCount']) || 0,
|
scannedQty,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
parseItemSnapshot(snapshotRaw) {
|
parseItemSnapshot(snapshotRaw) {
|
||||||
@ -1078,9 +1118,19 @@ export default {
|
|||||||
merged.has_shared_barcode = !!(item?.has_shared_barcode ?? snapshot?.has_shared_barcode ?? false)
|
merged.has_shared_barcode = !!(item?.has_shared_barcode ?? snapshot?.has_shared_barcode ?? false)
|
||||||
return this.normalizeOrderRow(merged)
|
return this.normalizeOrderRow(merged)
|
||||||
},
|
},
|
||||||
|
// 搜索框回车(@confirm):真机搜索框聚焦时,扫码枪的 Enter 也会触发 @confirm,
|
||||||
|
// 此时 plus.key 已缓冲完整条码(随后 Enter keyup 会 flush),跳过 @confirm 避免重复查询。
|
||||||
|
handleSearchInputConfirm() {
|
||||||
|
if (this.isRealDevice() && this.plusKeyBuffer && String(this.plusKeyBuffer).trim()) {
|
||||||
|
console.log('[order-scan] skip input confirm, plusKeyBuffer=', this.plusKeyBuffer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.handleConfirm()
|
||||||
|
},
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
// 提交后重置扫码快速输入标记,下一轮输入重新识别手动/扫码
|
// 提交后重置扫码快速输入标记,下一轮输入重新识别手动/扫码
|
||||||
this.scanBurstConfirmed = false
|
this.scanBurstConfirmed = false
|
||||||
|
console.log('[order-scan] handleConfirm keyword=', this.keyword, 'hasSelection=', this.hasSelection, 'packageMaterialDialogVisible=', this.packageMaterialDialogVisible)
|
||||||
// 包材绑定弹窗打开时:扫码/回车值进入包材搜索流程,而不是订单/商品条码查询
|
// 包材绑定弹窗打开时:扫码/回车值进入包材搜索流程,而不是订单/商品条码查询
|
||||||
if (this.packageMaterialDialogVisible) {
|
if (this.packageMaterialDialogVisible) {
|
||||||
const code = (this.keyword || '').trim()
|
const code = (this.keyword || '').trim()
|
||||||
@ -1155,8 +1205,12 @@ export default {
|
|||||||
this.keyword = (this.keyword || '') + key
|
this.keyword = (this.keyword || '') + key
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主动聚焦输入框,后续字符走浏览器默认输入
|
// 桌面端:主动聚焦输入框,后续字符走浏览器默认输入;
|
||||||
this.searchFocus = true
|
// 移动端(平板 H5/真机):不抢焦点(避免弹软键盘),字符已手动缓冲进 keyword,
|
||||||
|
// 由静默防抖/回车提交走查询,不聚焦输入框也能扫码查询
|
||||||
|
if (!this.isRealDevice()) {
|
||||||
|
this.searchFocus = true
|
||||||
|
}
|
||||||
|
|
||||||
// 回车且已有缓冲内容:视为扫码结束符,立即提交
|
// 回车且已有缓冲内容:视为扫码结束符,立即提交
|
||||||
if (key === 'Enter' && (this.keyword || '').trim()) {
|
if (key === 'Enter' && (this.keyword || '').trim()) {
|
||||||
@ -1373,33 +1427,47 @@ export default {
|
|||||||
handlePlusKeyEvent(event, type) {
|
handlePlusKeyEvent(event, type) {
|
||||||
const keyCode = Number(event?.keyCode || 0)
|
const keyCode = Number(event?.keyCode || 0)
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
// 空闲超过阈值后重新锁定实际生效的事件类型(自愈「锁错就永久静默」)
|
|
||||||
if (this._plusKeyEventType && this._plusLastKeyAt && now - this._plusLastKeyAt > 1200) {
|
|
||||||
this._plusKeyEventType = null
|
|
||||||
}
|
|
||||||
this._plusLastKeyAt = now
|
|
||||||
if (!this.isPageActive()) {
|
if (!this.isPageActive()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 锁定实际生效的事件类型,避免 keydown/keyup 都触发时把一个键记两次
|
// 先排除修饰键(Shift=59/60)
|
||||||
if (!this._plusKeyEventType) {
|
if (keyCode === 59 || keyCode === 60) {
|
||||||
this._plusKeyEventType = type
|
console.log('[order-scan][plus] shift', type, 'keyCode=', keyCode)
|
||||||
}
|
|
||||||
if (this._plusKeyEventType !== type) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const text = this.parsePlusKeyCodeToChar(keyCode)
|
const text = this.parsePlusKeyCodeToChar(keyCode)
|
||||||
const isEnter = this.isPlusEnterKey(keyCode, text)
|
const isEnter = this.isPlusEnterKey(keyCode, text)
|
||||||
|
// 无法映射的按键:忽略
|
||||||
|
if (!text && !isEnter) {
|
||||||
|
console.log('[order-scan][plus] unmapped', type, 'keyCode=', keyCode)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 去重:同一键的 keydown/keyup 成对到达时只处理一次(type 不同 + keyCode 相同 + 间隔 <20ms)。
|
||||||
|
// 不再锁定单一事件类型:真机 keydown/keyup 触发不稳定,锁定错乱会丢字符
|
||||||
|
// (表现为「第一次扫码条码不完整、第二次才完整」)。
|
||||||
|
if (this._plusLastKeyCode === keyCode && this._plusLastKeyType !== type && now - this._plusLastKeyAt < 20) {
|
||||||
|
console.log('[order-scan][plus] dedup', type, 'keyCode=', keyCode)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this._plusLastKeyCode = keyCode
|
||||||
|
this._plusLastKeyType = type
|
||||||
|
this._plusLastKeyAt = now
|
||||||
|
console.log('[order-scan][plus] char', type, 'keyCode=', keyCode, 'text=', text, 'isEnter=', isEnter, 'searchFocused=', this.searchFocused, 'buffer=', this.plusKeyBuffer)
|
||||||
if (text) {
|
if (text) {
|
||||||
// 相邻字符间隔过大 → 软键盘手动输入(字符已由 input 的 v-model 接收):
|
// 相邻字符间隔过大 = 软键盘手动输入(字符已由 input 的 v-model 接收):
|
||||||
// 不进入扫码缓冲,避免「停顿后自动提交查询」;回车查询仍走 @confirm
|
// 清空 plus.key 缓冲不自动查询,回车查询仍走 @confirm。
|
||||||
|
// 扫码枪字符间隔 <30ms(日志实测),不会被误伤;不再用 searchFocused 判断,
|
||||||
|
// 因为真机 reLaunch 后焦点残留会导致搜索框意外聚焦,误 skip 扫码枪字符。
|
||||||
const gap = this._plusLastCharAt ? now - this._plusLastCharAt : 0
|
const gap = this._plusLastCharAt ? now - this._plusLastCharAt : 0
|
||||||
this._plusLastCharAt = now
|
this._plusLastCharAt = now
|
||||||
if (gap > SCAN_BURST_MAX_GAP) {
|
// 仅 buffer 非空(同一串扫码内部)才判定间隔:跨扫码的首字符间隔天然 >100ms,
|
||||||
|
// 若一起判定会把每串扫码的首字符误丢(如 011000000228 被截成 11000000228)
|
||||||
|
if (this.plusKeyBuffer && gap > SCAN_BURST_MAX_GAP) {
|
||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
this.plusKeyBuffer = ''
|
this.plusKeyBuffer = ''
|
||||||
this.plusKeyStartedAt = 0
|
this.plusKeyStartedAt = 0
|
||||||
this.plusKeyLastAt = 0
|
this.plusKeyLastAt = 0
|
||||||
|
console.log('[order-scan][plus] skip-manual gap=', gap, text)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.plusKeyBuffer) {
|
if (!this.plusKeyBuffer) {
|
||||||
@ -1429,6 +1497,7 @@ export default {
|
|||||||
// 同时监听 keydown 与 keyup:部分真机只触发其一,由 handlePlusKeyEvent 锁定避免重复采集
|
// 同时监听 keydown 与 keyup:部分真机只触发其一,由 handlePlusKeyEvent 锁定避免重复采集
|
||||||
plus.key.addEventListener('keydown', this.plusKeyListener)
|
plus.key.addEventListener('keydown', this.plusKeyListener)
|
||||||
plus.key.addEventListener('keyup', this.plusKeyUpListener)
|
plus.key.addEventListener('keyup', this.plusKeyUpListener)
|
||||||
|
console.log('[order-scan] plus listener attached')
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
removePlusKeyboardListener() {
|
removePlusKeyboardListener() {
|
||||||
@ -1437,6 +1506,7 @@ export default {
|
|||||||
this.plusKeyStartedAt = 0
|
this.plusKeyStartedAt = 0
|
||||||
this.plusKeyLastAt = 0
|
this.plusKeyLastAt = 0
|
||||||
this._plusKeyEventType = null
|
this._plusKeyEventType = null
|
||||||
|
console.log('[order-scan] removePlusKeyboardListener has=', !!(this.plusKeyListener || this.plusKeyUpListener))
|
||||||
if (!this.plusKeyListener && !this.plusKeyUpListener) {
|
if (!this.plusKeyListener && !this.plusKeyUpListener) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1462,11 +1532,13 @@ export default {
|
|||||||
this.plusKeyStartedAt = 0
|
this.plusKeyStartedAt = 0
|
||||||
this.plusKeyLastAt = 0
|
this.plusKeyLastAt = 0
|
||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
|
console.log('[order-scan][plus] flush trigger=', trigger, 'code=', code)
|
||||||
if (!code) {
|
if (!code) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 过短内容(误触/软键盘单字符或短词停顿)不自动提交,回车查询不受影响
|
// 过短内容(误触/软键盘单字符或短词停顿)不自动提交,回车查询不受影响
|
||||||
if (code.length < PLUS_SCAN_MIN_LENGTH) {
|
if (code.length < PLUS_SCAN_MIN_LENGTH) {
|
||||||
|
console.log('[order-scan][plus] drop-too-short', code)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.submitScanCode(code, 'plus')
|
this.submitScanCode(code, 'plus')
|
||||||
@ -1564,6 +1636,57 @@ export default {
|
|||||||
this.ensureScanInputFocus()
|
this.ensureScanInputFocus()
|
||||||
}, delay)
|
}, delay)
|
||||||
},
|
},
|
||||||
|
// 清理称重输入框延迟聚焦定时器(弹窗关闭/页面离开时)
|
||||||
|
clearWeighFocusTimer() {
|
||||||
|
if (this.weighFocusTimer) {
|
||||||
|
clearTimeout(this.weighFocusTimer)
|
||||||
|
this.weighFocusTimer = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 恢复窗口软键盘模式:登录/打包页会把窗口设为 ALWAYS_HIDDEN(3)(窗口级、跨页持续),
|
||||||
|
// 导致订单复核页称重/包材输入框聚焦后软键盘弹出又被系统立刻隐藏。
|
||||||
|
// 这里重置为 ADJUST_NOTHING(0x30=48) | STATE_UNSPECIFIED(0):键盘可正常弹出,且不调整窗口避免旧 WebView 失焦
|
||||||
|
restoreSoftInputMode() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
try {
|
||||||
|
if (typeof plus !== 'undefined' && plus.android && plus.android.runtimeMainActivity) {
|
||||||
|
const main = plus.android.runtimeMainActivity()
|
||||||
|
const win = plus.android.invoke(main, 'getWindow')
|
||||||
|
plus.android.invoke(win, 'setSoftInputMode', 48)
|
||||||
|
console.log('[order-scan][kb] setSoftInputMode=ADJUST_NOTHING(48)')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('[order-scan][kb] restoreSoftInputMode failed:', e && e.message)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 称重输入框聚焦/失焦诊断日志(定位键盘被谁收起的时序)
|
||||||
|
onWeighInputFocus() {
|
||||||
|
console.log('[kb-diag] weigh input FOCUS', Date.now())
|
||||||
|
},
|
||||||
|
onWeighInputBlur() {
|
||||||
|
console.log('[kb-diag] weigh input BLUR', Date.now())
|
||||||
|
},
|
||||||
|
// 强制唤出软键盘:对当前已聚焦的输入框调 InputMethodManager.showSoftInput(SHOW_FORCED)
|
||||||
|
showSoftKeyboard() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
try {
|
||||||
|
const main = plus.android.runtimeMainActivity()
|
||||||
|
const win = plus.android.invoke(main, 'getWindow')
|
||||||
|
const focused = plus.android.invoke(win, 'getCurrentFocus')
|
||||||
|
const imm = plus.android.invoke(main, 'getSystemService', 'input_method')
|
||||||
|
if (focused) {
|
||||||
|
// SHOW_FORCED = 2(强制显示)
|
||||||
|
plus.android.invoke(imm, 'showSoftInput', focused, 2)
|
||||||
|
console.log('[order-scan][kb] showSoftInput SHOW_FORCED done')
|
||||||
|
} else {
|
||||||
|
console.log('[order-scan][kb] showSoftInput skipped: no focused view')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('[order-scan][kb] showSoftKeyboard failed:', e && e.message)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
suppressSoftKeyboardBurst() {
|
suppressSoftKeyboardBurst() {
|
||||||
if (!this.isPageActive()) {
|
if (!this.isPageActive()) {
|
||||||
return
|
return
|
||||||
@ -1600,6 +1723,7 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const trimmed = (code || '').trim()
|
const trimmed = (code || '').trim()
|
||||||
|
console.log('[order-scan] submitScanCode source=', source, 'code=', trimmed, 'hasSelection=', this.hasSelection)
|
||||||
if (!trimmed) {
|
if (!trimmed) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1719,10 +1843,12 @@ export default {
|
|||||||
}
|
}
|
||||||
const total = Number(target.quantity) || 0
|
const total = Number(target.quantity) || 0
|
||||||
const scanned = Number(target.scannedQty) || 0
|
const scanned = Number(target.scannedQty) || 0
|
||||||
// 已扫满(数量>0 且已扫>=总数):不再累加,提示并语音播报「超出订单数」
|
// 已扫满(数量>0 且已扫>=总数):不再累加。
|
||||||
|
// 免复核商品提示「该商品无需复核」,普通商品提示「该商品已复核完成」(对齐 WMS_PDA)
|
||||||
if (total > 0 && scanned >= total) {
|
if (total > 0 && scanned >= total) {
|
||||||
this.keyword = ''
|
this.keyword = ''
|
||||||
uni.showToast({ title: '超出订单数', icon: 'none' })
|
const msg = this.isRecheckExempt(target) ? '该商品无需复核' : '该商品已复核完成'
|
||||||
|
uni.showToast({ title: msg, icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const step = Number(this.scanQty) || 1
|
const step = Number(this.scanQty) || 1
|
||||||
@ -1938,6 +2064,44 @@ export default {
|
|||||||
}
|
}
|
||||||
uni.showToast({ title: text, icon: 'none' })
|
uni.showToast({ title: text, icon: 'none' })
|
||||||
},
|
},
|
||||||
|
// 进入详情时播报免复核商品(need_recheck=N)的打包要求,按文本去重后串行播报(对齐 WMS_PDA)
|
||||||
|
speakNoRecheckPackRequirements(items) {
|
||||||
|
if (!Array.isArray(items) || items.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const reqs = []
|
||||||
|
items.forEach((it) => {
|
||||||
|
if (!this.isRecheckExempt(it)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const v = String(it?.packingRequirements || '').trim()
|
||||||
|
if (v && v !== '--' && !reqs.includes(v)) {
|
||||||
|
reqs.push(v)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!reqs.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 串行播报:core/voice.js 每次播放都会重建音频实例,并发会互相打断,用 Promise 链 + 估时排队
|
||||||
|
const prev = this.recheckSpeakChain
|
||||||
|
let chain = prev && typeof prev.then === 'function' ? prev : Promise.resolve()
|
||||||
|
reqs.forEach((text) => {
|
||||||
|
chain = chain.then(() => this.speakVoiceOneByOne(text))
|
||||||
|
})
|
||||||
|
this.recheckSpeakChain = chain.catch(() => {})
|
||||||
|
},
|
||||||
|
// 播报单条语音并按文本长度估时等待(纯语音播报,不弹 toast)
|
||||||
|
speakVoiceOneByOne(text) {
|
||||||
|
const content = String(text || '').trim()
|
||||||
|
if (!content) {
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
getVoice().play(content)
|
||||||
|
const ms = Math.min(5000, Math.max(800, content.length * 300))
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(resolve, ms)
|
||||||
|
})
|
||||||
|
},
|
||||||
handleScanQtyPlus() {
|
handleScanQtyPlus() {
|
||||||
this.scanQty = (Number(this.scanQty) || 0) + 1
|
this.scanQty = (Number(this.scanQty) || 0) + 1
|
||||||
},
|
},
|
||||||
@ -1977,6 +2141,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleSearch() {
|
async handleSearch() {
|
||||||
const query = this.keyword.trim()
|
const query = this.keyword.trim()
|
||||||
|
console.log('[order-scan] handleSearch query=', query)
|
||||||
|
|
||||||
// 清空关键词:回到初始空状态
|
// 清空关键词:回到初始空状态
|
||||||
if (!query) {
|
if (!query) {
|
||||||
@ -2018,6 +2183,7 @@ export default {
|
|||||||
},
|
},
|
||||||
applyScanResult(payload, isBarcodeSearch = false) {
|
applyScanResult(payload, isBarcodeSearch = false) {
|
||||||
const list = Array.isArray(payload?.list) ? payload.list : []
|
const list = Array.isArray(payload?.list) ? payload.list : []
|
||||||
|
console.log('[order-scan] applyScanResult listLen=', list.length, 'msg=', payload?.msg || payload?.message || '')
|
||||||
if (list.length === 0) {
|
if (list.length === 0) {
|
||||||
const message = payload?.msg || payload?.message || '未找到对应订单'
|
const message = payload?.msg || payload?.message || '未找到对应订单'
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -3254,6 +3420,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 弹包材绑定弹窗(打印成功 / 打印失败重试成功后进入)
|
// 弹包材绑定弹窗(打印成功 / 打印失败重试成功后进入)
|
||||||
openGroupPackageBinding() {
|
openGroupPackageBinding() {
|
||||||
|
this.restoreSoftInputMode()
|
||||||
const waybill = this.getWaveRepresentWaybill(this.currentOrderHeader)
|
const waybill = this.getWaveRepresentWaybill(this.currentOrderHeader)
|
||||||
if (!waybill) {
|
if (!waybill) {
|
||||||
// 无运单号:回退到称重(复核前)
|
// 无运单号:回退到称重(复核前)
|
||||||
@ -3344,6 +3511,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 包材绑定:仅团购波次,按波次首单运单号(first_waybill_no)绑定包材
|
// 包材绑定:仅团购波次,按波次首单运单号(first_waybill_no)绑定包材
|
||||||
handleAddPackageMaterial() {
|
handleAddPackageMaterial() {
|
||||||
|
this.restoreSoftInputMode()
|
||||||
if (!this.hasSelection) {
|
if (!this.hasSelection) {
|
||||||
uni.showToast({ title: '请先在左侧选择订单', icon: 'none', silentVoice: true })
|
uni.showToast({ title: '请先在左侧选择订单', icon: 'none', silentVoice: true })
|
||||||
return
|
return
|
||||||
@ -3691,9 +3859,10 @@ export default {
|
|||||||
showCancel: false,
|
showCancel: false,
|
||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
})
|
})
|
||||||
|
getVoice().play('称重失败')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.showToast({ title: `保存成功:${numeric} g`, icon: 'none', silentVoice: true })
|
uni.showToast({ title: `称重成功:${numeric} 克`, icon: 'none' })
|
||||||
this.weighDialogVisible = false
|
this.weighDialogVisible = false
|
||||||
// 复核前自动称重模式:保存成功后直接继续执行确认复核(不弹二次确认弹窗)
|
// 复核前自动称重模式:保存成功后直接继续执行确认复核(不弹二次确认弹窗)
|
||||||
const shouldContinueReview = this.weighReviewMode
|
const shouldContinueReview = this.weighReviewMode
|
||||||
@ -3742,9 +3911,7 @@ export default {
|
|||||||
this.displayOrders.length > 0 &&
|
this.displayOrders.length > 0 &&
|
||||||
this.getWaveReviewStatus(this.currentOrderHeader) !== '已复核' &&
|
this.getWaveReviewStatus(this.currentOrderHeader) !== '已复核' &&
|
||||||
this.displayOrders.every(
|
this.displayOrders.every(
|
||||||
(g) =>
|
(g) => this.isRecheckExempt(g) || Number(g.scannedQty || 0) >= Number(g.quantity || 0)
|
||||||
String(g.needRecheck || '').trim().toUpperCase() === 'N' ||
|
|
||||||
Number(g.scannedQty || 0) >= Number(g.quantity || 0)
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this.noRecheckAutoAdvanceHandled = true
|
this.noRecheckAutoAdvanceHandled = true
|
||||||
@ -3795,7 +3962,8 @@ export default {
|
|||||||
// 已扫完(数量>0 且已扫>=总数)的行:无条码复核无意义,直接不弹窗
|
// 已扫完(数量>0 且已扫>=总数)的行:无条码复核无意义,直接不弹窗
|
||||||
if (this.isProductScanned(order)) {
|
if (this.isProductScanned(order)) {
|
||||||
diagDrop('无条码复核-blocked', { reason: 'already-scanned' })
|
diagDrop('无条码复核-blocked', { reason: 'already-scanned' })
|
||||||
uni.showToast({ title: '超出订单数', icon: 'none' })
|
const msg = this.isRecheckExempt(order) ? '该商品无需复核' : '该商品已复核完成'
|
||||||
|
uni.showToast({ title: msg, icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.openNoBarcodeReview(order)
|
this.openNoBarcodeReview(order)
|
||||||
@ -3840,7 +4008,8 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (scanned >= total) {
|
if (scanned >= total) {
|
||||||
uni.showToast({ title: '超出订单数', icon: 'none' })
|
const msg = this.isRecheckExempt(target) ? '该商品无需复核' : '该商品已复核完成'
|
||||||
|
uni.showToast({ title: msg, icon: 'none' })
|
||||||
this.closeNoBarcodeReview()
|
this.closeNoBarcodeReview()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -4117,6 +4286,8 @@ export default {
|
|||||||
this.currentWaybillInfo = null
|
this.currentWaybillInfo = null
|
||||||
this.displayOrders = (inlineItems || []).map((inlineItem) => this.normalizeOrderDetailItem(inlineItem))
|
this.displayOrders = (inlineItems || []).map((inlineItem) => this.normalizeOrderDetailItem(inlineItem))
|
||||||
this.syncDetailStats(src, this.displayOrders)
|
this.syncDetailStats(src, this.displayOrders)
|
||||||
|
// 进入详情时播报免复核商品的打包要求(need_recheck=N 且含打包要求)
|
||||||
|
this.speakNoRecheckPackRequirements(this.displayOrders)
|
||||||
|
|
||||||
// 该行有拦截标识时:点击行即进入拦截确认模式(顶部确认按钮变为"确认拦截")
|
// 该行有拦截标识时:点击行即进入拦截确认模式(顶部确认按钮变为"确认拦截")
|
||||||
if (this.isIntercepted(item)) {
|
if (this.isIntercepted(item)) {
|
||||||
@ -4202,6 +4373,8 @@ export default {
|
|||||||
: []
|
: []
|
||||||
this.displayOrders = stocks.map((stock) => this.normalizeOrderDetailItem(stock))
|
this.displayOrders = stocks.map((stock) => this.normalizeOrderDetailItem(stock))
|
||||||
this.syncDetailStats(wave, this.displayOrders)
|
this.syncDetailStats(wave, this.displayOrders)
|
||||||
|
// 进入详情时播报免复核商品的打包要求(need_recheck=N 且含打包要求)
|
||||||
|
this.speakNoRecheckPackRequirements(this.displayOrders)
|
||||||
// 已复核波次:商品明细统一置为全部已扫(复核后重选/取消称重重选该波次时保持已扫状态,
|
// 已复核波次:商品明细统一置为全部已扫(复核后重选/取消称重重选该波次时保持已扫状态,
|
||||||
// 避免长按商品行误弹“无条码复核”)
|
// 避免长按商品行误弹“无条码复核”)
|
||||||
if (this.getWaveReviewStatus(wave) === '已复核') {
|
if (this.getWaveReviewStatus(wave) === '已复核') {
|
||||||
@ -4259,15 +4432,16 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.loadPrinters()
|
this.loadPrinters()
|
||||||
this.loadSettings()
|
this.loadSettings()
|
||||||
|
this.restoreSoftInputMode()
|
||||||
// 扫码枪识别:真机/H5 双链路(隐藏 input + plus.key + DOM 全局监听)
|
// 扫码枪识别:真机/H5 双链路(隐藏 input + plus.key + DOM 全局监听)
|
||||||
this.setupScanCaptureMode()
|
this.setupScanCaptureMode()
|
||||||
this.attachPlusKeyboardListener()
|
this.attachPlusKeyboardListener()
|
||||||
this.attachGlobalKeyboardListener()
|
this.attachGlobalKeyboardListener()
|
||||||
this.suppressSoftKeyboardBurst()
|
this.suppressSoftKeyboardBurst()
|
||||||
this.scheduleScanInputFocus(260)
|
this.scheduleScanInputFocus(260)
|
||||||
// 页面进入即聚焦搜索框(仅 H5/Electron;真机不自动聚焦,避免误弹软键盘)
|
// 页面进入即聚焦搜索框(仅桌面端;移动端/真机不自动聚焦,避免误弹软键盘)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (!this.enableHiddenInputCapture && !this.isAppPlus()) {
|
if (!this.enableHiddenInputCapture && !this.isRealDevice()) {
|
||||||
this.activateSearchInput()
|
this.activateSearchInput()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -4275,6 +4449,7 @@ export default {
|
|||||||
activated() {
|
activated() {
|
||||||
// keep-alive 从其它页切回时:恢复扫码链路与隐藏 input 焦点
|
// keep-alive 从其它页切回时:恢复扫码链路与隐藏 input 焦点
|
||||||
this.pageActive = true
|
this.pageActive = true
|
||||||
|
this.restoreSoftInputMode()
|
||||||
this.setupScanCaptureMode()
|
this.setupScanCaptureMode()
|
||||||
this.attachPlusKeyboardListener()
|
this.attachPlusKeyboardListener()
|
||||||
this.attachGlobalKeyboardListener()
|
this.attachGlobalKeyboardListener()
|
||||||
@ -4284,9 +4459,11 @@ export default {
|
|||||||
deactivated() {
|
deactivated() {
|
||||||
// keep-alive 切到其它页时:暂停扫码链路,避免隐藏 input 抢占其它页焦点
|
// keep-alive 切到其它页时:暂停扫码链路,避免隐藏 input 抢占其它页焦点
|
||||||
this.pageActive = false
|
this.pageActive = false
|
||||||
|
console.log('[order-scan] deactivated -> remove listeners')
|
||||||
this.removePlusKeyboardListener()
|
this.removePlusKeyboardListener()
|
||||||
this.removeGlobalKeyboardListener()
|
this.removeGlobalKeyboardListener()
|
||||||
this.clearScanFocusResumeTimer()
|
this.clearScanFocusResumeTimer()
|
||||||
|
this.clearWeighFocusTimer()
|
||||||
this.clearKeyboardSuppressTimers()
|
this.clearKeyboardSuppressTimers()
|
||||||
this.clearHiddenScanTimer()
|
this.clearHiddenScanTimer()
|
||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
@ -4296,10 +4473,12 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.pageActive = false
|
this.pageActive = false
|
||||||
|
console.log('[order-scan] beforeUnmount -> remove listeners')
|
||||||
this.onResizeEnd()
|
this.onResizeEnd()
|
||||||
this.removePlusKeyboardListener()
|
this.removePlusKeyboardListener()
|
||||||
this.removeGlobalKeyboardListener()
|
this.removeGlobalKeyboardListener()
|
||||||
this.clearScanFocusResumeTimer()
|
this.clearScanFocusResumeTimer()
|
||||||
|
this.clearWeighFocusTimer()
|
||||||
this.clearKeyboardSuppressTimers()
|
this.clearKeyboardSuppressTimers()
|
||||||
this.clearHiddenScanTimer()
|
this.clearHiddenScanTimer()
|
||||||
this.clearPlusKeyTimer()
|
this.clearPlusKeyTimer()
|
||||||
@ -4982,6 +5161,15 @@ export default {
|
|||||||
z-index: 998;
|
z-index: 998;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 称重/包材键盘弹窗:固定到屏幕上部,避免软键盘弹出时遮挡输入框与底部按钮 */
|
||||||
|
.weigh-mask--keyboard {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weigh-mask--keyboard .weigh-dialog {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.weigh-dialog {
|
.weigh-dialog {
|
||||||
width: 5.49rem;
|
width: 5.49rem;
|
||||||
max-width: 92%;
|
max-width: 92%;
|
||||||
@ -5028,7 +5216,6 @@ export default {
|
|||||||
.weigh-info-row {
|
.weigh-info-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.15rem;
|
|
||||||
padding: 0.1rem 0;
|
padding: 0.1rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5042,6 +5229,7 @@ export default {
|
|||||||
.weigh-info-value {
|
.weigh-info-value {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
margin-left: 0.15rem;
|
||||||
font-size: 0.25rem;
|
font-size: 0.25rem;
|
||||||
color: var(--wms-text);
|
color: var(--wms-text);
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
@ -6005,7 +6193,6 @@ export default {
|
|||||||
.recommend-pack-bar {
|
.recommend-pack-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.15rem;
|
|
||||||
margin-bottom: 0.1rem;
|
margin-bottom: 0.1rem;
|
||||||
padding: 0.1rem 0.15rem;
|
padding: 0.1rem 0.15rem;
|
||||||
background-color: #fff8ef;
|
background-color: #fff8ef;
|
||||||
@ -6023,6 +6210,7 @@ export default {
|
|||||||
.recommend-pack-bar-name {
|
.recommend-pack-bar-name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
margin-left: 0.15rem;
|
||||||
font-size: 0.22rem;
|
font-size: 0.22rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--wms-text);
|
color: var(--wms-text);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user