feat(procurement): show customer sample fulfillment and charges
This commit is contained in:
@@ -8,7 +8,7 @@ export interface PageResult<T> {
|
||||
pages: number
|
||||
}
|
||||
|
||||
export type CrossBorderBusinessKind = 'procurement' | 'trucking' | 'looseboard'
|
||||
export type CrossBorderBusinessKind = 'trucking' | 'looseboard'
|
||||
|
||||
export interface BusinessOrderQuery {
|
||||
page: number
|
||||
@@ -16,8 +16,6 @@ export interface BusinessOrderQuery {
|
||||
orderNo?: string
|
||||
status?: string
|
||||
routeKeyword?: string
|
||||
productName?: string
|
||||
purchaseCategory?: string
|
||||
transportType?: string
|
||||
transportMode?: string
|
||||
requestedFrom?: string
|
||||
@@ -26,54 +24,6 @@ export interface BusinessOrderQuery {
|
||||
createdTo?: string
|
||||
}
|
||||
|
||||
export interface ProcurementSummary {
|
||||
orderNo: string
|
||||
purchaseCategory: string
|
||||
productName: string
|
||||
productSpecification: string | null
|
||||
purchaseQuantity: number
|
||||
budgetUnitPrice: number | null
|
||||
currency: string | null
|
||||
inboundQuantity: number
|
||||
outboundQuantity: number
|
||||
inventoryQuantity: number
|
||||
status: string
|
||||
version: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface ProcurementDetail {
|
||||
summary: ProcurementSummary
|
||||
productUrl: string | null
|
||||
receivingAddress: string | null
|
||||
contactName: string
|
||||
contactPhone: string
|
||||
domesticCarrier: string | null
|
||||
domesticTrackingNo: string | null
|
||||
overseasCarrier: string | null
|
||||
overseasTrackingNo: string | null
|
||||
estimatedArrivalAt: string | null
|
||||
remark: string | null
|
||||
reviewRemark: string | null
|
||||
}
|
||||
|
||||
export interface ProcurementCreate {
|
||||
customerName: string
|
||||
purchaseCategory: string
|
||||
productName: string
|
||||
productSpecification?: string
|
||||
productUrl?: string
|
||||
purchaseQuantity: number
|
||||
budgetUnitPrice?: number
|
||||
currency?: string
|
||||
receivingAddress?: string
|
||||
contactName: string
|
||||
contactPhone: string
|
||||
remark?: string
|
||||
idempotencyKey: string
|
||||
}
|
||||
|
||||
export interface TransportSummary {
|
||||
fleetArrangement: import('../fleetArrangement').FleetArrangement | null
|
||||
orderNo: string
|
||||
@@ -132,7 +82,6 @@ export interface TransportUpdate extends Omit<TransportCreate, 'idempotencyKey'>
|
||||
}
|
||||
|
||||
const endpointByKind: Record<CrossBorderBusinessKind, string> = {
|
||||
procurement: '/merchant/v1/last-leg/overseas-procurements',
|
||||
trucking: '/merchant/v1/last-leg/us-truck-orders',
|
||||
looseboard: '/merchant/v1/last-leg/local-looseboard-orders',
|
||||
}
|
||||
@@ -149,10 +98,6 @@ export function getBusinessOrder<T>(kind: CrossBorderBusinessKind, orderNo: stri
|
||||
return apiRequest<T>({ method: 'GET', url: `${endpointByKind[kind]}/${encodeURIComponent(orderNo)}` })
|
||||
}
|
||||
|
||||
export function createProcurement(payload: ProcurementCreate) {
|
||||
return apiRequest<ProcurementDetail>({ method: 'POST', url: endpointByKind.procurement, data: payload })
|
||||
}
|
||||
|
||||
export function createTransport(kind: 'trucking' | 'looseboard', payload: TransportCreate) {
|
||||
return apiRequest<TransportDetail>({ method: 'POST', url: endpointByKind[kind], data: payload })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
import { apiRequest } from '@/api/http'
|
||||
import type { PageResult } from './businessOrders'
|
||||
|
||||
export type Amount = number | string
|
||||
export interface ProcurementSummary {
|
||||
orderNo: string
|
||||
purchaseCategory: string
|
||||
productName: string
|
||||
productSpecification: string | null
|
||||
purchaseQuantity: number
|
||||
budgetUnitPrice: Amount | null
|
||||
currency: string | null
|
||||
status: string
|
||||
version: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
export interface ProcurementOrder extends ProcurementSummary {
|
||||
productUrl: string | null
|
||||
receivingAddress: string
|
||||
contactName: string
|
||||
contactPhone: string
|
||||
estimatedArrivalAt: string | null
|
||||
plannedWarehouseName: string | null
|
||||
actualWarehouseCode: string | null
|
||||
actualWarehouseName: string | null
|
||||
}
|
||||
export interface ProcurementFee {
|
||||
feeNo: string
|
||||
purpose: string
|
||||
name: string
|
||||
version: number | null
|
||||
active: boolean
|
||||
determination: string
|
||||
amount: Amount
|
||||
currency: string
|
||||
originalAmount: Amount | null
|
||||
originalCurrency: string | null
|
||||
exchangeRate: Amount | null
|
||||
exchangeRateMonth: string | null
|
||||
businessDate: string | null
|
||||
parentFeeNo: string | null
|
||||
walletStatus: string | null
|
||||
sourceLinked: boolean
|
||||
}
|
||||
export interface ProcurementBox {
|
||||
cartonNo: string
|
||||
quantity: number
|
||||
lengthCm: Amount
|
||||
widthCm: Amount
|
||||
heightCm: Amount
|
||||
grossWeightKg: Amount
|
||||
}
|
||||
export interface ProcurementShipment {
|
||||
shipmentNo: string
|
||||
leg: 'OVERSEAS' | 'DOMESTIC'
|
||||
shippedAt: string
|
||||
cartonNo: string
|
||||
quantity: number
|
||||
carrier: string
|
||||
trackingNo: string
|
||||
}
|
||||
export interface ProcurementDetail {
|
||||
order: ProcurementOrder
|
||||
budget: { totalAmount: Amount | null; currency: string; authorizedAt: string | null }
|
||||
purchased: boolean
|
||||
purchaseConfirmed: boolean
|
||||
purchaseNeedsAttention: boolean
|
||||
progress: { key: string; title: string; completedAt: string | null }[]
|
||||
boxes: ProcurementBox[]
|
||||
shipments: ProcurementShipment[]
|
||||
fees: ProcurementFee[]
|
||||
exceptionSummaries: string[]
|
||||
}
|
||||
export interface ProcurementCreate {
|
||||
customerName: string
|
||||
purchaseCategory: string
|
||||
productName: string
|
||||
productSpecification?: string
|
||||
productUrl?: string
|
||||
purchaseQuantity: number
|
||||
budgetUnitPrice: number
|
||||
currency: 'CNY' | 'USD'
|
||||
receivingAddress: string
|
||||
contactName: string
|
||||
contactPhone: string
|
||||
remark?: string
|
||||
idempotencyKey: string
|
||||
}
|
||||
export interface ProcurementQuery {
|
||||
page: number
|
||||
size: number
|
||||
orderNo?: string
|
||||
productName?: string
|
||||
purchaseCategory?: string
|
||||
status?: string
|
||||
}
|
||||
const endpoint = '/merchant/v1/last-leg/overseas-procurements'
|
||||
export async function listProcurements(params: ProcurementQuery) {
|
||||
const result = await apiRequest<PageResult<ProcurementSummary>>({ method: 'GET', url: endpoint, params })
|
||||
return { ...result, page: Number(result.page), size: Number(result.size), total: Number(result.total), pages: Number(result.pages) }
|
||||
}
|
||||
export function getProcurement(orderNo: string) {
|
||||
return apiRequest<ProcurementDetail>({ method: 'GET', url: `${endpoint}/${encodeURIComponent(orderNo)}` })
|
||||
}
|
||||
export function createProcurement(data: ProcurementCreate) {
|
||||
return apiRequest<ProcurementDetail>({ method: 'POST', url: endpoint, data })
|
||||
}
|
||||
Reference in New Issue
Block a user