feat(trucking): refine client truck order form and details

This commit is contained in:
2026-10-19 14:37:03 +08:00
parent 8c064cfb0d
commit 88c9ff2cb5
4 changed files with 205 additions and 41 deletions
+46 -8
View File
@@ -18,6 +18,9 @@ export interface BusinessOrderQuery {
routeKeyword?: string
transportType?: string
transportMode?: string
vehicleType?: 'PALLET_15' | 'PALLET_30'
pickupFrom?: string
pickupTo?: string
requestedFrom?: string
requestedTo?: string
createdFrom?: string
@@ -27,21 +30,28 @@ export interface BusinessOrderQuery {
export interface TransportSummary {
fleetArrangement: import('../fleetArrangement').FleetArrangement | null
orderNo: string
transportType: string
transportType?: string
transportMode?: string
palletRequired?: string | null
origin: string
destination: string
containerType: string | null
containerType?: string | null
palletCount?: number
packageCount: number
totalWeightKg: number
totalVolumeCbm: number
budgetAmount: number | null
currency: string | null
contactName: string | null
contactInfo: string | null
requestedDate: string | null
contactName?: string | null
contactInfo?: string | null
requestedDate?: string | null
vehicleType?: 'PALLET_15' | 'PALLET_30' | null
originContactName?: string | null
originContactPhone?: string | null
destinationContactName?: string | null
destinationContactPhone?: string | null
pickupAt?: string | null
deliveryAt?: string | null
status: string
version: number
createdAt: string
@@ -64,7 +74,6 @@ export interface TransportCreate {
destination: string
destinationAddress?: string
containerType?: string
palletCount?: number
packageCount: number
totalWeightKg: number
totalVolumeCbm: number
@@ -77,10 +86,35 @@ export interface TransportCreate {
idempotencyKey: string
}
export interface TruckCreate {
vehicleType: 'PALLET_15' | 'PALLET_30'
origin: string
originAddress?: string
destination: string
destinationAddress?: string
originContactName: string
originContactPhone: string
destinationContactName: string
destinationContactPhone: string
pickupAt: string
deliveryAt: string
packageCount: number
totalWeightKg: number
totalVolumeCbm: number
budgetAmount?: number
currency?: string
remark?: string
idempotencyKey: string
}
export interface TransportUpdate extends Omit<TransportCreate, 'idempotencyKey'> {
version: number
}
export interface TruckUpdate extends Omit<TruckCreate, 'idempotencyKey'> {
version: number
}
const endpointByKind: Record<CrossBorderBusinessKind, string> = {
trucking: '/merchant/v1/last-leg/us-truck-orders',
looseboard: '/merchant/v1/last-leg/local-looseboard-orders',
@@ -98,11 +132,15 @@ export function getBusinessOrder<T>(kind: CrossBorderBusinessKind, orderNo: stri
return apiRequest<T>({ method: 'GET', url: `${endpointByKind[kind]}/${encodeURIComponent(orderNo)}` })
}
export function createTransport(kind: 'trucking' | 'looseboard', payload: TransportCreate) {
export function createTransport(kind: 'trucking', payload: TruckCreate): Promise<TransportDetail>
export function createTransport(kind: 'looseboard', payload: TransportCreate): Promise<TransportDetail>
export function createTransport(kind: CrossBorderBusinessKind, payload: TransportCreate | TruckCreate) {
return apiRequest<TransportDetail>({ method: 'POST', url: endpointByKind[kind], data: payload })
}
export function updateTransport(kind: 'trucking' | 'looseboard', orderNo: string, payload: TransportUpdate) {
export function updateTransport(kind: 'trucking', orderNo: string, payload: TruckUpdate): Promise<TransportDetail>
export function updateTransport(kind: 'looseboard', orderNo: string, payload: TransportUpdate): Promise<TransportDetail>
export function updateTransport(kind: CrossBorderBusinessKind, orderNo: string, payload: TransportUpdate | TruckUpdate) {
return apiRequest<TransportDetail>({
method: kind === 'trucking' ? 'PATCH' : 'PUT',
url: `${endpointByKind[kind]}/${encodeURIComponent(orderNo)}`,