This commit is contained in:
2026-09-18 09:59:12 +08:00
parent 579a4b7353
commit 84e768f41a
9 changed files with 49 additions and 15 deletions
@@ -212,6 +212,21 @@ describe('LastMileOrdersView pending order and container conversion', () => {
vi.mocked(transferLastMileOrders).mockReset().mockResolvedValue(2)
})
it.each([
['PENDING_ASSIGNMENT', true],
['INBOUND_COMPLETED', false],
])('only enables a new hold after inbound completion for %s', async (currentStatus, disabled) => {
canAccess.mockImplementation(code => code === 'platform:overseas-warehouse:last-mile-order:edit')
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{
id: 'order-1', customerId, orderNo: 'LM-1', currentStatus, orderType: 'FIRST_LEG', detained: false,
}], page: 1, size: 10, total: 1, pages: 1 })
const wrapper = await mountView()
const holdButton = wrapper.get('.el-table__body-wrapper .row-actions').findAll('button')
.find(item => item.text().includes('暂扣订单'))!
expect((holdButton.element as HTMLButtonElement).disabled).toBe(disabled)
})
it('keeps the original pending order table and does not render a view switch or container table', async () => {
const wrapper = await openPending()
expect(wrapper.text()).toContain('尾程单号')
@@ -320,6 +335,22 @@ describe('LastMileOrdersView pending order and container conversion', () => {
expect(payload).not.toHaveProperty('plannedWarehouseName')
})
it('allows a historically held order to generate its inbound plan', async () => {
const wrapper = await openPending()
await selectRows(wrapper, [selectedRow({
detained: true,
orderTypeCode: 'ONE_CLICK_DROPSHIP',
currentStatusCode: 'PENDING_ASSIGNMENT',
})])
await button(wrapper, '生成入库计划')!.trigger('click')
await flushPromises()
expect(getContainerInboundPlanPreview).toHaveBeenCalledWith(bookingId)
const confirm = [...document.body.querySelectorAll('button')]
.find((item) => item.textContent?.includes('保存并生成入库单')) as HTMLButtonElement
expect(confirm.disabled).toBe(false)
})
it('blocks manual plan creation when the cabinet has no frozen expected arrival time', async () => {
const wrapper = await openPending()
await selectRows(wrapper, [selectedRow({ estimatedWarehouseAt: '', warehouseEta: '—' })])