feat(procurement): show customer sample fulfillment and charges
This commit is contained in:
@@ -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