WEB/src/views/order/orderManagement/config/order-common-config.ts
2026-05-09 18:18:05 +08:00

1246 lines
50 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 通用翻译映射
export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
is_urgency: {
'Y': '是',
'N': '否'
},
status: {
'pedding': '待审核',
'created': '已创建',
'cancel': '已取消',
'error': '错误',
'after-sales-error': '售后异常',
'finished': '已完成',
'cancelled': '已作废',
'archived': '已归档'
},
sync_status: {
'padding': '待同步',
'pedding': '待同步',
'pending': '待同步',
'fin': '已完成',
'error': '错误',
'none': '未同步'
},
order_status: {
'WAIT_AUDIT': '待审核',
'AUDITED': '已审核'
},
storage_status: {
'none': '未分配',
'padding': '分配中',
'fin': '已完成',
'error': '错误'
},
print_status: {
'none': '未打印',
'padding': '打印中',
'fin': '已完成'
},
pick_status: {
'none': '未拣货',
'padding': '拣货中',
'fin': '已完成'
},
pack_status: {
'none': '未打包',
'padding': '打包中',
'fin': '已完成'
},
intercept_status: {
'none': '无',
'pending': '待拦截',
'success': '已拦截'
},
invoice_flag: {
'Y': '是',
'N': '否'
},
post_status: {
'padding': '分配中',
'fin': '已分配',
'timeout': '超时',
'error': '错误',
'none': '未分配'
},
outbound_status: {
'none': '未出库',
'padding': '待出库',
'pending': '待出库',
'pedding': '待出库',
'processing': '出库中',
'fin': '已出库',
'done': '已出库',
'finished': '已出库',
'error': '出库异常',
'failed': '出库失败'
},
source_platform_code: {
'OFFLINE': '线下',
'PDD': '拼多多',
'JD': '京东',
'TAOBAO': '淘宝',
'TB': '淘宝'
},
/** 与 list 接口 raw 行字段一致(同 source_platform_code 展示映射) */
sys_platform_code: {
'OFFLINE': '线下',
'PDD': '拼多多',
'JD': '京东',
'TAOBAO': '淘宝',
'TB': '淘宝'
},
inspection_status: {
'none': '未审核',
'pending': '待审核',
'padding': '审核中',
'fin': '审核通过',
'reject': '审核驳回',
'error': '审核异常'
}
}
// 通用标签类型映射
export const COMMON_TAG_TYPES: Record<string, Record<string, string>> = {
is_urgency: {
'Y': 'danger',
'N': 'info'
},
status: {
'pedding': 'warning',
'pending': 'warning',
'created': 'success',
'cancel': 'danger',
'cancelled': 'danger',
'error': 'danger',
'after-sales-error': 'danger',
'finished': 'success',
'archived': 'info'
},
sync_status: {
'padding': 'warning',
'pedding': 'warning',
'pending': 'warning',
'fin': 'success',
'error': 'danger',
'none': 'info'
},
order_status: {
'WAIT_AUDIT': 'warning',
'AUDITED': 'success'
},
storage_status: {
'none': 'info',
'padding': 'warning',
'pending': 'warning',
'fin': 'success',
'error': 'danger'
},
print_status: {
'none': 'info',
'padding': 'warning',
'pending': 'warning',
'fin': 'success'
},
pick_status: {
'none': 'info',
'padding': 'warning',
'pending': 'warning',
'fin': 'success'
},
pack_status: {
'none': 'info',
'padding': 'warning',
'pending': 'warning',
'fin': 'success'
},
post_status: {
'padding': 'warning',
'pending': 'warning',
'fin': 'success',
'timeout': 'danger',
'error': 'danger',
'none': 'info'
},
outbound_status: {
'none': 'info',
'padding': 'warning',
'pending': 'warning',
'pedding': 'warning',
'processing': 'warning',
'fin': 'success',
'done': 'success',
'finished': 'success',
'error': 'danger',
'failed': 'danger'
},
inspection_status: {
'none': 'info',
'pending': 'warning',
'padding': 'warning',
'fin': 'success',
'reject': 'danger',
'error': 'danger'
}
}
export interface ToolbarButtonConfig {
key: string
label: string
dynamicLabelKey?: string
size?: '' | 'default' | 'small' | 'large'
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
plain?: boolean
loadingKey?: string
disabledKey?: string
action: string
}
export interface ToolbarApiActionConfig {
action: string
apiMethod: string
payloadKey?: string
confirmText?: string
confirmType?: 'warning' | 'error' | 'info' | 'success'
successText: string
failText: string
}
export const ORDER_TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
refresh: { key: 'refresh', label: '刷新', type: 'primary', size: 'small', action: 'loadData' },
export: { key: 'export', label: '导出', size: 'small', loadingKey: 'exportLoading', action: 'handleExport' },
columnConfig: { key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
toggleDetail: { key: 'toggleDetail', label: '显示详情', dynamicLabelKey: 'detailToggleLabel', size: 'small', action: 'toggleDetailVisible' },
reverseReview: { key: 'reverseReview', label: '反审回待审核', size: 'small', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleReverseReview' },
markPendingOutbound: { key: 'markPendingOutbound', label: '标记待出库', size: 'small', type: 'warning', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleMarkPendingOutbound' },
allocateStorage: { key: 'allocateStorage', label: '分配储位', size: 'small', type: 'primary', plain: true, loadingKey: 'storageAllocateLoading', disabledKey: 'hasNoSelection', action: 'openStorageAllocateDialog' },
cancelAllocateStorage: { key: 'cancelAllocateStorage', label: '取消分配储位', size: 'small', type: 'danger', plain: true, loadingKey: 'storageAllocateLoading', disabledKey: 'hasNoSelection', action: 'openStorageCancelDialog' },
waveSingleFetchByIds: {
key: 'waveSingleFetchByIds',
label: '抓取散单',
size: 'small',
type: 'primary',
plain: true,
loadingKey: 'waveSingleFetchLoading',
disabledKey: 'hasNoSelection',
action: 'handleWaveSingleFetchByIds'
},
allocateExpress: { key: 'allocateExpress', label: '分配快递号', size: 'small', type: 'success', loadingKey: 'allocateLoading', disabledKey: 'hasNoSelection', action: 'openAllocateExpressDialog' },
updateExpress: { key: 'updateExpress', label: '修改快递', size: 'small', type: 'warning', plain: true, loadingKey: 'updateOrderMetaLoading', disabledKey: 'hasNoSelection', action: 'openUpdateOrderExpressDialog' },
updatePlatform: { key: 'updatePlatform', label: '修改平台', size: 'small', type: 'info', plain: true, loadingKey: 'updateOrderMetaLoading', disabledKey: 'hasNoSelection', action: 'openUpdateOrderPlatformDialog' },
manualCreate: { key: 'manualCreate', label: '手动建单', size: 'small', type: 'primary', plain: true, action: 'openManualCreateDialog' },
excelImportCreate: { key: 'excelImportCreate', label: 'Excel导入建单', size: 'small', type: 'success', plain: true, action: 'openImportOrderDialog' },
cloneOrder: { key: 'cloneOrder', label: '克隆订单', size: 'small', type: 'warning', plain: true, loadingKey: 'cloneOrderLoading', disabledKey: 'notSingleSelection', action: 'openCloneOrderDialog' },
syncOrderIds: { key: 'syncOrderIds', label: '同步订单', size: 'small', type: 'primary', plain: true, loadingKey: 'syncOrderIdsLoading', disabledKey: 'hasNoSelection', action: 'openSyncOrderIdsDialog' },
cancelOrder: { key: 'cancelOrder', label: '取消订单', size: 'small', type: 'danger', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleCancelOrder' },
batchReview: { key: 'batchReview', label: '批量审核通过', size: 'small', type: 'success', loadingKey: 'reviewSubmitting', disabledKey: 'hasNoSelection', action: 'handleBatchReview' },
manualOutboundMigrate: {
key: 'manualOutboundMigrate',
label: '手动出库迁移',
size: 'small',
type: 'warning',
loadingKey: 'manualLoading',
disabledKey: 'hasNoOutboundTarget',
action: 'handleToolbarManualOutbound'
},
resolveException: {
key: 'resolveException',
label: '处理异常订单',
size: 'small',
type: 'warning',
loadingKey: 'resolveExceptionLoading',
disabledKey: 'hasNoSelection',
action: 'openResolveExceptionDialog'
}
}
export function pickToolbarButtons(keys: string[]) {
return keys
.map((key) => ORDER_TOOLBAR_BUTTONS[key])
.filter((button): button is ToolbarButtonConfig => Boolean(button))
}
export const PENDING_TOOLBAR_API_ACTIONS: ToolbarApiActionConfig[] = [
{
action: 'handleReverseReview',
apiMethod: 'reverseReviewOrder',
payloadKey: 'ids',
confirmText: '确定将选中的 {count} 条订单反审回待审核吗?',
confirmType: 'warning',
successText: '反审成功',
failText: '反审失败'
},
{
action: 'handleMarkPendingOutbound',
apiMethod: 'markPendingOutboundOrder',
payloadKey: 'ids',
confirmText: '确定将选中的 {count} 条订单标记为待出库吗?',
confirmType: 'warning',
successText: '标记待出库成功',
failText: '标记待出库失败'
},
{
action: 'handleCancelOrder',
apiMethod: 'cancelOrder',
payloadKey: 'ids',
confirmText: '确定取消选中的 {count} 条订单吗?',
confirmType: 'error',
successText: '取消订单成功',
failText: '取消订单失败'
}
]
export const REVIEW_TOOLBAR_API_ACTIONS: ToolbarApiActionConfig[] = [
{
action: 'handleBatchReview',
apiMethod: 'reviewOrder',
payloadKey: 'ids',
confirmText: '确定审核通过选中的 {count} 条订单吗?',
confirmType: 'warning',
successText: '审核成功',
failText: '订单审核失败,请稍后重试'
}
]
function normalizeUrgencyValue(value: any): string | undefined {
if (value === true || value === 1 || value === '1') return 'Y'
if (value === false || value === 0 || value === '0') return 'N'
const s = String(value).trim().toUpperCase()
if (s === 'Y' || s === 'YES' || s === 'TRUE') return 'Y'
if (s === 'N' || s === 'NO' || s === 'FALSE') return 'N'
return undefined
}
function normalizeSyncStatusKey(value: any): string {
return String(value ?? '').trim()
}
export function getTagType(field: string, value: any) {
if (field === 'is_urgency') {
const y = normalizeUrgencyValue(value)
const urgencyTags = COMMON_TAG_TYPES['is_urgency']
if (y && urgencyTags && urgencyTags[y] !== undefined) {
return urgencyTags[y]
}
}
const map = COMMON_TAG_TYPES[field]
if (map) {
if (map[value] !== undefined) return map[value]
if (field === 'sync_status') {
const k = normalizeSyncStatusKey(value)
if (k && map[k] !== undefined) return map[k]
const lower = k.toLowerCase()
const hit = Object.keys(map).find((key) => key.toLowerCase() === lower)
if (hit) return map[hit]
}
}
return 'info'
}
export function translateOrderField(field: string, value: any) {
if (value === null || value === undefined || value === '') {
return '-'
}
if (field === 'is_urgency') {
const y = normalizeUrgencyValue(value)
const urgencyText = COMMON_TRANSLATIONS['is_urgency']
if (y && urgencyText && urgencyText[y] !== undefined) {
return urgencyText[y]
}
}
const table = COMMON_TRANSLATIONS[field]
if (table) {
if (table[value] !== undefined) return table[value]
if (field === 'sync_status') {
const k = normalizeSyncStatusKey(value)
if (k && table[k] !== undefined) return table[k]
const lower = k.toLowerCase()
const hit = Object.keys(table).find((key) => key.toLowerCase() === lower)
if (hit) return table[hit]
}
}
return value
}
function pad2(value: number) {
return String(value).padStart(2, '0')
}
export function formatOrderTime(value: unknown) {
if (value === undefined || value === null || value === '') return '-'
if (value instanceof Date) {
if (Number.isNaN(value.getTime())) return '-'
return `${value.getFullYear()}-${pad2(value.getMonth() + 1)}-${pad2(value.getDate())} ${pad2(value.getHours())}:${pad2(value.getMinutes())}:${pad2(value.getSeconds())}`
}
if (typeof value === 'number' || /^\d+$/.test(String(value))) {
const raw = Number(value)
if (!Number.isFinite(raw)) return String(value)
const milliseconds = raw < 1000000000000 ? raw * 1000 : raw
const date = new Date(milliseconds)
if (Number.isNaN(date.getTime())) return String(value)
return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())}`
}
const text = String(value).trim()
if (!text) return '-'
const date = new Date(text)
if (Number.isNaN(date.getTime())) return text
return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())}`
}
function orderTimeFormatter(_row: any, _column: any, cellValue: unknown) {
return formatOrderTime(cellValue)
}
function waybillCodesFormatter(_row: any, _column: any, cellValue: unknown) {
if (cellValue === undefined || cellValue === null || cellValue === '') return '-'
const normalizeList = (list: any[]) =>
list
.map((item) => String(item ?? '').trim())
.filter((item) => item.length > 0)
.join(', ')
if (Array.isArray(cellValue)) {
const text = normalizeList(cellValue)
return text || '-'
}
const text = String(cellValue).trim()
if (!text) return '-'
// 兼容后端返回 JSON 字符串:["776..."] / ["A","B"]
if (text.startsWith('[') && text.endsWith(']')) {
try {
const parsed = JSON.parse(text)
if (Array.isArray(parsed)) {
const normalized = normalizeList(parsed)
return normalized || '-'
}
} catch {
// 非法 JSON 时回退原文
}
}
return text
}
/** 订单详情 descriptions 中需格式化为本地时间的字段(与列表 formatter 一致) */
export const ORDER_DETAIL_TIME_FIELDS = new Set([
'place_order_time',
'pay_time',
'create_at',
'created_at',
'updated_at',
'operate_time'
])
/**
* 仅列表基础能力:刷新 / 导出 / 字段设置 / 详情开关。
*/
export const simpleListToolbarButtonKeys = [
'refresh',
'export',
'columnConfig',
'toggleDetail'
]
export const simpleListToolbarButtons = pickToolbarButtons(simpleListToolbarButtonKeys)
/** ScanBox:波次分配 → where.wave_id 为 { operator: 'eq'|'ne', value: 0 } */
export const waveAssignmentScanField = {
label: '波次分配',
value: 'wave_id',
type: 'select',
conditionType: 'number',
options: [
{ label: '未分配波次', value: '__wave_assign_eq_0__', operator: 'eq', conditionValue: 0 },
{ label: '已分配波次', value: '__wave_assign_ne_0__', operator: 'ne', conditionValue: 0 }
]
}
/** ScanBox:快递公司(快递编码),选项由 index.getExpressList + fillExpressCompanyScanFieldOptions 注入 */
export const expressCompanyScanField = {
label: '快递公司',
value: 'logistics_code',
type: 'select',
options: [] as Array<{ label: string; value: string }>
}
export function mapExpressListToCompanySelectOptions(rawList: any[]): Array<{ label: string; value: string }> {
const result: Array<{ label: string; value: string }> = []
const seen = new Set<string>()
for (const item of rawList || []) {
const codeRaw = ['code', 'logistics_code', 'express_code']
.map((k) => item?.[k])
.find((v) => v !== undefined && v !== null && v !== '')
const code = String(codeRaw ?? '').trim()
if (!code || seen.has(code)) continue
const nameRaw = ['name', 'logistics_name', 'express_name']
.map((k) => item?.[k])
.find((v) => v !== undefined && v !== null && v !== '')
const name = String(nameRaw ?? '').trim()
result.push({ value: code, label: name ? `${code} - ${name}` : code })
seen.add(code)
}
return result
}
export function fillExpressCompanyScanFieldOptions(availableFields: any[], expressRaw: any[]) {
const field = availableFields.find((f: any) => f.value === 'logistics_code')
if (field) field.options = mapExpressListToCompanySelectOptions(expressRaw)
}
// deliveryOrder相关配置
export const deliveryAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'delivery_order_code', type: 'text' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
{ label: '来源平台', value: 'sys_platform_name', type: 'select', options: [] },
{ label: '收货人', value: 'name', type: 'text' },
{ label: '手机号', value: 'mobile', type: 'text' },
{ label: '物流公司', value: 'logistics_name', type: 'select', options: [] },
expressCompanyScanField,
{ label: '物流单号', value: 'waybill_codes', type: 'text' },
{ label: '紧急订单', value: 'is_urgency', type: 'select', options: [
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' },
]},
{ label: '同步状态', value: 'sync_status', type: 'select', options: [
{ label: '待同步', value: 'padding' },
{ label: '已同步', value: 'fin' },
{ label: '错误', value: 'error' }
]},
{ label: '出库状态', value: 'outbound_status', type: 'select', options: [
{ label: '未出库', value: 'none' },
{ label: '待出库', value: 'padding' },
{ label: '已出库', value: 'fin' }
]},
{ label: '创建时间', value: 'create_at', type: 'daterange' },
{ label: '支付时间', value: 'pay_time', type: 'daterange' },
]
export const deliveryColumns = [
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'delivery_order_code', label: '配送单号', width: '170' },
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'sys_platform_code', label: '平台来源', width: '100' },
{ prop: 'name', label: '收货人', width: '100' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'outbound_status', label: '出库状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'storage_status', label: '储位', width: '100' },
{ prop: 'post_status', label: '快递', width: '100' },
{ prop: 'pick_status', label: '拣货', width: '100' },
{ prop: 'pack_status', label: '打包', width: '100' },
{ prop: 'logistics_name', label: '物流公司', width: '120' },
{ prop: 'waybill_codes', label: '物流单号', width: '160', formatter: waybillCodesFormatter },
{ prop: 'is_urgency', label: '紧急', width: '80' },
{ prop: 'dispatch_lane', label: '道口', width: '80' },
{ prop: 'items_count', label: '商品种类', width: '100' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'delivery_time', label: '配送时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
]
export const deliverydetail = [
{ label: '订单总金额', prop: 'total_amount' },
{ label: '商品总金额', prop: 'item_amount' },
{ label: '订单折扣金额', prop: 'discount_amount' },
{ label: '商品名称(预留位置)', prop: 'item_name' },
{ label: '商品SKU', prop: 'items' },
{ label: '商品种类数', prop: 'items_count' },
{ label: '商品总数', prop: 'items_total' },
{ label: '总重量', prop: 'items_weight' },
{ label: '货主', prop: 'store_id' },
{ label: '国家编码', prop: 'country_code' },
{ label: '详细地址', prop: 'detail_address' },
]
export const deliverybuttonList: any[] = [
{
label: 'EXCEL操作',
type: 'dropdown',
command: 'handleDeliveryOperation',
options: [
{ label: '导出配送单(不含明细)', value: 'export-delivery-nodetail' },
{ label: '快递号导入(含明细)', value: 'import-delivery-detail' },
]
},
{
label: '打印操作',
type: 'dropdown',
command: 'handleDeliveryPrintOperation',
options: [
{ label: '打印发货单', value: 'print-delivery' },
{ label: '打印拣货单', value: 'print-picking' },
{ label: '打印面单(菜鸟)', value: 'print-waybill-cainiao', divided: true },
{ label: '打印面单(拼多多)', value: 'print-waybill-pdd' },
]
},
]
/** deliveryOrder */
export const deliveryOrderToolbarButtonKeys = simpleListToolbarButtonKeys
export const deliveryOrderToolbarButtons = simpleListToolbarButtons
// revieworder相关配置
export const reviewAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '发货单号', value: 'delivery_order_code', type: 'text' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
{ label: '平台编码', value: 'sys_platform_code', type: 'select', options: [] },
{ label: '收货人', value: 'name', type: 'text' },
{ label: '手机号', value: 'mobile', type: 'text' },
expressCompanyScanField,
{ label: '订单状态', value: 'status', type: 'select', options: [ { label: '待审核', value: 'pedding' }, { label: '已创建', value: 'created' }, { label: '错误', value: 'error' } ] },
{ label: '是否紧急', value: 'is_urgency', type: 'select', options: [ { label: '是', value: 'Y' }, { label: '否', value: 'N' } ] },
{ label: '同步状态', value: 'sync_status', type: 'select', options: [ { label: '待同步', value: 'padding' }, { label: '已完成', value: 'fin' }, { label: '错误', value: 'error' }, { label: '未同步', value: 'none' } ] },
{ label: '创建时间', value: 'create_at', type: 'daterange' },
]
export const reviewColums = [
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'sys_platform_code', label: '平台编码', width: '100' },
{ prop: 'name', label: '收货人', width: '110' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'is_urgency', label: '紧急', width: '80' },
{ prop: 'logistics_name', label: '物流公司', width: '120' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'pay_time', label: '支付时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'operator_name', label: '审核人', width: '100' },
{ prop: 'operate_time', label: '审核时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
]
export const reviewOrderDetail = [
// 基础信息
{ prop: 'delivery_order_code', label: '发货单号' },
{ prop: 'pre_delivery_order_code', label: '前置单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
{ prop: 'sys_platform_name', label: '来源平台' },
{ prop: 'sys_platform_code', label: '平台编码' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
{ prop: 'status', label: '订单状态' },
{ prop: 'is_urgency', label: '是否紧急' },
{ prop: 'invoice_flag', label: '发票标记' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'inspection_status', label: '审核状态' },
{ prop: 'source_order_codes', label: '来源单号' },
{ prop: 'pay_no', label: '支付单号' },
// 金额与商品
{ prop: 'total_amount', label: '订单总金额' },
{ prop: 'item_amount', label: '商品金额' },
{ prop: 'discount_amount', label: '折扣金额' },
{ prop: 'freight', label: '运费' },
{ prop: 'ar_amount', label: '应收金额' },
{ prop: 'got_amount', label: '实收金额' },
{ prop: 'items', label: '商品清单', span: 3 },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
// 收货与物流
{ prop: 'name', label: '收货人' },
{ prop: 'mobile', label: '手机号码' },
{ prop: 'tel', label: '固定电话' },
{ prop: 'province', label: '省份' },
{ prop: 'city', label: '城市' },
{ prop: 'area', label: '区县' },
{ prop: 'town', label: '镇街' },
{ prop: 'detail_address', label: '详细地址', span: 2 },
{ prop: 'zip_code', label: '邮编' },
{ prop: 'logistics_name', label: '物流公司' },
{ prop: 'waybill_codes', label: '物流单号' },
{ prop: 'delivery_type', label: '发货类型' },
{ prop: 'weight_type', label: '重量类型' },
// 时间信息
{ prop: 'place_order_time', label: '下单时间' },
{ prop: 'pay_time', label: '支付时间' },
{ prop: 'delivery_time', label: '配送时间' },
{ prop: 'create_at', label: '创建时间' },
{ prop: 'operator_name', label: '审核人' },
{ prop: 'operate_time', label: '审核时间' },
]
export const reviewOrderbuttonList: any[] = [
{
label: '审核操作',
type: 'dropdown',
command: 'handleReviewOperation',
options: [
{ label: '审核通过', value: 'approve' },
{ label: '审核驳回', value: 'reject' },
]
}
]
export const reviewToolbarButtonKeys = [
...simpleListToolbarButtonKeys,
'manualCreate',
'batchReview'
]
/** 页面级按钮列表:reviewOrder 直接消费,避免页面内重复拼装 */
export const reviewToolbarButtons = pickToolbarButtons(reviewToolbarButtonKeys)
/** entrustWarehouse(委托外仓) */
export const entrustWarehouseToolbarButtonKeys = simpleListToolbarButtonKeys
export const entrustWarehouseToolbarButtons = simpleListToolbarButtons
/** deliveryException(配送异常) */
export const deliveryExceptionToolbarButtonKeys = simpleListToolbarButtonKeys
export const deliveryExceptionToolbarButtons = simpleListToolbarButtons
/** 待出库:在简单列表基础上增加手动出库迁移 */
export const outboundToolbarButtonKeys = [
...simpleListToolbarButtonKeys,
'manualOutboundMigrate',
]
export const outboundToolbarButtons = pickToolbarButtons(outboundToolbarButtonKeys)
// pendingOrder相关配置
export const pendingAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
{ label: '来源平台', value: 'sys_platform_name', type: 'select', options: [] },
{ label: '物流公司', value: 'logistics_name', type: 'select', options: [] },
expressCompanyScanField,
{ label: '快递单号', value: 'waybill_codes', type: 'text' },
{ label: '订单状态', value: 'status', type: 'select', options: [
{ label: '待审核', value: 'pedding' },
{ label: '已创建', value: 'created' },
{ label: '已取消', value: 'cancel' },
{ label: '错误', value: 'error' },
{ label: '售后异常', value: 'after-sales-error' },
{ label: '已完成', value: 'finished' },
{ label: '已作废', value: 'cancelled' },
{ label: '已归档', value: 'archived' },
] },
{ label:'快递', value: 'post_status', type: 'select', options: [
{ label: '未分配', value: 'none' },
{ label: '分配中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
] },
{ label: '储位', value: 'storage_status', type: 'select', options: [
{ label: '未分配', value: 'none' },
{ label: '分配中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
] },
{ label: '拣货状态', value: 'pick_status', type: 'select', options: [
{ label: '未拣货', value: 'none' },
{ label: '拣货中', value: 'padding' },
{ label: '已完成', value: 'fin' },
] },
{ label: '打包状态', value: 'pack_status', type: 'select', options: [
{ label: '未打包', value: 'none' },
{ label: '打包中', value: 'padding' },
{ label: '已完成', value: 'fin' },
] },
{ label: '是否紧急', value: 'is_urgency', type: 'select', options: [
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
]},
{ label: '同步状态', value: 'sync_status', type: 'select', options: [
{ label: '待同步', value: 'padding' },
{ label: '已同步', value: 'fin' },
{ label: '错误', value: 'error' }
] },
{ label: '收货人', value: 'name', type: 'text' },
{ label: '手机号', value: 'mobile', type: 'text' },
{ label: '省份', value: 'province', type: 'text' },
{ label: '城市', value: 'city', type: 'text' },
{ label: '区县', value: 'area', type: 'text' },
{ label: '下单时间', value: 'place_order_time', type: 'daterange' },
{ label: '创建时间', value: 'create_at', type: 'daterange' },
]
export const pendingCloums = [
{ prop: 'delivery_order_code', label: '发货单号', width: '170' ,fixed: 'left'},
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'storage_status', label: '储位', width: '100' },
{ prop: 'post_status', label: '快递', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '100' },
{ prop: 'pack_status', label: '打包状态', width: '100' },
{ prop: 'waybill_codes', label: '快递单号', width: '160', formatter: waybillCodesFormatter },
{ prop: 'items_count', label: '商品种类', width: '100' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'province', label: '省份', width: '100' },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'pay_time', label: '支付时间', width: '160', formatter: orderTimeFormatter },
{ prop: 'place_order_time', label: '时效', width: '165', formatter: orderTimeFormatter },
{ prop: 'sys_platform_name', label: '来源', width: '120' },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'remark', label: '留言', width: '160' },
]
export const pendingOrderDetail = [
// 基础信息
{ prop: 'delivery_order_code', label: '发货单号' },
{ prop: 'pre_delivery_order_code', label: '前置单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
{ prop: 'sys_platform_name', label: '来源平台' },
{ prop: 'sys_platform_code', label: '平台编码' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
{ prop: 'status', label: '订单状态' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'is_urgency', label: '是否紧急' },
{ prop: 'invoice_flag', label: '发票标记' },
{ prop: 'source_order_codes', label: '来源单号' },
{ prop: 'pay_no', label: '支付单号' },
// 金额与商品
{ prop: 'total_amount', label: '订单总金额' },
{ prop: 'item_amount', label: '商品金额' },
{ prop: 'discount_amount', label: '折扣金额' },
{ prop: 'freight', label: '运费' },
{ prop: 'ar_amount', label: '应收金额' },
{ prop: 'got_amount', label: '实收金额' },
{ prop: 'items', label: '商品清单', span: 3 },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
// 收货与物流
{ prop: 'name', label: '收货人' },
{ prop: 'mobile', label: '手机号码' },
{ prop: 'tel', label: '固定电话' },
{ prop: 'province', label: '省份' },
{ prop: 'city', label: '城市' },
{ prop: 'area', label: '区县' },
{ prop: 'town', label: '镇街' },
{ prop: 'detail_address', label: '详细地址', span: 2 },
{ prop: 'zip_code', label: '邮编' },
{ prop: 'logistics_name', label: '物流公司' },
{ prop: 'waybill_codes', label: '物流单号' },
{ prop: 'delivery_type', label: '发货服务类型' },
{ prop: 'weight_type', label: '重量类型' },
// 时间信息
{ prop: 'place_order_time', label: '下单时间' },
{ prop: 'pay_time', label: '支付时间' },
{ prop: 'delivery_time', label: '配送时间' },
{ prop: 'create_at', label: '创建时间' },
{ prop: 'operator_name', label: '操作人' },
{ prop: 'operate_time', label: '操作时间' },
]
export const pendingOrderbuttonList: any[] = [
{
label: 'EXCEL操作',
type: 'dropdown',
command: 'handleExcelOperation',
options: [
{ label: '订单导入', value: 'import-order' },
{ label: '快递号导入', value: 'import-delivery' },
{ label: '地址导入', value: 'import-address' },
{ label: '导出订单(不含明细)', value: 'export-summary', divided: true },
{ label: '导出订单(含明细)', value: 'export-detail' },
]
},
{
label: '打印操作',
type: 'dropdown',
command: 'handlePrintOperation',
options: [
{ label: '打印发货单', value: 'print-delivery' },
{ label: '打印拣货单', value: 'print-picking' },
{ label: '打印面单(菜鸟)', value: 'print-waybill-cainiao', divided: true },
{ label: '打印面单(拼多多)', value: 'print-waybill-pdd' },
]
},
{
label: '分配快递号',
type: 'dropdown',
command: 'handleAssignDelivery',
options: [
{ label: '分配快递号', value: 'assign-delivery' },
]
},
{
label: '拆分',
type: 'dropdown',
command: 'handleSplitOrder',
options: [
{ label: '拆分', value: 'split' },
]
}
]
export const pendingToolbarButtonKeys = [
...simpleListToolbarButtonKeys,
'reverseReview',
'markPendingOutbound',
'waveSingleFetchByIds',
'allocateStorage',
'cancelAllocateStorage',
'allocateExpress',
'updateExpress',
'updatePlatform',
'manualCreate',
'excelImportCreate',
'cloneOrder',
'syncOrderIds',
'cancelOrder'
]
/** 页面级按钮列表:pendingOrder 直接消费,避免页面内重复拼装 */
export const pendingToolbarButtons = pickToolbarButtons(pendingToolbarButtonKeys)
/**
* deliveryException
*/
export const exceptionToolbarButtonKeys = [
...pendingToolbarButtonKeys.filter((key) => key !== 'syncOrderIds'),
'resolveException'
]
export const exceptionToolbarButtons = pickToolbarButtons(exceptionToolbarButtonKeys)
// outboundOrder
export const outboundAvailableFields = pendingAvailableFields
export const outboundColumns = pendingCloums
// orderWorkbench相关配置
export const workbenchStatusOptions = [
{ label: '待处理', value: 'pedding' },
{ label: '已完成', value: 'fin' },
{ label: '异常', value: 'error' }
]
export const workbenchAvailableFields = [
{ label: '订单号', value: 'delivery_order_code', type: 'text' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '买家昵称', value: 'buyer_nick', type: 'text' },
{ label: '订单状态', value: 'status', type: 'select', options: workbenchStatusOptions },
{ label: '是否紧急', value: 'is_urgency', type: 'select', options: [ { label: '是', value: 'Y' }, { label: '否', value: 'N' } ] }
]
export const workbenchColumns = [
{ prop: 'delivery_order_code', label: '订单号', minWidth: 160 },
{ prop: 'wave_no', label: '波次号', minWidth: 160 },
{ prop: 'order_flag', label: '订单标记', minWidth: 260 },
{ prop: 'sys_platform_name', label: '平台', minWidth: 120 },
{ prop: 'shop_nick', label: '店铺名称', minWidth: 140 },
{ prop: 'buyer_nick', label: '买家昵称', minWidth: 140 },
{ prop: 'name', label: '收货人', minWidth: 100 },
{ prop: 'mobile', label: '手机号', minWidth: 120 },
{ prop: 'is_urgency', label: '是否紧急', minWidth: 100 },
{ prop: 'status', label: '订单状态', minWidth: 120 },
{ prop: 'sync_status', label: '同步状态', minWidth: 110 },
{ prop: 'inspection_status', label: '审核状态', minWidth: 110 },
{ prop: 'outbound_status', label: '出库状态', minWidth: 120 },
{ prop: 'logistics_name', label: '物流公司', minWidth: 120 },
{ prop: 'waybill_codes', label: '物流单号', minWidth: 140, formatter: waybillCodesFormatter },
{ prop: 'items_total', label: '商品总数', minWidth: 100 },
{ prop: 'total_amount', label: '订单金额', minWidth: 110 },
{ prop: 'create_at', label: '创建时间', minWidth: 170, formatter: orderTimeFormatter },
{ prop: 'updated_at', label: '更新时间', minWidth: 170, formatter: orderTimeFormatter }
]
export const workbenchBadgeItems = [
{ key: 'reviewOrder', label: '待审核' },
{ key: 'pendingOrder', label: '待处理' },
{ key: 'outboundOrder', label: '待出库' },
{ key: 'expectionOrder', label: '异常' },
{ key: 'entrustOrder', label: '委托外仓' },
{ key: 'deliveryOrder', label: '配送' },
{ key: 'deliveryExpectionOrder', label: '配送异常' },
{ key: 'archiveOrder', label: '归档' }
]
// expectionOrder相关配置
export const expectionOrderAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
{ label: '发货单号', value: 'delivery_order_code', type: 'text' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '物流公司', value: 'logistics_name', type: 'select', options: [] },
expressCompanyScanField,
{ label: '快递单号', value: 'express_code', type: 'text' },
{label:'是否紧急', value: 'is_urgency', type: 'select', options: [ { label: '是', value: 'Y' }, { label: '否', value: 'N' } ] },
{ label: '拦截状态', value: 'intercept_status', type: 'select', options: [
{ label: '无', value: 'none' },
{ label: '待拦截', value: 'pending' },
{ label: '已拦截', value: 'success' }
]},
{label:'订单状态', value: 'status', type: 'select', options: [
{ label: '待审核', value: 'pedding' },
{ label: '已审核', value: 'created' },
{ label: '异常', value: 'error' },
{ label: '已作废', value: 'cancelled' },
{ label: '已归档', value: 'archived' }
]},
{label:'同步状态', value: 'sync_status', type: 'select', options: [
{ label: '待同步', value: 'padding' },
{ label: '同步中', value: 'pending' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
{ label: '未同步', value: 'none' }
]},
{label:'分配状态', value: 'storage_status', type: 'select', options: [
{ label: '未分配', value: 'none' },
{ label: '分配中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' }
]},
{label:'快递状态', value: 'post_status', type: 'select', options: [
{ label: '未分配', value: 'none' },
{ label: '分配中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
{ label: '超时', value: 'timeout' }
]},
{label:'拣货状态', value: 'pick_status', type: 'select', options: [
{ label: '未拣货', value: 'none' },
{ label: '拣货中', value: 'padding' },
{ label: '已完成', value: 'fin' }
]},
{label:'打包状态', value: 'pack_status', type: 'select', options: [
{ label: '未打包', value: 'none' },
{ label: '打包中', value: 'padding' },
{ label: '已完成', value: 'fin' }
]},
{ label: '创建时间', value: 'create_at', type: 'daterange' },
]
export const expectionColumns = [
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'sys_platform_name', label: '来源平台', width: '120' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'storage_status', label: '分配状态', width: '100' },
{ prop: 'post_status', label: '快递状态', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '100' },
{ prop: 'pack_status', label: '打包状态', width: '100' },
{ prop: 'name', label: '收货人', width: '110' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'pre_delivery_order_code', label: '前置单号', width: '140' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'pay_time', label: '支付时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
]
export const expectionOrderDetail = [
// 基础信息
{ prop: 'delivery_order_code', label: '发货单号' },
{ prop: 'order_code', label: '订单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'sys_platform_name', label: '来源平台' },
{ prop: 'status', label: '系统状态' },
{ prop: 'intercept_status', label: '拦截状态' },
// 异常/状态标记
{ prop: 'order_flag', label: '订单标记', span: 3 },
{ prop: 'lock_status', label: '锁定状态' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'post_status', label: '投递状态' },
// 收货信息
{ prop: 'name', label: '收货人' },
{ prop: 'mobile', label: '手机号' },
{ prop: 'province', label: '省份' },
{ prop: 'city', label: '城市' },
{ prop: 'area', label: '区县' },
{ prop: 'detail_address', label: '详细地址' },
// 物流信息
{ prop: 'logistics_name', label: '物流公司' },
{ prop: 'express_code', label: '运单号' },
// 统计信息
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
// 时间信息
{ prop: 'create_at', label: '创建时间' },
{ prop: 'updated_at', label: '更新时间' },
{ prop: 'operate_time', label: '操作时间' },
]
export const expectionOrderbuttonList: any[] = [
{
label: 'EXCEL操作',
type: 'dropdown',
command: 'handleExpectionOperation',
options: [
{ label: '异常跟踪单导入', value: 'import-exception-tracking' },
{ label: '导出异常跟踪单', value: 'export-exception-tracking' },
]
}
]
// deliveryException相关配置
export const archiveAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
{ label: '发货单号', value: 'delivery_order_code', type: 'text' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
expressCompanyScanField,
{label:'是否紧急', value: 'is_urgency', type: 'select', options: [ { label: '是', value: 'Y' }, { label: '否', value: 'N' } ] },
{ label: '订单状态', value: 'status', type: 'select', options: [
{ label: '待审核', value: 'pedding' },
{ label: '已创建', value: 'created' },
{ label: '异常', value: 'error' },
{ label: '已作废', value: 'cancelled' },
{ label: '已归档', value: 'archived' }
]},
{ label: '状态', value: 'status', type: 'select', options: [
{ label: '已完成', value: 'finished' },
{ label: '已作废', value: 'cancelled' },
{ label: '已归档', value: 'archived' }
]},
{label:'同步状态', value: 'sync_status', type: 'select', options: [
{ label: '待同步', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
{ label: '未同步', value: 'none' }
]},
{label:'出库状态', value: 'outbound_status', type: 'select', options: [
{ label: '未出库', value: 'none' },
{ label: '待出库', value: 'padding' },
{ label: '已出库', value: 'fin' }
]},
{label:'拣货状态', value: 'pick_status', type: 'select', options: [
{ label: '未拣货', value: 'none' },
{ label: '拣货中', value: 'padding' },
{ label: '已完成', value: 'fin' }
]},
{label:'打包状态', value: 'pack_status', type: 'select', options: [
{ label: '未打包', value: 'none' },
{ label: '打包中', value: 'padding' },
{ label: '已完成', value: 'fin' }
]},
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
{ label: '收货人', value: 'name', type: 'text' },
{ label: '手机号', value: 'mobile', type: 'text' },
]
export const archiveColumns = [
{ prop: 'id', label: 'ID', width: '80' },
{ prop: 'order_code', label: '订单号', width: '180' },
{ prop: 'delivery_order_code', label: '发货单号', width: '160' },
{ prop: 'wave_no', label: '波次号', width: '160' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'name', label: '收货人', width: '120' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'logistics_name', label: '物流公司', width: '120' },
{ prop: 'status', label: '状态', width: '100' },
{ prop: 'create_at', label: '创建时间', width: '160' },
{ prop: 'updated_at', label: '归档时间', width: '160' },
]
export const archiveOrderDetail = [
// 基础信息
{ prop: 'delivery_order_code', label: '发货单号' },
{ prop: 'order_code', label: '订单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'sys_platform_name', label: '来源平台' },
{ prop: 'status', label: '系统状态' },
// 收货信息
{ prop: 'name', label: '收货人' },
{ prop: 'mobile', label: '手机号' },
{ prop: 'province', label: '省份' },
{ prop: 'city', label: '城市' },
{ prop: 'area', label: '区县' },
{ prop: 'detail_address', label: '详细地址' },
// 物流信息
{ prop: 'logistics_name', label: '物流公司' },
{ prop: 'express_code', label: '运单号' },
// 金额/统计
{ prop: 'total_amount', label: '总金额' },
{ prop: 'item_amount', label: '商品金额' },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
// 时间信息
{ prop: 'place_order_time', label: '下单时间' },
{ prop: 'pay_time', label: '支付时间' },
{ prop: 'create_at', label: '创建时间' },
{ prop: 'updated_at', label: '归档/更新时间' },
]
/** archiveOrder */
export const archiveOrderToolbarButtonKeys = simpleListToolbarButtonKeys
export const archiveOrderToolbarButtons = simpleListToolbarButtons