扫码货位:先弹窗显示识别内容,点击搜索后请求后端查询

This commit is contained in:
97694732@qq.com 2026-06-04 17:31:53 +08:00
parent 008a49e59a
commit 48839d8fc5

View File

@ -1546,6 +1546,14 @@ export default {
const whCode = scanned.substring(0, sepIdx).trim() const whCode = scanned.substring(0, sepIdx).trim()
const locCode = scanned.substring(sepIdx + 2).trim() const locCode = scanned.substring(sepIdx + 2).trim()
if (whCode && locCode) { if (whCode && locCode) {
//
uni.showModal({
title: '扫码结果',
content: '仓库编码:' + whCode + '\n货位号' + locCode + '\n\n点击"搜索"查询货位',
confirmText: '搜索',
cancelText: '取消',
success: async (modalRes) => {
if (!modalRes.confirm) return
// //
const whIdx = this.popupWarehouseList.findIndex(w => { const whIdx = this.popupWarehouseList.findIndex(w => {
const code = (w.code || '').toLowerCase() const code = (w.code || '').toLowerCase()
@ -1566,23 +1574,30 @@ export default {
} else { } else {
uni.showToast({ title: '已切换仓库' + whCode + ',但未找到货位' + locCode, icon: 'none' }) uni.showToast({ title: '已切换仓库' + whCode + ',但未找到货位' + locCode, icon: 'none' })
} }
} else {
uni.showToast({ title: '未找到仓库: ' + whCode, icon: 'none' })
}
}
})
return return
} }
} }
}
// // ##
let matched = null uni.showModal({
for (const loc of this.popupAllLocationList) { title: '扫码结果',
const code = (loc.code || '').toLowerCase() content: '条码内容:' + scanned + '\n\n点击"搜索"在当前仓库中查询货位',
const name = (loc.name || '').toLowerCase() confirmText: '搜索',
cancelText: '取消',
success: async (modalRes) => {
if (!modalRes.confirm) return
const search = scanned.toLowerCase() const search = scanned.toLowerCase()
if (code === search || name === search || const matched = this.popupAllLocationList.find(l => {
code.includes(search) || search.includes(code)) { const code = (l.code || '').toLowerCase()
matched = loc const name = (l.name || '').toLowerCase()
break return code === search || name === search ||
} code.includes(search) || search.includes(code)
} })
if (matched) { if (matched) {
this.popupSelectedLoc = matched this.popupSelectedLoc = matched
this.popupLocationSearch = '' this.popupLocationSearch = ''
@ -1591,6 +1606,8 @@ export default {
} else { } else {
uni.showToast({ title: '未找到匹配货位', icon: 'none' }) uni.showToast({ title: '未找到匹配货位', icon: 'none' })
} }
}
})
}, },
fail: () => {} fail: () => {}
}) })