This commit is contained in:
2026-09-03 14:12:42 +08:00
parent f50ea81cbc
commit a25b4ed0f7
4 changed files with 36 additions and 12 deletions
@@ -17,7 +17,7 @@ const detail = {
},
order: {
order: { version: 7, receivingWarehouseId: '700000000000000001', channelCode: 'OLD', channelName: '原渠道', customerRemark: '原备注' },
cargoes: [{ itemNo: 1, cargoName: '台灯', packageCount: 2, totalQuantity: 20, lengthCm: 40, widthCm: 30, heightCm: 20, grossWeightKg: 18, volumeCbm: 0.048, currency: 'USD', material: '铝', usage: '照明' }],
cargoes: [{ itemNo: 1, cargoName: '台灯', packageCount: 2, totalQuantity: 20, lengthCm: 40, widthCm: 30, heightCm: 20, grossWeightKg: 18, volumeCbm: 0.048, currency: 'USD', material: '铝', productUsage: '照明' }],
parties: [], internalNotes: [], statusHistory: [],
},
timeline: [],
@@ -68,7 +68,13 @@ describe('OrderDeclarationEditorDialog', () => {
expect(ElMessageBox.confirm).toHaveBeenCalledWith(expect.stringContaining('原箱码继续有效,无需更换已打印箱唛'), '确认变更渠道', expect.any(Object))
expect(ElMessageBox.confirm).toHaveBeenCalledWith(expect.stringContaining('纸面上的旧渠道文字不会自动变化'), '确认变更渠道', expect.any(Object))
expect(updatePlatformUnifiedOrderDeclaration).toHaveBeenCalledWith('208', '90001', expect.objectContaining({ expectedVersion: 7, estimatedVolumeCbm: 0.625, channelCode: 'NEW', channelName: '新渠道' }))
expect(updatePlatformUnifiedOrderDeclaration).toHaveBeenCalledWith('208', '90001', expect.objectContaining({
expectedVersion: 7,
estimatedVolumeCbm: 0.625,
channelCode: 'NEW',
channelName: '新渠道',
cargoes: [expect.objectContaining({ itemNo: 1, usage: '照明' })],
}))
expect(ElMessage.success).toHaveBeenCalledWith(expect.stringContaining('订单已标记为“曾变更渠道”'))
expect(wrapper.emitted('updated')).toHaveLength(1)
expect(wrapper.emitted('update:modelValue')).toContainEqual([false])
@@ -83,11 +89,13 @@ describe('OrderDeclarationEditorDialog', () => {
expect(wrapper.find('.cargo-table').exists()).toBe(true)
expect(wrapper.text()).toContain('箱数 / 数量')
expect(wrapper.text()).toContain('材质 / 用途')
expect(wrapper.text()).toContain('铝 / 照明')
expect(wrapper.text()).toContain('2 箱 / 20')
const editButton = wrapper.findAll('button').find((button) => button.text() === '编辑')!
await editButton.trigger('click')
expect(wrapper.find('input[aria-label="币种"]').attributes('readonly')).toBeDefined()
expect(wrapper.findAllComponents({ name: 'ElInput' }).some((input) => input.props('modelValue') === '照明')).toBe(true)
})
it('preserves the editor when the versioned update fails', async () => {
@@ -88,7 +88,7 @@ function resetForm() {
hsCode: text(row, 'hsCode'), customsHsCode: text(row, 'customsHsCode'),
unitsPerPackage: optionalNumber(row, 'unitsPerPackage'),
unitDeclaredValue: optionalNumber(row, 'unitDeclaredValue'), declaredValue: optionalNumber(row, 'declaredValue'),
currency: text(row, 'currency'), material: text(row, 'material'), usage: text(row, 'usage'),
currency: text(row, 'currency'), material: text(row, 'material'), usage: text(row, 'productUsage'),
brand: text(row, 'brand'), cargoRemark: text(row, 'cargoRemark') || text(row, 'remark'),
}
})