This commit is contained in:
yin 2026-06-30 18:19:51 +08:00
parent 57b95fb8bf
commit 1d3e0c0f64
10 changed files with 118 additions and 69 deletions

Binary file not shown.

View File

@ -562,7 +562,9 @@ export function translateOrderField(field: string, value: any) {
}
const INTERCEPT_STATUS_MAP: Record<string, string> = {
none: '—',
none: '无',
pending: '待拦截',
success: '已拦截',
requesting: '请求拦截中',
requested: '已请求拦截',
intercepting: '拦截中',
@ -578,10 +580,24 @@ const INTERCEPT_STATUS_MAP: Record<string, string> = {
}
export function translateInterceptStatus(value: any): string {
if (value === null || value === undefined || value === '' || value === 'none') {
return '—'
const normalized = String(value ?? 'none').trim().toLowerCase()
if (!normalized || normalized === 'none') {
return INTERCEPT_STATUS_MAP.none ?? '无'
}
return INTERCEPT_STATUS_MAP[String(value)] || String(value)
return INTERCEPT_STATUS_MAP[normalized] ?? INTERCEPT_STATUS_MAP[String(value).trim()] ?? String(value)
}
export function getInterceptStatusTagType(value: unknown): string {
const normalized = String(value ?? 'none').trim().toLowerCase()
if (!normalized || normalized === 'none') return 'info'
if (['failed', 'exception', 'timeout', 'delivered_by_mistake'].includes(normalized)) return 'danger'
if (['success', 'intercepted_in_transit', 'intercepted_at_warehouse', 'returned'].includes(normalized)) {
return 'success'
}
if (['pending', 'requesting', 'requested', 'intercepting', 'returning'].includes(normalized)) {
return 'warning'
}
return 'danger'
}
function pad2(value: number) {
@ -1279,6 +1295,7 @@ export type UpperTableCopyAction = 'copy' | 'copyQr'
const ORDER_LIST_COPY_ACTIONS: Record<string, UpperTableCopyAction> = {
delivery_order_code: 'copy',
order_code: 'copy',
wave_no: 'copy',
source_order_codes: 'copy',
express_numbers: 'copyQr',
waybill_codes: 'copyQr',
@ -1297,11 +1314,20 @@ export function applyOrderListCopyActions<T extends { prop: string; formatter?:
})
}
/** 订单列表:货主(接口字段 store_remark) */
export const orderStoreRemarkColumn = {
prop: 'store_remark',
label: '货主',
width: '120',
showOverflowTooltip: true
}
export const deliveryColumns = applyOrderListCopyActions([
{ prop: 'id', label: '订单ID', width: '80' },
{ prop: 'delivery_order_code', label: '发货单号', width: '170', fixed: 'left' },
{ prop: 'pre_delivery_order_code', label: '前置单号', width: '150' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'wave_no', label: '波次号', width: '150' },
{ prop: 'wave_id', label: '波次ID', width: '90' },
{ prop: 'order_flag', label: '订单标记', minWidth: '220' },
@ -1481,6 +1507,7 @@ export const reviewColums = applyOrderListCopyActions([
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'sys_platform_code', label: '平台编码', width: '100' },
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'status', label: '订单状态', width: '100' },
@ -1642,6 +1669,7 @@ export const pendingCloums = [
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
@ -1890,6 +1918,7 @@ export const workbenchColumns = applyOrderListCopyActions([
{ prop: 'sys_platform_name', label: '平台', minWidth: 120 },
{ prop: 'create_channel', label: '来源', minWidth: 120 },
{ prop: 'shop_nick', label: '店铺名称', minWidth: 140 },
orderStoreRemarkColumn,
{ prop: 'buyer_nick', label: '买家昵称', minWidth: 140 },
{ prop: 'name', label: '收件人', minWidth: 100 },
{ prop: 'mobile', label: '电话', minWidth: 120 },
@ -1964,6 +1993,7 @@ export const expectionColumns = [
{ prop: 'sys_platform_name', label: '平台', width: '120' },
{ prop: 'create_channel', label: '来源', width: '120' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
@ -2072,6 +2102,7 @@ export const archiveColumns = applyOrderListCopyActions([
{ prop: 'wave_no', label: '波次号', width: '160' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'create_channel', label: '来源', width: '120' },
{ prop: 'name', label: '收件人', width: '120' },
{ prop: 'mobile', label: '电话', width: '120' },

View File

@ -26,7 +26,8 @@
/>
</div>
<div class="toolbar-right">
<!-- 已迁移至 ScanBox:搜索订单号 -->
<!-- <div class="toolbar-right">
<el-input
size="small"
placeholder="搜索配送单号"
@ -34,7 +35,7 @@
style="width:220px"
@keyup.enter.native="onQuickSearch"
/>
</div>
</div> -->
</div>
<div class="split-stack" ref="splitStackRef">
@ -274,7 +275,6 @@ const columns = ref([...deliveryColumns])
const selectionRows = ref<any[]>([])
const selectedOrderId = ref<number | string | null>(null)
const detailVisible = ref(true)
const quickSearch = ref('')
const toolbarButtons = deliveryOrderToolbarButtons
const selectedRow = computed(() => {
@ -419,22 +419,7 @@ async function loadData() {
}
function buildWhere() {
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
if (quickSearch.value) {
const q = quickSearch.value.trim()
if (/^\d+$/.test(q)) {
where.id = {
operator: 'eq',
value: Number(q),
type: 'text'
}
}
where.delivery_order_code = {
operator: 'like',
value: q,
type: 'text'
}
}
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
return sanitizeDeliveryListWhere(where)
}
@ -500,11 +485,6 @@ function handlePageSizeChange(size: number) {
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function openColumnConfigPanel() {
upperTable.value?.openColumnConfig?.()
}

View File

@ -25,7 +25,8 @@
@action="handleToolbarButtonClick"
/>
</div>
<div class="toolbar-right">
<!-- 已迁移至 ScanBox:搜索订单号 -->
<!-- <div class="toolbar-right">
<el-input
size="small"
placeholder="搜索出库单号"
@ -33,7 +34,7 @@
style="width:220px"
@keyup.enter.native="onQuickSearch"
/>
</div>
</div> -->
</div>
<div class="split-stack" ref="splitStackRef">
@ -231,7 +232,6 @@ const columns = ref(buildPendingStyleColumns(outboundColumns))
const selectionRows = ref<any[]>([])
const selectedOrderId = ref<number | string | null>(null)
const detailVisible = ref(true)
const quickSearch = ref('')
const toolbarButtons = outboundToolbarButtons
const manualResult = ref<any>(null)
@ -271,22 +271,7 @@ function sanitizeOutboundListWhere(where: Record<string, any>) {
}
function buildWhere() {
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
if (quickSearch.value) {
const q = quickSearch.value.trim()
if (/^\d+$/.test(q)) {
where.id = {
operator: 'eq',
value: Number(q),
type: 'text'
}
}
where.delivery_order_code = {
operator: 'like',
value: q,
type: 'text'
}
}
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
return sanitizeOutboundListWhere(where)
}
@ -407,11 +392,6 @@ function handlePageSizeChange(size: number) {
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function openColumnConfigPanel() {
upperTable.value?.openColumnConfig?.()
}

View File

@ -100,10 +100,12 @@
</template>
<template #column-intercept_status="{ row }">
<el-tag v-if="row.intercept_status && row.intercept_status !== 'none'" type="danger" size="small">
{{ translateInterceptStatus(row.intercept_status) }}
<el-tag
:type="getInterceptStatusTagType(resolveOrderInterceptStatus(row))"
size="small"
>
{{ translateInterceptStatus(resolveOrderInterceptStatus(row)) }}
</el-tag>
<span v-else style="color:#909399">—</span>
</template>
<template #column-print_status="{ row }">
@ -362,6 +364,7 @@ import {
type ToolbarButtonConfig,
translateOrderField,
translateInterceptStatus,
getInterceptStatusTagType,
getTagType,
fillExpressCompanyScanFieldOptions,
fillStoreScanFieldOptions,
@ -385,7 +388,7 @@ import BatchAsyncTaskForm from './form/BatchAsyncTaskForm.vue'
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
import { createOrderPageExport } from './utils/order-page-export'
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from './utils/order-index-helpers'
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderInterceptStatus, resolveOrderRecheckStatus } from './utils/order-index-helpers'
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
import { useOrderBatchPrint } from './utils/use-order-batch-print'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'

View File

@ -103,7 +103,7 @@
<el-tab-pane label="商品明细" name="items" />
<el-tab-pane label="收货信息" name="receiver" />
<el-tab-pane label="订单日志" name="logs" />
<el-tab-pane label="订单审核" name="review" />
<!-- <el-tab-pane label="订单审核" name="review" /> -->
</el-tabs>
<div v-if="activeTab === 'detail' || activeTab === 'items'" class="detail-header-actions">
<order-detail-display-toggle v-model="detailDisplayMode" />
@ -124,7 +124,7 @@
</el-descriptions>
</div>
<div v-else-if="activeTab === 'review'" :key="`review-${selectedOrderId}`" class="detail-page order-review-wrapper review-tab-panel">
<el-alert type="info" :closable="false" show-icon title="可对当前选中订单发起审核操作" />
<!-- <el-alert type="info" :closable="false" show-icon title="可对当前选中订单发起审核操作" /> -->
<div class="review-tab-action">
<el-button size="small" type="primary" :loading="reviewSubmitting" @click="handleSingleReview">审核当前订单</el-button>
</div>

View File

@ -63,11 +63,12 @@ export function parseOrderListResponse(res: any): ParsedOrderListResponse {
if (!obj || typeof obj !== 'object') {
return { list: [] as any[], total: 0, page: 1, pageSize: 20, recheck_status: undefined as string | undefined }
}
const list = Array.isArray(obj.list)
const rawList = Array.isArray(obj.list)
? obj.list
: Array.isArray(obj.records)
? obj.records
: []
const list = rawList.map(normalizeOrderListRow)
const pagination = obj.pagination && typeof obj.pagination === 'object' ? obj.pagination : {}
const total = Number(pagination.total ?? obj.total ?? obj.count ?? list.length)
const page = Number(pagination.page ?? obj.page ?? 1)
@ -396,6 +397,36 @@ export function buildOrderWhereConditions(rawConditions: Record<string, any>) {
return where
}
/** 列表行字段归一化(snake_case 优先,兼容 camelCase) */
export function normalizeOrderListRow(row: any) {
if (!row || typeof row !== 'object') return row
const normalized = { ...row }
if (normalized.intercept_status == null && normalized.interceptStatus != null) {
normalized.intercept_status = normalized.interceptStatus
}
if (normalized.recheck_status == null && normalized.recheckStatus != null) {
normalized.recheck_status = normalized.recheckStatus
}
if (normalized.store_remark == null && normalized.storeRemark != null) {
normalized.store_remark = normalized.storeRemark
}
return normalized
}
/** 行级拦截状态(优先 intercept_status,兼容 interceptStatus) */
export function resolveOrderInterceptStatus(row?: Record<string, any> | null): string {
if (!row || typeof row !== 'object') return 'none'
const value = row.intercept_status ?? row.interceptStatus
if (value === undefined || value === null || value === '') return 'none'
return String(value).trim()
}
/** 是否为有效拦截状态(非 none / 空) */
export function isActiveInterceptStatus(value: unknown): boolean {
const normalized = String(value ?? 'none').trim().toLowerCase()
return normalized !== '' && normalized !== 'none'
}
/** 行级复核状态(优先 recheck_status,兼容历史 inspection_status) */
export function resolveOrderRecheckStatus(row?: Record<string, any> | null): string {
if (!row || typeof row !== 'object') return ''

View File

@ -26,7 +26,7 @@
/>
</div>
<div class="toolbar-right">
<span class="toolbar-switch-label">已选 {{ selectionRows.length }} 个订单</span>
<!-- <span class="toolbar-switch-label">已选 {{ selectionRows.length }} 个订单</span> -->
</div>
</div>

View File

@ -38,7 +38,7 @@
</div>
<div class="pending-order-panel__toolbar-right">
<el-input v-model="quickSearch" size="small" placeholder="搜索订单号" style="width: 220px" @keyup.enter="onQuickSearch" />
<!-- <el-input v-model="quickSearch" size="small" placeholder="搜索订单号" style="width: 220px" @keyup.enter="onQuickSearch" /> -->
</div>
</div>
@ -109,6 +109,21 @@
</el-tag>
</template>
<template #column-recheck_status="{ row }">
<el-tag :type="getTagType('recheck_status', resolveOrderRecheckStatus(row))" size="small">
{{ translateOrderField('recheck_status', resolveOrderRecheckStatus(row)) }}
</el-tag>
</template>
<template #column-intercept_status="{ row }">
<el-tag
:type="getInterceptStatusTagType(resolveOrderInterceptStatus(row))"
size="small"
>
{{ translateInterceptStatus(resolveOrderInterceptStatus(row)) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无待处理订单</div>
</template>
@ -170,13 +185,21 @@ import SyncOrderIdsForm from '@/views/order/orderManagement/form/SyncOrderIdsFor
import ManualWaybillForm from '@/views/order/orderManagement/form/ManualWaybillForm.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import { createPendingToolbarController } from '@/views/order/orderManagement/utils/toolbar-actions'
import { buildOrderWhereConditions, sanitizeOrderListWhere } from '@/views/order/orderManagement/utils/order-index-helpers'
import {
pendingCloums,
buildOrderWhereConditions,
parseOrderListResponse,
resolveOrderInterceptStatus,
resolveOrderRecheckStatus,
sanitizeOrderListWhere
} from '@/views/order/orderManagement/utils/order-index-helpers'
import {
buildPendingStyleColumns,
pendingAvailableFields,
pickToolbarButtons,
type ToolbarButtonConfig,
translateOrderField,
translateInterceptStatus,
getInterceptStatusTagType,
getTagType,
fillExpressCompanyScanFieldOptions
} from '@/views/order/orderManagement/config/order-common-config'
@ -198,7 +221,7 @@ const list = ref<any[]>([])
const loading = ref(false)
const queryTime = ref(0)
const tableSize = ref('small')
const columns = ref(pendingCloums)
const columns = ref(buildPendingStyleColumns())
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const quickSearch = ref('')
@ -271,9 +294,10 @@ async function loadData() {
sortOrder: 'DESC' as const
}
})
if (res && (res.code === 1 || res.code === 200) && res.data) {
list.value = res.data.list || []
pagination.total = res.data.pagination?.total || res.data.total || 0
if (res && (res.code === 1 || res.code === 200)) {
const data = parseOrderListResponse(res)
list.value = data.list
pagination.total = data.total
} else {
list.value = []
pagination.total = 0

View File

@ -14,8 +14,8 @@ type InventoryScanFieldGroupKey = keyof typeof INVENTORY_SCAN_FIELD_GROUPS
export function inventoryScanField<G extends InventoryScanFieldGroupKey>(
group: G,
field: Record<string, any>
) {
return { ...field, group: INVENTORY_SCAN_FIELD_GROUPS[group] }
): InventoryScanFieldConfig {
return { ...field, group: INVENTORY_SCAN_FIELD_GROUPS[group] } as InventoryScanFieldConfig
}
function extractInventoryScanConds(condition: any): Record<string, any> | null {