From 6d2df0f0d0d1641b1ac08586fe090fcfbea94723 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Mon, 24 Aug 2026 22:11:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=86=E5=8C=85=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=90=8E=E9=94=81=E5=AE=9A=E8=B4=A7=E4=B8=BB?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E6=B8=85=E7=A9=BA=EF=BC=8C=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=99=90=E5=AE=9A=E5=BD=93=E5=89=8D=E8=B4=A7?= =?UTF-8?q?=E4=B8=BB=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=BC=B9=E7=AA=97=E5=9B=9E?= =?UTF-8?q?=E4=BC=A0store=5Fid=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/StockPickerDialog.vue | 4 +++- src/views/express/returnUnpackwork/index.vue | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/views/express/returnUnpack/components/StockPickerDialog.vue b/src/views/express/returnUnpack/components/StockPickerDialog.vue index 2051e679..375f5a07 100644 --- a/src/views/express/returnUnpack/components/StockPickerDialog.vue +++ b/src/views/express/returnUnpack/components/StockPickerDialog.vue @@ -76,6 +76,7 @@ import { isStockApiSuccess, parseStockWarehouseSearch, mapStockPickerItem, + getStockStoreId, } from '@/views/order/orderManagement/utils/stock-picker-helpers' import { parseStockWarehouseListResponse } from '@/views/stock/combo_stock/combo-stock-config' @@ -167,7 +168,8 @@ function mapRow(row: any): StockPickerItem | null { const mapped = mapStockPickerItem(row) const id = Number(mapped.item_id) if (!Number.isInteger(id) || id <= 0) return null - const storeId = Number(mapped.store_id ?? row?.store_id) + // 货主ID优先取 store_stock.store_id(stock.warehouse.search 返回结构),其次顶层 store_id + const storeId = Number(getStockStoreId(row) ?? mapped.store_id ?? row?.store_id) return { id, item_code: String(mapped.item_code ?? ''), diff --git a/src/views/express/returnUnpackwork/index.vue b/src/views/express/returnUnpackwork/index.vue index 56a7f5a9..f8444d20 100644 --- a/src/views/express/returnUnpackwork/index.vue +++ b/src/views/express/returnUnpackwork/index.vue @@ -64,10 +64,12 @@ @@ -495,7 +497,7 @@ @@ -503,7 +505,7 @@ @@ -599,6 +601,8 @@ const { // 货主选择(来源:returnUnpack.create 返回 + 条码查询商品返回) const selectedStoreId = ref(null) const storeOptions = ref>([]) +/** 货主是否锁定:原单退回或已选择商品后不可再切换 */ +const storeLocked = ref(false) // 产品状态(快速添加明细时使用) const defaultProductStatus = ref<'normal' | 'damaged'>('normal') @@ -668,6 +672,8 @@ function syncStoreFromStockItem(item: any) { if (selectedStoreId.value == null) { selectedStoreId.value = storeId } + // 选择商品后锁定货主:货主由商品所属仓库决定,不允许再切换 + storeLocked.value = true } // 拆包单列表 + 明细分页 + 操作 @@ -790,6 +796,8 @@ async function handleCreate(barcode?: string) { if (recordStoreId != null) { addStoreCandidate(recordStoreId, data.store_remark || '') } + // 原单退回的拆包单锁定货主,不允许切换 + storeLocked.value = Boolean(data.is_original_return) ElMessage.success(`拆包单创建成功,ID ${data.id}`) // 保留输入的运单号显示在锁定的输入框中(创建后运单号置灰不可改) lastScannedBarcode.value = '' @@ -978,6 +986,8 @@ function handleStockSelected(item: { id: number; item_code: string; item_name: s if (!detailForm.barcode && item.barcode) { detailForm.barcode = item.barcode } + // 手动选择商品后同步并锁定货主 + syncStoreFromStockItem(item) } function openStockPicker() { @@ -1348,6 +1358,7 @@ function resetWorkState() { waybillCode.value = '' detailBarcode.value = '' selectedStoreId.value = null + storeLocked.value = false storeOptions.value = [] defaultProductStatus.value = 'normal' orderDetailData.value = null