优化
This commit is contained in:
@@ -145,6 +145,33 @@ describe('LastMileOrderDetailView domestic detail alignment', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('allows selecting and submitting manual storage rent', async () => {
|
||||
const { dialog } = await openFeeEditor()
|
||||
const select = dialog.findAllComponents({ name: 'ElSelect' })[0]!
|
||||
expect(select.findAllComponents({ name: 'ElOption' }).some(option => option.props('value') === 'FEE_TYPE_077')).toBe(true)
|
||||
select.vm.$emit('update:modelValue', 'FEE_TYPE_077')
|
||||
dialog.findAllComponents({ name: 'ElInputNumber' })[0]!.vm.$emit('update:modelValue', 80)
|
||||
await flushPromises()
|
||||
dialog.vm.$emit('confirm'); await flushPromises()
|
||||
expect(createLastMileOrderFee).toHaveBeenCalledWith('internal-order-id', expect.objectContaining({ feeItemCode: 'FEE_TYPE_077', amount: 80 }))
|
||||
})
|
||||
|
||||
it('creates a return order fee without charging quantity or unit inputs', async () => {
|
||||
vi.mocked(getLastMileOrder).mockResolvedValue({ order: { id: 'internal-order-id', customerId: 'customer-1', orderNo: 'RT-1', orderType: 'RETURN_RELABEL', currentStatus: 'INBOUND_COMPLETED' }, cargo: [], fees: [], statusHistory: [], operationHistory: [] })
|
||||
const { dialog } = await openFeeEditor()
|
||||
expect(dialog.text()).not.toContain('计费数量')
|
||||
expect(dialog.text()).not.toContain('计费单位')
|
||||
dialog.findAllComponents({ name: 'ElSelect' })[0]!.vm.$emit('update:modelValue', 'FEE_TYPE_071')
|
||||
dialog.findComponent({ name: 'ElInputNumber' }).vm.$emit('update:modelValue', 80)
|
||||
await flushPromises()
|
||||
dialog.vm.$emit('confirm'); await flushPromises()
|
||||
expect(createLastMileOrderFee).toHaveBeenCalledOnce()
|
||||
const payload = vi.mocked(createLastMileOrderFee).mock.calls[0]![1]
|
||||
expect(payload.amount).toBe(80)
|
||||
expect(payload).not.toHaveProperty('chargeableQuantity')
|
||||
expect(payload).not.toHaveProperty('quantityUnit')
|
||||
expect(payload).not.toHaveProperty('unitPrice')
|
||||
})
|
||||
it('shows business references without changing the transfer workflow or requiring business-list permission', async () => {
|
||||
vi.mocked(getLastMileOrder).mockResolvedValue({ order: { id: 'internal-order-id', customerId: 'A', orderNo: 'WT-1', sourceOrderNo: 'WT-1', orderType: 'WAREHOUSE_TRANSFER', businessSource: { businessType: 'LOCAL_LOOSEBOARD', label: '本土散板 · 拼车需求池', businessOrderNo: 'LB-1', externalBookingNo: 'FB-1' } }, cargo: [], fees: [], statusHistory: [], operationHistory: [] })
|
||||
const wrapper = mount(LastMileOrderDetailView, { global: { plugins: [ElementPlus] } }); await flushPromises()
|
||||
@@ -284,13 +311,13 @@ describe('LastMileOrderDetailView domestic detail alignment', () => {
|
||||
await dialog.findAll('button').find(button => button.text() === '保存费用')!.trigger('click'); await flushPromises()
|
||||
expect(createLastMileOrderFee).not.toHaveBeenCalled()
|
||||
})
|
||||
it('uses the live catalog, excludes automatic rent and only loads suppliers for payables', async () => {
|
||||
it('uses the live catalog including rent and only loads suppliers for payables', async () => {
|
||||
const { dialog } = await openFeeEditor()
|
||||
expect(listOverseasFeeItems).toHaveBeenCalledWith('RECEIVABLE')
|
||||
expect(listSuppliers).not.toHaveBeenCalled()
|
||||
const select = dialog.findAllComponents({ name: 'ElSelect' })[0]!
|
||||
expect(select.props('allowCreate')).toBe(false)
|
||||
expect(select.findAllComponents({ name: 'ElOption' }).map(option => option.props('value'))).toEqual(['FEE_TYPE_071'])
|
||||
expect(select.findAllComponents({ name: 'ElOption' }).map(option => option.props('value'))).toEqual(['FEE_TYPE_071', 'FEE_TYPE_077'])
|
||||
await fillFee(dialog, 'PAYABLE')
|
||||
expect(listOverseasFeeItems).toHaveBeenLastCalledWith('PAYABLE')
|
||||
expect(listSuppliers).toHaveBeenCalledOnce()
|
||||
|
||||
Reference in New Issue
Block a user