feat: complete phase 5 merchant delivery
This commit is contained in:
@@ -1,17 +1,125 @@
|
||||
import { overseasApiRequest } from '@/api/overseasHttp'
|
||||
|
||||
export interface PageResult<T> { records: T[]; page: number; size: number; total: number; pages: number }
|
||||
export interface DeliveryRow { id: string; deliveryNo: string; outboundNo: string; dispatchNo: string; overseasWarehouseName: string; status: string; waybillNo: string; deliveryMethod: string; carrierName: string; vehiclePlate: string; driverName: string; palletCount: number; packageCount: number; totalWeightKg: number; totalVolumeCbm: number; plannedDeliveryAt: string; expectedArrivalAt: string; signedAt: string; createdAt: string }
|
||||
export interface DeliveryQuery { page: number; size: number; documentNo?: string; warehouseId?: string; status?: string; dispatchNo?: string; waybillNo?: string; vehiclePlate?: string; driverName?: string; deliveryMethod?: string; plannedFrom?: string; plannedTo?: string }
|
||||
export interface DeliveryTransferPayload { dispatchNo: string; idempotencyKey: string; plannedDeliveryAt: string; deliveryMethod: string; pickupMethod: string; loadingType: string; waybillNo?: string; carrierName?: string; vehicleType?: string; vehicleSize?: string; driverName?: string; driverPhone?: string; vehiclePlate?: string; appointmentAccount?: string; sellerName?: string; remark?: string; fees: Array<{ feeType: string; currency: string; amount: number; remark?: string }> }
|
||||
export interface PageResult<T> {
|
||||
records: T[]
|
||||
page: number
|
||||
size: number
|
||||
total: number
|
||||
pages: number
|
||||
}
|
||||
|
||||
export interface DeliveryRow {
|
||||
id: string
|
||||
deliveryNo: string
|
||||
outboundNo: string | null
|
||||
dispatchNo: string
|
||||
overseasWarehouseName: string | null
|
||||
status: string
|
||||
waybillNo: string | null
|
||||
deliveryMethod: string
|
||||
carrierName: string | null
|
||||
vehiclePlate: string | null
|
||||
driverName: string | null
|
||||
palletCount: number
|
||||
packageCount: number
|
||||
totalWeightKg: number | null
|
||||
totalVolumeCbm: number | null
|
||||
plannedDeliveryAt: string
|
||||
expectedArrivalAt: string | null
|
||||
signedAt: string | null
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface DeliveryOrderFee {
|
||||
id?: string
|
||||
feeType: string
|
||||
currency: string
|
||||
amount: number
|
||||
remark?: string | null
|
||||
}
|
||||
|
||||
export interface DeliveryOrderItem {
|
||||
id?: string
|
||||
palletNo?: string | null
|
||||
inboundCode?: string | null
|
||||
skuCode?: string | null
|
||||
productName?: string | null
|
||||
packageCount?: number | null
|
||||
weightKg?: number | null
|
||||
volumeCbm?: number | null
|
||||
}
|
||||
|
||||
export interface DeliveryOrderDetail extends DeliveryRow {
|
||||
pickupMethod: string
|
||||
loadingType: string
|
||||
vehicleType: string | null
|
||||
vehicleSize: string | null
|
||||
driverPhone: string | null
|
||||
appointmentAccount: string | null
|
||||
sellerName: string | null
|
||||
remark: string | null
|
||||
fees: DeliveryOrderFee[]
|
||||
items?: DeliveryOrderItem[] | PageResult<DeliveryOrderItem>
|
||||
updatedAt?: string | null
|
||||
}
|
||||
|
||||
export interface DeliveryQuery {
|
||||
page: number
|
||||
size: number
|
||||
documentNo?: string
|
||||
warehouseId?: string
|
||||
status?: string
|
||||
dispatchNo?: string
|
||||
waybillNo?: string
|
||||
vehiclePlate?: string
|
||||
driverName?: string
|
||||
deliveryMethod?: string
|
||||
plannedFrom?: string
|
||||
plannedTo?: string
|
||||
}
|
||||
|
||||
export interface DeliveryTransferPayload {
|
||||
dispatchNo: string
|
||||
idempotencyKey: string
|
||||
plannedDeliveryAt: string
|
||||
deliveryMethod: string
|
||||
pickupMethod: string
|
||||
loadingType: string
|
||||
waybillNo?: string
|
||||
carrierName?: string
|
||||
vehicleType?: string
|
||||
vehicleSize?: string
|
||||
driverName?: string
|
||||
driverPhone?: string
|
||||
vehiclePlate?: string
|
||||
appointmentAccount?: string
|
||||
sellerName?: string
|
||||
remark?: string
|
||||
fees: DeliveryOrderFee[]
|
||||
}
|
||||
|
||||
export function listDeliveryOrders(params: DeliveryQuery) {
|
||||
return overseasApiRequest<PageResult<DeliveryRow>>({ method: 'GET', url: '/merchant/v1/last-leg/delivery-orders', params })
|
||||
return overseasApiRequest<PageResult<DeliveryRow>>({
|
||||
method: 'GET',
|
||||
url: '/merchant/v1/last-leg/delivery-orders',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function getDeliveryOrder(deliveryNo: string) {
|
||||
return overseasApiRequest<Record<string, unknown>>({ method: 'GET', url: `/merchant/v1/last-leg/delivery-orders/${encodeURIComponent(deliveryNo)}`, params: { page: 1, size: 200 } })
|
||||
return overseasApiRequest<DeliveryOrderDetail>({
|
||||
method: 'GET',
|
||||
url: `/merchant/v1/last-leg/delivery-orders/${encodeURIComponent(deliveryNo)}`,
|
||||
params: { page: 1, size: 200 },
|
||||
})
|
||||
}
|
||||
|
||||
export function createDeliveryOrder(payload: DeliveryTransferPayload) {
|
||||
const { dispatchNo, ...request } = payload
|
||||
return overseasApiRequest<Record<string, unknown>>({ method: 'POST', url: '/merchant/v1/last-leg/delivery-orders', params: { dispatchNo }, data: request })
|
||||
return overseasApiRequest<DeliveryOrderDetail>({
|
||||
method: 'POST',
|
||||
url: '/merchant/v1/last-leg/delivery-orders',
|
||||
params: { dispatchNo },
|
||||
data: request,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user