完善柜级费用分摊与财务来源展示
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { http } from '@/shared/api/http'
|
||||
import { adjustContainerFee, approveContainerFee, createContainerFee, listContainerCostDetails, listContainerFeeSupplierOptions, listContainerFees, rejectContainerFee, uploadContainerFeePaymentVoucher, voidContainerFee } from './containerFees'
|
||||
import { adjustContainerFee, approveContainerFee, approveContainerFeeAllocationGroup, createContainerFee, createContainerFeeAllocationGroup, listContainerCostDetails, listContainerFeeSupplierOptions, listContainerFees, rejectContainerFee, uploadContainerFeePaymentVoucher, voidContainerFee, voidContainerFeeAllocationGroup } from './containerFees'
|
||||
import { listSuppliers } from '@/modules/suppliers'
|
||||
|
||||
vi.mock('@/modules/suppliers', () => ({ listSuppliers: vi.fn() }))
|
||||
@@ -21,6 +21,24 @@ describe('container fee API', () => {
|
||||
expect(created).toMatchObject({ id: '3', loadingPlanId: '9', containerBookingId: '99', direction: 'PAYABLE', supplierId: '41', supplierName: '承运商A', supplierCategory: 'TRUCKING', settlementMode: 'DIRECT_PAID', paymentVoucherFileIds: ['9001'] })
|
||||
})
|
||||
|
||||
it('writes and reviews one atomic allocation group without an accountId shortcut', async () => {
|
||||
const post = vi.spyOn(http, 'post').mockResolvedValue({ code: '200', data: [] })
|
||||
const fee = { feeItemId: '7', direction: 'RECEIVABLE' as const, supplierId: null,
|
||||
settlementMode: null, paidAt: null, paymentMethod: null, paymentReferenceNo: null,
|
||||
paymentVoucherFileIds: null, businessDate: '2026-09-02', amount: 300,
|
||||
currency: 'CNY' as const, remark: null }
|
||||
const allocations = [
|
||||
{ customerId: '11', orderId: '501', orderNo: 'FL-501', inboundId: null, inboundCode: null, amount: 120 },
|
||||
{ customerId: '12', orderId: '502', orderNo: 'FL-502', inboundId: '602', inboundCode: 'IB-602', amount: 180 },
|
||||
]
|
||||
await createContainerFeeAllocationGroup('9', { fee, allocations })
|
||||
await approveContainerFeeAllocationGroup('9', '71')
|
||||
await voidContainerFeeAllocationGroup('9', '71', 1)
|
||||
expect(post).toHaveBeenCalledWith('/platform/v1/loading-plans/9/fee-details/allocation-groups', { fee, allocations })
|
||||
expect(post).toHaveBeenCalledWith('/platform/v1/loading-plans/9/fee-details/allocation-groups/71/approve')
|
||||
expect(post).toHaveBeenCalledWith('/platform/v1/loading-plans/9/fee-details/allocation-groups/71/void', { expectedSourceVersion: 1 })
|
||||
})
|
||||
|
||||
it('uploads a payment voucher in the current customer scope and rejects a mismatched echo', async () => {
|
||||
const post = vi.spyOn(http, 'post').mockResolvedValueOnce({ code: '200', data: { fileId: 9001, tenantId: 11, fileName: '付款凭证.png' } })
|
||||
await expect(uploadContainerFeePaymentVoucher('11', new File(['x'], '付款凭证.png'))).resolves.toEqual({ fileId: '9001', fileName: '付款凭证.png' })
|
||||
|
||||
Reference in New Issue
Block a user