feat(overseas): show return receipt and redispatch history

This commit is contained in:
2026-10-04 10:48:38 +08:00
parent 2c2e19c4ea
commit a8ff0ef1de
5 changed files with 90 additions and 7 deletions
@@ -23,11 +23,11 @@ function snapshot(number = 'EX-1', version = 1, remaining = 4): ExceptionDetail
return normalizeExceptionDetail({ order: { id: '1', exceptionNo: number, customerId: 'C', exceptionType: 'RETURN', returnDirection: 'OVERSEAS_WAREHOUSE',
overseasWarehouseId: '92', status: remaining ? 'PROCESSING' : 'COMPLETED', version: String(version), allowedActions: remaining ? ['COMPLETE_EXCEPTION'] : [],
reason: '拒收', exceptionAt: '', updatedAt: '', evidenceFileIds: ['91'] },
returnSources: remaining ? [{ outboundPalletItemId: '10', inventoryPositionId: '20', palletNo: 'ORIGINAL', skuCode: 'SKU', maxReturnPackages: String(remaining) }] : [] } as unknown as ExceptionDetail)
returnSources: remaining ? [{ outboundPalletItemId: '10', inventoryPositionId: '20', palletNo: 'ORIGINAL', skuCode: 'SKU', maxReturnPackages: String(remaining) }] : [], returnReceipts: [] } as unknown as ExceptionDetail)
}
function open() { return mount(ExceptionProcessingPanel, { props: { customerId: 'C', exceptionNo: 'EX-1', active: true }, global: {
directives: { loading: () => {} }, stubs: { ElDescriptions: shell, ElDescriptionsItem: shell, ElForm: shell, ElFormItem: shell,
ElInput: field, ElInputNumber: quantity, ElSelect: field, ElOption: true, ElButton: { template: '<button><slot /></button>' } },
ElInput: field, ElInputNumber: quantity, ElSelect: field, ElOption: true, RouterLink: { template: '<a><slot /></a>' }, ElButton: { template: '<button><slot /></button>' } },
} }) }
async function fill(wrapper: ReturnType<typeof open>, amount = 2) {
if (wrapper.find('[data-test="history-0"]').exists()) await wrapper.get('[data-test="history-0"]').setValue(true)
@@ -35,6 +35,40 @@ async function fill(wrapper: ReturnType<typeof open>, amount = 2) {
await wrapper.get('[data-test="quantity-0"]').setValue(amount)
await wrapper.get('[data-test="target-0"]').setValue('30'); await flushPromises()
}
it('completed detail retains multiple receipt batches and redispatches as read-only history without commands', async () => {
const completed = snapshot('EX-1', 7, 0)
completed.returnReceipts = [
{ receiptNo: 'RSR-1', receivedPackages: 2, receivedAt: '2026-10-03T23:24:13', redispatches: [
{ dispatchNo: 'DS-1', status: 'DEPARTED', selectedPackages: 1, pickedPackages: 1, deliveries: [{ deliveryNo: 'DL-1', status: 'DELIVERED' }] },
{ dispatchNo: 'DS-2', status: 'PENDING_DEPARTURE', selectedPackages: 1, pickedPackages: 0, deliveries: [] },
] },
{ receiptNo: 'RSR-2', receivedPackages: 1, receivedAt: '2026-10-03T23:25:13', redispatches: [] },
]
vi.mocked(getExceptionDetail).mockResolvedValue(completed)
const wrapper = open(); await flushPromises()
for (const text of ['RSR-1', 'RSR-2', 'DS-1', 'DS-2', 'DL-1', '尚未关联重派排车', '已发车', '待发车']) expect(wrapper.text()).toContain(text)
expect(wrapper.findAll('.exception-return-batch')).toHaveLength(2)
expect(wrapper.find('[data-test="start"]').exists()).toBe(false)
expect(wrapper.find('[data-test="complete"]').exists()).toBe(false)
expect(wrapper.find('[data-test="cancel"]').exists()).toBe(false)
expect(commandException).not.toHaveBeenCalled(); expect(uploadExceptionEvidence).not.toHaveBeenCalled()
wrapper.unmount()
})
it('related business numbers remain visible without independent list permissions, but no navigation links are offered', async () => {
can.mockReturnValue(false)
const completed = snapshot('EX-1', 7, 0)
completed.returnReceipts = [{ receiptNo: 'RSR-1', receivedPackages: 2, receivedAt: '', redispatches: [
{ dispatchNo: 'DS-1', status: 'DEPARTED', selectedPackages: 2, pickedPackages: 2, deliveries: [{ deliveryNo: 'DL-1', status: 'DELIVERED' }] },
] }]
vi.mocked(getExceptionDetail).mockResolvedValue(completed)
const wrapper = open(); await flushPromises()
expect(wrapper.text()).toContain('DS-1'); expect(wrapper.text()).toContain('DL-1')
expect(wrapper.find('.exception-return-history a').exists()).toBe(false)
expect(commandException).not.toHaveBeenCalled()
wrapper.unmount()
})
beforeEach(() => {
vi.resetAllMocks(); can.mockReturnValue(true)
vi.mocked(getExceptionDetail).mockResolvedValue(snapshot())