Files
admin-web/src/modules/overseas-warehouse/api/exceptionOrders.ts
T
2026-09-29 17:56:00 +08:00

33 lines
2.6 KiB
TypeScript

import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
import { normalizeOverseasPage, type OverseasPagePayload } from './lastMileOrders'
export interface ExceptionOrderQuery { page: number; size: number; keyword?: string; exceptionType?: string; status?: string; customerId?: string; warehouseId?: string; createdFrom?: string; createdTo?: string }
export interface ExceptionOrderRow {
id: string; exceptionNo: string; exceptionType: string; status: string; reason: string
customerId: string; customerName?: string | null; overseasWarehouseId?: string | null; overseasWarehouseName?: string | null
lastMileOrderId?: string | null; lastMileOrderNo?: string | null; inboundOrderId?: string | null; inboundCode?: string | null
deliveryOrderId?: string | null; deliveryNo?: string | null; outboundNo?: string | null
skuCode?: string | null; packageCount?: number | null; returnDirection?: string | null; returnLogisticsNo?: string | null
handlingAction?: string | null; handlerName?: string | null; exceptionAt: string; updatedAt: string
}
export interface ExceptionRelation {
lastMileOrderId?: string | null; lastMileOrderNo?: string | null; inboundOrderId?: string | null; inboundCode?: string | null
customerId: string; customerName?: string | null; overseasWarehouseId?: string | null; overseasWarehouseName?: string | null
deliveryNo?: string | null; outboundNo?: string | null; availablePackages?: number | null
}
export interface CreateExceptionOrderPayload { customerId?: string; inboundCode?: string; lastMileOrderNo?: string; exceptionType: string; reason: string; packageCount?: number; skuCode?: string }
export async function listExceptionOrders(query: ExceptionOrderQuery) {
const response = await http.get<ApiEnvelope<OverseasPagePayload<ExceptionOrderRow>>, ApiEnvelope<OverseasPagePayload<ExceptionOrderRow>>>('/platform/v1/last-leg/exception-orders', { params: query })
return normalizeOverseasPage(unwrapApiResponse(response))
}
export async function resolveExceptionRelation(params: { customerId?: string; inboundCode?: string; lastMileOrderNo?: string }) {
const response = await http.get<ApiEnvelope<ExceptionRelation>, ApiEnvelope<ExceptionRelation>>('/platform/v1/last-leg/exception-orders/resolve', { params })
return unwrapApiResponse(response)
}
export async function createExceptionOrder(payload: CreateExceptionOrderPayload) {
const response = await http.post<ApiEnvelope<{ id: string; exceptionNo: string; status: string }>, ApiEnvelope<{ id: string; exceptionNo: string; status: string }>>('/platform/v1/last-leg/exception-orders', payload)
return unwrapApiResponse(response)
}