feat: 完善头程审核与计费信息

This commit is contained in:
2026-09-08 17:38:09 +08:00
parent cb7bb90eb6
commit dd9b8f7a63
16 changed files with 273 additions and 31 deletions
@@ -540,10 +540,59 @@ export interface UnifiedOrderBatchApprovalResult {
failedOrders: Array<{ orderId: number | string; code: string; message: string }>
}
export function batchApprovePlatformUnifiedOrders(tenantId: string, orderIds: string[]) {
export interface UnifiedOrderBatchReviewItem {
orderId: string
orderVersion: number
}
export interface UnifiedOrderBatchApprovalPreviewItem extends UnifiedOrderBatchReviewItem {
inboundCode: string | null
customerId: string | null
customerName: string | null
chineseGoodsNames: string[]
channelCode: string | null
channelName: string | null
destinationWarehouseCode: string | null
destinationWarehouseName: string | null
canApprove: boolean
blockReason: string | null
}
export interface UnifiedOrderBatchApprovalPreview {
total: number
approvableCount: number
items: UnifiedOrderBatchApprovalPreviewItem[]
}
function normalizeBatchApprovalPreview(result: UnifiedOrderBatchApprovalPreview): UnifiedOrderBatchApprovalPreview {
return {
...result,
total: integer(result.total, 0),
approvableCount: integer(result.approvableCount, 0),
items: (result.items || []).map((item) => ({
...item,
orderId: String(item.orderId),
orderVersion: integer(item.orderVersion, 0),
customerId: id(item.customerId),
chineseGoodsNames: (item.chineseGoodsNames || []).map((name) => name.trim()).filter(Boolean),
canApprove: Boolean(item.canApprove),
})),
}
}
export async function getPlatformUnifiedOrderBatchApprovalPreview(tenantId: string, items: UnifiedOrderBatchReviewItem[]) {
const response = await http.post<ApiEnvelope<UnifiedOrderBatchApprovalPreview>, ApiEnvelope<UnifiedOrderBatchApprovalPreview>>(
'/platform/v1/orders/first-leg/batch-review-preview',
{ items },
{ params: { tenantId } },
)
return normalizeBatchApprovalPreview(unwrapApiResponse(response))
}
export function batchApprovePlatformUnifiedOrders(tenantId: string, items: UnifiedOrderBatchReviewItem[]) {
return http.post<ApiEnvelope<UnifiedOrderBatchApprovalResult>, ApiEnvelope<UnifiedOrderBatchApprovalResult>>(
'/platform/v1/orders/first-leg/batch-approve',
{ orderIds },
{ items },
{ params: { tenantId } },
).then(unwrapApiResponse)
}