diff --git a/WMS-OMS-取号对接.md b/WMS-OMS-取号对接.md index df78585..bad5692 100644 --- a/WMS-OMS-取号对接.md +++ b/WMS-OMS-取号对接.md @@ -1290,5 +1290,5 @@ GET /api/order-status/list?status=delivery&sn_codes=SN1,SN2 - 后端先按 `(principal_id, sn_code)` 从 `order_sn_codes` 取命中的订单ID,再回状态表过滤; - 订单导出的筛选条件同样支持「序列号」(`sn_codes`); -- 订单详情(`GET /api/order-status/:id`)返回 `order.sn_codes`,页面详情抽屉展示序列号明细。 +- 订单详情(`GET /api/order-status/:id`)返回 `order.sn_codes`;页面详情抽屉在「商品明细」每行提供「SN码(N)」按钮,点击展开该行的序列号列表(含运单号 / 回传时间)。 diff --git a/frontend/src/views/Order/StatusPanel.vue b/frontend/src/views/Order/StatusPanel.vue index d5186f8..e568f1b 100644 --- a/frontend/src/views/Order/StatusPanel.vue +++ b/frontend/src/views/Order/StatusPanel.vue @@ -593,11 +593,45 @@ const detailRow = ref(null) const detailProducts = ref([]) /** 仓库回传的序列号(order_sn_codes,随详情返回) */ const detailSnCodes = ref([]) +/** 商品明细里已展开 SN 列表的行(el-table 的受控展开行 key = 明细 id) */ +const expandedItemIds = ref([]) + +/** 该明细行对应的回传序列号(优先按行号匹配,缺行号时按商品编码匹配) */ +function snCodesOfLine(row: OrderItemLine): OrderStatusSnCode[] { + const lineNo = String(row.order_line_no == null ? '' : row.order_line_no).trim() + const itemCode = String(row.item_code == null ? '' : row.item_code).trim() + return detailSnCodes.value.filter(sn => { + const snLineNo = String(sn.order_line_no == null ? '' : sn.order_line_no).trim() + if (lineNo && snLineNo) return snLineNo === lineNo + return Boolean(itemCode) && String(sn.item_code == null ? '' : sn.item_code).trim() === itemCode + }) +} + +function isItemSnExpanded(row: OrderItemLine): boolean { + return row.id != null && expandedItemIds.value.includes(Number(row.id)) +} + +/** 点「SN码」切换该明细行的折叠 SN 列表 */ +function toggleItemSn(row: OrderItemLine) { + if (row.id == null) return + const id = Number(row.id) + expandedItemIds.value = isItemSnExpanded(row) + ? expandedItemIds.value.filter(item => item !== id) + : [ ...expandedItemIds.value, id ] +} + +/** el-table 展开箭头与按钮共用同一份展开状态 */ +function onItemExpandChange(_row: OrderItemLine, expandedRows: OrderItemLine[]) { + expandedItemIds.value = (expandedRows || []) + .map(item => Number(item.id)) + .filter(id => Number.isInteger(id)) +} async function openDetail(row: OrderStatusItem) { detailRow.value = row detailProducts.value = [] detailSnCodes.value = [] + expandedItemIds.value = [] detailVisible.value = true detailLoading.value = true try { @@ -1146,7 +1180,7 @@ onBeforeUnmount(() => { /> - + - 商品明细({{ detailProducts.length }} 行) - - - - - + + 商品明细({{ detailProducts.length }} 行{{ detailSnCodes.length ? ` · 序列号 ${detailSnCodes.length} 个` : '' }}) + + + + + + + + + - + - + - + + + + - - @@ -1374,6 +1431,20 @@ onBeforeUnmount(() => { .muted { color: var(--el-text-color-secondary); } +/* 商品明细:展开的 SN 列表(一行一个序列号) */ +.sn-expand { + padding: 4px 8px 4px 28px; +} +.sn-expand__item { + display: flex; + align-items: center; + gap: 8px; + padding: 2px 0; +} +.sn-expand__meta { + color: var(--el-text-color-secondary); + font-size: 12px; +} .add-line { margin-top: 8px; }