feat(order): 支持 SN 订单筛选与复核提交,优化订单详情加载与选择交互
- recheckOrder.confirmRecheck 支持 sn_map(key=stock_id,value=SN 码数组), 返回 has_sn_item / sn_count / sn_item_count;复核单列表新增「含SN」列 - 订单列表、待处理、复核筛选新增 is_sn_order(由 has_sn_item 归一化), ScanBox 增加「含SN商品」字段;导出新增 SN码数量 / SN码 / SN码汇总 三列, 并扩展 order-common-config 的列类型(formatter / copyAction / copyValue / 折叠) - 波次策略类型支持 3=SN 并允许数组多选,接口补充 excluded_sn_order_ids - 新增 order-detail-cache:按请求函数隔离的 15s TTL 缓存、并发合并、 fingerprint 失效与手动刷新绕过,切换 tab / 来回点行不再重复请求; 订单明细、待处理详情面板增加单元格格式化缓存并处理 copyAction 列 - 商品选择、组合商品选择、拆包库存选择新增「按货主过滤」开关 (默认开启,未指定货主时禁用),切换后保留已选状态 - 新建待处理订单预览行支持内联编辑来源单号、镇、邮编、单据类型、加急、 是否开票等字段,并跟踪行改动;出库单单据类型/来源类型改为中文映射, 出入库日志补充单据类型字典 - ToolbarButtonGroup 的 ResizeObserver 增加 80ms 防抖,useVerticalSplitPane 拖动改为 rAF 节流,减少拖拽分栏时的重复重排
This commit is contained in:
parent
2a37739b7d
commit
33e0b4c459
@ -79,6 +79,10 @@ export type DeliveryOrderListItem = {
|
||||
/** 重量类型 */
|
||||
weight_type?: string | number | null
|
||||
is_urgency?: string
|
||||
/** 是否含 SN(序列号) 商品原始列(后端订单分表 has_sn_item,enum Y/N;旧版基表存量恒为 N) */
|
||||
has_sn_item?: 'Y' | 'N'
|
||||
/** 是否含 SN(序列号) 商品归一化字段(与 has_sn_item 同义,筛选与展示统一用它) */
|
||||
is_sn_order?: 'Y' | 'N'
|
||||
invoice_flag?: string
|
||||
status?: string
|
||||
name?: string
|
||||
|
||||
@ -22,8 +22,9 @@ export type OrderListParams = {
|
||||
* - create_channel 订单来源渠道筛选(按订单表 create_channel 列过滤;枚举:MANUAL=手工单、API=接口、QM=奇门、STOCKOUT=出库转单):
|
||||
* {"create_channel":"MANUAL"} 单值精确;{"create_channel":["QM","API"]} 裸数组按 in 多选;
|
||||
* {"create_channel":{"operator":"in","value":["QM","API"]}} 标准结构多选;{"create_channel":{"operator":"ne","value":"MANUAL"}} 排除指定渠道。
|
||||
* 注意:列表响应中的 create_channel 已格式化为中文标签,查询条件须传英文枚举值。
|
||||
*/
|
||||
* 注意:列表响应中的 create_channel 已格式化为中文标签,查询条件须传英文枚举值。 * - is_sn_order 是否含 SN(序列号) 商品筛选(后端订单分表 has_sn_item enum Y/N 归一化后输出):
|
||||
* {"is_sn_order":"Y"} 仅含 SN 商品订单;{"is_sn_order":"N"} 仅无 SN 商品订单。
|
||||
* 响应行同时返回 has_sn_item(原始列)与 is_sn_order(归一化),前端筛选/展示统一用 is_sn_order。 */
|
||||
where?: Record<string, any>
|
||||
sort?: {
|
||||
sortField?: string
|
||||
@ -185,14 +186,18 @@ export type OrderExportParams = {
|
||||
* 导出表头字段白名单(中文表头字符串数组,如 ["系统订单号","外部订单号"]);不传或空数组时输出全部列。
|
||||
* 支持 export_columns 与 exportColumns 两种写法。
|
||||
*
|
||||
* 文档枚举共 52 个(校验不区分导出模式,选中当前模式不存在的表头时该列自动忽略;传入非法表头会报错并列出非法值):
|
||||
* 文档枚举共 55 个(校验不区分导出模式,选中当前模式不存在的表头时该列自动忽略;传入非法表头会报错并列出非法值):
|
||||
* 系统订单号、外部订单号、平台单号、订单ID、订单号、外部单号、订单状态、抓取波次号、波次号、波次序号、
|
||||
* 货主、平台、来源、店铺昵称、收件人、收件人电话、省、市、区、镇、详细地址、商品明细、仓库商品名称、
|
||||
* 商品条码、商品图片、数量、物流公司、运单号、业务类型、运单接口、包材ID、包材编码、包材名称、分配时间、
|
||||
* 订单商品总类数、订单商品总数、商品重量、称重重量(g)、订单金额、实收金额、创建时间、支付时间、发货时间、
|
||||
* 订单商品总类数、订单商品总数、SN码数量、SN码、SN码汇总、商品重量、称重重量(g)、订单金额、实收金额、创建时间、支付时间、发货时间、
|
||||
* 出库状态、复核状态、复核完成状态、配货状态、打包状态、备注、买家留言、卖家留言、归档时间。
|
||||
* 其中仅 waybill 输出:系统订单号、外部订单号、平台单号、抓取波次号、商品明细;
|
||||
* 仅 item 输出:订单ID、订单号、外部单号、波次号、仓库商品名称、商品条码、商品图片、数量。
|
||||
* 其中仅 waybill 输出:系统订单号、外部订单号、平台单号、抓取波次号、商品明细、SN码汇总;
|
||||
* 仅 item 输出:订单ID、订单号、外部单号、波次号、仓库商品名称、商品条码、商品图片、数量、SN码。
|
||||
* 「SN码数量」(sn_quantity)= 启用序列号管理商品(stock_warehouse.is_sn_mgmt='Y')的 plan_qty 合计;
|
||||
* waybill 模式仅主单号行输出合计(子单号行为 0),item 模式按商品明细行输出(非 SN 商品行为 0)。
|
||||
* 「SN码」(sn_codes, item):该商品行复核时登记的 SN 码列表(状态限定 BOUND/VERIFIED/REISSUED,排除退回/作废);
|
||||
* 「SN码汇总」(sn_codes_summary, waybill):整单全部已登记 SN 码汇总,仅主单号行输出。
|
||||
* ⚠️ 白名单不含「领料状态」「确认打印状态」(列表页有该状态列,但导出不支持,传入会报错)。
|
||||
* ⚠️ 「复核时间」(recheck_time) 已由后端支持(2026-10-08 确认),文档枚举暂未收录,保留在可选列中。
|
||||
* 前端字段清单见 views/order/orderManagement/config/order-common-config.ts 的 ORDER_EXPORT_ALL_COLUMNS。
|
||||
|
||||
@ -51,6 +51,7 @@ export type PendingOrderListParams = {
|
||||
* {"confirm_print_status":"fin"} 单值精确,也支持裸数组按 in 与 {operator,value} 标准结构(同 create_channel 示例)。
|
||||
* claim_status 领料状态筛选(按订单表列过滤;枚举:none=未领料、padding=领料中、fin=已领料、error=异常):
|
||||
* 例 {"claim_status":{"operator":"ne","value":"fin"}} 查未完成领料的订单。
|
||||
* is_sn_order 是否含 SN(序列号)商品筛选(按 has_sn_item 归一化):{"is_sn_order":"Y"} 仅 SN 订单、"N" 仅非 SN 订单。
|
||||
*/
|
||||
where?: OrderWhere;
|
||||
sort?: OrderSort;
|
||||
|
||||
@ -235,6 +235,12 @@ export type ConfirmRecheckResultShape = {
|
||||
recheck_time?: string
|
||||
review_no?: string
|
||||
reviewNo?: string
|
||||
/** 是否含序列号管理商品:Y/N */
|
||||
has_sn_item?: 'Y' | 'N'
|
||||
/** 本次提交并校验通过的 SN 数量(非 SN 订单为 0) */
|
||||
sn_count?: number
|
||||
/** 本次提交涉及的序列号管理明细数(非 SN 订单为 0) */
|
||||
sn_item_count?: number
|
||||
}
|
||||
|
||||
/** order.recheckOrder.scanOrder:扫码查询订单(运单号或车号) */
|
||||
@ -282,6 +288,13 @@ export type ConfirmRecheckParams = {
|
||||
id?: string | number
|
||||
orderId?: string | number
|
||||
wave_id?: string | number
|
||||
/**
|
||||
* SN 码提交(唯一格式,SN 订单必填):{ "stock_id": ["sn_code", ...] }
|
||||
* - key = 仓库商品ID(订单明细里的 stock_id)
|
||||
* - value = 该商品的 SN 码列表(也兼容逗号/换行分隔的字符串)
|
||||
* - 数量必须等于该商品在订单内的 plan_qty 合计;非 SN 商品不允许提交
|
||||
*/
|
||||
sn_map?: Record<string, string[] | string>
|
||||
}
|
||||
|
||||
function coerceOrderId(v: string | number): string | number {
|
||||
@ -292,23 +305,32 @@ function coerceOrderId(v: string | number): string | number {
|
||||
return s
|
||||
}
|
||||
|
||||
function pickConfirmRecheckBody(data: ConfirmRecheckParams): Record<string, string | number> {
|
||||
function pickConfirmRecheckBody(data: ConfirmRecheckParams): Record<string, unknown> {
|
||||
const body: Record<string, unknown> = {}
|
||||
// 团购波次模式:优先使用 wave_id
|
||||
if (data.wave_id !== undefined && data.wave_id !== null && `${data.wave_id}`.trim() !== '') {
|
||||
return { wave_id: coerceOrderId(data.wave_id) }
|
||||
body.wave_id = coerceOrderId(data.wave_id)
|
||||
} else {
|
||||
const raw =
|
||||
data.order_id !== undefined && data.order_id !== null && `${data.order_id}`.trim() !== ''
|
||||
? data.order_id
|
||||
: data.id !== undefined && data.id !== null && `${data.id}`.trim() !== ''
|
||||
? data.id
|
||||
: data.orderId !== undefined && data.orderId !== null && `${data.orderId}`.trim() !== ''
|
||||
? data.orderId
|
||||
: undefined
|
||||
if (raw === undefined) {
|
||||
throw new Error('订单 ID 不能为空(order_id / id / orderId / wave_id)')
|
||||
}
|
||||
body.order_id = coerceOrderId(raw)
|
||||
}
|
||||
const raw =
|
||||
data.order_id !== undefined && data.order_id !== null && `${data.order_id}`.trim() !== ''
|
||||
? data.order_id
|
||||
: data.id !== undefined && data.id !== null && `${data.id}`.trim() !== ''
|
||||
? data.id
|
||||
: data.orderId !== undefined && data.orderId !== null && `${data.orderId}`.trim() !== ''
|
||||
? data.orderId
|
||||
: undefined
|
||||
if (raw === undefined) {
|
||||
throw new Error('订单 ID 不能为空(order_id / id / orderId / wave_id)')
|
||||
|
||||
// SN 订单必填:sn_map(key=仓库商品 stock_id)透传给服务端;非 SN 订单不传
|
||||
if (data.sn_map && Object.keys(data.sn_map).length) {
|
||||
body.sn_map = data.sn_map
|
||||
}
|
||||
return { order_id: coerceOrderId(raw) }
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
/** order.recheckOrder.confirmRecheck:按订单 ID 确认复核并记录复核任务 */
|
||||
@ -395,6 +417,8 @@ export type RecheckOrderSingleListItem = {
|
||||
create_at?: string
|
||||
pick_time?: string
|
||||
recheck_time?: string
|
||||
/** 是否含序列号管理商品:Y/N(SN 订单复核必须提交 SN 码) */
|
||||
has_sn_item?: 'Y' | 'N'
|
||||
}
|
||||
|
||||
export type QueryRecheckOrderSingleListResponse = {
|
||||
|
||||
@ -24,6 +24,7 @@ export type ReviewOrderListParams = {
|
||||
* {"create_channel":"MANUAL"} 单值精确;{"create_channel":["QM","API"]} 裸数组按 in 多选;
|
||||
* {"create_channel":{"operator":"in","value":["QM","API"]}} 标准结构多选;{"create_channel":{"operator":"ne","value":"MANUAL"}} 排除指定渠道。
|
||||
* 注意:列表响应中的 create_channel 已格式化为中文标签,查询条件须传英文枚举值。
|
||||
* is_sn_order 是否含 SN(序列号)商品筛选(按 has_sn_item 归一化):{"is_sn_order":"Y"} 仅 SN 订单、"N" 仅非 SN 订单。
|
||||
*/
|
||||
where?: OrderWhere
|
||||
sort?: OrderSort
|
||||
|
||||
@ -303,10 +303,10 @@ export type WaveStrategyListParams = {
|
||||
page_size?: number
|
||||
size?: number
|
||||
}
|
||||
/** 仅支持 1=散单、2=团购;与 where.strategy_type 同时存在时以顶层为准 */
|
||||
strategy_type?: number
|
||||
/** 当前仅支持 where.strategy_type(1/2) */
|
||||
where?: { strategy_type?: number } & Record<string, unknown>
|
||||
/** 仅支持 1=散单、2=团购、3=SN(序列号管理);支持数组多选(如 [1,3]);与 where.strategy_type 同时存在时以顶层为准 */
|
||||
strategy_type?: number | number[]
|
||||
/** 当前仅支持 where.strategy_type(1/2/3,支持数组) */
|
||||
where?: { strategy_type?: number | number[] } & Record<string, unknown>
|
||||
/** 0-不计算(默认),1-计算并返回每条策略的 next_fetch_order_count;支持别名 calculateNextFetchOrderCount */
|
||||
calculate_next_fetch_order_count?: number
|
||||
calculateNextFetchOrderCount?: number
|
||||
@ -367,7 +367,9 @@ export type WaveStrategyListResponse = {
|
||||
|
||||
export type WaveStrategyCreateParams = {
|
||||
strategy_name: string
|
||||
/** 1=散单 2=团购 3=SN(序列号管理);3 时服务端固定 batch_mode=2、pick_mode=3 */
|
||||
strategy_type: number
|
||||
/** SN(3)可不传,服务端固定写入 2(先拣后分) */
|
||||
batch_mode: number
|
||||
status?: number
|
||||
order_min_sku?: number | null
|
||||
@ -397,6 +399,7 @@ type WaveStrategyIdentityParam =
|
||||
|
||||
export type WaveStrategyUpdateParams = WaveStrategyIdentityParam & {
|
||||
strategy_name?: string
|
||||
/** 1=散单 2=团购 3=SN(序列号管理);改为 3 时服务端同步将 batch_mode 固定为 2 */
|
||||
strategy_type?: number
|
||||
batch_mode?: number
|
||||
status?: number
|
||||
@ -1104,6 +1107,8 @@ export type WaveSingleFetchByIdsResponse = {
|
||||
excluded_locked_order_ids?: Array<number>
|
||||
skipped_order_ids?: Array<number>
|
||||
not_found_order_ids?: Array<number>
|
||||
/** 因 SN(序列号管理)被排除、未加入波次的订单 ID 列表 */
|
||||
excluded_sn_order_ids?: Array<number>
|
||||
}
|
||||
|
||||
export function orderWaveSingleFetchByIds(
|
||||
|
||||
@ -133,6 +133,8 @@ const expandVisible = ref(false)
|
||||
|
||||
let resizeObserver: ResizeObserver | null = null
|
||||
let layoutFrame = 0
|
||||
/** ResizeObserver 防抖定时器:拖拽窗口/分栏时避免每个像素都跑一轮溢出测量 */
|
||||
let resizeTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
function emitAction(action: ToolbarButtonConfig['action']) {
|
||||
emit('action', action)
|
||||
@ -221,7 +223,11 @@ async function scheduleLayout() {
|
||||
function setupResizeObserver() {
|
||||
resizeObserver?.disconnect()
|
||||
resizeObserver = new ResizeObserver(() => {
|
||||
void scheduleLayout()
|
||||
if (resizeTimer) clearTimeout(resizeTimer)
|
||||
resizeTimer = setTimeout(() => {
|
||||
resizeTimer = null
|
||||
void scheduleLayout()
|
||||
}, 80)
|
||||
})
|
||||
|
||||
const parent = containerRef.value?.parentElement
|
||||
@ -239,6 +245,10 @@ onMounted(() => {
|
||||
onBeforeUnmount(() => {
|
||||
resizeObserver?.disconnect()
|
||||
resizeObserver = null
|
||||
if (resizeTimer) {
|
||||
clearTimeout(resizeTimer)
|
||||
resizeTimer = null
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
|
||||
@ -26,15 +26,34 @@ export function useVerticalSplitPane(options: VerticalSplitPaneOptions = {}) {
|
||||
let dragStartY = 0
|
||||
let dragStartPercent = 0
|
||||
let stackHeightPx = 0
|
||||
/** mousemove → rAF 节流:鼠标事件可能 >100Hz,没必要每帧多次重排上下两区(含 el-table) */
|
||||
let dragRafId = 0
|
||||
let pendingMoveEvent: MouseEvent | null = null
|
||||
|
||||
function cleanupDragListeners() {
|
||||
window.removeEventListener('mousemove', onResizeMouseMove)
|
||||
window.removeEventListener('mouseup', onResizeMouseUp)
|
||||
if (dragRafId) {
|
||||
cancelAnimationFrame(dragRafId)
|
||||
dragRafId = 0
|
||||
}
|
||||
pendingMoveEvent = null
|
||||
document.body.style.cursor = ''
|
||||
document.body.style.userSelect = ''
|
||||
}
|
||||
|
||||
function onResizeMouseMove(e: MouseEvent) {
|
||||
pendingMoveEvent = e
|
||||
if (dragRafId) return
|
||||
dragRafId = requestAnimationFrame(() => {
|
||||
dragRafId = 0
|
||||
const event = pendingMoveEvent
|
||||
pendingMoveEvent = null
|
||||
if (event) applyResizeMove(event)
|
||||
})
|
||||
}
|
||||
|
||||
function applyResizeMove(e: MouseEvent) {
|
||||
if (stackHeightPx <= 0) return
|
||||
const dy = e.clientY - dragStartY
|
||||
// 鼠标下移 → 分隔线下移 → 上半列表区应变大 → 底部占比应变小(与 dy 反向)
|
||||
|
||||
@ -67,6 +67,18 @@ export function extractStoreListFromResponse(storesRes: any): any[] {
|
||||
return storesRes?.stores || storesRes?.data?.stores || storesRes?.data || []
|
||||
}
|
||||
|
||||
/**
|
||||
* 货主展示名:下拉选项 label 在缺名称时会回退为数字 ID / 「货主 12」
|
||||
* 这类兜底值不适合展示在提示文案里,统一返回空字符串。
|
||||
*/
|
||||
export function resolveStoreDisplayName(label: unknown): string {
|
||||
const text = String(label ?? '').trim()
|
||||
if (!text) return ''
|
||||
if (/^\d+$/.test(text)) return ''
|
||||
if (/^货主\s*\d+$/.test(text)) return ''
|
||||
return text
|
||||
}
|
||||
|
||||
export function fillStoreScanFieldOptions(availableFields: any[], rawStores: any[]) {
|
||||
const field = availableFields.find((f: any) => f.value === 'store_id')
|
||||
if (field) field.options = mapStoreListToSelectOptions(rawStores)
|
||||
|
||||
@ -19,6 +19,21 @@
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="handleSearch">搜索</el-button>
|
||||
<!-- 货主过滤为可选开关:默认启用,未指定货主时禁用 -->
|
||||
<el-checkbox
|
||||
v-model="filterByStore"
|
||||
size="small"
|
||||
:disabled="!storeId"
|
||||
class="picker-store-filter"
|
||||
@change="handleStoreFilterChange"
|
||||
>
|
||||
按货主过滤
|
||||
</el-checkbox>
|
||||
<span class="picker-store-filter-hint">
|
||||
<template v-if="!storeId">未指定货主,查询全部货主</template>
|
||||
<template v-else-if="filterByStore">已按货主过滤{{ storeName ? `:${storeName}` : '' }}</template>
|
||||
<template v-else>未按货主过滤,可查到全部货主商品</template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
@ -97,8 +112,9 @@ const PICKER_LIST_PAGE_SIZE = 50
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
|
||||
const props = withDefaults(defineProps<{ storeId?: number; initialKeyword?: string }>(), {
|
||||
const props = withDefaults(defineProps<{ storeId?: number; storeName?: string; initialKeyword?: string }>(), {
|
||||
storeId: undefined,
|
||||
storeName: '',
|
||||
initialKeyword: '',
|
||||
})
|
||||
|
||||
@ -109,12 +125,16 @@ const keyword = ref('')
|
||||
const list = ref<StockPickerItem[]>([])
|
||||
const currentRow = ref<StockPickerItem | null>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
/** 是否按货主过滤商品(可选功能,默认启用;未指定货主时该开关不可用) */
|
||||
const filterByStore = ref(true)
|
||||
|
||||
watch(visible, (opened) => {
|
||||
if (!opened) return
|
||||
focusMode.value = 'search'
|
||||
keyword.value = props.initialKeyword || ''
|
||||
currentRow.value = null
|
||||
// 每次打开恢复默认:按货主过滤
|
||||
filterByStore.value = true
|
||||
if (props.initialKeyword) {
|
||||
handleSearch()
|
||||
} else {
|
||||
@ -194,8 +214,10 @@ function formatRowLabel(item: StockPickerItem): string {
|
||||
async function loadInitialList() {
|
||||
loading.value = true
|
||||
try {
|
||||
// 货主过滤为可选功能(默认启用):关闭时不加 store_id 限定
|
||||
const storeId = filterByStore.value ? props.storeId : undefined
|
||||
// where 统一按 stock.warehouse.list 规范:{ 字段: { operator, value, type } }
|
||||
const where = buildStockQuery(props.storeId ? { store_id: props.storeId } : {})
|
||||
const where = buildStockQuery(storeId ? { store_id: storeId } : {})
|
||||
const res: any = await stockWarehouse({ page: 1, pageSize: PICKER_LIST_PAGE_SIZE }, where)
|
||||
if (!isStockApiSuccess(res)) {
|
||||
list.value = []
|
||||
@ -219,7 +241,7 @@ async function handleSearch() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: { keyword: string; store_id?: number } = { keyword: text }
|
||||
if (props.storeId) params.store_id = props.storeId
|
||||
if (filterByStore.value && props.storeId) params.store_id = props.storeId
|
||||
const res: any = await warehouseSearch(params)
|
||||
if (!isStockApiSuccess(res)) {
|
||||
list.value = []
|
||||
@ -240,6 +262,17 @@ function handleCurrentChange(row: StockPickerItem | null) {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
/** 货主过滤开关切换:有关键字时重新搜索,否则重载首屏列表 */
|
||||
function handleStoreFilterChange() {
|
||||
currentRow.value = null
|
||||
tableRef.value?.setCurrentRow?.()
|
||||
if (keyword.value.trim()) {
|
||||
void handleSearch()
|
||||
} else {
|
||||
void loadInitialList()
|
||||
}
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
if (!currentRow.value) return
|
||||
emit('confirm', { ...currentRow.value })
|
||||
@ -352,6 +385,7 @@ onUnmounted(() => {
|
||||
<style scoped lang="scss">
|
||||
.picker-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
@ -360,6 +394,26 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 按货主过滤开关:默认勾选,未指定货主时禁用 */
|
||||
.picker-store-filter {
|
||||
margin-right: 0;
|
||||
flex: none;
|
||||
|
||||
:deep(.el-checkbox__label) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.picker-store-filter-hint {
|
||||
flex: none;
|
||||
max-width: 200px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.picker-meta {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
|
||||
@ -619,6 +619,7 @@
|
||||
<StockPickerDialog
|
||||
v-model="stockPickerVisible"
|
||||
:store-id="currentStoreId()"
|
||||
:store-name="currentStoreName()"
|
||||
:initial-keyword="stockPickerKeyword"
|
||||
@confirm="handleStockSelected"
|
||||
/>
|
||||
@ -627,6 +628,7 @@
|
||||
<StockPickerDialog
|
||||
v-model="quickAddPickerVisible"
|
||||
:store-id="currentStoreId()"
|
||||
:store-name="currentStoreName()"
|
||||
:initial-keyword="quickAddKeyword"
|
||||
@confirm="handleQuickAddSelected"
|
||||
/>
|
||||
@ -675,6 +677,7 @@ import { CMD, CMD_LABEL, CMD_TAG_TYPE, SCAN_COMMANDS, resolveScanCommand, type S
|
||||
import StockPickerDialog from '@/views/express/returnUnpack/components/StockPickerDialog.vue'
|
||||
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
|
||||
import { toWaybillCodes } from '@/components/waybill/waybill-column'
|
||||
import { resolveStoreDisplayName } from '@/utils/storeScanOptions'
|
||||
import { queryStockProducts, mapStockPickerItem, getStockStoreId } from '@/views/stock/utils/stockPickerHelpers'
|
||||
import { orderDetail, orderList } from '@/api/order.index/orderindex'
|
||||
import { parseOrderDetailPayload, normalizeOrderDetailItems } from '@/views/order/shared/orderListExport'
|
||||
@ -771,6 +774,14 @@ function currentStoreId(): number | undefined {
|
||||
return recordStoreId != null ? Number(recordStoreId) : undefined
|
||||
}
|
||||
|
||||
/** 当前货主名称(仅用于弹窗提示,不展示货主 ID) */
|
||||
function currentStoreName(): string {
|
||||
const id = currentStoreId()
|
||||
if (id == null) return ''
|
||||
const matched = storeOptions.value.find((s) => s.value === id)
|
||||
return resolveStoreDisplayName(matched?.label)
|
||||
}
|
||||
|
||||
function addStoreCandidate(storeId: number, storeName?: string) {
|
||||
if (!Number.isInteger(storeId) || storeId <= 0) return
|
||||
const exists = storeOptions.value.some((s) => s.value === storeId)
|
||||
|
||||
@ -114,6 +114,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -123,6 +124,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -137,7 +139,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, computed, defineAsyncComponent } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -156,12 +158,12 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
const ExpressWaybillPanel = defineAsyncComponent(() => import('./component/ExpressWaybillPanel.vue'))
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template
|
||||
v-for="column in upperColumns"
|
||||
v-for="column in slotColumns"
|
||||
:key="column.prop"
|
||||
#[column.slotName]="{ row: item }"
|
||||
>
|
||||
@ -57,6 +57,9 @@
|
||||
</template>
|
||||
<span v-else class="cell-empty">—</span>
|
||||
</template>
|
||||
<template v-else-if="column.formatter">
|
||||
{{ column.formatter(item, column) }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatCellValue(item, column) }}
|
||||
</template>
|
||||
@ -78,6 +81,7 @@ import {
|
||||
type OrderItemColumnConfig
|
||||
} from '../config/order-common-config'
|
||||
import { normalizeOrderDetailItems, parseOrderDetailPayload } from '@/views/order/shared/orderListExport'
|
||||
import { loadOrderDetailCached } from '../utils/order-detail-cache'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import type { OrderDetailDisplayMode } from './OrderDetailDisplayToggle.vue'
|
||||
|
||||
@ -109,6 +113,13 @@ const upperColumns = computed(() =>
|
||||
activeColumns.value.map((column) => ({ ...column, slotName: `column-${column.prop}` }))
|
||||
)
|
||||
|
||||
/**
|
||||
* 需要自定义插槽渲染的列:
|
||||
* copyAction 列(条码/拣货位)必须交给 UpperTable 内置分支,
|
||||
* 否则插槽会覆盖「多值只显示首个 + `+N` 折叠 / 点击复制」能力。
|
||||
*/
|
||||
const slotColumns = computed(() => upperColumns.value.filter((column) => !column.copyAction))
|
||||
|
||||
const tableRef = ref<any>(null)
|
||||
const queryTime = ref(0)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
@ -147,7 +158,7 @@ function handlePageChange(page: number) {
|
||||
/** 刷新商品明细(与订单日志面板的刷新按钮交互一致) */
|
||||
function handleRefresh() {
|
||||
if (!props.row?.id) return
|
||||
loadItems()
|
||||
loadItems(true)
|
||||
}
|
||||
|
||||
function handlePageSizeChange(pageSize: number) {
|
||||
@ -176,31 +187,47 @@ function getNestedValue(row: Record<string, any>, prop: string) {
|
||||
}, row)
|
||||
}
|
||||
|
||||
/** 单元格格式化结果缓存(行对象 → 列 prop → 文本):滚动/选中/分页重渲染时避免重复计算 */
|
||||
const cellTextCache = new WeakMap<object, Map<string, string>>()
|
||||
|
||||
function formatCellValue(row: Record<string, any>, column: OrderItemColumnConfig) {
|
||||
const raw = column.prop.includes('.') ? getNestedValue(row, column.prop) : row[column.prop]
|
||||
if (raw === undefined || raw === null || raw === '') return '-'
|
||||
|
||||
const cacheable = !!row && typeof row === 'object'
|
||||
let rowCache: Map<string, string> | undefined
|
||||
if (cacheable) {
|
||||
rowCache = cellTextCache.get(row)
|
||||
if (rowCache?.has(column.prop)) return rowCache.get(column.prop)!
|
||||
}
|
||||
|
||||
let text: string
|
||||
if (column.amount) {
|
||||
return formatAmount(raw)
|
||||
}
|
||||
|
||||
if (column.time) {
|
||||
return formatOrderTime(raw)
|
||||
}
|
||||
|
||||
if (typeof raw === 'object') {
|
||||
text = formatAmount(raw)
|
||||
} else if (column.time) {
|
||||
text = formatOrderTime(raw)
|
||||
} else if (typeof raw === 'object') {
|
||||
try {
|
||||
const text = JSON.stringify(raw)
|
||||
return text === '{}' || text === '[]' ? '-' : text
|
||||
const json = JSON.stringify(raw)
|
||||
text = json === '{}' || json === '[]' ? '-' : json
|
||||
} catch {
|
||||
return '-'
|
||||
text = '-'
|
||||
}
|
||||
} else {
|
||||
text = raw
|
||||
}
|
||||
|
||||
return raw
|
||||
if (cacheable) {
|
||||
if (!rowCache) {
|
||||
rowCache = new Map()
|
||||
cellTextCache.set(row, rowCache)
|
||||
}
|
||||
rowCache.set(column.prop, text)
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
async function loadItems() {
|
||||
async function loadItems(force = false) {
|
||||
if (!props.row?.id) {
|
||||
items.value = []
|
||||
pagination.total = 0
|
||||
@ -210,11 +237,17 @@ async function loadItems() {
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const requestFn = props.detailRequest || orderPendingOrder.detail
|
||||
const res: any = await requestFn({
|
||||
id: props.row.id,
|
||||
ids: [props.row.id],
|
||||
tableType: 'order'
|
||||
})
|
||||
// 与「订单明细」tab 共用缓存:切 tab 不会重复请求同一份 detail
|
||||
//(指纹与详情面板保持一致,两边才能互相命中)
|
||||
const res: any = await loadOrderDetailCached(
|
||||
requestFn,
|
||||
{
|
||||
id: props.row.id,
|
||||
ids: [props.row.id],
|
||||
tableType: 'order'
|
||||
},
|
||||
{ force, fingerprint: `${props.row.updated_at ?? ''}|${props.row.status ?? ''}` }
|
||||
)
|
||||
const ok = res && (res.code === 1 || res.code === 200)
|
||||
if (!ok) {
|
||||
ElMessage.error(res?.message || '获取商品明细失败')
|
||||
|
||||
@ -43,6 +43,8 @@ import {
|
||||
type OrderDetailSectionConfig
|
||||
} from '../config/order-common-config'
|
||||
import { parseOrderDetailPayload, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { loadOrderDetailCached } from '../utils/order-detail-cache'
|
||||
import { toWaybillCodes } from '@/components/waybill/waybill-column'
|
||||
import type { OrderDetailDisplayMode } from './OrderDetailDisplayToggle.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
@ -80,33 +82,45 @@ function formatAmount(value: unknown) {
|
||||
function formatWaybillCodes(value: unknown) {
|
||||
if (value === undefined || value === null || value === '') return '-'
|
||||
|
||||
const normalizeList = (list: unknown[]) =>
|
||||
list
|
||||
.map((item) => String(item ?? '').trim())
|
||||
.filter((item) => item.length > 0)
|
||||
.join(', ')
|
||||
|
||||
// 运单号可能为:数组 / JSON 数组字符串 / 逗号分号分隔串 / 对象数组(取内部单号字段)
|
||||
let list: unknown[] = []
|
||||
if (Array.isArray(value)) {
|
||||
const text = normalizeList(value)
|
||||
return text || '-'
|
||||
list = value
|
||||
} else {
|
||||
const text = String(value).trim()
|
||||
if (!text) return '-'
|
||||
if (text.startsWith('[') && text.endsWith(']')) {
|
||||
try {
|
||||
const parsed = JSON.parse(text)
|
||||
if (Array.isArray(parsed)) list = parsed
|
||||
} catch {
|
||||
// 非法 JSON 时回退分隔符解析
|
||||
}
|
||||
}
|
||||
if (!list.length) list = toWaybillCodes(text)
|
||||
}
|
||||
|
||||
const text = String(value).trim()
|
||||
if (!text) return '-'
|
||||
const codes = list.map(pickWaybillText).filter(Boolean)
|
||||
return codes.length ? codes.join(', ') : '-'
|
||||
}
|
||||
|
||||
if (text.startsWith('[') && text.endsWith(']')) {
|
||||
try {
|
||||
const parsed = JSON.parse(text)
|
||||
if (Array.isArray(parsed)) {
|
||||
const normalized = normalizeList(parsed)
|
||||
return normalized || '-'
|
||||
}
|
||||
} catch {
|
||||
// 非法 JSON 时回退原文
|
||||
/** 对象型运单项中可能承载单号的字段(按优先级) */
|
||||
const WAYBILL_TEXT_KEYS = ['waybill_code', 'waybill_no', 'waybill_codes', 'express_code', 'code', 'value', 'text'] as const
|
||||
|
||||
/** 从单个运单项提取单号文本:兼容字符串/数字/对象 */
|
||||
function pickWaybillText(item: unknown): string {
|
||||
if (item === null || item === undefined) return ''
|
||||
if (typeof item === 'string' || typeof item === 'number') return String(item).trim()
|
||||
if (typeof item === 'object') {
|
||||
const record = item as Record<string, unknown>
|
||||
for (const key of WAYBILL_TEXT_KEYS) {
|
||||
const value = record[key]
|
||||
if (value === null || value === undefined || typeof value === 'object') continue
|
||||
const text = String(value).trim()
|
||||
if (text) return text
|
||||
}
|
||||
}
|
||||
|
||||
return text
|
||||
return ''
|
||||
}
|
||||
|
||||
function getFieldRawValue(prop: string) {
|
||||
@ -121,6 +135,11 @@ function displayFieldValue(field: OrderDetailFieldConfig) {
|
||||
const raw = getFieldRawValue(field.prop)
|
||||
if (raw === undefined || raw === null || raw === '') return '-'
|
||||
|
||||
// 运单号需先于「对象 → JSON 字符串」兜底处理,否则数组会原样渲染成 ["YT..."]
|
||||
if (field.waybill) {
|
||||
return formatWaybillCodes(raw)
|
||||
}
|
||||
|
||||
if (typeof raw === 'object') {
|
||||
try {
|
||||
const text = JSON.stringify(raw)
|
||||
@ -130,10 +149,6 @@ function displayFieldValue(field: OrderDetailFieldConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
if (field.waybill) {
|
||||
return formatWaybillCodes(raw)
|
||||
}
|
||||
|
||||
if (field.amount) {
|
||||
return formatAmount(raw)
|
||||
}
|
||||
@ -219,11 +234,17 @@ async function loadDetail() {
|
||||
loading.value = true
|
||||
try {
|
||||
const requestFn = props.detailRequest || orderPendingOrder.detail
|
||||
const res: any = await requestFn({
|
||||
id: props.row.id,
|
||||
ids: [props.row.id],
|
||||
tableType: 'order'
|
||||
})
|
||||
// 带缓存:切「订单明细/商品明细」tab、来回点同一行不再重复请求
|
||||
// 「刷新」语义:updated_at / status 变化时 fingerprint 不匹配,自动重新拉取
|
||||
const res: any = await loadOrderDetailCached(
|
||||
requestFn,
|
||||
{
|
||||
id: props.row.id,
|
||||
ids: [props.row.id],
|
||||
tableType: 'order'
|
||||
},
|
||||
{ fingerprint: `${props.row.updated_at ?? ''}|${props.row.status ?? ''}` }
|
||||
)
|
||||
if (requestId !== latestRequestId) return
|
||||
const ok = res && (res.code === 1 || res.code === 200)
|
||||
if (!ok) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import type { ToolbarButtonConfig, ToolbarApiActionConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
import { ORDER_BULK_SEARCH_OPERATORS, scanBasicField, scanWorkflowField, stockQueryScanField } from '@/utils/scanFields'
|
||||
import { normalizeBarcodeList } from '@/utils/barcode'
|
||||
|
||||
/**
|
||||
* 已抽离到公共层的类型与工具,此处保留转发以兼容存量 import
|
||||
@ -41,6 +42,11 @@ export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
|
||||
'Y': '是',
|
||||
'N': '否'
|
||||
},
|
||||
/** 是否含 SN(序列号)商品:后端归一化字段 is_sn_order */
|
||||
is_sn_order: {
|
||||
'Y': '是',
|
||||
'N': '否'
|
||||
},
|
||||
status: {
|
||||
'pedding': '待审核',
|
||||
'created': '已创建',
|
||||
@ -360,14 +366,18 @@ export type OrderExportColumnOption = {
|
||||
}
|
||||
|
||||
/**
|
||||
* order.export 全部可导出字段(共 54 个 = 接口文档枚举 52 个 + 「复核时间」+「拦截状态」):
|
||||
* 仅 waybill 模式输出:系统订单号、外部订单号、平台单号、抓取波次号、商品明细;
|
||||
* 仅 item 模式输出:订单ID、订单号、外部单号、波次号、仓库商品名称、商品条码、商品图片、数量;
|
||||
* order.export 全部可导出字段(共 57 个 = 接口文档枚举 55 个 + 「复核时间」+「拦截状态」):
|
||||
* 仅 waybill 模式输出:系统订单号、外部订单号、平台单号、抓取波次号、商品明细、SN码汇总;
|
||||
* 仅 item 模式输出:订单ID、订单号、外部单号、波次号、仓库商品名称、商品条码、商品图片、数量、SN码;
|
||||
* 其余为两种模式通用(选了当前模式不存在的表头时后端会自动忽略该列)。
|
||||
* ⚠️ 接口白名单**不含**「领料状态」「确认打印状态」(列表页仍有这两列,但导出不支持,传入非法表头会直接报错)。
|
||||
* ⚠️ 「复核时间」(recheck_time) 刚由后端支持(2026-10-08),文档 52 项的枚举暂未收录,勿以为多余而删除。
|
||||
* ⚠️ 「复核时间」(recheck_time) 刚由后端支持(2026-10-08),文档枚举暂未收录,勿以为多余而删除。
|
||||
* ⚠️ 「拦截状态」(intercept_status) 由前端于 2026-11-02 按需求先加入(配送订单等列表页均有该列);
|
||||
* 接口文档 52 项枚举尚未收录,需后端同步支持该表头,否则传入会按「非法表头」报错。
|
||||
* 接口文档 55 项枚举尚未收录,需后端同步支持该表头,否则传入会按「非法表头」报错。
|
||||
* 「SN码数量」(字段 sn_quantity):订单明细中启用序列号管理(is_sn_mgmt='Y')商品的 plan_qty 合计;
|
||||
* waybill 模式仅主单号行输出合计(子单号行为 0),item 模式按商品明细行输出(非 SN 商品行为 0)。
|
||||
* 「SN码」(sn_codes, 仅 item):该商品行复核时登记的 SN 码列表(状态限定 BOUND/VERIFIED/REISSUED);
|
||||
* 「SN码汇总」(sn_codes_summary, 仅 waybill):整单全部已登记 SN 码汇总,仅主单号行输出。
|
||||
* 「来源」列(字段 create_channel)位于「平台」列之后,waybill/item 两种模式均输出。
|
||||
*/
|
||||
export const ORDER_EXPORT_ALL_COLUMNS: OrderExportColumnOption[] = [
|
||||
@ -404,6 +414,9 @@ export const ORDER_EXPORT_ALL_COLUMNS: OrderExportColumnOption[] = [
|
||||
{ label: '数量', modes: ['item'], group: '商品明细' },
|
||||
{ label: '订单商品总类数', modes: ['waybill', 'item'], group: '商品明细' },
|
||||
{ label: '订单商品总数', modes: ['waybill', 'item'], group: '商品明细' },
|
||||
{ label: 'SN码数量', modes: ['waybill', 'item'], group: '商品明细' },
|
||||
{ label: 'SN码', modes: ['item'], group: '商品明细' },
|
||||
{ label: 'SN码汇总', modes: ['waybill'], group: '商品明细' },
|
||||
{ label: '商品重量', modes: ['waybill', 'item'], group: '商品明细' },
|
||||
{ label: '称重重量(g)', modes: ['waybill', 'item'], group: '商品明细' },
|
||||
// ===== 物流信息 =====
|
||||
@ -1158,42 +1171,136 @@ export type OrderItemColumnConfig = {
|
||||
amount?: boolean
|
||||
time?: boolean
|
||||
image?: boolean
|
||||
/** 单元格文本格式化(转义后的纯文本;UpperTable 内置分支渲染) */
|
||||
formatter?: (row: Record<string, any>, column?: any, value?: any, index?: number) => string
|
||||
/** 多值折叠/点击复制(UpperTable 内置 copyAction 分支) */
|
||||
copyAction?: 'copy' | 'copyQr'
|
||||
/** 多值取值器:返回数组时自动启用「只显示首个 + `+N`」折叠 */
|
||||
copyValue?: (row: Record<string, any>) => unknown
|
||||
copyMultiCollapse?: boolean
|
||||
}
|
||||
|
||||
/** 商品明细精简显示:常用字段(默认) */
|
||||
/** 商品明细布尔字段(0/1、true/false、Y/N、是/否)→ 是/否 */
|
||||
export function formatOrderItemBoolean(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') return '-'
|
||||
if (typeof value === 'boolean') return value ? '是' : '否'
|
||||
const text = String(value).trim().toLowerCase()
|
||||
if (['1', 'true', 'y', 'yes', '是', '有'].includes(text)) return '是'
|
||||
if (['0', 'false', 'n', 'no', '否', '无'].includes(text)) return '否'
|
||||
return String(value)
|
||||
}
|
||||
|
||||
/** 拣货位、库位项可能承载文本的字段(按优先级) */
|
||||
const ORDER_ITEM_LOCATION_TEXT_KEYS = [
|
||||
'location_code',
|
||||
'location_name',
|
||||
'space_code',
|
||||
'space_name',
|
||||
'code',
|
||||
'name',
|
||||
'label',
|
||||
'value',
|
||||
'text'
|
||||
] as const
|
||||
|
||||
function pickOrderItemLocationText(item: unknown): string {
|
||||
if (item === null || item === undefined) return ''
|
||||
if (typeof item === 'string' || typeof item === 'number') return String(item).trim()
|
||||
if (typeof item !== 'object') return ''
|
||||
const record = item as Record<string, unknown>
|
||||
for (const key of ORDER_ITEM_LOCATION_TEXT_KEYS) {
|
||||
const value = record[key]
|
||||
if (value === null || value === undefined || typeof value === 'object') continue
|
||||
const text = String(value).trim()
|
||||
if (text) return text
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 拣货位多值解析:兼容数组(字符串/对象/嵌套)、JSON 字符串数组、
|
||||
* 以及 `|` `,` `,` `;` `;` `、` 拼接的字符串,去重后返回。
|
||||
*/
|
||||
export function normalizeOrderItemPickingLocations(value: unknown): string[] {
|
||||
if (value === null || value === undefined) return []
|
||||
if (Array.isArray(value)) {
|
||||
const list: string[] = []
|
||||
for (const item of value) list.push(...normalizeOrderItemPickingLocations(item))
|
||||
return [...new Set(list)]
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
const text = pickOrderItemLocationText(value)
|
||||
return text ? [text] : []
|
||||
}
|
||||
const raw = String(value).trim()
|
||||
if (!raw || raw === '[]' || raw === '[ ]') return []
|
||||
if (raw.startsWith('[') && raw.endsWith(']')) {
|
||||
try {
|
||||
const parsed = JSON.parse(raw)
|
||||
if (Array.isArray(parsed)) return normalizeOrderItemPickingLocations(parsed)
|
||||
} catch {
|
||||
// 非合法 JSON,按普通文本继续处理
|
||||
}
|
||||
}
|
||||
const parts = raw
|
||||
.split(/[|,,;;、]+/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
return [...new Set(parts)]
|
||||
}
|
||||
|
||||
/** 商品明细精简显示:常用字段(默认,统一居中) */
|
||||
export const orderItemCompactColumns: OrderItemColumnConfig[] = [
|
||||
{ prop: 'images', label: '图片', width: 80, align: 'center', image: true },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 140, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 180, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'order_line_no', label: '行号', width: 80, align: 'center' },
|
||||
{ prop: 'plan_qty', label: '计划数量', width: 100, align: 'center' },
|
||||
{ prop: 'sku_property', label: '规格', width: 120, showOverflowTooltip: true },
|
||||
{ prop: 'sku_property', label: '规格', width: 120, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'stock_unit', label: '单位', width: 80, align: 'center' },
|
||||
{ prop: 'stock_id', label: 'SKU', width: 100, align: 'center' },
|
||||
{ prop: 'store_id', label: '货主ID', width: 100, align: 'center' },
|
||||
]
|
||||
|
||||
/** 商品明细显示全部:对齐 data.json items 返回字段 */
|
||||
/** 商品明细显示全部:对齐 data.json items 返回字段(统一居中) */
|
||||
export const orderItemFullColumns: OrderItemColumnConfig[] = [
|
||||
{ prop: 'images', label: '图片', width: 80, align: 'center', image: true },
|
||||
{ prop: 'id', label: '明细ID', width: 90, align: 'center' },
|
||||
{ prop: 'order_item_id', label: '订单明细ID', width: 110, align: 'center' },
|
||||
{ prop: 'order_id', label: '订单ID', width: 90, align: 'center' },
|
||||
{ prop: 'order_line_no', label: '行号', width: 80, align: 'center' },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 140, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 180, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'stock_id', label: 'SKU', width: 100, align: 'center' },
|
||||
{ prop: 'plan_qty', label: '计划数量', width: 100, align: 'center' },
|
||||
{ prop: 'quantity', label: '库存数量', width: 100, align: 'right' },
|
||||
{ prop: 'locked_quantity', label: '锁定数量', width: 100, align: 'right' },
|
||||
{ prop: 'sku_property', label: '规格', minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'quantity', label: '库存数量', width: 100, align: 'center' },
|
||||
{ prop: 'locked_quantity', label: '锁定数量', width: 100, align: 'center' },
|
||||
{ prop: 'sku_property', label: '规格', minWidth: 140, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'stock_unit', label: '单位', width: 80, align: 'center' },
|
||||
{ prop: 'is_batch_mgmt', label: '批次管理', width: 100, align: 'center' },
|
||||
{ prop: 'is_shelf_life_mgmt', label: '效期管理', width: 100, align: 'center' },
|
||||
{ prop: 'is_images', label: '有图', width: 80, align: 'center' },
|
||||
{ prop: 'barcodes', label: '条码', minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'packing_requirements', label: '包装要求', minWidth: 120, showOverflowTooltip: true },
|
||||
{ prop: 'picking_locations', label: '拣货位', minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'is_batch_mgmt', label: '批次管理', width: 100, align: 'center', formatter: (row) => formatOrderItemBoolean(row?.is_batch_mgmt) },
|
||||
{ prop: 'is_shelf_life_mgmt', label: '效期管理', width: 100, align: 'center', formatter: (row) => formatOrderItemBoolean(row?.is_shelf_life_mgmt) },
|
||||
{ prop: 'is_images', label: '有图', width: 80, align: 'center', formatter: (row) => formatOrderItemBoolean(row?.is_images) },
|
||||
// 条码/拣货位:解析多值(数组 / JSON 串 / 分隔符串),只显示首个 + 「+N」折叠,单击可复制
|
||||
{
|
||||
prop: 'barcodes',
|
||||
label: '条码',
|
||||
minWidth: 150,
|
||||
align: 'center',
|
||||
copyAction: 'copy',
|
||||
copyMultiCollapse: true,
|
||||
copyValue: (row) =>
|
||||
normalizeBarcodeList(row?.barcodes, { separators: ['|', ',', ',', ';', ';', '、'] })
|
||||
},
|
||||
{ prop: 'packing_requirements', label: '包装要求', minWidth: 120, align: 'center', showOverflowTooltip: true },
|
||||
{
|
||||
prop: 'picking_locations',
|
||||
label: '拣货位',
|
||||
minWidth: 150,
|
||||
align: 'center',
|
||||
copyAction: 'copy',
|
||||
copyMultiCollapse: true,
|
||||
copyValue: (row) => normalizeOrderItemPickingLocations(row?.picking_locations)
|
||||
},
|
||||
{ prop: 'store_id', label: '货主ID', width: 100, align: 'center' },
|
||||
]
|
||||
|
||||
@ -1224,6 +1331,16 @@ export const isUrgencyFilterOptions = [
|
||||
{ label: '否', value: 'N' },
|
||||
]
|
||||
|
||||
/**
|
||||
* 是否含 SN(序列号)商品。
|
||||
* 后端在订单分表上新增 has_sn_item 原始列,并在查询层归一化为 is_sn_order:
|
||||
* 筛选只传 is_sn_order(Y/N),响应行同时返回 has_sn_item 与 is_sn_order。
|
||||
*/
|
||||
export const isSnOrderFilterOptions = [
|
||||
{ label: '是', value: 'Y' },
|
||||
{ label: '否', value: 'N' },
|
||||
]
|
||||
|
||||
export const buyerMessageHasFilterOptions = [
|
||||
{ label: '有留言', value: 'has' },
|
||||
{ label: '无留言', value: 'none' },
|
||||
@ -1452,6 +1569,8 @@ export const recheckTimeRangeScanField = scanBasicField({ label: '复核时间',
|
||||
// ScanBox 会自动把它们合并成一个「时间」控件,下拉选项 = 本页声明的时间字段。
|
||||
|
||||
export const isUrgencyScanField = scanBasicField({ label: '是否紧急', value: 'is_urgency', type: 'select', options: isUrgencyFilterOptions })
|
||||
/** ScanBox:含SN商品 → where.is_sn_order = Y/N(后端按订单分表 has_sn_item 归一化过滤;勿传 has_sn_item) */
|
||||
export const snOrderScanField = scanBasicField({ label: '含SN商品', value: 'is_sn_order', type: 'select', options: isSnOrderFilterOptions })
|
||||
export const buyerMessageHasScanField = scanBasicField({ label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions })
|
||||
export const buyerMessageScanField = scanBasicField({ label: '留言', value: 'buyer_message', type: 'text', defaultOperator: 'like' })
|
||||
/** 「包含商品」筛选项定义已迁至 @/utils/scanFields(此处仅转发) */
|
||||
@ -1584,6 +1703,7 @@ export const deliveryAvailableFields = [
|
||||
// 快速筛选
|
||||
{ ...storeScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...isUrgencyScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...snOrderScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...waveAssignmentScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
// 订单信息
|
||||
{ ...pendingOrderQuickSearchScanField, group: SCAN_ORDER_INFO_GROUP },
|
||||
@ -1672,6 +1792,23 @@ export const orderWaveIndexColumn = {
|
||||
align: 'center'
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表:是否含 SN(序列号管理)商品
|
||||
* 响应同时返回 has_sn_item(原始 Y/N)与 is_sn_order(归一化 Y/N),筛选/展示统一用 is_sn_order。
|
||||
*/
|
||||
export const orderSnColumn = {
|
||||
prop: 'is_sn_order',
|
||||
label: '含SN',
|
||||
width: '70',
|
||||
align: 'center',
|
||||
formatter: (row: any) => {
|
||||
const value = String(row?.is_sn_order ?? row?.has_sn_item ?? '').trim().toUpperCase()
|
||||
if (value === 'Y') return '是'
|
||||
if (value === 'N') return '否'
|
||||
return '—'
|
||||
}
|
||||
}
|
||||
|
||||
export const deliveryColumns = applyOrderListCopyActions([
|
||||
{ prop: 'id', label: '订单ID', width: '80' },
|
||||
orderWaveIndexColumn,
|
||||
@ -1679,6 +1816,7 @@ export const deliveryColumns = applyOrderListCopyActions([
|
||||
{ prop: 'pre_delivery_order_code', label: '前置单号', width: '150' },
|
||||
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
||||
orderStoreRemarkColumn,
|
||||
orderSnColumn,
|
||||
{ prop: 'wave_no', label: '波次号', width: '150' },
|
||||
{ prop: 'wave_id', label: '波次ID', width: '90' },
|
||||
{ prop: 'order_flag', label: '订单标记', minWidth: '220' },
|
||||
@ -1790,6 +1928,7 @@ export const reviewAvailableFields = [
|
||||
// 快速筛选
|
||||
{ ...storeScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...isUrgencyScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...snOrderScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...waveAssignmentScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
// 订单信息
|
||||
{ ...orderQuickSearchScanField, label: '发货单号', group: SCAN_ORDER_INFO_GROUP },
|
||||
@ -1811,6 +1950,7 @@ export const reviewAvailableFields = [
|
||||
// 流程状态
|
||||
{ ...syncStatusScanField, group: SCAN_PROCESS_STATUS_GROUP },
|
||||
{ ...recheckStatusScanField, group: SCAN_PROCESS_STATUS_GROUP },
|
||||
{ ...storageStatusScanField, group: SCAN_PROCESS_STATUS_GROUP },
|
||||
{ ...lockStatusScanField, group: SCAN_PROCESS_STATUS_GROUP },
|
||||
{ ...orderStatusScanField(reviewOrderStatusFilterOptions), group: SCAN_PROCESS_STATUS_GROUP },
|
||||
// 收货信息
|
||||
@ -1832,12 +1972,14 @@ export const reviewColums = applyOrderListCopyActions([
|
||||
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
|
||||
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
||||
orderStoreRemarkColumn,
|
||||
orderSnColumn,
|
||||
{ prop: 'sys_platform_name', label: '平台编码', width: '100' },
|
||||
{ prop: 'source_order_codes', label: '平台交易单号', width: '140' },
|
||||
{ prop: 'status', label: '订单状态', width: '100', formatter: (row: any) => translateOrderField('status', row.status) },
|
||||
{ prop: 'name', label: '收件人', width: '110' },
|
||||
{ prop: 'sync_status', label: '同步状态', width: '100' },
|
||||
{ prop: 'recheck_status', label: '复核状态', width: '100' },
|
||||
{ prop: 'storage_status', label: '储位状态', width: '100', formatter: (row: any) => translateOrderField('storage_status', row.storage_status) },
|
||||
{ prop: 'lock_status', label: '锁定状态', width: '100' },
|
||||
{ prop: 'is_urgency', label: '是否紧急', width: '80' },
|
||||
{ prop: 'logistics_name', label: '快递', width: '120' },
|
||||
@ -1958,6 +2100,7 @@ export const pendingAvailableFields = [
|
||||
// 快速筛选
|
||||
{ ...storeScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...isUrgencyScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...snOrderScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...waveAssignmentScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
// 订单信息
|
||||
{ ...pendingOrderQuickSearchScanField, group: SCAN_ORDER_INFO_GROUP },
|
||||
@ -2013,6 +2156,7 @@ export const pendingCloums = [
|
||||
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
|
||||
{ prop: 'shop_nick', label: '店铺名称', width: '140', showOverflowTooltip: true },
|
||||
orderStoreRemarkColumn,
|
||||
orderSnColumn,
|
||||
{ prop: 'sys_platform_name', label: '平台编码', width: '100' },
|
||||
{ prop: 'name', label: '收件人', width: '110' },
|
||||
{ prop: 'mobile', label: '电话', width: '120' },
|
||||
@ -2317,6 +2461,7 @@ export const workbenchColumns = applyOrderListCopyActions([
|
||||
{ prop: 'create_channel', label: '来源', minWidth: 120 },
|
||||
{ prop: 'shop_nick', label: '店铺名称', minWidth: 140 },
|
||||
orderStoreRemarkColumn,
|
||||
orderSnColumn,
|
||||
{ prop: 'buyer_nick', label: '买家昵称', minWidth: 140 },
|
||||
{ prop: 'name', label: '收件人', minWidth: 100 },
|
||||
{ prop: 'mobile', label: '电话', minWidth: 120 },
|
||||
@ -2358,6 +2503,7 @@ export const expectionOrderAvailableFields = [
|
||||
// 快速筛选
|
||||
{ ...storeScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...isUrgencyScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...snOrderScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...waveAssignmentScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
// 订单信息
|
||||
{ ...pendingOrderQuickSearchScanField, group: SCAN_ORDER_INFO_GROUP },
|
||||
@ -2407,6 +2553,7 @@ export const expectionColumns = [
|
||||
{ prop: 'create_channel', label: '来源', width: '120' },
|
||||
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
||||
orderStoreRemarkColumn,
|
||||
orderSnColumn,
|
||||
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
|
||||
{ prop: 'sync_status', label: '同步状态', width: '100' },
|
||||
{ prop: 'storage_status', label: '储位状态', width: '100' },
|
||||
@ -2489,6 +2636,7 @@ export const archiveAvailableFields = [
|
||||
// 快速筛选
|
||||
{ ...storeScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...isUrgencyScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...snOrderScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
{ ...waveAssignmentScanField, group: SCAN_QUICK_FILTER_GROUP },
|
||||
// 订单信息
|
||||
{ ...orderQuickSearchScanField, group: SCAN_ORDER_INFO_GROUP },
|
||||
@ -2532,6 +2680,7 @@ export const archiveColumns = applyOrderListCopyActions([
|
||||
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
|
||||
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
||||
orderStoreRemarkColumn,
|
||||
orderSnColumn,
|
||||
{ prop: 'create_channel', label: '来源', width: '120' },
|
||||
{ prop: 'name', label: '收件人', width: '120' },
|
||||
{ prop: 'mobile', label: '电话', width: '120' },
|
||||
|
||||
@ -110,6 +110,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -119,6 +120,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -133,7 +135,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, computed, defineAsyncComponent } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -152,11 +154,11 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
|
||||
@ -202,6 +202,7 @@
|
||||
</div>
|
||||
|
||||
<wave-platform-print-preview-dialog
|
||||
v-if="batchPrintDialogVisible"
|
||||
v-model="batchPrintDialogVisible"
|
||||
:error-message="batchPrintErrorMessage"
|
||||
:payload="batchPrintPayload"
|
||||
@ -210,6 +211,7 @@
|
||||
@print-success="onBatchPrintSuccess"
|
||||
/>
|
||||
<wave-platform-print-preview-dialog
|
||||
v-if="subWaybillPrintDialogVisible"
|
||||
v-model="subWaybillPrintDialogVisible"
|
||||
:error-message="subWaybillPrintErrorMessage"
|
||||
:payload="subWaybillPrintPayload"
|
||||
@ -312,6 +314,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<allocate-sub-order-number-form
|
||||
v-if="allocateSubOrderNumberDialogVisible"
|
||||
v-model="allocateSubOrderNumberDialogVisible"
|
||||
v-model:sub-order-count="allocateSubOrderNumberCount"
|
||||
:loading="allocateSubOrderNumberLoading"
|
||||
@ -323,6 +326,7 @@
|
||||
|
||||
<!-- 配送订单批量转退回拆包单(returnUnpack.transferByOrders):入参取勾选行 id -->
|
||||
<transfer-by-orders-dialog
|
||||
v-if="transferByOrdersVisible"
|
||||
v-model:visible="transferByOrdersVisible"
|
||||
:rows="transferByOrderRows"
|
||||
@remove-row="removeTransferByOrderRow"
|
||||
@ -330,6 +334,7 @@
|
||||
/>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -339,6 +344,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -353,7 +359,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||
import { ref, reactive, onMounted, computed, watch, defineAsyncComponent } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -374,16 +380,16 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
const ExpressWaybillPanel = defineAsyncComponent(() => import('./component/ExpressWaybillPanel.vue'))
|
||||
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
|
||||
import { toWaybillCodes } from '@/components/waybill/waybill-column'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
const WavePlatformPrintPreviewDialog = defineAsyncComponent(() => import('@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
@ -392,7 +398,7 @@ import { useDeliveryOrderSubWaybillPrint } from './utils/use-delivery-sub-waybil
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import TransferByOrdersDialog from './component/TransferByOrdersDialog.vue'
|
||||
const TransferByOrdersDialog = defineAsyncComponent(() => import('./component/TransferByOrdersDialog.vue'))
|
||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
@ -110,6 +110,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -119,6 +120,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -133,7 +135,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, computed, defineAsyncComponent } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -152,11 +154,11 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
|
||||
@ -195,12 +195,14 @@
|
||||
</div>
|
||||
|
||||
<allocate-express-form
|
||||
v-if="allocateDialogVisible"
|
||||
v-model="allocateDialogVisible"
|
||||
:loading="allocateLoading"
|
||||
@closed="resetAllocateDialog"
|
||||
@submit="submitAllocateExpress"
|
||||
/>
|
||||
<task-progress-dialog
|
||||
v-if="allocateExpressProgressVisible"
|
||||
:visible="allocateExpressProgressVisible"
|
||||
title="分配快递号"
|
||||
:polling="allocateExpressProgressPolling"
|
||||
@ -211,6 +213,7 @@
|
||||
@close="closeAllocateExpressProgress"
|
||||
/>
|
||||
<storage-allocate-form
|
||||
v-if="storageDialogVisible"
|
||||
v-model="storageDialogVisible"
|
||||
v-model:allow-storage-location="storageForm.allowStorageLocation"
|
||||
:mode="storageDialogMode"
|
||||
@ -229,6 +232,7 @@
|
||||
@submit="submitStorageAllocate"
|
||||
/>
|
||||
<update-order-meta-form
|
||||
v-if="updateOrderMetaDialogVisible"
|
||||
v-model="updateOrderMetaDialogVisible"
|
||||
v-model:code="updateOrderMetaState.code"
|
||||
:mode="updateOrderMetaDialogMode"
|
||||
@ -241,6 +245,7 @@
|
||||
@submit="submitUpdateOrderMeta"
|
||||
/>
|
||||
<clone-order-form
|
||||
v-if="cloneOrderDialogVisible"
|
||||
v-model="cloneOrderDialogVisible"
|
||||
:loading="cloneOrderLoading"
|
||||
:source-order-id="cloneSourceOrderId"
|
||||
@ -249,6 +254,7 @@
|
||||
@submit="submitCloneOrder"
|
||||
/>
|
||||
<manual-waybill-form
|
||||
v-if="manualWaybillDialogVisible"
|
||||
v-model="manualWaybillDialogVisible"
|
||||
v-model:waybill-code="manualWaybillState.waybill_code"
|
||||
:loading="manualWaybillLoading"
|
||||
@ -258,9 +264,10 @@
|
||||
@submit="submitManualWaybill"
|
||||
/>
|
||||
<sync-order-ids-form
|
||||
v-if="syncOrderIdsDialogVisible"
|
||||
v-model="syncOrderIdsDialogVisible"
|
||||
:order-count="selectionRows.length"
|
||||
:order-ids="getSelectedIds()"
|
||||
:order-ids="selectedOrderIds"
|
||||
:order-items="selectedOrderTagItems"
|
||||
:loading="syncOrderIdsLoading"
|
||||
:request-id="syncOrderIdsRequestId"
|
||||
@ -276,6 +283,7 @@
|
||||
@submit="submitSyncOrderIds"
|
||||
/>
|
||||
<batch-quick-recheck-form
|
||||
v-if="batchQuickRecheckDialogVisible"
|
||||
v-model="batchQuickRecheckDialogVisible"
|
||||
:suggested-ids="batchQuickRecheckSuggestedIds"
|
||||
:selected-rows="batchQuickRecheckSelectedRows"
|
||||
@ -295,6 +303,7 @@
|
||||
@submit="submitUpdateAddress"
|
||||
/>
|
||||
<update-remark-form
|
||||
v-if="updateRemarkDialogVisible"
|
||||
v-model="updateRemarkDialogVisible"
|
||||
v-model:form="updateRemarkState"
|
||||
:order-count="updateRemarkOrderIds.length"
|
||||
@ -305,7 +314,7 @@
|
||||
@submit="submitUpdateRemark"
|
||||
/>
|
||||
<batch-async-task-form
|
||||
v-if="batchAsyncTaskConfig"
|
||||
v-if="batchAsyncTaskConfig && batchAsyncTaskDialogVisible"
|
||||
v-model="batchAsyncTaskDialogVisible"
|
||||
:title="batchAsyncTaskConfig.title"
|
||||
:description="batchAsyncTaskConfig.description"
|
||||
@ -384,6 +393,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<allocate-sub-order-number-form
|
||||
v-if="allocateSubOrderNumberDialogVisible"
|
||||
v-model="allocateSubOrderNumberDialogVisible"
|
||||
:loading="allocateSubOrderNumberLoading"
|
||||
:order-id="allocateSubOrderNumberOrderId"
|
||||
@ -393,6 +403,7 @@
|
||||
/>
|
||||
|
||||
<wave-platform-print-preview-dialog
|
||||
v-if="batchPrintDialogVisible"
|
||||
v-model="batchPrintDialogVisible"
|
||||
:error-message="batchPrintErrorMessage"
|
||||
:payload="batchPrintPayload"
|
||||
@ -403,6 +414,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -412,6 +424,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -450,25 +463,25 @@ import {
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import log from './component/log.vue'
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
import { useCreateOrderSession } from '@/views/order/shared/createOrderSession/useCreateOrderSession'
|
||||
import AllocateExpressForm from '@/views/order/shared/form/AllocateExpressForm.vue'
|
||||
import StorageAllocateForm from '@/views/order/shared/form/StorageAllocateForm.vue'
|
||||
import UpdateOrderMetaForm from './form/UpdateOrderMetaForm.vue'
|
||||
import CloneOrderForm from './form/CloneOrderForm.vue'
|
||||
import ManualWaybillForm from '@/views/order/shared/form/ManualWaybillForm.vue'
|
||||
import SyncOrderIdsForm from '@/views/order/shared/form/SyncOrderIdsForm.vue'
|
||||
import BatchQuickRecheckForm from './form/BatchQuickRecheckForm.vue'
|
||||
const AllocateExpressForm = defineAsyncComponent(() => import('@/views/order/shared/form/AllocateExpressForm.vue'))
|
||||
const StorageAllocateForm = defineAsyncComponent(() => import('@/views/order/shared/form/StorageAllocateForm.vue'))
|
||||
const UpdateOrderMetaForm = defineAsyncComponent(() => import('./form/UpdateOrderMetaForm.vue'))
|
||||
const CloneOrderForm = defineAsyncComponent(() => import('./form/CloneOrderForm.vue'))
|
||||
const ManualWaybillForm = defineAsyncComponent(() => import('@/views/order/shared/form/ManualWaybillForm.vue'))
|
||||
const SyncOrderIdsForm = defineAsyncComponent(() => import('@/views/order/shared/form/SyncOrderIdsForm.vue'))
|
||||
const BatchQuickRecheckForm = defineAsyncComponent(() => import('./form/BatchQuickRecheckForm.vue'))
|
||||
// 修改地址弹窗按需加载:它依赖省市区字典(约 134KB)与整套快递接口配置,不必随页签首屏加载
|
||||
const UpdateAddressForm = defineAsyncComponent(() => import('@/views/order/shared/form/UpdateAddressForm.vue'))
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
import BatchAsyncTaskForm from '@/views/order/shared/form/BatchAsyncTaskForm.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
const UpdateRemarkForm = defineAsyncComponent(() => import('./form/UpdateRemarkForm.vue'))
|
||||
const BatchAsyncTaskForm = defineAsyncComponent(() => import('@/views/order/shared/form/BatchAsyncTaskForm.vue'))
|
||||
const AllocateSubOrderNumberForm = defineAsyncComponent(() => import('./form/AllocateSubOrderNumberForm.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
@ -478,12 +491,12 @@ import { createPendingToolbarController } from '@/views/order/shared/toolbarActi
|
||||
import { buildOrderTagItems } from '@/views/order/shared/orderTagItems'
|
||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||
const WavePlatformPrintPreviewDialog = defineAsyncComponent(() => import('@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'))
|
||||
import { getOrderPrintData } from '@/api/order.print/orderprint'
|
||||
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||
import { unwrapWavePlatformPrintPayload } from '@/views/order/shared/wavePrintPayload'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import TaskProgressDialog from '@/components/TaskProgressDialog.vue'
|
||||
const TaskProgressDialog = defineAsyncComponent(() => import('@/components/TaskProgressDialog.vue'))
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
const upperTable = ref<any>(null)
|
||||
@ -522,7 +535,8 @@ const tableSize = ref('small')
|
||||
const columns = ref(buildPendingStyleColumns(expectionColumns))
|
||||
|
||||
const selectionRows = ref<any[]>([])
|
||||
|
||||
/** 选中行订单 ID(模板里直接调 getSelectedIds() 会在每次渲染重算,这里转成 computed 缓存) */
|
||||
const selectedOrderIds = computed(() => getSelectedIds())
|
||||
/** 异常订单处理弹窗展示的已选订单标签 */
|
||||
const resolveExceptionTagItems = computed(() =>
|
||||
buildOrderTagItems(selectionRows.value, resolveExceptionOrderIds.value)
|
||||
|
||||
@ -48,8 +48,14 @@
|
||||
<component :is="defaultTab.component" />
|
||||
</div>
|
||||
|
||||
<order-workbench-list-dialog v-model="workbenchDialogVisible" />
|
||||
<BindPackageMaterialByWaybillDialog v-model="bindByWaybillDialogVisible" />
|
||||
<order-workbench-list-dialog
|
||||
v-if="workbenchDialogVisible"
|
||||
v-model="workbenchDialogVisible"
|
||||
/>
|
||||
<BindPackageMaterialByWaybillDialog
|
||||
v-if="bindByWaybillDialogVisible"
|
||||
v-model="bindByWaybillDialogVisible"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -68,8 +74,8 @@ const DeliveryOrder = defineAsyncComponent(() => import('./deliveryOrder.vue'))
|
||||
const EntrustWarehouse = defineAsyncComponent(() => import('./entrustWarehouse.vue'))
|
||||
const DeliveryException = defineAsyncComponent(() => import('./deliveryException.vue'))
|
||||
const ArchiveOrder = defineAsyncComponent(() => import('./archiveOrder.vue'))
|
||||
import OrderWorkbenchListDialog from './component/OrderWorkbenchListDialog.vue'
|
||||
import BindPackageMaterialByWaybillDialog from './component/BindPackageMaterialByWaybillDialog.vue'
|
||||
const OrderWorkbenchListDialog = defineAsyncComponent(() => import('./component/OrderWorkbenchListDialog.vue'))
|
||||
const BindPackageMaterialByWaybillDialog = defineAsyncComponent(() => import('./component/BindPackageMaterialByWaybillDialog.vue'))
|
||||
import TabArea from '@/components/TabArea/index.vue'
|
||||
import { useTabOrder } from '@/composables/useTabOrder'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
@ -177,6 +177,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -186,6 +187,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -200,7 +202,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { computed, nextTick, onMounted, reactive, ref, defineAsyncComponent } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -219,13 +221,13 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import log from './component/log.vue'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import OutboundManualOutboundForm from './component/OutboundManualOutboundForm.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
const OutboundManualOutboundForm = defineAsyncComponent(() => import('./component/OutboundManualOutboundForm.vue'))
|
||||
const ExpressWaybillPanel = defineAsyncComponent(() => import('./component/ExpressWaybillPanel.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
|
||||
@ -147,6 +147,7 @@
|
||||
</div>
|
||||
|
||||
<update-remark-form
|
||||
v-if="updateRemarkDialogVisible"
|
||||
v-model="updateRemarkDialogVisible"
|
||||
v-model:form="updateRemarkState"
|
||||
:order-count="updateRemarkOrderIds.length"
|
||||
@ -160,6 +161,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -169,6 +171,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -183,7 +186,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, onActivated, onDeactivated, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, onActivated, onDeactivated, computed, defineAsyncComponent } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -203,14 +206,14 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import { useCreateOrderSession } from '@/views/order/shared/createOrderSession/useCreateOrderSession'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
const UpdateRemarkForm = defineAsyncComponent(() => import('./form/UpdateRemarkForm.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
|
||||
116
src/views/order/orderManagement/utils/order-detail-cache.ts
Normal file
116
src/views/order/orderManagement/utils/order-detail-cache.ts
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* 订单明细接口(order.pendingOrder.detail / 各页 fetchXxxDetail)请求缓存。
|
||||
*
|
||||
* 背景:
|
||||
* - 详情区「订单明细」与「商品明细」两个 tab 调的是**同一个接口**,切 tab 会 v-if 卸载重建 → 重复请求;
|
||||
* - 连续点选不同行会串行发请求,来回点同一行又会重复拉同一份数据;
|
||||
* - 列表刷新后(updated_at / status 变化)需要重新拉取。
|
||||
*
|
||||
* 设计:
|
||||
* - 按**请求函数身份**隔离缓存(WeakMap):8 个订单页各自传不同 fetcher,不会串数据;
|
||||
* - 缓存原始响应,调用方仍按各自逻辑解析;
|
||||
* - 默认 TTL 15s;并发同一 key 复用同一个 promise;
|
||||
* - `fingerprint`(如 `updated_at|status`)变化时视为失效,保证列表刷新后能取到新数据;
|
||||
* - `force: true` 供「刷新」按钮绕过缓存。
|
||||
*/
|
||||
|
||||
type DetailRequestFn = (params: Record<string, any>) => Promise<any>
|
||||
|
||||
export interface OrderDetailCacheOptions {
|
||||
/** 缓存有效期(毫秒),默认 15s */
|
||||
ttl?: number
|
||||
/** 强制跳过缓存(手动刷新) */
|
||||
force?: boolean
|
||||
/** 数据指纹:与缓存中的指纹不一致时重新请求(如 `updated_at|status`) */
|
||||
fingerprint?: string
|
||||
}
|
||||
|
||||
interface DetailCacheEntry {
|
||||
data: any
|
||||
expiresAt: number
|
||||
fingerprint?: string
|
||||
}
|
||||
|
||||
/** 默认缓存有效期:兼顾「切 tab/来回点行」去重与详情新鲜度 */
|
||||
export const ORDER_DETAIL_CACHE_TTL = 15_000
|
||||
|
||||
const detailCache = new WeakMap<DetailRequestFn, Map<string, DetailCacheEntry>>()
|
||||
const inflightRequests = new WeakMap<DetailRequestFn, Map<string, Promise<any>>>()
|
||||
|
||||
function getDetailCache(requestFn: DetailRequestFn) {
|
||||
let cache = detailCache.get(requestFn)
|
||||
if (!cache) {
|
||||
cache = new Map()
|
||||
detailCache.set(requestFn, cache)
|
||||
}
|
||||
return cache
|
||||
}
|
||||
|
||||
function getInflightMap(requestFn: DetailRequestFn) {
|
||||
let map = inflightRequests.get(requestFn)
|
||||
if (!map) {
|
||||
map = new Map()
|
||||
inflightRequests.set(requestFn, map)
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
function resolveCacheKey(params: Record<string, any>): string {
|
||||
const id = params?.id ?? params?.order_id ?? params?.orderId
|
||||
return String(id ?? '').trim()
|
||||
}
|
||||
|
||||
/**
|
||||
* 带缓存的订单明细请求。
|
||||
* @param requestFn 页面传入的明细接口(或默认 orderPendingOrder.detail)
|
||||
* @param params 接口入参(必须包含 id)
|
||||
*/
|
||||
export function loadOrderDetailCached(
|
||||
requestFn: DetailRequestFn,
|
||||
params: Record<string, any>,
|
||||
options: OrderDetailCacheOptions = {}
|
||||
): Promise<any> {
|
||||
const { ttl = ORDER_DETAIL_CACHE_TTL, force = false, fingerprint } = options
|
||||
const key = resolveCacheKey(params)
|
||||
const cache = getDetailCache(requestFn)
|
||||
const inflight = getInflightMap(requestFn)
|
||||
|
||||
if (!key) {
|
||||
// 无 id 不缓存,直接请求(由调用方保证 id 合法)
|
||||
return requestFn(params)
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
const hit = cache.get(key)
|
||||
const fingerprintMatches = fingerprint === undefined || hit?.fingerprint === fingerprint
|
||||
if (hit && hit.expiresAt > Date.now() && fingerprintMatches) {
|
||||
return Promise.resolve(hit.data)
|
||||
}
|
||||
}
|
||||
|
||||
const pending = inflight.get(key)
|
||||
if (pending) return pending
|
||||
|
||||
const promise = requestFn(params)
|
||||
.then((res) => {
|
||||
cache.set(key, { data: res, expiresAt: Date.now() + ttl, fingerprint })
|
||||
return res
|
||||
})
|
||||
.finally(() => {
|
||||
if (inflight.get(key) === promise) inflight.delete(key)
|
||||
})
|
||||
|
||||
inflight.set(key, promise)
|
||||
return promise
|
||||
}
|
||||
|
||||
/** 失效某条(或全部)明细缓存:订单状态被操作后调用 */
|
||||
export function invalidateOrderDetailCache(requestFn: DetailRequestFn, id?: number | string | null) {
|
||||
const cache = detailCache.get(requestFn)
|
||||
if (!cache) return
|
||||
if (id === undefined || id === null || id === '') {
|
||||
cache.clear()
|
||||
return
|
||||
}
|
||||
cache.delete(String(id).trim())
|
||||
}
|
||||
@ -34,7 +34,7 @@
|
||||
>
|
||||
<div class="task-panel__grid">
|
||||
<!-- 称重方式 -->
|
||||
<div class="task-panel__field task-panel__field--input task-panel__field--full">
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label is-required">称重方式</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="weighing_mode">
|
||||
@ -371,16 +371,11 @@ watch(
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 双列栅格:每格一个「标签 + 控件」行,窄屏自动降为单列 */
|
||||
/* 单列栅格:每个「标签 + 控件」独占一行,长运单号可完整显示 */
|
||||
&__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
column-gap: 16px;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
row-gap: 8px;
|
||||
|
||||
@media (max-width: 720px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
&__field {
|
||||
@ -411,11 +406,6 @@ watch(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 整行占满(如单选组) */
|
||||
&--full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 标签列固定宽度(含必填星号占位):与控件左缘对齐 */
|
||||
|
||||
@ -94,6 +94,9 @@
|
||||
<el-table-column prop="wave_no" label="波次号" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="shop_nick" label="店铺" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="logistics_name" label="快递" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="含SN" width="70" align="center">
|
||||
<template #default="{ row }">{{ row.has_sn_item === 'Y' ? '是' : '否' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="拣货状态" width="96" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getRecheckListTagType('pick_status', row.pick_status)" size="small">
|
||||
|
||||
@ -9,8 +9,19 @@
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<div class="select-product-meta">
|
||||
<span v-if="storeId">货主 ID:{{ storeId }}</span>
|
||||
<span v-else>全部货主</span>
|
||||
<!-- 货主过滤为可选开关:默认启用,单据未指定货主时禁用 -->
|
||||
<el-checkbox
|
||||
v-model="filterByStore"
|
||||
size="small"
|
||||
:disabled="!storeId"
|
||||
class="select-product-store-filter"
|
||||
@change="handleStoreFilterChange"
|
||||
>
|
||||
按货主过滤
|
||||
</el-checkbox>
|
||||
<span v-if="!storeId">当前单据未指定货主,查询全部货主</span>
|
||||
<span v-else-if="filterByStore">已按货主过滤{{ storeName ? `:${storeName}` : '' }}</span>
|
||||
<span v-else>未按货主过滤,可查到全部货主商品</span>
|
||||
<span v-if="searchMode === 'combo'" class="select-product-meta-hint">组合搜索已展开为子商品</span>
|
||||
<span class="select-product-meta-count">已选 <em>{{ localSelectedItems.length }}</em> 个</span>
|
||||
</div>
|
||||
@ -97,6 +108,11 @@
|
||||
<el-input v-model="item.plan_qty" size="small" class="selected-qty-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实付单价" width="120" align="center" header-align="center">
|
||||
<template #default="{ row: item }">
|
||||
<el-input v-model="item.actual_price" size="small" placeholder="选填" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center" header-align="center">
|
||||
<template #default="{ row: item }">
|
||||
<el-button type="danger" link size="small" @click="removeSelectedItem(item.item_code)">移除</el-button>
|
||||
@ -115,7 +131,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, reactive, ref, watch } from 'vue'
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
applyStockMatchToSelectedItem,
|
||||
@ -140,6 +156,8 @@ const visible = defineModel<boolean>({ default: false })
|
||||
|
||||
const props = defineProps<{
|
||||
storeId?: number
|
||||
/** 货主名称(仅用于提示文案,缺失时不展示 ID) */
|
||||
storeName?: string
|
||||
selectedItems?: SelectProductItem[]
|
||||
planQty?: string
|
||||
}>()
|
||||
@ -151,6 +169,10 @@ const emit = defineEmits<{
|
||||
const loading = ref(false)
|
||||
const keyword = ref('')
|
||||
const searchMode = ref<ProductSearchMode>('stock')
|
||||
/** 是否按单据货主过滤商品(可选功能,默认启用;未指定货主时该开关不可用) */
|
||||
const filterByStore = ref(true)
|
||||
/** 实际下发的货主条件:开关关闭时不传 store_id */
|
||||
const effectiveStoreId = computed(() => (filterByStore.value ? props.storeId : undefined))
|
||||
|
||||
function currentWarehouseMode(): WarehouseSearchMode | undefined {
|
||||
return searchMode.value === 'combo' ? 'combo' : undefined
|
||||
@ -201,6 +223,8 @@ watch(visible, (opened) => {
|
||||
localSelectedItems.value = (props.selectedItems || []).map((item) => ({ ...item }))
|
||||
keyword.value = ''
|
||||
pagination.currentPage = 1
|
||||
// 每次打开恢复默认:按货主过滤
|
||||
filterByStore.value = true
|
||||
void initDialog()
|
||||
})
|
||||
|
||||
@ -275,7 +299,7 @@ async function enrichLocalSelectedItems() {
|
||||
try {
|
||||
const { res, list: stockList } = await queryStockProducts({
|
||||
keyword: codes.join(','),
|
||||
storeId: props.storeId
|
||||
storeId: effectiveStoreId.value
|
||||
})
|
||||
if (isStockApiSuccess(res)) {
|
||||
const matchedRows = stockList
|
||||
@ -292,11 +316,11 @@ async function enrichLocalSelectedItems() {
|
||||
|
||||
const comboResult = await queryStockProducts({
|
||||
keyword: comboCodes.join(','),
|
||||
storeId: props.storeId,
|
||||
storeId: effectiveStoreId.value,
|
||||
mode: 'combo'
|
||||
})
|
||||
if (!isStockApiSuccess(comboResult.res)) return
|
||||
const expanded = await expandComboSearchResults(comboResult.list, { storeId: props.storeId })
|
||||
const expanded = await expandComboSearchResults(comboResult.list, { storeId: effectiveStoreId.value })
|
||||
enrichLocalSelectedItemsFromRows(expanded.filter((item) => getPickerRowItemId(item)))
|
||||
} catch (error) {
|
||||
console.error('enrich selected product names failed:', error)
|
||||
@ -309,7 +333,7 @@ async function loadList() {
|
||||
try {
|
||||
const { res, list: rawList } = await queryStockProducts({
|
||||
keyword: keyword.value.trim(),
|
||||
storeId: props.storeId,
|
||||
storeId: effectiveStoreId.value,
|
||||
mode
|
||||
})
|
||||
if (!isStockApiSuccess(res)) {
|
||||
@ -318,7 +342,7 @@ async function loadList() {
|
||||
return
|
||||
}
|
||||
if (mode === 'combo') {
|
||||
allRows.value = await expandComboSearchResults(rawList, { storeId: props.storeId })
|
||||
allRows.value = await expandComboSearchResults(rawList, { storeId: effectiveStoreId.value })
|
||||
if (!allRows.value.length && rawList.length) {
|
||||
ElMessage.warning('组合商品未包含有效子商品')
|
||||
}
|
||||
@ -334,7 +358,7 @@ async function loadList() {
|
||||
}
|
||||
}
|
||||
const expandedCombos = comboRows.length
|
||||
? await expandComboSearchResults(comboRows, { storeId: props.storeId })
|
||||
? await expandComboSearchResults(comboRows, { storeId: effectiveStoreId.value })
|
||||
: []
|
||||
allRows.value = [
|
||||
...stockRows
|
||||
@ -469,6 +493,19 @@ function handleSearchModeChange() {
|
||||
})
|
||||
}
|
||||
|
||||
/** 货主过滤开关切换:按当前关键字重新加载列表并保持已选状态 */
|
||||
function handleStoreFilterChange() {
|
||||
pagination.currentPage = 1
|
||||
syncingSelection.value = true
|
||||
void loadList()
|
||||
.then(() => enrichLocalSelectedItems())
|
||||
.then(() => syncSelectionFromLocal())
|
||||
.finally(async () => {
|
||||
await nextTick()
|
||||
syncingSelection.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
syncingSelection.value = true
|
||||
@ -549,6 +586,16 @@ function handleConfirm() {
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
/* 按货主过滤开关:默认勾选,未指定货主时禁用 */
|
||||
.select-product-store-filter {
|
||||
margin-right: 0;
|
||||
height: 20px;
|
||||
|
||||
:deep(.el-checkbox__label) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 已选数量:靠右并以蓝色数字强调 */
|
||||
.select-product-meta-count {
|
||||
margin-left: auto;
|
||||
|
||||
@ -161,6 +161,16 @@
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-source_order_codes="{ row }">
|
||||
<el-input
|
||||
v-model="row.source_order_codes"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="选填"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #column-store_id="{ row }">
|
||||
<div :class="{ 'cell-required-empty': isRequiredFieldEmpty(row, 'store_id') }">
|
||||
<el-select
|
||||
@ -300,6 +310,16 @@
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-town="{ row }">
|
||||
<el-input
|
||||
v-model="row.town"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="选填"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #column-detail_address="{ row }">
|
||||
<div :class="{ 'cell-required-empty': isRequiredFieldEmpty(row, 'detail_address') }">
|
||||
<el-input
|
||||
@ -311,6 +331,57 @@
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-zip_code="{ row }">
|
||||
<el-input
|
||||
v-model="row.zip_code"
|
||||
size="small"
|
||||
clearable
|
||||
maxlength="20"
|
||||
placeholder="选填"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #column-order_type="{ row }">
|
||||
<el-select
|
||||
v-model="row.order_type"
|
||||
size="small"
|
||||
filterable
|
||||
clearable
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="选填"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in orderTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #column-is_urgency="{ row }">
|
||||
<el-select
|
||||
v-model="row.is_urgency"
|
||||
size="small"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
>
|
||||
<el-option v-for="opt in yesNoOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template #column-invoice_flag="{ row }">
|
||||
<el-select
|
||||
v-model="row.invoice_flag"
|
||||
size="small"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
>
|
||||
<el-option v-for="opt in yesNoOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template #column-logistics_code="{ row }">
|
||||
<el-select
|
||||
v-model="row.logistics_code"
|
||||
@ -319,7 +390,7 @@
|
||||
clearable
|
||||
placeholder="请选择快递"
|
||||
:disabled="isPreviewRowLocked(row)"
|
||||
@change="markPreviewRowDirty(row)"
|
||||
@change="handlePreviewLogisticsChange(row)"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in importExpressOptions"
|
||||
@ -475,6 +546,7 @@
|
||||
<SelectProductDialog
|
||||
v-model="selectProductDialogVisible"
|
||||
:store-id="selectProductTargetRow?.store_id"
|
||||
:store-name="selectProductStoreName"
|
||||
:selected-items="selectProductTargetRow?.selected_items"
|
||||
:plan-qty="selectProductTargetRow?.plan_qty"
|
||||
@confirm="handleSelectProductConfirm"
|
||||
@ -529,7 +601,7 @@ import {
|
||||
getDistrictNodes,
|
||||
resolveRegionCodesFromNames
|
||||
} from '@/views/system/setting/expressinterface/express-interface-config'
|
||||
import { extractStoreListFromResponse, mapStoreListToSelectOptions } from '@/utils/storeScanOptions'
|
||||
import { extractStoreListFromResponse, mapStoreListToSelectOptions, resolveStoreDisplayName } from '@/utils/storeScanOptions'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
@ -586,6 +658,20 @@ type ImportPreviewRow = {
|
||||
province: string
|
||||
city: string
|
||||
area: string
|
||||
/** 镇/街道(选填,接口字段 town) */
|
||||
town: string
|
||||
/** 邮编(选填,接口字段 zip_code) */
|
||||
zip_code: string
|
||||
/** 来源订单号(选填,接口字段 source_order_codes) */
|
||||
source_order_codes: string
|
||||
/** 订单类型(选填,接口字段 order_type) */
|
||||
order_type: string
|
||||
/** 是否加急 Y/N(选填,接口字段 is_urgency,默认 N) */
|
||||
is_urgency: string
|
||||
/** 是否开票 Y/N(选填,接口字段 invoice_flag,默认 N) */
|
||||
invoice_flag: string
|
||||
/** 快递名称(选填,接口字段 logistics_name,选快递时自动带出) */
|
||||
logistics_name: string
|
||||
province_code: string
|
||||
city_code: string
|
||||
area_code: string
|
||||
@ -604,6 +690,7 @@ const importPreviewColumns = [
|
||||
{ prop: 'row_no', label: '行号', width: '70', fixed: 'left', align: 'center' },
|
||||
{ prop: '_issue', label: '异常', width: '60', fixed: 'left' },
|
||||
{ prop: 'delivery_order_code', label: '发货单号', minWidth: '140', fixed: 'left' },
|
||||
{ prop: 'source_order_codes', label: '来源订单号', minWidth: '160' },
|
||||
{ prop: 'store_id', label: '货主', minWidth: '160', fixed: 'left' },
|
||||
{ prop: 'selected_items', label: '商品', minWidth: '110', fixed: 'left', align: 'center' },
|
||||
{ prop: 'shop_nick', label: '自定义店铺*', minWidth: '140' },
|
||||
@ -614,7 +701,12 @@ const importPreviewColumns = [
|
||||
{ prop: 'province', label: '省份*', minWidth: '120' },
|
||||
{ prop: 'city', label: '城市*', minWidth: '120' },
|
||||
{ prop: 'area', label: '区/县*', minWidth: '120' },
|
||||
{ prop: 'town', label: '镇/街道', minWidth: '120' },
|
||||
{ prop: 'detail_address', label: '详细地址', minWidth: '150' },
|
||||
{ prop: 'zip_code', label: '邮编', minWidth: '100' },
|
||||
{ prop: 'order_type', label: '订单类型', minWidth: '130' },
|
||||
{ prop: 'is_urgency', label: '是否紧急', minWidth: '100' },
|
||||
{ prop: 'invoice_flag', label: '发票标记', minWidth: '100' },
|
||||
{ prop: 'logistics_code', label: '快递', minWidth: '140' },
|
||||
{ prop: 'source_platform_code', label: '来源平台', minWidth: '140' },
|
||||
{ prop: 'sys_platform_code', label: '平台', minWidth: '140' },
|
||||
@ -649,6 +741,20 @@ const importPlatformOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const defaultStoreId = ref<number | undefined>(undefined)
|
||||
const provinceOptions = buildProvinceOptions()
|
||||
|
||||
/** 订单类型可选项(与 COMMON_TRANSLATIONS.order_type 对齐,允许自定义输入) */
|
||||
const orderTypeOptions = [
|
||||
{ label: '交易出库', value: 'JYCK' },
|
||||
{ label: '调拨出库', value: 'TRANSFER' },
|
||||
{ label: '退货出库', value: 'RETURN' },
|
||||
{ label: '其他出库', value: 'OTHER' }
|
||||
]
|
||||
|
||||
/** 是/否枚举(接口约定 Y/N) */
|
||||
const yesNoOptions = [
|
||||
{ label: '否', value: 'N' },
|
||||
{ label: '是', value: 'Y' }
|
||||
]
|
||||
|
||||
const previewTableRef = ref<InstanceType<typeof UpperTable> | null>(null)
|
||||
const previewPagination = reactive({ currentPage: 1, pageSize: 100, total: 0 })
|
||||
/** 预览表格筛选:全部 / 有异常(_issueCount > 0) / 正常 */
|
||||
@ -688,6 +794,14 @@ const exportSelectedLoading = ref(false)
|
||||
const selectProductDialogVisible = ref(false)
|
||||
const selectProductTargetRow = ref<ImportPreviewRow | null>(null)
|
||||
|
||||
/** 选择商品弹窗提示用货主名称:由 store_id 在货主下拉中反查,不展示 ID */
|
||||
const selectProductStoreName = computed(() => {
|
||||
const id = Number(selectProductTargetRow.value?.store_id)
|
||||
if (!Number.isFinite(id) || id <= 0) return ''
|
||||
const matched = storeOptions.value.find((item) => Number(item.value) === id)
|
||||
return resolveStoreDisplayName(matched?.label)
|
||||
})
|
||||
|
||||
const selectedPreviewRowsForAddress = computed(() =>
|
||||
importPreviewRows.value.filter(
|
||||
(row) => selectedPreviewRowKeys.value.has(row._rowKey) && !isPreviewRowLocked(row)
|
||||
@ -819,7 +933,17 @@ function restoreCreateOrderDraft() {
|
||||
const snapshot = takeCreateOrderDraft()
|
||||
if (!snapshot) return
|
||||
previewRowKeySeed = snapshot.previewRowKeySeed
|
||||
importPreviewRows.value = snapshot.importPreviewRows as ImportPreviewRow[]
|
||||
// 兼容旧草稿:早期快照没有 town / 新增可选字段,补默认值避免输入框拿到 undefined
|
||||
importPreviewRows.value = (snapshot.importPreviewRows as ImportPreviewRow[]).map((row) => ({
|
||||
...row,
|
||||
town: String(row.town ?? ''),
|
||||
zip_code: String(row.zip_code ?? ''),
|
||||
source_order_codes: String(row.source_order_codes ?? ''),
|
||||
order_type: String(row.order_type ?? ''),
|
||||
is_urgency: normalizeYesNo(row.is_urgency, 'N'),
|
||||
invoice_flag: normalizeYesNo(row.invoice_flag, 'N'),
|
||||
logistics_name: String(row.logistics_name ?? '')
|
||||
}))
|
||||
importOrderFileName.value = snapshot.importOrderFileName
|
||||
importOrderResult.value = snapshot.importOrderResult as ImportOrderResult | null
|
||||
defaultStoreId.value = snapshot.defaultStoreId
|
||||
@ -899,6 +1023,13 @@ function createEmptyPreviewRowForm(): ImportPreviewRow {
|
||||
province: '',
|
||||
city: '',
|
||||
area: '',
|
||||
town: '',
|
||||
zip_code: '',
|
||||
source_order_codes: '',
|
||||
order_type: '',
|
||||
is_urgency: 'N',
|
||||
invoice_flag: 'N',
|
||||
logistics_name: '',
|
||||
province_code: '',
|
||||
city_code: '',
|
||||
area_code: '',
|
||||
@ -917,12 +1048,13 @@ function hasValidSelectedItemId(item: PreviewSelectedItem) {
|
||||
return Number.isInteger(itemId) && itemId > 0
|
||||
}
|
||||
|
||||
function buildSelectedItemFromImport(itemCode: string, planQty: string): PreviewSelectedItem {
|
||||
function buildSelectedItemFromImport(itemCode: string, planQty: string, actualPrice?: string): PreviewSelectedItem {
|
||||
return {
|
||||
item_code: itemCode,
|
||||
item_name: '',
|
||||
barcode: '',
|
||||
plan_qty: planQty || '1'
|
||||
plan_qty: planQty || '1',
|
||||
actual_price: String(actualPrice ?? '').trim() || undefined
|
||||
}
|
||||
}
|
||||
|
||||
@ -945,7 +1077,7 @@ function resolveExpandedPlanQty(planQty: string | number | undefined, comboItemQ
|
||||
}
|
||||
|
||||
function collectGroupOrderItems(rows: ImportPreviewRow[]) {
|
||||
const items: Array<{ item_id: number; item_code: string; item_name: string; plan_qty: number }> = []
|
||||
const items: Array<{ item_id: number; item_code: string; item_name: string; plan_qty: number; actual_price?: number }> = []
|
||||
for (const row of rows) {
|
||||
for (const item of row.selected_items) {
|
||||
const itemId = Number(item.item_id)
|
||||
@ -955,7 +1087,8 @@ function collectGroupOrderItems(rows: ImportPreviewRow[]) {
|
||||
item_id: itemId,
|
||||
item_code: String(item.item_code || '').trim(),
|
||||
item_name: String(item.item_name || '').trim(),
|
||||
plan_qty: planQty
|
||||
plan_qty: planQty,
|
||||
actual_price: normalizeActualPrice(item.actual_price)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1003,7 +1136,9 @@ async function resolveMissingItemIdsForGroup(rows: ImportPreviewRow[]) {
|
||||
plan_qty: resolveExpandedPlanQty(planQty, subItem.combo_item_quantity),
|
||||
store_id: subItem.store_id,
|
||||
is_combo: false,
|
||||
combo_id: undefined
|
||||
combo_id: undefined,
|
||||
// 行内录入的实付单价沿用到展开后的子商品
|
||||
actual_price: item.actual_price
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -1016,6 +1151,54 @@ function getRowCityOptions(row: ImportPreviewRow) {
|
||||
return buildCityOptions(row.province_code)
|
||||
}
|
||||
|
||||
/** 是/否归一化:兼容 Y/N、true/false、1/0 与常见中文写法 */
|
||||
function normalizeYesNo(value: unknown, fallback = 'N'): string {
|
||||
if (value === true || value === 1) return 'Y'
|
||||
if (value === false || value === 0) return 'N'
|
||||
const raw = String(value ?? '').trim().toUpperCase()
|
||||
if (!raw) return fallback
|
||||
if (['Y', 'YES', 'TRUE', '1', '是', '需要', '有', '开票'].includes(raw)) return 'Y'
|
||||
if (['N', 'NO', 'FALSE', '0', '否', '不需要', '无', '不开票'].includes(raw)) return 'N'
|
||||
return fallback
|
||||
}
|
||||
|
||||
const ORDER_TYPE_NAME_TO_CODE: Record<string, string> = {
|
||||
交易出库: 'JYCK',
|
||||
调拨出库: 'TRANSFER',
|
||||
退货出库: 'RETURN',
|
||||
其他出库: 'OTHER'
|
||||
}
|
||||
|
||||
/** 订单类型归一化:中文名转接口枚举,已是编码则转大写(无法识别时原样保留) */
|
||||
function normalizeOrderType(value: unknown): string {
|
||||
const raw = String(value ?? '').trim()
|
||||
if (!raw) return ''
|
||||
return ORDER_TYPE_NAME_TO_CODE[raw] || raw.toUpperCase()
|
||||
}
|
||||
|
||||
/** 实付单价归一化:空值返回 undefined,非法值返回 undefined(提交前另有校验) */
|
||||
function normalizeActualPrice(value: unknown): number | undefined {
|
||||
const raw = String(value ?? '').trim()
|
||||
if (!raw) return undefined
|
||||
const num = Number(raw)
|
||||
return Number.isFinite(num) && num >= 0 ? num : undefined
|
||||
}
|
||||
|
||||
/** 从快递选项 label("CODE (名称)")中取名称 */
|
||||
function extractExpressName(label: string): string {
|
||||
const matched = /\(([^()]*)\)\s*$/.exec(String(label || ''))
|
||||
const name = matched?.[1]
|
||||
return name ? name.trim() : ''
|
||||
}
|
||||
|
||||
/** 选择快递后同步快递名称(接口字段 logistics_name) */
|
||||
function handlePreviewLogisticsChange(row: ImportPreviewRow) {
|
||||
const code = String(row.logistics_code || '').trim()
|
||||
const option = importExpressOptions.value.find((item) => String(item.value) === code)
|
||||
row.logistics_name = option ? extractExpressName(String(option.label || '')) : ''
|
||||
markPreviewRowDirty(row)
|
||||
}
|
||||
|
||||
function getRowAreaOptions(row: ImportPreviewRow) {
|
||||
return buildDistrictOptions(row.province_code, row.city_code)
|
||||
}
|
||||
@ -1027,6 +1210,8 @@ function handlePreviewProvinceChange(row: ImportPreviewRow, code: string) {
|
||||
row.area_code = ''
|
||||
row.city = ''
|
||||
row.area = ''
|
||||
// 镇/街道从属于区县,上级变更后清空,避免残留旧值
|
||||
row.town = ''
|
||||
markPreviewRowDirty(row)
|
||||
}
|
||||
|
||||
@ -1035,12 +1220,14 @@ function handlePreviewCityChange(row: ImportPreviewRow, code: string) {
|
||||
row.city = findRegionNameByCode(getCityNodes(row.province_code), code)
|
||||
row.area_code = ''
|
||||
row.area = ''
|
||||
row.town = ''
|
||||
markPreviewRowDirty(row)
|
||||
}
|
||||
|
||||
function handlePreviewAreaChange(row: ImportPreviewRow, code: string) {
|
||||
row.area_code = code || ''
|
||||
row.area = findRegionNameByCode(getDistrictNodes(row.province_code, row.city_code), code)
|
||||
row.town = ''
|
||||
markPreviewRowDirty(row)
|
||||
}
|
||||
|
||||
@ -1225,6 +1412,14 @@ function mergeDuplicateOrderRows(rows: ImportPreviewRow[]): ImportPreviewRow[] {
|
||||
if (!existing.province && row.province) existing.province = row.province
|
||||
if (!existing.city && row.city) existing.city = row.city
|
||||
if (!existing.area && row.area) existing.area = row.area
|
||||
if (!existing.town && row.town) existing.town = row.town
|
||||
if (!existing.zip_code && row.zip_code) existing.zip_code = row.zip_code
|
||||
if (!existing.source_order_codes && row.source_order_codes) existing.source_order_codes = row.source_order_codes
|
||||
if (!existing.order_type && row.order_type) existing.order_type = row.order_type
|
||||
if (!existing.logistics_name && row.logistics_name) existing.logistics_name = row.logistics_name
|
||||
// 加急/开票:任一行标记为是即保留是
|
||||
if (String(row.is_urgency || '').trim().toUpperCase() === 'Y') existing.is_urgency = 'Y'
|
||||
if (String(row.invoice_flag || '').trim().toUpperCase() === 'Y') existing.invoice_flag = 'Y'
|
||||
if (!existing.province_code && row.province_code) existing.province_code = row.province_code
|
||||
if (!existing.city_code && row.city_code) existing.city_code = row.city_code
|
||||
if (!existing.area_code && row.area_code) existing.area_code = row.area_code
|
||||
@ -1329,7 +1524,11 @@ function getNextPreviewRowTemplate(copyFrom?: ImportPreviewRow): ImportPreviewRo
|
||||
store_id: defaultStoreId.value ?? lastRow.store_id,
|
||||
shop_nick: lastRow.shop_nick,
|
||||
remark: lastRow.remark,
|
||||
order_type: lastRow.order_type,
|
||||
is_urgency: normalizeYesNo(lastRow.is_urgency, 'N'),
|
||||
invoice_flag: normalizeYesNo(lastRow.invoice_flag, 'N'),
|
||||
logistics_code: lastRow.logistics_code,
|
||||
logistics_name: lastRow.logistics_name,
|
||||
source_platform_code: lastRow.source_platform_code,
|
||||
sys_platform_code: lastRow.sys_platform_code,
|
||||
selected_items: [],
|
||||
@ -1665,6 +1864,7 @@ function triggerImportFileSelect() {
|
||||
/** 导入模板可识别的字段键(与 buildPreviewRow 解析出的行字段一一对应) */
|
||||
type ImportFieldKey =
|
||||
| 'delivery_order_code'
|
||||
| 'source_order_codes'
|
||||
| 'store_id'
|
||||
| 'name'
|
||||
| 'mobile'
|
||||
@ -1672,9 +1872,16 @@ type ImportFieldKey =
|
||||
| 'province'
|
||||
| 'city'
|
||||
| 'area'
|
||||
| 'town'
|
||||
| 'detail_address'
|
||||
| 'zip_code'
|
||||
| 'order_type'
|
||||
| 'is_urgency'
|
||||
| 'invoice_flag'
|
||||
| 'logistics_name'
|
||||
| 'item_code'
|
||||
| 'plan_qty'
|
||||
| 'actual_price'
|
||||
| 'shop_nick'
|
||||
| 'remark'
|
||||
| 'logistics_code'
|
||||
@ -1688,6 +1895,7 @@ type ImportFieldKey =
|
||||
*/
|
||||
const IMPORT_FIELD_ALIASES: Record<ImportFieldKey, string[]> = {
|
||||
delivery_order_code: ['*订单号', '订单号*', '订单号', 'delivery_order_code', '发货单号'],
|
||||
source_order_codes: ['来源订单号', '*来源订单号', '来源订单号*', 'source_order_codes', 'source_order_code', '平台订单号'],
|
||||
store_id: ['*货主ID', '货主ID*', '货主ID', 'store_id', '货主', '*货主', '货主*'],
|
||||
name: ['*收件人', '收件人*', '收件人', '收件人姓名', '*收件人姓名', '姓名', '收货人', 'name'],
|
||||
mobile: ['手机号', '手机', '手机号码', '*手机号', '*手机号(mobile/tel至少填一项)', '联系电话', '联系方式', 'mobile'],
|
||||
@ -1695,9 +1903,16 @@ const IMPORT_FIELD_ALIASES: Record<ImportFieldKey, string[]> = {
|
||||
province: ['省份', 'province'],
|
||||
city: ['城市', 'city'],
|
||||
area: ['区/县', '区县', 'area'],
|
||||
town: ['镇/街道', '*镇/街道', '镇/街道*', '镇街', '镇', '*镇', '镇*', '街道', 'town'],
|
||||
detail_address: ['*详细地址', '详细地址*', '详细地址', 'detail_address'],
|
||||
zip_code: ['邮编', '*邮编', '邮政编码', 'zip_code', 'postcode', 'post_code'],
|
||||
order_type: ['订单类型', '*订单类型', '订单类型*', 'order_type'],
|
||||
is_urgency: ['是否紧急', '是否加急', '加急', 'is_urgency'],
|
||||
invoice_flag: ['发票标记', '是否需要发票', '是否开票', '发票', 'invoice_flag'],
|
||||
logistics_name: ['快递名称', '物流名称', 'logistics_name'],
|
||||
item_code: ['*商品编码', '商品编码*', '商品编码', 'item_code'],
|
||||
plan_qty: ['*计划数量', '计划数量*', '计划数量', 'plan_qty'],
|
||||
actual_price: ['实付单价', '成交单价', '单价', 'actual_price'],
|
||||
shop_nick: ['*自定义店铺', '自定义店铺*', '自定义店铺', '店铺名称', '*店铺名称', '店铺名称*', 'shop_nick', '店铺'],
|
||||
remark: ['留言', '*留言', '留言*', 'remark', '备注', '订单备注'],
|
||||
logistics_code: ['快递编码', 'logistics_code'],
|
||||
@ -1707,9 +1922,9 @@ const IMPORT_FIELD_ALIASES: Record<ImportFieldKey, string[]> = {
|
||||
|
||||
/** 「导出选中」在拿不到模板时的兼顾表头(均为上述别名主名,保证导出文件仍能被导入识别) */
|
||||
const FALLBACK_EXPORT_HEADER = [
|
||||
'*订单号', '*货主ID', '*自定义店铺', '留言', '*收件人', '手机号', '电话',
|
||||
'省份', '城市', '区/县', '*详细地址', '*商品编码', '*计划数量',
|
||||
'快递编码', '来源平台编码', '系统平台编码'
|
||||
'*订单号', '来源订单号', '*货主ID', '*自定义店铺', '留言', '*收件人', '手机号', '电话',
|
||||
'省份', '城市', '区/县', '镇/街道', '*详细地址', '邮编', '订单类型', '是否紧急', '发票标记',
|
||||
'*商品编码', '*计划数量', '实付单价', '快递编码', '快递名称', '来源平台编码', '系统平台编码'
|
||||
]
|
||||
|
||||
/** 表头归一化:去空白与 * 号、转小写,用于模板表头与字段别名互认 */
|
||||
@ -1754,6 +1969,7 @@ function getExportCellValue(
|
||||
): string | number {
|
||||
switch (field) {
|
||||
case 'delivery_order_code': return String(row.delivery_order_code || '').trim()
|
||||
case 'source_order_codes': return String(row.source_order_codes || '')
|
||||
case 'store_id': return row.store_id ? Number(row.store_id) : ''
|
||||
case 'name': return String(row.name || '')
|
||||
case 'mobile': return String(row.mobile || '')
|
||||
@ -1761,7 +1977,13 @@ function getExportCellValue(
|
||||
case 'province': return String(row.province || '')
|
||||
case 'city': return String(row.city || '')
|
||||
case 'area': return String(row.area || '')
|
||||
case 'town': return String(row.town || '')
|
||||
case 'detail_address': return String(row.detail_address || '')
|
||||
case 'zip_code': return String(row.zip_code || '')
|
||||
case 'order_type': return String(row.order_type || '')
|
||||
case 'is_urgency': return String(row.is_urgency || 'N')
|
||||
case 'invoice_flag': return String(row.invoice_flag || 'N')
|
||||
case 'logistics_name': return String(row.logistics_name || '')
|
||||
case 'shop_nick': return String(row.shop_nick || '')
|
||||
case 'remark': return String(row.remark || '')
|
||||
case 'logistics_code': return String(row.logistics_code || '')
|
||||
@ -1769,6 +1991,7 @@ function getExportCellValue(
|
||||
case 'sys_platform_code': return String(row.sys_platform_code || '')
|
||||
case 'item_code': return String(item?.item_code || '')
|
||||
case 'plan_qty': return String(item?.plan_qty || row.plan_qty || '1')
|
||||
case 'actual_price': return String(item?.actual_price || '')
|
||||
default: return ''
|
||||
}
|
||||
}
|
||||
@ -1857,14 +2080,22 @@ function buildPreviewRow(row: Record<string, any>, rowNo: number): ImportPreview
|
||||
const province = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.province))
|
||||
const city = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.city))
|
||||
const area = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.area))
|
||||
const town = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.town))
|
||||
const detailAddressRaw = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.detail_address))
|
||||
const zipCode = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.zip_code))
|
||||
const sourceOrderCodes = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.source_order_codes))
|
||||
const orderType = normalizeOrderType(pickImportValue(row, IMPORT_FIELD_ALIASES.order_type))
|
||||
const isUrgency = normalizeYesNo(pickImportValue(row, IMPORT_FIELD_ALIASES.is_urgency), 'N')
|
||||
const invoiceFlag = normalizeYesNo(pickImportValue(row, IMPORT_FIELD_ALIASES.invoice_flag), 'N')
|
||||
const logisticsName = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.logistics_name))
|
||||
const actualPrice = toImportString(pickImportValue(row, IMPORT_FIELD_ALIASES.actual_price))
|
||||
const regionCodes = resolvePreviewRowRegionCodes({ province, city, area })
|
||||
|
||||
if (!deliveryOrderCode && !storeId && !name && !itemCode && !planQty) {
|
||||
return null
|
||||
}
|
||||
|
||||
const selectedItems = itemCode ? [buildSelectedItemFromImport(itemCode, planQty || '1')] : []
|
||||
const selectedItems = itemCode ? [buildSelectedItemFromImport(itemCode, planQty || '1', actualPrice)] : []
|
||||
|
||||
return {
|
||||
_rowKey: createPreviewRowKey(),
|
||||
@ -1881,6 +2112,13 @@ function buildPreviewRow(row: Record<string, any>, rowNo: number): ImportPreview
|
||||
province,
|
||||
city,
|
||||
area,
|
||||
town,
|
||||
zip_code: zipCode,
|
||||
source_order_codes: sourceOrderCodes,
|
||||
order_type: orderType,
|
||||
is_urgency: isUrgency,
|
||||
invoice_flag: invoiceFlag,
|
||||
logistics_name: logisticsName,
|
||||
province_code: regionCodes.provinceCode,
|
||||
city_code: regionCodes.cityCode,
|
||||
area_code: regionCodes.districtCode,
|
||||
@ -1950,6 +2188,7 @@ async function parseImportPreviewFromFile(file: File) {
|
||||
if (data.province) row.province = String(data.province).trim()
|
||||
if (data.city) row.city = String(data.city).trim()
|
||||
if (data.area) row.area = String(data.area).trim()
|
||||
if (data.town) row.town = String(data.town).trim()
|
||||
if (data.detailAddress) row.detail_address = String(data.detailAddress).trim()
|
||||
if (!row._source_address) row._source_address = address
|
||||
if (data.name && !row.name) row.name = String(data.name).trim()
|
||||
@ -2038,7 +2277,8 @@ async function parseImportPreviewFromFile(file: File) {
|
||||
plan_qty: resolveExpandedPlanQty(planQty, subItem.combo_item_quantity),
|
||||
store_id: subItem.store_id,
|
||||
is_combo: false,
|
||||
combo_id: undefined
|
||||
combo_id: undefined,
|
||||
actual_price: item.actual_price
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -2110,7 +2350,8 @@ function buildCreateOrderPayload(rows: ImportPreviewRow[]): PendingOrderCreateOr
|
||||
item_id: item.item_id,
|
||||
plan_qty: item.plan_qty,
|
||||
item_name: item.item_name || undefined,
|
||||
order_line_no: String(index + 1)
|
||||
order_line_no: String(index + 1),
|
||||
actual_price: item.actual_price
|
||||
}))
|
||||
|
||||
return {
|
||||
@ -2122,11 +2363,20 @@ function buildCreateOrderPayload(rows: ImportPreviewRow[]): PendingOrderCreateOr
|
||||
province: String(header.province || '').trim(),
|
||||
city: String(header.city || '').trim(),
|
||||
area: String(header.area || '').trim(),
|
||||
// 镇/街道、邮编、来源订单号、订单类型为选填字段,留空时不传
|
||||
town: String(header.town || '').trim() || undefined,
|
||||
zip_code: String(header.zip_code || '').trim() || undefined,
|
||||
source_order_codes: String(header.source_order_codes || '').trim() || undefined,
|
||||
order_type: normalizeOrderType(header.order_type) || undefined,
|
||||
// 加急/开票接口约定 Y/N,默认 N
|
||||
is_urgency: normalizeYesNo(header.is_urgency, 'N'),
|
||||
invoice_flag: normalizeYesNo(header.invoice_flag, 'N'),
|
||||
items,
|
||||
delivery_order_code: String(header.delivery_order_code || '').trim() || undefined,
|
||||
shop_nick: String(header.shop_nick || '').trim(),
|
||||
remark: String(header.remark || '').trim() || undefined,
|
||||
logistics_code: String(header.logistics_code || '').trim() || undefined,
|
||||
logistics_name: String(header.logistics_name || '').trim() || undefined,
|
||||
source_platform_code: String(header.source_platform_code || '').trim() || undefined,
|
||||
sys_platform_code: String(header.sys_platform_code || '').trim() || undefined
|
||||
}
|
||||
@ -2208,6 +2458,15 @@ function validatePreviewRowsBeforeSubmit(options?: { requireItemId?: boolean })
|
||||
ElMessage.warning(`订单「${orderLabel}」:计划数量须为正整数`)
|
||||
return false
|
||||
}
|
||||
if (pendingItems.some((item) => {
|
||||
const raw = String(item.actual_price ?? '').trim()
|
||||
if (!raw) return false
|
||||
const price = Number(raw)
|
||||
return !Number.isFinite(price) || price < 0
|
||||
})) {
|
||||
ElMessage.warning(`订单「${orderLabel}」:实付单价须为非负数字`)
|
||||
return false
|
||||
}
|
||||
|
||||
if (options?.requireItemId) {
|
||||
const items = collectGroupOrderItems(rows)
|
||||
@ -2453,6 +2712,8 @@ function applyParsedAddressToRow(row: ImportPreviewRow, data: PendingOrderParseA
|
||||
if (data.province) row.province = String(data.province).trim()
|
||||
if (data.city) row.city = String(data.city).trim()
|
||||
if (data.area) row.area = String(data.area).trim()
|
||||
// 解析到镇/街道时回填;未解析到则保留原值,避免清掉手工填写的内容
|
||||
if (data.town) row.town = String(data.town).trim()
|
||||
if (data.detailAddress) row.detail_address = String(data.detailAddress).trim()
|
||||
if (data.name) row.name = String(data.name).trim()
|
||||
if (data.mobile) row.mobile = String(data.mobile).trim()
|
||||
|
||||
@ -711,9 +711,13 @@ async function submitFallbackOrderFetchByIds() {
|
||||
const excluded = payload?.excluded_existing_wave_order_ids
|
||||
const skipped = payload?.skipped_order_ids
|
||||
const notFound = payload?.not_found_order_ids
|
||||
const excludedSn = payload?.excluded_sn_order_ids
|
||||
if (Array.isArray(excluded) && excluded.length) {
|
||||
parts.push(`已在波次中跳过 ${excluded.length} 单`)
|
||||
}
|
||||
if (Array.isArray(excludedSn) && excludedSn.length) {
|
||||
parts.push(`SN 订单不支持散单抓取,已跳过 ${excludedSn.length} 单`)
|
||||
}
|
||||
if (Array.isArray(skipped) && skipped.length) {
|
||||
parts.push(`跳过 ${skipped.length} 单`)
|
||||
}
|
||||
|
||||
@ -4161,12 +4161,16 @@ async function submitFallbackOrderFetchByIds() {
|
||||
const excludedLocked = payload?.excluded_locked_order_ids
|
||||
const skipped = payload?.skipped_order_ids
|
||||
const notFound = payload?.not_found_order_ids
|
||||
const excludedSn = payload?.excluded_sn_order_ids
|
||||
if (Array.isArray(excluded) && excluded.length) {
|
||||
parts.push(`已在波次中跳过 ${excluded.length} 单`)
|
||||
}
|
||||
if (Array.isArray(excludedLocked) && excludedLocked.length) {
|
||||
parts.push(`已锁定跳过 ${excludedLocked.length} 单`)
|
||||
}
|
||||
if (Array.isArray(excludedSn) && excludedSn.length) {
|
||||
parts.push(`SN 订单不支持散单抓取,已跳过 ${excludedSn.length} 单`)
|
||||
}
|
||||
if (Array.isArray(skipped) && skipped.length) {
|
||||
parts.push(`跳过 ${skipped.length} 单`)
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@
|
||||
@sort-change="handleSortChange"
|
||||
>
|
||||
<template #column-strategy_type="{ row }">
|
||||
<span v-if="row.strategy_type != null" :class="getStatusTextClass(row.strategy_type == 2 ? 'warning' : 'primary')">
|
||||
{{ ({ 1: '散单', 2: '团购' } as Record<number, string>)[Number(row.strategy_type)] ?? row.strategy_type }}
|
||||
<span v-if="row.strategy_type != null" :class="getStatusTextClass(row.strategy_type == 2 ? 'warning' : row.strategy_type == 3 ? 'success' : 'primary')">
|
||||
{{ ({ 1: '散单', 2: '团购', 3: 'SN' } as Record<number, string>)[Number(row.strategy_type)] ?? row.strategy_type }}
|
||||
</span>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
@ -253,6 +253,7 @@
|
||||
<el-select v-model="waveStrategyFormModel.strategy_type" size="default" clearable placeholder="请选择策略类型" style="width: 100%">
|
||||
<el-option :value="1" label="散单" />
|
||||
<el-option :value="2" label="团购" />
|
||||
<el-option :value="WAVE_STRATEGY_TYPE_SN" label="SN" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@ -262,7 +263,7 @@
|
||||
<span class="task-panel__field-label">批次模式</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="batch_mode">
|
||||
<el-select v-model="waveStrategyFormModel.batch_mode" size="default" clearable placeholder="请选择批次模式" style="width: 100%">
|
||||
<el-select v-model="waveStrategyFormModel.batch_mode" size="default" clearable placeholder="请选择批次模式" style="width: 100%" :disabled="isSnStrategy">
|
||||
<el-option :value="1" label="单品单件" />
|
||||
<el-option :value="2" label="先拣后分" />
|
||||
<el-option :value="3" label="边拣边分" />
|
||||
@ -271,6 +272,7 @@
|
||||
<el-option :value="6" label="流利架" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<p v-if="isSnStrategy" class="wave-strategy-sn-hint">SN 策略固定为「先拣后分」,批次模式由服务端强制写入</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -323,7 +325,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__field task-panel__field--control">
|
||||
<div v-if="!isSnStrategy" class="task-panel__field task-panel__field--control">
|
||||
<span class="task-panel__field-label">同结构最小数</span>
|
||||
<div class="task-panel__field-form task-panel__field-form--row">
|
||||
<el-form-item prop="min_same_structure">
|
||||
@ -331,7 +333,7 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--control">
|
||||
<div v-if="!isSnStrategy" class="task-panel__field task-panel__field--control">
|
||||
<span class="task-panel__field-label">同结构最大数</span>
|
||||
<div class="task-panel__field-form task-panel__field-form--row">
|
||||
<el-form-item prop="max_same_structure">
|
||||
@ -524,6 +526,7 @@
|
||||
|
||||
<p class="task-panel__form-tip">
|
||||
SKU / 件数 / 同结构类阈值留空表示不限;准入限制(货主、快递、省份、平台)不选表示不限制。
|
||||
<template v-if="isSnStrategy">SN 策略仅匹配含 SN(序列号管理)商品的订单;散单/团购抓取会自动排除 SN 订单。</template>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -556,7 +559,8 @@ import {
|
||||
waveStrategyFormRules,
|
||||
buildWaveStrategyMutationPayload,
|
||||
waveBooleanOptions,
|
||||
waveStrategyToolbarButtons
|
||||
waveStrategyToolbarButtons,
|
||||
WAVE_STRATEGY_TYPE_SN
|
||||
} from './config/wave-config'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
@ -653,10 +657,33 @@ const filteredColumns = computed(() => {
|
||||
|
||||
const toolbarButtons = waveStrategyToolbarButtons
|
||||
|
||||
const waveStrategyActiveFormRules = computed(() => ({
|
||||
...waveStrategyFormRules,
|
||||
batch_mode: waveStrategyFormModel.strategy_type === 2 ? [] : waveStrategyFormRules.batch_mode
|
||||
}))
|
||||
const waveStrategyActiveFormRules = computed(() => {
|
||||
const strategyType = Number(waveStrategyFormModel.strategy_type)
|
||||
return {
|
||||
...waveStrategyFormRules,
|
||||
// 团购(2)不配置批次模式;SN(3)由服务端固定为 2,均不需必填校验
|
||||
batch_mode: strategyType === 2 || strategyType === WAVE_STRATEGY_TYPE_SN ? [] : waveStrategyFormRules.batch_mode
|
||||
}
|
||||
})
|
||||
|
||||
/** 当前是否为 SN 策略(策略类型=3):批次模式固定「先拣后分」且不可编辑 */
|
||||
const isSnStrategy = computed(() => Number(waveStrategyFormModel.strategy_type) === WAVE_STRATEGY_TYPE_SN)
|
||||
|
||||
/** 切换策略类型时同步批次模式:进入 SN 强制 2 且不配置同结构阈值;离开 SN 清空以免误带 */
|
||||
watch(
|
||||
() => waveStrategyFormModel.strategy_type,
|
||||
(type, prevType) => {
|
||||
if (Number(type) === WAVE_STRATEGY_TYPE_SN) {
|
||||
waveStrategyFormModel.batch_mode = 2
|
||||
waveStrategyFormModel.min_same_structure = undefined
|
||||
waveStrategyFormModel.max_same_structure = undefined
|
||||
return
|
||||
}
|
||||
if (Number(prevType) === WAVE_STRATEGY_TYPE_SN) {
|
||||
waveStrategyFormModel.batch_mode = undefined
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const buttonLoadingMap = computed(() => ({
|
||||
loading: loading.value
|
||||
@ -751,7 +778,12 @@ function buildWaveStrategyListApiParams(): WaveStrategyListParams {
|
||||
calculate_next_fetch_order_count: showWaveStrategyNextFetchOrderCount.value ? 1 : 0
|
||||
}
|
||||
const strategyTypeRaw = rawWhere.strategy_type
|
||||
if (strategyTypeRaw !== undefined && strategyTypeRaw !== null && strategyTypeRaw !== '') {
|
||||
if (Array.isArray(strategyTypeRaw)) {
|
||||
const types = strategyTypeRaw
|
||||
.map((item) => Number(item))
|
||||
.filter((item) => Number.isFinite(item) && item > 0)
|
||||
if (types.length) params.strategy_type = types
|
||||
} else if (strategyTypeRaw !== undefined && strategyTypeRaw !== null && strategyTypeRaw !== '') {
|
||||
params.strategy_type = Number(strategyTypeRaw)
|
||||
}
|
||||
if (currentSort.prop) {
|
||||
@ -1496,6 +1528,14 @@ onMounted(() => {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
/* SN 策略:批次模式固定提示 */
|
||||
.wave-strategy-sn-hint {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&__foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@ -75,6 +75,18 @@
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-confirm_print_status="{ row }">
|
||||
<span :class="getStatusTextClass(getTagType('confirm_print_status', row.confirm_print_status))">
|
||||
{{ translateOrderField('confirm_print_status', row.confirm_print_status) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-claim_status="{ row }">
|
||||
<span :class="getStatusTextClass(getTagType('claim_status', row.claim_status))">
|
||||
{{ translateOrderField('claim_status', row.claim_status) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-pick_status="{ row }">
|
||||
<span :class="getStatusTextClass(getTagType('pick_status', row.pick_status))">
|
||||
{{ translateOrderField('pick_status', row.pick_status) }}
|
||||
@ -87,6 +99,12 @@
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-lock_status="{ row }">
|
||||
<span :class="getStatusTextClass(getTagType('lock_status', row.lock_status))">
|
||||
{{ translateOrderField('lock_status', row.lock_status) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-sync_status="{ row }">
|
||||
<span :class="getStatusTextClass(getTagType('sync_status', row.sync_status))">
|
||||
{{ translateOrderField('sync_status', row.sync_status) }}
|
||||
|
||||
@ -347,9 +347,11 @@ export const waveStrategyAvailableFields = [
|
||||
label: '策略类型',
|
||||
value: 'strategy_type',
|
||||
type: 'select',
|
||||
multiple: true,
|
||||
options: [
|
||||
{ label: '散单', value: 1 },
|
||||
{ label: '团购', value: 2 }
|
||||
{ label: '团购', value: 2 },
|
||||
{ label: 'SN', value: 3 }
|
||||
]
|
||||
}),
|
||||
waveScanField('strategy', { label: '波次前缀', value: 'wave_prefix', type: 'text' }),
|
||||
@ -914,6 +916,9 @@ export const waveStorageAssignmentErrorPhraseMap: Array<[RegExp, string]> = [
|
||||
[/none|success|succeeded|finished|completed|done|fin/gi, '无']
|
||||
]
|
||||
|
||||
/** 策略类型:3=SN(序列号管理),服务端固定 batch_mode=2、pick_mode=3 */
|
||||
export const WAVE_STRATEGY_TYPE_SN = 3
|
||||
|
||||
/** 波次策略表单校验规则 */
|
||||
export const waveStrategyFormRules = {
|
||||
strategy_name: [{ required: true, message: '请输入策略名称', trigger: 'blur' }],
|
||||
@ -976,6 +981,14 @@ export function buildWaveStrategyMutationPayload(
|
||||
if (model.allowed_provinces?.length) payload.allowed_provinces = model.allowed_provinces
|
||||
if (model.allowed_platforms?.length) payload.allowed_platforms = model.allowed_platforms
|
||||
|
||||
// SN 策略(strategy_type=3):batch_mode 由服务端固定为 2(先拣后分),
|
||||
// 同结构阈值不参与 SN 策略,均不传
|
||||
if (Number(model.strategy_type) === WAVE_STRATEGY_TYPE_SN) {
|
||||
delete payload.batch_mode
|
||||
delete payload.min_same_structure
|
||||
delete payload.max_same_structure
|
||||
}
|
||||
|
||||
Object.keys(payload).forEach((key) => {
|
||||
const field = key as keyof typeof payload
|
||||
if (payload[field] === undefined) {
|
||||
|
||||
@ -198,12 +198,17 @@
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<ComboStockPickerDialog v-model="pickerVisible" :store-id="formData.store_id" @confirm="handlePickItems" />
|
||||
<ComboStockPickerDialog
|
||||
v-model="pickerVisible"
|
||||
:store-id="formData.store_id"
|
||||
:store-name="pickerStoreName"
|
||||
@confirm="handlePickItems"
|
||||
/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, watch } from 'vue'
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { comboGoodsCreate, comboGoodsUpdate } from '@/api/combogoods/combogoods'
|
||||
@ -221,7 +226,7 @@ import {
|
||||
parseComboNameNotation,
|
||||
parseComboSimpleNotation
|
||||
} from '@/views/stock/utils/stockPickerHelpers'
|
||||
import { extractStoreListFromResponse, mapStoreListToSelectOptions } from '@/utils/storeScanOptions'
|
||||
import { extractStoreListFromResponse, mapStoreListToSelectOptions, resolveStoreDisplayName } from '@/utils/storeScanOptions'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
|
||||
@ -264,6 +269,14 @@ const rules: FormRules = {
|
||||
combo_name: [{ required: true, message: '请输入组合名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
/** 选择子商品弹窗提示用货主名称:由 store_id 在货主下拉中反查,不展示 ID */
|
||||
const pickerStoreName = computed(() => {
|
||||
const id = Number(formData.store_id)
|
||||
if (!Number.isFinite(id) || id <= 0) return ''
|
||||
const matched = storeOptions.value.find((item) => Number(item.value) === id)
|
||||
return resolveStoreDisplayName(matched?.label)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => visible.value,
|
||||
(opened) => {
|
||||
|
||||
@ -33,6 +33,21 @@
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="handleSearch">搜索</el-button>
|
||||
<!-- 货主过滤为可选开关:默认启用,未指定货主时禁用 -->
|
||||
<el-checkbox
|
||||
v-model="filterByStore"
|
||||
size="small"
|
||||
:disabled="!storeId"
|
||||
class="picker-store-filter"
|
||||
@change="handleStoreFilterChange"
|
||||
>
|
||||
按货主过滤
|
||||
</el-checkbox>
|
||||
<span class="picker-store-filter-hint">
|
||||
<template v-if="!storeId">未指定货主,查询全部货主商品</template>
|
||||
<template v-else-if="filterByStore">已按货主过滤{{ storeName ? `:${storeName}` : '' }}</template>
|
||||
<template v-else>未按货主过滤,可查到全部货主商品</template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
@ -51,7 +66,9 @@
|
||||
<el-table-column prop="item_code" label="商品编码" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="item_name" label="商品名称" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="barcode" label="条码" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="store_id" label="货主 ID" width="88" />
|
||||
<el-table-column prop="store_name" label="货主" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.store_name || '—' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- <p class="task-panel__form-tip">已选 {{ selectedItems.length }} 个商品;勾选状态在搜索切换后保留。</p> -->
|
||||
@ -90,6 +107,8 @@ export type ComboStockPickerItem = {
|
||||
item_name: string
|
||||
barcode: string
|
||||
store_id?: number
|
||||
/** 货主名称(store_stock.store_remask / store_name 等) */
|
||||
store_name?: string
|
||||
}
|
||||
|
||||
const PICKER_LIST_PAGE_SIZE = 50
|
||||
@ -98,8 +117,11 @@ const visible = defineModel<boolean>({ default: false })
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
storeId?: number
|
||||
/** 货主名称(仅用于提示文案,缺失时不展示 ID) */
|
||||
storeName?: string
|
||||
}>(), {
|
||||
storeId: undefined
|
||||
storeId: undefined,
|
||||
storeName: ''
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ confirm: [items: ComboStockPickerItem[]] }>()
|
||||
@ -109,11 +131,15 @@ const keyword = ref('')
|
||||
const list = ref<ComboStockPickerItem[]>([])
|
||||
const selectedItems = ref<ComboStockPickerItem[]>([])
|
||||
const tableRef = ref<any>(null)
|
||||
/** 是否按货主过滤商品(可选功能,默认启用;未指定货主时该开关不可用) */
|
||||
const filterByStore = ref(true)
|
||||
|
||||
watch(visible, (opened) => {
|
||||
if (!opened) return
|
||||
keyword.value = ''
|
||||
selectedItems.value = []
|
||||
// 每次打开恢复默认:按货主过滤
|
||||
filterByStore.value = true
|
||||
loadInitialList()
|
||||
})
|
||||
|
||||
@ -135,10 +161,26 @@ function mapPickerRow(row: any): ComboStockPickerItem | null {
|
||||
item_code: getStockItemCode(row) || mapped.item_code,
|
||||
item_name: getStockItemName(row) || mapped.item_name,
|
||||
barcode: getStockBarcode(row) || mapped.barcode,
|
||||
store_id: getStockStoreId(row)
|
||||
store_id: getStockStoreId(row),
|
||||
store_name: extractStoreName(row)
|
||||
}
|
||||
}
|
||||
|
||||
/** 货主名称:优先 store_stock.store_remask,其次 store_name / store_remask */
|
||||
function extractStoreName(row: any): string {
|
||||
const candidates = [
|
||||
row?.store_stock?.store_remask,
|
||||
row?.store_stock?.store_name,
|
||||
row?.store_name,
|
||||
row?.store_remask
|
||||
]
|
||||
for (const candidate of candidates) {
|
||||
const text = String(candidate ?? '').trim()
|
||||
if (text && text.toLowerCase() !== 'null') return text
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function mapRows(rawList: unknown[]): ComboStockPickerItem[] {
|
||||
return rawList
|
||||
.map((row) => mapPickerRow(row))
|
||||
@ -148,8 +190,10 @@ function mapRows(rawList: unknown[]): ComboStockPickerItem[] {
|
||||
async function loadInitialList() {
|
||||
loading.value = true
|
||||
try {
|
||||
// 货主过滤为可选功能(默认启用):关闭时不加 store_id 限定
|
||||
const storeId = filterByStore.value ? props.storeId : undefined
|
||||
// where 统一按 stock.warehouse.list 规范:{ 字段: { operator, value, type } }
|
||||
const where = buildStockQuery(props.storeId ? { store_id: props.storeId } : {})
|
||||
const where = buildStockQuery(storeId ? { store_id: storeId } : {})
|
||||
const res: any = await stockWarehouse({ page: 1, pageSize: PICKER_LIST_PAGE_SIZE }, where)
|
||||
if (!isComboGoodsApiSuccess(res)) {
|
||||
list.value = []
|
||||
@ -175,7 +219,7 @@ async function handleSearch() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: { keyword: string; store_id?: number } = { keyword: text }
|
||||
if (props.storeId) {
|
||||
if (filterByStore.value && props.storeId) {
|
||||
params.store_id = props.storeId
|
||||
}
|
||||
const res: any = await warehouseSearch(params)
|
||||
@ -198,6 +242,17 @@ function handleSelectionChange(rows: ComboStockPickerItem[]) {
|
||||
selectedItems.value = rows || []
|
||||
}
|
||||
|
||||
/** 货主过滤开关切换:有关键字时重新搜索,否则重载首屏列表 */
|
||||
function handleStoreFilterChange() {
|
||||
selectedItems.value = []
|
||||
tableRef.value?.clearSelection?.()
|
||||
if (keyword.value.trim()) {
|
||||
void handleSearch()
|
||||
} else {
|
||||
void loadInitialList()
|
||||
}
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
if (!selectedItems.value.length) return
|
||||
emit('confirm', selectedItems.value.map((item) => ({ ...item })))
|
||||
@ -217,8 +272,33 @@ function handleClosed() {
|
||||
|
||||
.picker-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.el-input {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 按货主过滤开关:默认勾选,未指定货主时禁用 */
|
||||
.picker-store-filter {
|
||||
margin-right: 0;
|
||||
flex: none;
|
||||
|
||||
:deep(.el-checkbox__label) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.picker-store-filter-hint {
|
||||
flex: none;
|
||||
max-width: 200px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@ export type OrderSelectedProductItem = {
|
||||
combo_id?: number
|
||||
/** 组合商品子项数量(展开时带出;建单导入按「该数量 × Excel 计划数量」计算) */
|
||||
combo_item_quantity?: number
|
||||
/** 实付单价(建单选填,字符串便于输入框编辑;提交时转为 number) */
|
||||
actual_price?: string
|
||||
}
|
||||
|
||||
export function isStockApiSuccess(res: any) {
|
||||
|
||||
@ -107,29 +107,65 @@ export const inventoryTypeConfig = {
|
||||
FP: { text: '返品', tagType: 'info' }
|
||||
}
|
||||
|
||||
// 订单类型配置
|
||||
// 订单类型配置(出入库记录 order_type:业务单据类型 + 系统内部动作类型)
|
||||
export const orderTypeConfig: Record<string, string> = {
|
||||
// ===== 订单/单据 =====
|
||||
ORDER: '订单',
|
||||
ORDER_CANCEL: '取消订单',
|
||||
CGRK: '采购入库',
|
||||
JYCK: '交易出库',
|
||||
CGTH: '采购退货',
|
||||
JYTH: '交易退货',
|
||||
SCRK: '生产入库',
|
||||
SHRK: '收货入库',
|
||||
DELIVERY_ORDER: '出库单',
|
||||
RECEIVING: '收货单',
|
||||
ENTRY_ORDER: '入库单',
|
||||
entry_order: '入库单',
|
||||
INVENTORY: '盘点单',
|
||||
RETURN: '退货单',
|
||||
|
||||
// ===== 入库单类型(与 storage/entry 筛选项同源) =====
|
||||
CGRK: '采购入库',
|
||||
THRK: '退货入库',
|
||||
QTRK: '其他入库',
|
||||
PDRK: '盘点入库',
|
||||
SCRK: '生产入库',
|
||||
SHRK: '收货入库',
|
||||
LYRK: '领用入库',
|
||||
CCRK: '拆解入库',
|
||||
DBRK: '调拨入库',
|
||||
B2BRK: 'B2B入库',
|
||||
XNRK: '虚拟入库',
|
||||
MATCH: '入库匹配',
|
||||
|
||||
// ===== 出库单类型(与 storage/stockout 单据类型同源) =====
|
||||
PTCK: '普通出库',
|
||||
QTCK: '其他出库',
|
||||
JYCK: '交易出库',
|
||||
DBCK: '调拨出库',
|
||||
THCK: '退货出库',
|
||||
PDCK: '盘点出库',
|
||||
LYCK: '领用出库',
|
||||
SCCK: '生产出库',
|
||||
CCCK: '拆解出库',
|
||||
B2BCK: 'B2B出库',
|
||||
XNCK: '虚拟出库',
|
||||
CGTH: '采购退货',
|
||||
JYTH: '交易退货',
|
||||
|
||||
// ===== 拣货/系统内部动作 =====
|
||||
PICK_OUTBOUND: '拣货出库',
|
||||
PICK_RETURN: '拣货返还',
|
||||
entry_order: '入库单',
|
||||
INTERCEPT_GAP: '拦截差异'
|
||||
PICKING_LOCK: '拣货锁定',
|
||||
PICKING_UNLOCK: '拣货解锁',
|
||||
INTERCEPT_GAP: '拦截差异',
|
||||
|
||||
// ===== 货主库存 / 库存转移 =====
|
||||
STOCK_STORE_INBOUND: '货主库存入库',
|
||||
STOCK_STORE_OUTBOUND: '货主库存出库',
|
||||
STOCK_TRANSFER_IN: '库存移入',
|
||||
STOCK_TRANSFER_OUT: '库存移出'
|
||||
}
|
||||
|
||||
export function getOrderTypeLabel(type: string): string {
|
||||
return orderTypeConfig[type] || type || '—'
|
||||
if (!type) return '—'
|
||||
const key = String(type).trim()
|
||||
return orderTypeConfig[key] ?? orderTypeConfig[key.toUpperCase()] ?? key
|
||||
}
|
||||
|
||||
/** 库存类型展示文本(兼容后端小写/带空格的枚举值) */
|
||||
|
||||
@ -502,10 +502,21 @@
|
||||
<el-button size="small" type="primary" :loading="systemProductLoading" @click="querySystemProducts(1)">
|
||||
查询
|
||||
</el-button>
|
||||
<!-- 货主过滤为可选开关:默认启用,收货单未绑定货主时禁用 -->
|
||||
<el-checkbox
|
||||
v-model="filterByReceivingStore"
|
||||
size="small"
|
||||
:disabled="!boundStoreId"
|
||||
class="system-product-filter-switch"
|
||||
@change="querySystemProducts(1)"
|
||||
>
|
||||
按收货单货主过滤
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<span class="system-product-filter-hint">
|
||||
<template v-if="boundStoreId">已按收货单货主过滤:{{ boundStoreName || ('ID ' + boundStoreId) }}</template>
|
||||
<template v-else>当前收货单未绑定货主,查询不过滤货主</template>
|
||||
<template v-if="!boundStoreId">当前收货单未绑定货主,查询不过滤货主</template>
|
||||
<template v-else-if="filterByReceivingStore">已按收货单货主过滤{{ boundStoreName ? `:${boundStoreName}` : '' }}</template>
|
||||
<template v-else>未按货主过滤,可查到全部货主的商品</template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -1275,6 +1286,8 @@ const systemProductResults = ref<any[]>([])
|
||||
const systemProductAllResults = ref<any[]>([])
|
||||
const systemProductSelection = ref<any[]>([])
|
||||
const systemProductPagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
/** 查询系统商品时是否自动按收货单货主过滤(可选功能,默认启用;收货单未绑定货主时开关不可用) */
|
||||
const filterByReceivingStore = ref(true)
|
||||
|
||||
/** 条码列多值折叠取值:只显示首个条码 + `+N` 展开全部(UpperTable copyAction 内置能力) */
|
||||
const getSystemProductBarcodes = (row: any): unknown[] =>
|
||||
@ -2306,6 +2319,8 @@ const openEditSystemProductPicker = async () => {
|
||||
const openSystemProductPicker = async () => {
|
||||
systemProductPickerVisible.value = true
|
||||
systemProductSelection.value = []
|
||||
// 每次打开恢复默认:按收货单货主过滤
|
||||
filterByReceivingStore.value = true
|
||||
await querySystemProducts(1)
|
||||
}
|
||||
|
||||
@ -2455,12 +2470,13 @@ const onSystemProductPageSizeChange = (size: number) => {
|
||||
applySystemProductPageSlice()
|
||||
}
|
||||
|
||||
/** 查询系统商品:使用 stock.warehouse.search 关键字检索(store_id + keyword),一次取回全部匹配后本地分页 */
|
||||
/** 查询系统商品:使用 stock.warehouse.search 关键字检索(keyword + 可选 store_id),一次取回全部匹配后本地分页 */
|
||||
const querySystemProducts = async (page = 1) => {
|
||||
systemProductLoading.value = true
|
||||
try {
|
||||
const keyword = String(systemProductKeyword.value ?? '').trim()
|
||||
const storeId = boundStoreId.value
|
||||
// 货主过滤为可选功能(默认启用):关闭时查询全部货主的商品
|
||||
const storeId = filterByReceivingStore.value ? boundStoreId.value : undefined
|
||||
|
||||
const requestData: { keyword?: string; store_id?: number } = {}
|
||||
if (keyword) {
|
||||
@ -3624,6 +3640,17 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 按收货单货主过滤开关:默认勾选,未绑定货主时禁用 */
|
||||
.system-product-filter-switch {
|
||||
margin-left: 4px;
|
||||
margin-right: 0;
|
||||
height: 24px;
|
||||
|
||||
:deep(.el-checkbox__label) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 收货单货主过滤说明:与查询行同行、靠右,纯文字无容器背景 */
|
||||
.system-product-filter-hint {
|
||||
margin-left: auto;
|
||||
|
||||
@ -590,6 +590,8 @@ import {
|
||||
stockoutToolbarButtons,
|
||||
formatStockoutData,
|
||||
formatStockoutListItems,
|
||||
formatStockoutOrderType,
|
||||
formatStockoutSourceType,
|
||||
normalizeStockoutWaybillCodes,
|
||||
splitStockoutWaybillCodes,
|
||||
isSameStockoutWaybillCodes,
|
||||
@ -1520,6 +1522,12 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
|
||||
if (col.prop === 'sync_status') {
|
||||
return syncStatusConfig[val as keyof typeof syncStatusConfig]?.text || val || ''
|
||||
}
|
||||
if (col.prop === 'order_type') {
|
||||
return formatStockoutOrderType(val)
|
||||
}
|
||||
if (col.prop === 'source_type') {
|
||||
return formatStockoutSourceType(val)
|
||||
}
|
||||
return val === null || val === undefined ? '' : val
|
||||
})
|
||||
)
|
||||
|
||||
@ -142,6 +142,55 @@ export const syncStatusConfig: Record<string, { text: string; tagType: string }>
|
||||
failed: { text: '同步失败', tagType: 'danger' }
|
||||
}
|
||||
|
||||
/**
|
||||
* 单据类型 order_type(出库单):接口返回英文编码,展示时转中文。
|
||||
* 覆盖「XXCK」全套出库单据类型(与入库 CGRK/THRK/QTRK… 同一套编码规则),
|
||||
* 同时保留历史英文枚举 TRANSFER / RETURN 兼容旧数据。
|
||||
*/
|
||||
export const stockoutOrderTypeConfig: Record<string, string> = {
|
||||
PTCK: '普通出库',
|
||||
QTCK: '其他出库',
|
||||
JYCK: '交易出库',
|
||||
DBCK: '调拨出库',
|
||||
THCK: '退货出库',
|
||||
PDCK: '盘点出库',
|
||||
LYCK: '领用出库',
|
||||
SCCK: '生产出库',
|
||||
CCCK: '拆解出库',
|
||||
B2BCK: 'B2B出库',
|
||||
XNCK: '虚拟出库',
|
||||
GFCK: '采购退货出库',
|
||||
HHCK: '换货出库',
|
||||
BFCK: '补发出库',
|
||||
JXCK: '借出出库',
|
||||
// 历史/兼容英文枚举
|
||||
TRANSFER: '调拨出库',
|
||||
RETURN: '退货出库'
|
||||
}
|
||||
|
||||
/** 来源类型 source_type:QM=奇门 / API=接口 / WMS=系统(与 storage 模块其它页面同源) */
|
||||
export const stockoutSourceTypeConfig: Record<string, string> = {
|
||||
QM: '奇门',
|
||||
API: '接口',
|
||||
WMS: '系统'
|
||||
}
|
||||
|
||||
/** 单据类型展示文本(兼容大小写;已是中文/未知枚举直接原样返回) */
|
||||
export function formatStockoutOrderType(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') return '--'
|
||||
const key = String(value).trim()
|
||||
const hit = stockoutOrderTypeConfig[key] ?? stockoutOrderTypeConfig[key.toUpperCase()]
|
||||
return hit ?? key
|
||||
}
|
||||
|
||||
/** 来源类型展示文本(兼容大小写;已是中文/未知枚举直接原样返回) */
|
||||
export function formatStockoutSourceType(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') return '--'
|
||||
const key = String(value).trim()
|
||||
const hit = stockoutSourceTypeConfig[key] ?? stockoutSourceTypeConfig[key.toUpperCase()]
|
||||
return hit ?? key
|
||||
}
|
||||
|
||||
// 时间格式化函数
|
||||
export function formatDateTime(dateStr: string): string {
|
||||
if (!dateStr) return '--'
|
||||
@ -220,8 +269,8 @@ export const entryColums = [
|
||||
{ prop: 'order_status', label: '出库状态', width: '100' },
|
||||
{ prop: 'sync_status', label: '同步状态', width: '100' },
|
||||
{ prop: 'sync_message', label: '同步消息', minWidth: '140', showOverflowTooltip: true },
|
||||
{ prop: 'order_type', label: '单据类型', width: '100' },
|
||||
{ prop: 'source_type', label: '来源类型', width: '100' },
|
||||
{ prop: 'order_type', label: '单据类型', width: '100', formatter: (row: any) => formatStockoutOrderType(row?.order_type) },
|
||||
{ prop: 'source_type', label: '来源类型', width: '100', formatter: (row: any) => formatStockoutSourceType(row?.source_type) },
|
||||
{ prop: 'store_name', label: '货主', minWidth: '140', formatter: (row: any) => String(row?.store_name || '').trim() || '--' },
|
||||
{ prop: 'source_platform_name', label: '来源平台', width: '130', formatter: (row: any) => String(row?.source_platform_name || '').trim() || '--' },
|
||||
{ prop: 'extend_props', label: '转单订单号', width: '180', formatter: (row: any) => formatTransferredOrderCode(row) },
|
||||
|
||||
@ -225,6 +225,7 @@
|
||||
<upper-table
|
||||
ref="balanceLogTableRef"
|
||||
table-id="store-balance-logs"
|
||||
default-align="center"
|
||||
:data="balanceLogList"
|
||||
:columns="balanceLogColumns"
|
||||
:show-selection="true"
|
||||
@ -1605,15 +1606,15 @@ const balanceLogPagination = reactive({
|
||||
total: 0
|
||||
})
|
||||
|
||||
/** 余额变动表格列(序号列已移除) */
|
||||
/** 余额变动表格列(序号列已移除;统一居中显示,与货主列表一致) */
|
||||
const balanceLogColumns = [
|
||||
{ prop: 'created_at', label: '变动时间', minWidth: 160, showOverflowTooltip: true },
|
||||
{ prop: 'before_quantity', label: '变动前', minWidth: 90, align: 'right' },
|
||||
{ prop: 'after_quantity', label: '变动后', minWidth: 90, align: 'right' },
|
||||
{ prop: 'delta', label: '变动值', minWidth: 90, align: 'right' },
|
||||
{ prop: 'before_quantity', label: '变动前', minWidth: 90 },
|
||||
{ prop: 'after_quantity', label: '变动后', minWidth: 90 },
|
||||
{ prop: 'delta', label: '变动值', minWidth: 90 },
|
||||
{ prop: 'change_type_label', label: '变动类型', minWidth: 120 },
|
||||
{ prop: 'business_type_label', label: '业务类型', minWidth: 120 },
|
||||
{ prop: 'business_id', label: '业务ID', minWidth: 100, align: 'right' },
|
||||
{ prop: 'business_id', label: '业务ID', minWidth: 100 },
|
||||
{ prop: 'operator', label: '操作人', minWidth: 120 },
|
||||
{ prop: 'reason', label: '原因', minWidth: 220, showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user