From a10ee73ba9165efe9baf17b68848f1e83a7edd36 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Fri, 28 Aug 2026 17:27:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E7=B4=A7=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E9=80=80=E7=A8=8E=E6=8A=A5=E5=85=B3=E9=95=BFID=E5=A5=91?= =?UTF-8?q?=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/first-leg/api/customs.test.mjs | 2 ++ src/modules/first-leg/api/customs.ts | 18 +++++++++--------- .../views/FirstLegOrdersView.test.mjs | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/modules/first-leg/api/customs.test.mjs b/src/modules/first-leg/api/customs.test.mjs index 1178ea2..2e780ee 100644 --- a/src/modules/first-leg/api/customs.test.mjs +++ b/src/modules/first-leg/api/customs.test.mjs @@ -12,6 +12,8 @@ test('maps only the frozen merchant container-customs contract', () => { assert.match(source, /orderId: string/) assert.match(source, /documentId: string/) assert.match(source, /loadingPlanId: string/) + assert.match(source, /getMerchantCustomsForOrder\(orderId: string\)/) + assert.doesNotMatch(source, /number \| string/) assert.match(source, /url: `\/merchant\/v1\/customs\/orders\/\$\{encodedId\(orderId\)\}`/) assert.doesNotMatch(source, /customs\/cases|MerchantCustomsCaseDetail|getMerchantCustomsByOrder/) }) diff --git a/src/modules/first-leg/api/customs.ts b/src/modules/first-leg/api/customs.ts index ea26674..6e7d15f 100644 --- a/src/modules/first-leg/api/customs.ts +++ b/src/modules/first-leg/api/customs.ts @@ -73,13 +73,13 @@ export const MERCHANT_CUSTOMS_STATUS_LABELS: Record) { +function inboundQuery(inboundIds: string[]) { const params = new URLSearchParams() - inboundIds.map(String).forEach((id) => params.append('inboundIds', id)) + inboundIds.forEach((id) => params.append('inboundIds', id)) return params.toString() } @@ -93,14 +93,14 @@ export function validateMerchantCustomsFile(file: File) { if (file.size > MAX_CUSTOMS_FILE_SIZE) throw new Error('单个文件不能超过 50MB') } -export function getMerchantCustomsForOrder(orderId: number | string) { +export function getMerchantCustomsForOrder(orderId: string) { return apiRequest({ method: 'GET', url: `/merchant/v1/customs/orders/${encodedId(orderId)}`, }) } -export function uploadMerchantCustomsDocument(planId: number | string, inboundIds: Array, file: File) { +export function uploadMerchantCustomsDocument(planId: string, inboundIds: string[], file: File) { validateMerchantCustomsFile(file) return apiRequest({ method: 'POST', @@ -111,7 +111,7 @@ export function uploadMerchantCustomsDocument(planId: number | string, inboundId }) } -export function replaceMerchantCustomsDocument(document: MerchantCustomsDocument, inboundIds: Array, file: File) { +export function replaceMerchantCustomsDocument(document: MerchantCustomsDocument, inboundIds: string[], file: File) { validateMerchantCustomsFile(file) const params = new URLSearchParams(inboundQuery(inboundIds)) params.set('expectedVersion', String(document.source.version)) @@ -124,12 +124,12 @@ export function replaceMerchantCustomsDocument(document: MerchantCustomsDocument }) } -export function updateMerchantCustomsDocumentInbounds(document: MerchantCustomsDocument, inboundIds: Array) { +export function updateMerchantCustomsDocumentInbounds(document: MerchantCustomsDocument, inboundIds: string[]) { return apiRequest({ method: 'PUT', url: `/merchant/v1/customs/documents/${encodedId(document.documentId)}/inbounds`, headers: { 'Idempotency-Key': createIdempotencyKey(`merchant-customs-scope-${document.documentId}`) }, - data: { inboundIds: inboundIds.map(String), expectedVersion: document.source.version }, + data: { inboundIds, expectedVersion: document.source.version }, }) } diff --git a/src/modules/first-leg/views/FirstLegOrdersView.test.mjs b/src/modules/first-leg/views/FirstLegOrdersView.test.mjs index a74f1bd..b395768 100644 --- a/src/modules/first-leg/views/FirstLegOrdersView.test.mjs +++ b/src/modules/first-leg/views/FirstLegOrdersView.test.mjs @@ -512,7 +512,7 @@ test('supports the frozen customs document workflow and customer-safe downloads' '/completion/download', ]) assert.match(customsApiSource, new RegExp(path.replaceAll('/', '\\/'))) assert.match(customsApiSource, /MAX_CUSTOMS_FILE_SIZE = 50 \* 1024 \* 1024/) - assert.match(customsApiSource, /inboundIds: inboundIds\.map\(String\)/) + assert.match(customsApiSource, /data: \{ inboundIds, expectedVersion: document\.source\.version \}/) assert.match(customsApiSource, /requestId: error\.requestId/) assert.match(customsDialogSource, /报关开始后仅可查看和下载,不提供退回或解锁/) assert.match(customsDialogSource, /detail\.status === 'COMPLETED' && item\.completion/)