Merge branch 'dev' of http://8.163.30.128:10082/html/client-web into dev
This commit is contained in:
@@ -140,6 +140,17 @@ test('requires public destination ids while keeping private addresses detached f
|
||||
assert.ok(validateFirstLegOrderDraft(privateDraft).includes('私人地址不能引用平台公共仓库'))
|
||||
})
|
||||
|
||||
test('requires customs inspection when any cargo is a wooden product', () => {
|
||||
const draft = validDraft()
|
||||
draft.items[0].woodenProduct = true
|
||||
draft.customsInspection = null
|
||||
assert.ok(validateFirstLegOrderDraft(draft).includes('第 1 条货物为木制品,“是否商检”必须选择“是”'))
|
||||
draft.customsInspection = false
|
||||
assert.ok(validateFirstLegOrderDraft(draft).includes('第 1 条货物为木制品,“是否商检”必须选择“是”'))
|
||||
draft.customsInspection = true
|
||||
assert.ok(!validateFirstLegOrderDraft(draft).some((message) => message.includes('为木制品')))
|
||||
})
|
||||
|
||||
test('summarizes cargo values from line items', () => {
|
||||
const first = validDraft().items[0]
|
||||
const second = { ...first, id: 'cargo-2', pieces: 40, packageCount: 4, grossWeightKg: 300, volumeCbm: 1.25 }
|
||||
|
||||
@@ -84,6 +84,7 @@ export function createEmptyCargoItem(id = `cargo-${Date.now()}`): FirstLegCargoI
|
||||
declaredValue: 0,
|
||||
currency: 'USD',
|
||||
dangerousGoods: false,
|
||||
woodenProduct: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,12 +100,14 @@ export function validateFirstLegOrderDraft(draft: FirstLegOrderDraft) {
|
||||
if (!['TAX_INCLUDED', 'TAX_EXCLUDED'].includes(draft.pricingTaxMode)) errors.push('请选择报价包税方式')
|
||||
if (!draft.receivingWarehouseId) errors.push('请选择平台收货仓')
|
||||
if (draft.pickupMethod === 'PICKUP') {
|
||||
if (!draft.senderAddressId) errors.push('请选择已保存的提货地址')
|
||||
if (!draft.shipperPartySnapshot?.contactName.trim()) errors.push('请填写提货联系人')
|
||||
if (!draft.shipperPartySnapshot?.phone.trim()) errors.push('请填写提货联系电话')
|
||||
if (!draft.shipperPartySnapshot?.city.trim()) errors.push('请填写提货城市')
|
||||
if (!draft.shipperPartySnapshot?.address.trim()) errors.push('请填写提货地址')
|
||||
}
|
||||
if (draft.destinationType === 'PRIVATE') {
|
||||
if (!draft.privateDestinationAddressId) errors.push('请选择已保存的私人仓地址')
|
||||
if (!draft.consigneePartySnapshot?.name.trim()) errors.push('请填写私人地址名称')
|
||||
if (!draft.consigneePartySnapshot?.contactName.trim()) errors.push('请填写收件人姓名')
|
||||
if (!draft.consigneePartySnapshot?.phone.trim()) errors.push('请填写收件人电话')
|
||||
@@ -129,6 +132,7 @@ export function validateFirstLegOrderDraft(draft: FirstLegOrderDraft) {
|
||||
if (!Number.isInteger(item.unitsPerPackage) || item.unitsPerPackage <= 0) errors.push(`${line}每箱数量必须为正整数`)
|
||||
if (item.grossWeightKg <= 0) errors.push(`${line}毛重必须大于 0`)
|
||||
if (item.volumeCbm <= 0) errors.push(`${line}体积必须大于 0`)
|
||||
if (item.woodenProduct && draft.customsInspection !== true) errors.push(`${line}为木制品,“是否商检”必须选择“是”`)
|
||||
})
|
||||
|
||||
return errors
|
||||
|
||||
Reference in New Issue
Block a user