From f1853246d1dba7b96a41047bd294b791fd4a734e Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Fri, 5 Jun 2026 09:32:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81:=E5=88=87=E6=8D=A2=E5=88=B0?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E4=BB=93=E5=BA=93tab=E5=90=8E=E5=B8=A6?= =?UTF-8?q?=E7=9D=80=E8=B4=A7=E4=BD=8D=E5=8F=B7=E9=87=8D=E6=96=B0=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=90=8E=E7=AB=AF=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index c45849f..4854e05 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -1620,7 +1620,7 @@ export default { const raw = this.scanPopupRaw if (whCode && locCode) { - // 格式 NS##a5-4 → 先切换到对应仓库 tab,再在搜索框输入货位号 + // 格式 NS##a5-4 → 按仓库编码匹配仓库,切换tab,带着货位号请求后端过滤 const whIdx = this.popupWarehouseList.findIndex(w => { const code = (w.code || '').toLowerCase() const name = (w.name || '').toLowerCase() @@ -1628,22 +1628,19 @@ export default { return code === search || name === search || code.includes(search) }) if (whIdx !== -1) { - // 切换到该仓库(不携带搜索参数,加载全部货位) + const wh = this.popupWarehouseList[whIdx] + // 切换到该仓库 tab this.popupActiveWhIndex = whIdx - this.popupSelectedWh = this.popupWarehouseList[whIdx] + this.popupSelectedWh = wh this.popupSelectedLoc = null this.popupLocationSearch = '' - await this.loadPopupLocations(this.popupWarehouseList[whIdx].id) - // 将货位号填入搜索框,触发前端过滤显示 - this.popupLocationSearch = locCode - // 如果过滤后只剩一条,自动选中 - if (this.filteredLocationList.length === 1) { - this.popupSelectedLoc = this.filteredLocationList[0] - uni.showToast({ title: '已匹配 仓库' + whCode + ' 货位:' + this.filteredLocationList[0].code, icon: 'success' }) - } else if (this.filteredLocationList.length > 1) { - uni.showToast({ title: '已切换到仓库' + whCode + ',找到' + this.filteredLocationList.length + '个匹配货位', icon: 'none' }) + // 带着货位号请求后端过滤货位列表(重新请求接口) + await this.loadPopupLocations(wh.id, false, locCode) + if (this.popupLocationList.length > 0) { + this.popupSelectedLoc = this.popupLocationList[0] + uni.showToast({ title: '已匹配 仓库' + whCode + ' 货位:' + this.popupLocationList[0].code, icon: 'success' }) } else { - uni.showToast({ title: '已切换到仓库' + whCode + ',但未找到匹配货位', icon: 'none' }) + uni.showToast({ title: '已切换到仓库' + whCode + ',但未找到货位' + locCode, icon: 'none' }) } } else { uni.showToast({ title: '未找到仓库: ' + whCode, icon: 'none' })