15 lines
1.3 KiB
TypeScript
15 lines
1.3 KiB
TypeScript
import { overseasHttp } from '@/shared/api/overseasHttp'
|
|||
|
|
import { unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
||
|
|
import { normalizeOverseasPage, type OverseasPagePayload } from './lastMileOrders'
|
||
|
|
|
||
|
|
export interface OutboundRow { id: string; outboundNo: string; dispatchNo?: string | null; overseasWarehouseId?: string | null; status?: string | null; palletCount?: number | null; packageCount?: number | null; createdAt?: string | null }
|
||
|
|
export interface OutboundQuery { page: number; size: number; documentNo?: string; warehouseId?: string; status?: string }
|
||
|
|
export async function listOutbounds(query: OutboundQuery) {
|
||
|
|
const response = await overseasHttp.get<ApiEnvelope<OverseasPagePayload<OutboundRow>>, ApiEnvelope<OverseasPagePayload<OutboundRow>>>('/platform/v1/last-leg/outbound-orders', { params: query })
|
||
|
|
return normalizeOverseasPage(unwrapApiResponse(response))
|
||
|
|
}
|
||
|
|
export async function createOneClickDropshipOutbound(customerId: string, payload: { recipient: string; items: Array<{ inventoryPositionId: string; packages: number; sku?: string }>; remark?: string; idempotencyKey: string }) {
|
||
|
|
const response = await overseasHttp.post<ApiEnvelope<OutboundRow>, ApiEnvelope<OutboundRow>>('/platform/v1/last-leg/outbound-orders/one-click-dropship', payload, { params: { customerId } })
|
||
|
|
return unwrapApiResponse(response)
|
||
|
|
}
|