This commit is contained in:
2026-08-04 10:31:53 +08:00
parent 198101c42c
commit 5c25806081
10 changed files with 100 additions and 31 deletions
@@ -34,6 +34,12 @@ test('sends backend-required channel, customs, destination and cargo fields', ()
}
assert.match(storeSource, /containerMode: draft\.transportMode === 'FCL' \? 'FULL_CONTAINER'/)
assert.match(storeSource, /customerId: draft\.shipperPartyId/)
assert.match(storeSource, /customerName: customerName\.trim\(\) \|\| draft\.shipperPartySnapshot\.name/)
})
test('only blocks submission when a known company audit status is not active', () => {
assert.match(storeSource, /companyAuditStatus\?: MerchantTenantStatus/)
assert.match(storeSource, /if \(companyAuditStatus && companyAuditStatus !== 'ACTIVE'\)/)
})
test('does not expose the out-of-scope cancellation write', () => {
@@ -66,7 +66,7 @@ function savePayload(draft: FirstLegOrderDraft, warehouse: PlatformReceivingWare
// 后端把 customerId 作为订单主往来单位校验并以服务端名称覆盖 customerName;
// 当前商户下单以所选发货单位作为主往来单位,收发货详情仍分别保存订单快照。
customerId: draft.shipperPartyId,
customerName,
customerName: customerName.trim() || draft.shipperPartySnapshot.name,
transportMode: apiTransport(draft),
tradeTerm: draft.tradeTerm || undefined,
destinationCountryCode: draft.destinationCountryCode.trim().toUpperCase(),
@@ -246,8 +246,8 @@ export const useFirstLegOrdersStore = defineStore('client-first-leg-orders', ()
return loadDetail(String(createdId))
}
async function submit(draft: FirstLegOrderDraft, customerName: string, id?: string, companyAuditStatus: MerchantTenantStatus = 'ACTIVE') {
if (companyAuditStatus !== 'ACTIVE') throw new Error('企业资料尚未审核通过,请先完善企业资料并等待平台审核')
async function submit(draft: FirstLegOrderDraft, customerName: string, id?: string, companyAuditStatus?: MerchantTenantStatus) {
if (companyAuditStatus && companyAuditStatus !== 'ACTIVE') throw new Error('企业资料尚未审核通过,请先完善企业资料并等待平台审核')
const order = await saveDraft(draft, customerName, id)
await submitMerchantFirstLegOrder(order.id)
return loadDetail(order.id)