fix: align merchant delivery contract

This commit is contained in:
2026-09-02 02:39:56 +08:00
parent 00506b5793
commit d4166a75f8
3 changed files with 51 additions and 8 deletions
@@ -63,6 +63,30 @@ export interface DeliveryOrderDetail extends DeliveryRow {
updatedAt?: string | null
}
interface DeliveryOrderDetailResponse {
order: Omit<DeliveryOrderDetail, 'fees' | 'items' | 'updatedAt'>
skus: DeliveryOrderItem[]
fees: DeliveryOrderFee[]
operations: Array<{
id: string
operatedAt: string
operationNode: string
operatorName: string
result: string
}>
}
export interface DeliveryTransferResult {
dispatchNo: string
outboundNo: string
outboundStatus: string
deliveryNo: string
deliveryStatus: string
palletCount: number
packageCount: number
replayed: boolean
}
export interface DeliveryQuery {
page: number
size: number
@@ -107,16 +131,20 @@ export function listDeliveryOrders(params: DeliveryQuery) {
}
export function getDeliveryOrder(deliveryNo: string) {
return overseasApiRequest<DeliveryOrderDetail>({
return overseasApiRequest<DeliveryOrderDetailResponse>({
method: 'GET',
url: `/merchant/v1/last-leg/delivery-orders/${encodeURIComponent(deliveryNo)}`,
params: { page: 1, size: 200 },
})
}).then(({ order, skus, fees }) => ({
...order,
fees,
items: skus,
}))
}
export function createDeliveryOrder(payload: DeliveryTransferPayload) {
const { dispatchNo, ...request } = payload
return overseasApiRequest<DeliveryOrderDetail>({
return overseasApiRequest<DeliveryTransferResult>({
method: 'POST',
url: '/merchant/v1/last-leg/delivery-orders',
params: { dispatchNo },