This commit is contained in:
2026-08-20 18:02:24 +08:00
parent c93eea89c8
commit b0d527b016
8 changed files with 288 additions and 32 deletions
@@ -3,6 +3,8 @@ import { listSuppliers, type SupplierCategory } from '@/modules/suppliers'
export type InboundFeeDirection = 'RECEIVABLE' | 'PAYABLE'
export type InboundFeeReviewStatus = 'PENDING' | 'APPROVED' | 'REJECTED'
export type FeeSettlementMode = 'ON_ACCOUNT' | 'DIRECT_PAID'
export type FeePaymentMethod = 'ONLINE' | 'BANK_TRANSFER' | 'CASH' | 'OTHER'
export interface InboundFeeDetail {
id: string | number
@@ -15,6 +17,11 @@ export interface InboundFeeDetail {
supplierId: string | number | null
supplierName: string | null
supplierCategory: SupplierCategory | null
settlementMode?: FeeSettlementMode | null
paidAt?: string | null
paymentMethod?: FeePaymentMethod | null
paymentReferenceNo?: string | null
paymentVoucherFileIds?: Array<string | number> | null
businessDate: string
customerName: string | null
feeTypeNameSnapshot: string
@@ -37,6 +44,11 @@ export interface SaveInboundFeeDetailRequest {
currency: string
amount: number
supplierId: string | number | null
settlementMode: FeeSettlementMode | null
paidAt: string | null
paymentMethod: FeePaymentMethod | null
paymentReferenceNo: string | null
paymentVoucherFileIds: Array<string | number> | null
remark: string | null
}
@@ -50,6 +62,7 @@ export interface InboundFeeItemOption {
}
export interface InboundFeeSupplierOption { id: string; supplierName: string; category: SupplierCategory }
export interface FeePaymentVoucher { fileId: string; fileName: string }
const supplierCategories: SupplierCategory[] = ['BOOKING', 'CUSTOMS', 'TRUCKING', 'CERTIFICATE']
@@ -123,3 +136,14 @@ export async function listInboundFeeSupplierOptions(category: SupplierCategory |
id: supplier.id, supplierName: supplier.name, category: supplier.category,
}))
}
export async function uploadInboundFeePaymentVoucher(customerId: string, file: File): Promise<FeePaymentVoucher> {
const body = new FormData(); body.append('file', file)
const raw = unwrapApiResponse(await http.post<unknown, ApiEnvelope<Record<string, unknown>>>('/platform/finance/v1/vouchers', body, {
params: { customerId }, headers: { 'Content-Type': 'multipart/form-data' },
}))
const fileId = raw.fileId == null ? '' : String(raw.fileId)
const echoedCustomerId = raw.tenantId == null ? String(raw.customerId ?? customerId) : String(raw.tenantId)
if (!fileId || echoedCustomerId !== customerId) throw new Error('付款凭证与当前客户不匹配')
return { fileId, fileName: String(raw.fileName || raw.file_name || file.name) }
}