优化
This commit is contained in:
@@ -11,16 +11,26 @@ export type UnifiedOrderMainStatus =
|
||||
| 'LOADED'
|
||||
| 'DELIVERED'
|
||||
| 'COMPLETED'
|
||||
| 'WAIT_WEIGHT_CONFIRM' | 'WEIGHT_CONFIRMED' | 'WAIT_CUSTOMS_DOCS' | 'EXPORT_CUSTOMS'
|
||||
| 'SAILING_CLEARANCE' | 'WAIT_UNLOAD' | 'WAIT_DISPATCH' | 'OUTBOUND_DOCUMENT' | 'DELIVERING' | 'SIGNED'
|
||||
|
||||
export const unifiedOrderStatusOptions: Array<{ value: UnifiedOrderMainStatus; label: string }> = [
|
||||
{ value: 'PENDING_REVIEW', label: '待审核' },
|
||||
{ value: 'WAIT_MEASURE', label: '待测量数据' },
|
||||
{ value: 'WAIT_WEIGHT_CONFIRM', label: '待客户确认' },
|
||||
{ value: 'WEIGHT_CONFIRMED', label: '已确认数据' },
|
||||
{ value: 'WAIT_CUSTOMS_DOCS', label: '待上传资料' },
|
||||
{ value: 'WAIT_PALLETIZE', label: '一件代发打托' },
|
||||
{ value: 'WAIT_SPLIT', label: '待分柜' },
|
||||
{ value: 'LOADING', label: '装柜中' },
|
||||
{ value: 'LOADED', label: '装柜完成' },
|
||||
{ value: 'DELIVERED', label: '派送完成' },
|
||||
{ value: 'COMPLETED', label: '已完成' },
|
||||
{ value: 'EXPORT_CUSTOMS', label: '出口报关' },
|
||||
{ value: 'SAILING_CLEARANCE', label: '已开船/待清关' },
|
||||
{ value: 'WAIT_UNLOAD', label: '待拆柜' },
|
||||
{ value: 'WAIT_DISPATCH', label: '待排车' },
|
||||
{ value: 'OUTBOUND_DOCUMENT', label: '出库单' },
|
||||
{ value: 'DELIVERING', label: '派送中' },
|
||||
{ value: 'SIGNED', label: '签收完成' },
|
||||
]
|
||||
|
||||
export interface UnifiedOrderMeasurementSummary {
|
||||
@@ -314,6 +324,23 @@ export interface UnifiedOrderQuery {
|
||||
size: number
|
||||
}
|
||||
|
||||
export type UnifiedOrderStatusCountQuery = Omit<UnifiedOrderQuery, 'page' | 'size' | 'mainStatus'>
|
||||
export interface UnifiedOrderStatusCounts {
|
||||
counts: Partial<Record<UnifiedOrderMainStatus | 'MEASUREMENT_REVIEW', number>>
|
||||
}
|
||||
|
||||
export async function getPlatformUnifiedOrderStatusCounts(query: UnifiedOrderStatusCountQuery): Promise<UnifiedOrderStatusCounts> {
|
||||
// Strip these fields at runtime too, so callers cannot accidentally scope the other tabs.
|
||||
const params = Object.fromEntries(Object.entries(query).filter(([key, value]) =>
|
||||
!['page', 'size', 'mainStatus'].includes(key) && value !== undefined && value !== ''))
|
||||
const response = await http.get<ApiEnvelope<UnifiedOrderStatusCounts>, ApiEnvelope<UnifiedOrderStatusCounts>>(
|
||||
`${unifiedOrdersApiPath}/status-counts`, { params },
|
||||
)
|
||||
const result = unwrapApiResponse(response)
|
||||
return { counts: Object.fromEntries(Object.entries(result.counts || {}).filter(([, count]) =>
|
||||
typeof count === 'number' && Number.isSafeInteger(count) && count >= 0)) }
|
||||
}
|
||||
|
||||
type PagePayload = Omit<UnifiedOrderPageResource, 'page' | 'size' | 'total' | 'pages'> & {
|
||||
page: number | string
|
||||
size: number | string
|
||||
@@ -667,5 +694,7 @@ export async function listPlatformUnifiedOrderFeeDetails(accountId: string, inbo
|
||||
}
|
||||
|
||||
export function unifiedOrderStatusLabel(status: UnifiedOrderMainStatus) {
|
||||
if (status === 'DELIVERED') return '签收完成'
|
||||
if (status === 'COMPLETED') return '已完成'
|
||||
return unifiedOrderStatusOptions.find((item) => item.value === status)?.label || '未知状态'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user