优化
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
import { ApiError, apiRequest } from '@/api/http'
|
||||
import type { ApiFirstLegStatus, MerchantFirstLegOrderDetail, PageResult } from '@/modules/first-leg/api/firstLeg'
|
||||
|
||||
export type ApiUnifiedOrderMainStatus =
|
||||
| 'PENDING_REVIEW'
|
||||
| 'WAIT_MEASURE'
|
||||
| 'INBOUNDED'
|
||||
| 'WAIT_SPLIT'
|
||||
| 'LOADING'
|
||||
| 'LOADED'
|
||||
| 'DELIVERED'
|
||||
|
||||
export interface MerchantUnifiedMeasurementSummary {
|
||||
reviewStatus: string | null
|
||||
actualGrossWeightKg: number | null
|
||||
actualVolumeCbm: number | null
|
||||
chargeableWeightKg: number | null
|
||||
completedAt: string | null
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedPreloadSummary {
|
||||
status: string
|
||||
version: number
|
||||
itemCount: number
|
||||
updatedAt: string | null
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedLoadingSummary {
|
||||
status: string
|
||||
loadingVersion: number
|
||||
pickingVersion: number
|
||||
expectedCount: number | null
|
||||
pickedCount: number | null
|
||||
evidenceCount: number | null
|
||||
sealNo: string | null
|
||||
updatedAt: string | null
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedDeliverySummary {
|
||||
status: string
|
||||
completedAt: string | null
|
||||
trackingNo: string | null
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedTransportSummary {
|
||||
loadingStatus: string | null
|
||||
containerNo: string | null
|
||||
cabinetNo: string | null
|
||||
vesselName: string | null
|
||||
voyageNo: string | null
|
||||
sailingAt: string | null
|
||||
portArrivalAt: string | null
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedOrderRow {
|
||||
orderId: number | string
|
||||
tenantId: number | string
|
||||
orderNo: string | null
|
||||
mainStatus: ApiUnifiedOrderMainStatus
|
||||
nextAction: string | null
|
||||
internalOrderStatus: ApiFirstLegStatus | null
|
||||
customerId: number | string | null
|
||||
customerName: string
|
||||
channelName: string | null
|
||||
receivingWarehouseId: number | string | null
|
||||
receivingWarehouseName: string | null
|
||||
destinationWarehouseId: number | string | null
|
||||
destinationWarehouseName: string | null
|
||||
inboundId: number | string | null
|
||||
inboundVersion: number | null
|
||||
inboundCode: string | null
|
||||
expectedShipDate: string | null
|
||||
totalPackageCount: number | null
|
||||
actualGrossWeightKg: number | null
|
||||
actualVolumeCbm: number | null
|
||||
measurement: MerchantUnifiedMeasurementSummary | null
|
||||
preload: MerchantUnifiedPreloadSummary | null
|
||||
loading: MerchantUnifiedLoadingSummary | null
|
||||
delivery: MerchantUnifiedDeliverySummary | null
|
||||
transport: MerchantUnifiedTransportSummary | null
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedTimelineEvent {
|
||||
source: string
|
||||
eventType: string
|
||||
mainStatus: ApiUnifiedOrderMainStatus | null
|
||||
action: string | null
|
||||
remark: string | null
|
||||
operatorId: number | string | null
|
||||
operatorName: string | null
|
||||
occurredAt: string | null
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedCustomNode {
|
||||
id: number | string
|
||||
name: string
|
||||
nodeType: string
|
||||
sortOrder: number
|
||||
customerVisible: boolean
|
||||
plannedAt: string | null
|
||||
completedAt: string | null
|
||||
operatorName: string | null
|
||||
remark: string | null
|
||||
attachmentIds: Array<number | string>
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedOrderDetail {
|
||||
summary: MerchantUnifiedOrderRow
|
||||
order: MerchantFirstLegOrderDetail
|
||||
timeline: MerchantUnifiedTimelineEvent[]
|
||||
// C02 does not return custom nodes yet. Optionality keeps the client forward-compatible without inventing data.
|
||||
customNodes?: MerchantUnifiedCustomNode[]
|
||||
}
|
||||
|
||||
export interface MerchantUnifiedOrderQuery {
|
||||
keyword?: string
|
||||
orderNo?: string
|
||||
mainStatus?: ApiUnifiedOrderMainStatus
|
||||
receivingWarehouseId?: number | string
|
||||
destinationWarehouseId?: number | string
|
||||
createdFrom?: string
|
||||
createdTo?: string
|
||||
page?: number
|
||||
size?: number
|
||||
}
|
||||
|
||||
const unifiedOrderBaseUrl = '/merchant/v1/orders'
|
||||
|
||||
export function getMerchantUnifiedOrders(params: MerchantUnifiedOrderQuery = {}) {
|
||||
return apiRequest<PageResult<MerchantUnifiedOrderRow>>({
|
||||
method: 'GET',
|
||||
url: unifiedOrderBaseUrl,
|
||||
params: { page: 1, size: 200, ...params },
|
||||
})
|
||||
}
|
||||
|
||||
export function getMerchantUnifiedOrder(orderId: number | string) {
|
||||
return apiRequest<MerchantUnifiedOrderDetail>({
|
||||
method: 'GET',
|
||||
url: `${unifiedOrderBaseUrl}/${orderId}`,
|
||||
})
|
||||
}
|
||||
|
||||
export function isUnifiedOrderQueryUnavailable(error: unknown) {
|
||||
return error instanceof ApiError && (error.status === 404 || error.code === 'A0404')
|
||||
}
|
||||
Reference in New Issue
Block a user