diff --git a/src/modules/first-leg/api/customs.ts b/src/modules/first-leg/api/customs.ts index 1f2b507..3f70920 100644 --- a/src/modules/first-leg/api/customs.ts +++ b/src/modules/first-leg/api/customs.ts @@ -32,9 +32,10 @@ export interface MerchantCustomsDocument { inboundIds: string[] inboundCodes: string[] frozen: boolean - completion: MerchantCustomsFile | null + receipt: MerchantCustomsFile | null receiptStatus: 'PENDING' | 'CONFIRMED' | 'REJECTED' | null receiptRejectReason: string | null + finalDocument: MerchantCustomsFile | null } export interface MerchantCustomsContainer { @@ -186,10 +187,17 @@ export function downloadMerchantCustomsSource(document: MerchantCustomsDocument) return download(`/merchant/v1/customs/documents/${encodedId(document.documentId)}/download`, document.source.fileName) } -export function downloadMerchantCustomsCompletion(document: MerchantCustomsDocument) { +export function downloadMerchantCustomsReceipt(document: MerchantCustomsDocument) { return download( - `/merchant/v1/customs/documents/${encodedId(document.documentId)}/completion/download`, - document.completion?.fileName || `customs-completion-${document.documentId}`, + `/merchant/v1/customs/documents/${encodedId(document.documentId)}/receipt/download`, + document.receipt?.fileName || `customs-receipt-${document.documentId}`, + ) +} + +export function downloadMerchantCustomsFinal(document: MerchantCustomsDocument) { + return download( + `/merchant/v1/customs/documents/${encodedId(document.documentId)}/final/download`, + document.finalDocument?.fileName || `customs-final-${document.documentId}`, ) } @@ -198,7 +206,7 @@ export function confirmMerchantCustomsReceipt(document: MerchantCustomsDocument) method: 'POST', url: `/merchant/v1/customs/documents/${encodedId(document.documentId)}/receipt/confirm`, headers: { 'Idempotency-Key': createIdempotencyKey(`merchant-customs-receipt-confirm-${document.documentId}`) }, - data: { expectedVersion: document.completion?.version ?? 0, confirm: true, remark: null }, + data: { expectedVersion: document.receipt?.version ?? 0, confirm: true, remark: null }, }) } @@ -207,7 +215,7 @@ export function rejectMerchantCustomsReceipt(document: MerchantCustomsDocument, method: 'POST', url: `/merchant/v1/customs/documents/${encodedId(document.documentId)}/receipt/reject`, headers: { 'Idempotency-Key': createIdempotencyKey(`merchant-customs-receipt-reject-${document.documentId}`) }, - data: { expectedVersion: document.completion?.version ?? 0, confirm: false, remark: reason }, + data: { expectedVersion: document.receipt?.version ?? 0, confirm: false, remark: reason }, }) } diff --git a/src/modules/first-leg/components/CustomsDocumentsDialog.vue b/src/modules/first-leg/components/CustomsDocumentsDialog.vue index fdab2a1..b2e3477 100644 --- a/src/modules/first-leg/components/CustomsDocumentsDialog.vue +++ b/src/modules/first-leg/components/CustomsDocumentsDialog.vue @@ -6,7 +6,8 @@ import { MERCHANT_CUSTOMS_STATUS_LABELS, deleteMerchantCustomsDocument, confirmMerchantCustomsReceipt, - downloadMerchantCustomsCompletion, + downloadMerchantCustomsReceipt, + downloadMerchantCustomsFinal, downloadMerchantCustomsSource, getMerchantCustomsForOrder, merchantCustomsErrorMessage, @@ -194,13 +195,13 @@ function saveDownload(blob: Blob, fileName: string) { URL.revokeObjectURL(url) } -async function downloadFile(document: MerchantCustomsDocument, kind: 'source' | 'completion') { +async function downloadFile(document: MerchantCustomsDocument, kind: 'source' | 'receipt' | 'final') { const key = `${document.documentId}:${kind}` downloadingKey.value = key try { const result = kind === 'source' ? await downloadMerchantCustomsSource(document) - : await downloadMerchantCustomsCompletion(document) + : kind === 'receipt' ? await downloadMerchantCustomsReceipt(document) : await downloadMerchantCustomsFinal(document) saveDownload(result.blob, result.fileName) } catch (error) { ElMessage.error(merchantCustomsErrorMessage(error, '文件下载失败')) @@ -211,7 +212,7 @@ async function downloadFile(document: MerchantCustomsDocument, kind: 'source' | async function confirmReceipt(document: MerchantCustomsDocument) { try { - await ElMessageBox.confirm('确认已核对整份报关行回执吗?确认后将进入整柜报关完成汇总。', '确认报关行回执', { type: 'warning' }) + await ElMessageBox.confirm('确认已核对整份报关行回执吗?确认后平台会把确认结果发送给报关行执行。', '确认报关行回执', { type: 'warning' }) mutating.value = true await confirmMerchantCustomsReceipt(document) ElMessage.success('回执确认成功') @@ -318,12 +319,13 @@ function formatSize(bytes: number) {