This commit is contained in:
2026-11-03 11:43:50 +08:00
parent f8408b8076
commit 1c2dd8797a
34 changed files with 354 additions and 84 deletions
@@ -28,6 +28,19 @@ beforeEach(() => {
afterEach(() => { vi.restoreAllMocks(); vi.unstubAllGlobals(); document.body.innerHTML = '' })
describe('仓租列表服务端契约', () => {
it('uses the whole pallet billing basis from the charge snapshot when only one box leaves', async () => {
vi.mocked(api.getStorageRentLot).mockResolvedValue({ lot: { ...lot, businessType: 'RETURN_ORDER', billingUnit: 'PALLET', originalQuantity: 16 },
charges: [{ id: '3', outboundNo: 'OUT1', businessNo: 'CD1', quantity: 1, storageDays: 1, originalAmount: 1.5,
currency: 'USD', settlementAmount: 15, currencyRate: 10, status: 'PENDING_REVIEW', createdAt: '', outboundAt: '', billingQuantity: 1, billingUnit: 'PALLET' }] })
const wrapper = mount(StorageRentPanel, { attachTo: document.body, props: { customers: [] }, global: { plugins: [ElementPlus] } })
await flushPromises()
await wrapper.findAll('.el-table__body-wrapper button').find(button => button.text().trim() === '详情')!.trigger('click')
await flushPromises()
const dialog = document.body.querySelector('[role="dialog"]')!
expect(dialog.textContent).toContain('本次计租基数')
expect(dialog.textContent).toContain('1 托')
expect(dialog.textContent).not.toContain('0.0625 托')
})
it('shows storage age and remaining quantity and traces each half pallet without financial actions', async () => {
const returned = { ...lot, businessType: 'RETURN_ORDER', businessNo: 'TH1', quantityUnit: 'PIECE', originalQuantity: 6, remainingQuantity: 2, billingQuantity: 1.5, billingUnit: 'PALLET', status: 'IN_STOCK', generatedAmounts: [{ currency: 'USD', amount: 1.5 }], settledAmount: 10, chargeCount: 2, settledChargeCount: 2 }
vi.mocked(api.listStorageRentLots).mockResolvedValue({ records: [returned], total: 1, page: 1, size: 20, pages: 1 })