小修改
This commit is contained in:
parent
f2fb59d356
commit
097846f385
@ -495,10 +495,38 @@
|
||||
>
|
||||
<el-table-column type="selection" width="48" reserve-selection />
|
||||
<el-table-column prop="id" label="订单ID" min-width="100" />
|
||||
<el-table-column prop="delivery_order_code" label="订单号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="shop_name" label="店铺" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="订单号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.delivery_no || row.delivery_order_code || row.order_sn || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物流单号" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.tracking_no || row.tracking_number || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="店铺" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.store_name || row.shop_name || row.shop || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sys_platform_name" label="平台" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="logistics_name" label="快递" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="物流公司" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.sys_logistics_name || row.logistics_name || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="province" label="省份" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="商品种数" min-width="90" align="right">
|
||||
<template #default="{ row }">
|
||||
{{ row.items_count ?? row.item_count ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品总数" min-width="90" align="right">
|
||||
<template #default="{ row }">
|
||||
{{ row.items_total ?? row.item_total ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品快照" min-width="260" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span class="order-info-text">{{ getFallbackOrderItemSnapshotText(row) }}</span>
|
||||
@ -753,7 +781,6 @@ import { KeepAlive, computed, onBeforeUnmount, onMounted, reactive, ref, watch }
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { pendingAvailableFields } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import {
|
||||
waveScanBoxConfig,
|
||||
@ -987,9 +1014,25 @@ const waveStrategyQuickScanResult = reactive({
|
||||
errorMessage: ''
|
||||
})
|
||||
const waveStrategyPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const fallbackOrderOwnerOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const fallbackOrderLogisticsOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const fallbackOrderPlatformOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const presetTree = ref<any[]>([])
|
||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(waveAvailableFields)))
|
||||
const fallbackOrderAvailableFieldsRef = reactive(JSON.parse(JSON.stringify(pendingAvailableFields)))
|
||||
const fallbackOrderAvailableFieldsRef = reactive([
|
||||
{ label: '订单ID', value: 'id', type: 'number' },
|
||||
{ label: '订单号', value: 'delivery_no', type: 'text' },
|
||||
{ label: '物流单号', value: 'tracking_no', type: 'text' },
|
||||
{ label: '商品种数最小值', value: 'items_count_min', type: 'number' },
|
||||
{ label: '商品种数最大值', value: 'items_count_max', type: 'number' },
|
||||
{ label: '商品总数最小值', value: 'items_total_min', type: 'number' },
|
||||
{ label: '商品总数最大值', value: 'items_total_max', type: 'number' },
|
||||
{ label: '物流公司', value: 'sys_logistics_name', type: 'select', options: fallbackOrderLogisticsOptions.value },
|
||||
{ label: '店铺名称', value: 'store_name', type: 'text' },
|
||||
{ label: '货主', value: 'owner_name', type: 'select', options: fallbackOrderOwnerOptions.value },
|
||||
{ label: '省份', value: 'province', type: 'text' },
|
||||
{ label: '来源平台', value: 'sys_platform_name', type: 'select', options: fallbackOrderPlatformOptions.value }
|
||||
])
|
||||
const columns = ref(JSON.parse(JSON.stringify(waveBatchColumns)))
|
||||
|
||||
const toolbarButtons = computed(() => getWaveToolbarButtons(props.waveType))
|
||||
@ -2354,9 +2397,94 @@ function openSingleOrderDialog() {
|
||||
waveStrategyPagination.currentPage = 1
|
||||
waveStrategyList.value = []
|
||||
waveStrategyPagination.total = 0
|
||||
void loadFallbackOrderFilterOptions()
|
||||
void fetchFallbackOrderList()
|
||||
}
|
||||
|
||||
function normalizeCode(value: unknown) {
|
||||
return String(value ?? '').trim()
|
||||
}
|
||||
|
||||
function mapNameOptions(rawList: any[], nameKeys: string[]) {
|
||||
const result: Array<{ label: string; value: string }> = []
|
||||
const seen = new Set<string>()
|
||||
for (const item of rawList || []) {
|
||||
const name = normalizeCode(nameKeys.map((key) => item?.[key]).find((v) => v !== undefined && v !== null && v !== ''))
|
||||
if (!name || seen.has(name)) continue
|
||||
result.push({ value: name, label: name })
|
||||
seen.add(name)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function unwrapIndexListResponse(res: any): any[] {
|
||||
const payload = res?.data !== undefined ? res.data : res
|
||||
if (Array.isArray(payload)) return payload
|
||||
if (payload && typeof payload === 'object') {
|
||||
if (Array.isArray(payload.list)) return payload.list
|
||||
if (Array.isArray(payload.items)) return payload.items
|
||||
if (Array.isArray(payload.records)) return payload.records
|
||||
}
|
||||
if (Array.isArray(res?.list)) return res.list
|
||||
return []
|
||||
}
|
||||
|
||||
function patchFallbackFieldOptions(fieldValue: string, options: Array<{ label: string; value: string }>) {
|
||||
const targetField = fallbackOrderAvailableFieldsRef.find((field: any) => field.value === fieldValue)
|
||||
if (targetField) {
|
||||
targetField.options = options
|
||||
}
|
||||
}
|
||||
|
||||
async function loadFallbackOrderFilterOptions() {
|
||||
const hasReadyOptions = fallbackOrderOwnerOptions.value.length > 0
|
||||
&& fallbackOrderLogisticsOptions.value.length > 0
|
||||
&& fallbackOrderPlatformOptions.value.length > 0
|
||||
if (hasReadyOptions) return
|
||||
|
||||
try {
|
||||
const [storesRes, expressRes, platformRes] = await Promise.all([
|
||||
indexApi.loadStores({ type: 'order' }),
|
||||
indexApi.getExpressList({}),
|
||||
indexApi.getPlatformList({})
|
||||
])
|
||||
|
||||
const storesResAny = storesRes as any
|
||||
const stores = Array.isArray(storesResAny?.stores)
|
||||
? storesResAny.stores
|
||||
: Array.isArray(storesResAny?.data?.stores)
|
||||
? storesResAny.data.stores
|
||||
: []
|
||||
const expressRaw = unwrapIndexListResponse(expressRes)
|
||||
const platformRaw = unwrapIndexListResponse(platformRes)
|
||||
|
||||
const ownerNameSet = new Set<string>()
|
||||
stores.forEach((item: any) => {
|
||||
const ownerName = String(item?.label || item?.name || '').trim()
|
||||
if (!ownerName) return
|
||||
ownerNameSet.add(ownerName)
|
||||
})
|
||||
fallbackOrderOwnerOptions.value = Array.from(ownerNameSet).map((name) => ({
|
||||
label: name,
|
||||
value: name
|
||||
}))
|
||||
fallbackOrderLogisticsOptions.value = mapNameOptions(expressRaw, ['name', 'logistics_name', 'express_name', 'label'])
|
||||
fallbackOrderPlatformOptions.value = mapNameOptions(platformRaw, ['name', 'platform_name', 'sys_platform_name', 'label'])
|
||||
|
||||
patchFallbackFieldOptions('owner_name', fallbackOrderOwnerOptions.value)
|
||||
patchFallbackFieldOptions('sys_logistics_name', fallbackOrderLogisticsOptions.value)
|
||||
patchFallbackFieldOptions('sys_platform_name', fallbackOrderPlatformOptions.value)
|
||||
} catch (error) {
|
||||
console.error('load fallback order filter options failed:', error)
|
||||
fallbackOrderOwnerOptions.value = []
|
||||
fallbackOrderLogisticsOptions.value = []
|
||||
fallbackOrderPlatformOptions.value = []
|
||||
patchFallbackFieldOptions('owner_name', [])
|
||||
patchFallbackFieldOptions('sys_logistics_name', [])
|
||||
patchFallbackFieldOptions('sys_platform_name', [])
|
||||
}
|
||||
}
|
||||
|
||||
async function loadGroupOrderStoreOptions() {
|
||||
if (groupOrderStoreOptions.value.length > 0) return
|
||||
try {
|
||||
@ -2415,12 +2543,30 @@ function buildGroupOrderListPayload() {
|
||||
}
|
||||
|
||||
function sanitizeFallbackOrderWhere(where: Record<string, any>) {
|
||||
const allowedFieldMap: Record<string, string> = {
|
||||
id: 'id',
|
||||
delivery_no: 'delivery_no',
|
||||
deliveryNo: 'delivery_no',
|
||||
tracking_no: 'tracking_no',
|
||||
trackingNo: 'tracking_no',
|
||||
items_count_min: 'items_count_min',
|
||||
items_count_max: 'items_count_max',
|
||||
items_total_min: 'items_total_min',
|
||||
items_total_max: 'items_total_max',
|
||||
sys_logistics_name: 'sys_logistics_name',
|
||||
store_name: 'store_name',
|
||||
owner_name: 'owner_name',
|
||||
province: 'province',
|
||||
sys_platform_name: 'sys_platform_name'
|
||||
}
|
||||
const nextWhere: Record<string, any> = {}
|
||||
Object.keys(where || {}).forEach((key) => {
|
||||
if (key === 'warehouse_id' || key === 'warehouseId') return
|
||||
const normalizedKey = allowedFieldMap[key]
|
||||
if (!normalizedKey) return
|
||||
const value = where[key]
|
||||
if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) return
|
||||
nextWhere[key] = value
|
||||
nextWhere[normalizedKey] = value
|
||||
})
|
||||
return nextWhere
|
||||
}
|
||||
@ -2431,11 +2577,7 @@ function buildFallbackOrderListPayload() {
|
||||
page: fallbackOrderPagination.currentPage,
|
||||
pageSize: fallbackOrderPagination.pageSize
|
||||
},
|
||||
where: sanitizeFallbackOrderWhere(buildWhereConditions(fallbackOrderScanBox.value?.getConditions?.() || {})),
|
||||
sort: {
|
||||
sortField: 'updated_at',
|
||||
sortOrder: 'DESC'
|
||||
}
|
||||
where: sanitizeFallbackOrderWhere(buildWhereConditions(fallbackOrderScanBox.value?.getConditions?.() || {}))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user