This commit is contained in:
2026-08-12 10:59:49 +08:00
parent fb542e0b6f
commit f9ff9086d5
20 changed files with 103 additions and 81 deletions
@@ -122,7 +122,7 @@ async function openCreate() {
} else {
const [fees, suppliers] = await Promise.all([
listFinanceFeePool(customerId, 'PAYABLE'),
listPlatformPartners({ page: 1, size: 200, type: 'SUPPLIER', status: 'ACTIVE' }),
listPlatformPartners({ page: 1, size: 200, status: 'ACTIVE' }),
])
feeOptions.value = fees.filter((item) => item.feeSourceId && item.status === 'AVAILABLE')
supplierOptions.value = suppliers.records
@@ -70,7 +70,7 @@ describe('Finance G3/G4 views', () => {
document.body.innerHTML = ''
const customer = { id: '10001', tenantName: '客户A', status: 'ACTIVE' } as PlatformTenantResource
vi.mocked(listPlatformTenants).mockReset().mockResolvedValue({ records: [customer], page: 1, size: 200, total: 1, pages: 1 })
vi.mocked(listPlatformPartners).mockReset().mockResolvedValue({ records: [{ id: '301', tenantId: '0', dataScopeId: '0', partnerCode: 'SUP-301', partnerName: '供应商A', partnerType: 'SUPPLIER', types: ['SUPPLIER'], contactName: '', contactPhone: '', contactEmail: null, countryCode: 'CN', province: null, city: '', district: null, addressLine: '', postalCode: null, status: 'ACTIVE', remark: null } as PlatformPartnerResource], page: 1, size: 200, total: 1, pages: 1 })
vi.mocked(listPlatformPartners).mockReset().mockResolvedValue({ records: [{ id: '301', tenantId: '0', dataScopeId: '0', partnerCode: 'PARTNER-301', partnerName: '往来单位A', partnerType: 'CUSTOMER', types: ['CUSTOMER'], contactName: '', contactPhone: '', contactEmail: null, countryCode: 'CN', province: null, city: '', district: null, addressLine: '', postalCode: null, status: 'ACTIVE', remark: null } as PlatformPartnerResource], page: 1, size: 200, total: 1, pages: 1 })
vi.mocked(listFinanceStatements).mockReset().mockResolvedValue([statement])
vi.mocked(getReconciliationStatement).mockReset().mockResolvedValue(statementDetail)
vi.mocked(actionReconciliationStatement).mockReset().mockResolvedValue(statementDetail)
@@ -106,8 +106,8 @@ describe('Finance G3/G4 views', () => {
const wrapper = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ap:view', 'platform:finance:settlement-ap:create', 'platform:finance:payment:create'], { kind: 'payable' })
const vm = wrapper.vm as unknown as { load(model: Record<string, string>): Promise<void>; openCreate(): Promise<void>; submitCreate(): Promise<void>; openPayment(row: FinancePayableSettlement): void; submitPayment(): Promise<void>; createForm: { supplierId: string; dueDate: string; feeSourceIds: string[] }; paymentFile: File | null; paymentForm: { amount: number; transactionDate: string; method: 'BANK_TRANSFER'; referenceNo: string; remark: string } }
await vm.load({ customerId: '10001' }); await vm.openCreate()
expect(listPlatformPartners).toHaveBeenCalledWith({ page: 1, size: 200, type: 'SUPPLIER', status: 'ACTIVE' })
expect(document.body.textContent).toContain('供应商A · SUP-301')
expect(listPlatformPartners).toHaveBeenCalledWith({ page: 1, size: 200, status: 'ACTIVE' })
expect(document.body.textContent).toContain('往来单位A · PARTNER-301')
Object.assign(vm.createForm, { supplierId: '301', dueDate: '2026-09-30', feeSourceIds: ['81'] })
await vm.submitCreate()
expect(createPayableSettlement).toHaveBeenCalledWith({ customerId: '10001', supplierId: '301', feeSourceIds: ['81'], dueDate: '2026-09-30', currency: 'CNY' })