diff --git a/src/api/returnunpack/index.ts b/src/api/returnunpack/index.ts index 19e6407d..96c71be2 100644 --- a/src/api/returnunpack/index.ts +++ b/src/api/returnunpack/index.ts @@ -72,8 +72,28 @@ export type ReturnUnpackRecord = { [key: string]: any } +/** 原订单商品明细行(order.items 顶层透出) */ +export type ReturnUnpackOrderItem = { + /** 商品编码 */ + item_code?: string + /** 商品名称 */ + item_name?: string + /** 规格属性 */ + sku_property?: string + /** 数量 */ + quantity?: number + /** 计划数量 */ + plan_qty?: number + /** 条码数组 */ + barcodes?: { id?: number; barcode?: string }[] + /** 图片数组 */ + image_url?: string[] + [key: string]: any +} + /** 原订单详情(原单退回时返回,含 items 明细) */ export type ReturnUnpackOriginalOrder = { + items?: ReturnUnpackOrderItem[] [key: string]: any } @@ -113,6 +133,8 @@ export type ReturnUnpackCreateResponse = { store_remark: string /** 原订单详情(仅原单退回时返回,非原单为 null) */ order?: ReturnUnpackOriginalOrder | null + /** 原订单商品明细数组(order.items 顶层透出,仅原单退回时返回;非原单退回或原订单详情缺失时为 null) */ + order_items?: ReturnUnpackOrderItem[] | null /** 是否幂等复用已有拆包单 */ reused?: boolean } diff --git a/src/views/express/returnUnpack/components/StockPickerDialog.vue b/src/views/express/returnUnpack/components/StockPickerDialog.vue index 14e24e4c..cb733ef3 100644 --- a/src/views/express/returnUnpack/components/StockPickerDialog.vue +++ b/src/views/express/returnUnpack/components/StockPickerDialog.vue @@ -10,10 +10,12 @@ >
搜索 @@ -46,7 +48,7 @@ diff --git a/src/views/storage/log/component/TransactionStockItem.vue b/src/views/storage/log/component/TransactionStockItem.vue new file mode 100644 index 00000000..6f423aee --- /dev/null +++ b/src/views/storage/log/component/TransactionStockItem.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/storage/log/index.vue b/src/views/storage/log/index.vue index 1047d12c..6536309d 100644 --- a/src/views/storage/log/index.vue +++ b/src/views/storage/log/index.vue @@ -81,32 +81,21 @@ />
-
- 出入库记录详情 -
+ + + +
- - - - {{ selectedRowData.transaction_type === 'INBOUND' ? '入库' : '出库' }} - - - {{ selectedRowData.stock_id }} - {{ selectedRowData.space_id }} - {{ selectedRowData.warehouse_id }} - {{ selectedRowData.store_id }} - {{ getOrderTypeLabel(selectedRowData.order_type) }} - {{ selectedRowData.operator_name }} - {{ selectedRowData.quantity }} - {{ selectedRowData.record_count }} - {{ formatDateTime(selectedRowData.first_created_at) }} - {{ formatDateTime(selectedRowData.last_created_at) }} - + + +
@@ -141,6 +130,8 @@ import { transactionTypeConfig, getOrderTypeLabel } from './log-config' +import TransactionDetail from './component/TransactionDetail.vue' +import TransactionStockItem from './component/TransactionStockItem.vue' import { useSettingsStore } from '@/stores/modules/settings' import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane' import dayjs from 'dayjs' @@ -245,6 +236,14 @@ const selectedRowData = computed(() => { return list.value.find(item => item.id === selectedLogId.value) || {} }) +/** 详情 tab 组件映射(对齐 storage/receiving 详情结构) */ +const activeTab = ref('detail') +const componentMap: Record = { + detail: TransactionDetail, + stockItem: TransactionStockItem +} +const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.detail) + onMounted(() => { loadFilterData() loadData() diff --git a/src/views/storage/productflow/component/ProductflowDetail.vue b/src/views/storage/productflow/component/ProductflowDetail.vue new file mode 100644 index 00000000..4453df6a --- /dev/null +++ b/src/views/storage/productflow/component/ProductflowDetail.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/views/storage/productflow/component/ProductflowStockItem.vue b/src/views/storage/productflow/component/ProductflowStockItem.vue new file mode 100644 index 00000000..01ff5d1c --- /dev/null +++ b/src/views/storage/productflow/component/ProductflowStockItem.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/storage/productflow/index.vue b/src/views/storage/productflow/index.vue index 8836649e..5d68c6d6 100644 --- a/src/views/storage/productflow/index.vue +++ b/src/views/storage/productflow/index.vue @@ -109,40 +109,20 @@ />
-
- 流水详情 #{{ selectedFlowId }} -
+ + + +
- - {{ selectedRowData.id }} - {{ formatDateTime(selectedRowData.created_at) }} - - - {{ getTransactionTypeLabel(selectedRowData.transaction_type) }} - - - {{ selectedRowData.operator_name || '—' }} - {{ selectedRowData.stock_id ?? '—' }} - {{ selectedRowData.store_id ?? '—' }} - {{ selectedRowData.warehouse_id ?? '—' }} - {{ selectedRowData.batch_no || '—' }} - - {{ formatQuantityDisplay(selectedRowData) }} - - - {{ selectedRowData.before_quantity ?? '—' }} → {{ selectedRowData.after_quantity ?? '—' }} - - - {{ selectedRowData.before_locked_quantity ?? '—' }} → {{ selectedRowData.after_locked_quantity ?? '—' }} - - {{ getOrderTypeLabel(selectedRowData.order_type) }} - {{ selectedRowData.order_no || '—' }} - {{ selectedRowData.order_id || '—' }} - {{ selectedRowData.receiving_id || '—' }} - {{ selectedRowData.entry_order_id || '—' }} - {{ selectedRowData.remark || '—' }} - + + +
@@ -194,8 +174,15 @@ import { getTransactionTypeLabel, getTransactionTypeTag, getOrderTypeLabel, - formatQuantityDelta + formatQuantityDisplay, + formatStockQuantity, + formatLockQuantity, + getQuantityClass, + getStockClass, + getLockClass } from './productflow-config' +import ProductflowDetail from './component/ProductflowDetail.vue' +import ProductflowStockItem from './component/ProductflowStockItem.vue' const scanBox = ref(null) const upperTable = ref(null) @@ -270,6 +257,14 @@ const selectedRowData = computed(() => { return list.value.find(item => item.id === selectedFlowId.value) || {} }) +/** 详情 tab 组件映射(对齐 storage/receiving 详情结构) */ +const activeTab = ref('detail') +const componentMap: Record = { + detail: ProductflowDetail, + stockItem: ProductflowStockItem +} +const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.detail) + function resolveButtonLoading(loadingKey?: string) { if (!loadingKey) return false return Boolean((buttonLoadingMap.value as Record)[loadingKey]) @@ -348,52 +343,6 @@ function normalizeToWhere(condition: any) { return {} } -function formatQuantityDisplay(row: any): string { - const qty = formatQuantityDelta(row) - if (qty === undefined || qty === null) return '—' - if (qty > 0) return `+${qty}` - return String(qty) -} - -/** 库存变动列:仅 INBOUND/OUTBOUND 有值,其余为 0 */ -function formatStockQuantity(row: any): string { - const t = (row.transaction_type || '').toUpperCase() - if (t === 'INBOUND' || t === 'OUTBOUND') return formatQuantityDisplay(row) - return '0' -} - -/** 锁定变动列:仅 LOCK/UNLOCK 有值,其余为 0 */ -function formatLockQuantity(row: any): string { - const t = (row.transaction_type || '').toUpperCase() - if (t === 'LOCK' || t === 'UNLOCK') return formatQuantityDisplay(row) - return '0' -} - -function getQuantityClass(row: any, mode?: 'stock' | 'lock'): string { - const t = (row.transaction_type || '').toUpperCase() - // 非目标类型 → 灰色 - if (mode === 'stock' && t !== 'INBOUND' && t !== 'OUTBOUND') return 'qty-flat' - if (mode === 'lock' && t !== 'LOCK' && t !== 'UNLOCK') return 'qty-flat' - - const qty = formatQuantityDelta(row) - if (qty === undefined || qty === null || qty === 0) return 'qty-flat' - return qty > 0 ? 'qty-up' : 'qty-down' -} - -function getStockClass(type?: string): string { - const t = (type || '').toUpperCase() - if (t === 'INBOUND') return 'stock-in' - if (t === 'OUTBOUND') return 'stock-out' - return '' -} - -function getLockClass(type?: string): string { - const t = (type || '').toUpperCase() - if (t === 'LOCK') return 'lock-lock' - if (t === 'UNLOCK') return 'lock-unlock' - return '' -} - async function loadFilterData() { try { const [storesRes, presetRes]: any = await Promise.all([ @@ -760,6 +709,48 @@ onMounted(() => { min-height: 42px; box-sizing: border-box; + .detail-tab { + flex: 1; + min-width: 0; + margin-bottom: -1px; + + :deep(.el-tabs__header) { + margin: 0; + border-bottom: none; + } + + :deep(.el-tabs__nav-wrap::after) { + display: none; + } + + :deep(.el-tabs__active-bar) { + display: none; + } + + :deep(.el-tabs__item) { + height: 40px; + line-height: 40px; + font-size: 13px; + padding: 0 16px; + color: #606266; + border: 1px solid transparent; + border-bottom: none; + border-radius: 4px 4px 0 0; + transition: color 0.2s; + } + + :deep(.el-tabs__item:hover) { + color: var(--el-color-primary); + } + + :deep(.el-tabs__item.is-active) { + color: var(--el-color-primary); + background-color: #fff; + border-color: #ebeef5; + border-bottom-color: #fff; + } + } + .detail-info { display: flex; align-items: center; diff --git a/src/views/storage/productflow/productflow-config.ts b/src/views/storage/productflow/productflow-config.ts index 793fcab6..8b27e5db 100644 --- a/src/views/storage/productflow/productflow-config.ts +++ b/src/views/storage/productflow/productflow-config.ts @@ -215,3 +215,58 @@ export function formatQuantityDelta(row: { } return abs } + +/** 变动数量展示文本(正数带 + 号) */ +export function formatQuantityDisplay(row: { + quantity?: number + before_quantity?: number + after_quantity?: number + transaction_type?: string +}): string { + const qty = formatQuantityDelta(row) + if (qty === undefined || qty === null) return '—' + if (qty > 0) return `+${qty}` + return String(qty) +} + +/** 库存变动列:仅 INBOUND/OUTBOUND 有值,其余为 0 */ +export function formatStockQuantity(row: any): string { + const t = (row.transaction_type || '').toUpperCase() + if (t === 'INBOUND' || t === 'OUTBOUND') return formatQuantityDisplay(row) + return '0' +} + +/** 锁定变动列:仅 LOCK/UNLOCK 有值,其余为 0 */ +export function formatLockQuantity(row: any): string { + const t = (row.transaction_type || '').toUpperCase() + if (t === 'LOCK' || t === 'UNLOCK') return formatQuantityDisplay(row) + return '0' +} + +/** 数量颜色类:mode=stock 仅 INBOUND/OUTBOUND 有色,mode=lock 仅 LOCK/UNLOCK 有色 */ +export function getQuantityClass(row: any, mode?: 'stock' | 'lock'): string { + const t = (row.transaction_type || '').toUpperCase() + // 非目标类型 → 灰色 + if (mode === 'stock' && t !== 'INBOUND' && t !== 'OUTBOUND') return 'qty-flat' + if (mode === 'lock' && t !== 'LOCK' && t !== 'UNLOCK') return 'qty-flat' + + const qty = formatQuantityDelta(row) + if (qty === undefined || qty === null || qty === 0) return 'qty-flat' + return qty > 0 ? 'qty-up' : 'qty-down' +} + +/** 可用库存颜色类 */ +export function getStockClass(type?: string): string { + const t = (type || '').toUpperCase() + if (t === 'INBOUND') return 'stock-in' + if (t === 'OUTBOUND') return 'stock-out' + return '' +} + +/** 锁定库存颜色类 */ +export function getLockClass(type?: string): string { + const t = (type || '').toUpperCase() + if (t === 'LOCK') return 'lock-lock' + if (t === 'UNLOCK') return 'lock-unlock' + return '' +} diff --git a/src/views/system/setting/storeExpressBindingPolicy/index.vue b/src/views/system/setting/storeExpressBindingPolicy/index.vue index f652e708..7e989c7f 100644 --- a/src/views/system/setting/storeExpressBindingPolicy/index.vue +++ b/src/views/system/setting/storeExpressBindingPolicy/index.vue @@ -581,8 +581,9 @@ async function submitForm() { p.weight_type = formData.weight_type p.shop_name = formData.shopNameList.length ? formData.shopNameList : undefined p.store_ids = formData.storeIdsList.length ? formData.storeIdsList : undefined - p.regions = formData.regionsList.length ? formData.regionsList : undefined - p.exclude_regions = formData.excludeRegionsList.length ? formData.excludeRegionsList : undefined + // 限定地区/排除地区无数据时传空数组(而非 undefined),确保后端能清除已有地区 + p.regions = formData.regionsList.length ? formData.regionsList : [] + p.exclude_regions = formData.excludeRegionsList.length ? formData.excludeRegionsList : [] p.min_weight_g = formData.min_weight_g p.max_weight_g = formData.max_weight_g p.priority = formData.priority