优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { apiRequest } from '@/api/http'
|
||||
import { apiBlobRequest, apiRequest } from '@/api/http'
|
||||
import type { PageResult } from './businessOrders'
|
||||
|
||||
export type Amount = number | string
|
||||
@@ -97,6 +97,35 @@ export interface ProcurementQuery {
|
||||
purchaseCategory?: string
|
||||
status?: string
|
||||
}
|
||||
export interface ProcurementWorkflowFile { fileId: string; fileName: string; contentType: string }
|
||||
export interface ProcurementReceipt {
|
||||
id: string
|
||||
quantity: number
|
||||
fileIds: string[]
|
||||
receivedAt: string
|
||||
}
|
||||
export interface ProcurementOutbound {
|
||||
id: string
|
||||
outboundNo: string
|
||||
quantity: number
|
||||
trackingNo: string
|
||||
status: string
|
||||
fileIds: string[]
|
||||
createdAt: string
|
||||
completedAt: string | null
|
||||
}
|
||||
export interface ProcurementWorkflow {
|
||||
orderNo: string
|
||||
version: number
|
||||
status: string
|
||||
receivedQuantity: number
|
||||
stockQuantity: number
|
||||
reservedQuantity: number
|
||||
availableQuantity: number
|
||||
files: ProcurementWorkflowFile[]
|
||||
receipts: ProcurementReceipt[]
|
||||
outbounds: ProcurementOutbound[]
|
||||
}
|
||||
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 })
|
||||
@@ -108,3 +137,13 @@ export function getProcurement(orderNo: string) {
|
||||
export function createProcurement(data: ProcurementCreate) {
|
||||
return apiRequest<ProcurementDetail>({ method: 'POST', url: endpoint, data })
|
||||
}
|
||||
export function getProcurementWorkflow(orderNo: string) {
|
||||
return apiRequest<ProcurementWorkflow>({ method: 'GET', url: `${endpoint}/${encodeURIComponent(orderNo)}/workflow` })
|
||||
}
|
||||
export function confirmProcurement(orderNo: string, data: { version: number; idempotencyKey: string }) {
|
||||
return apiRequest<ProcurementWorkflow>({ method: 'POST', url: `${endpoint}/${encodeURIComponent(orderNo)}/confirm`, data })
|
||||
}
|
||||
|
||||
export function getProcurementFile(orderNo: string, fileId: string) {
|
||||
return apiBlobRequest({ method: 'GET', url: `${endpoint}/${encodeURIComponent(orderNo)}/files/${encodeURIComponent(fileId)}/content` })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user