From 60734cbb03533af3482ac99798d8e2e3daa6dfab Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Thu, 10 Sep 2026 14:02:37 +0800 Subject: [PATCH] fix(admin): show empty customs state for unloaded plan --- .../api/platformContainerCustoms.test.ts | 2 +- .../api/platformContainerCustoms.ts | 1 + .../components/ContainerCustomsPanel.test.ts | 16 +++++++++++++++- .../components/ContainerCustomsPanel.vue | 9 ++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/modules/container-loading/api/platformContainerCustoms.test.ts b/src/modules/container-loading/api/platformContainerCustoms.test.ts index 1a64e112..0c2959f5 100644 --- a/src/modules/container-loading/api/platformContainerCustoms.test.ts +++ b/src/modules/container-loading/api/platformContainerCustoms.test.ts @@ -4,7 +4,7 @@ import { completeAllBuyContainerCustoms, downloadContainerCustomsCompletion, dow const customs = { aggregateId: 2092438843630391401n, loadingPlanId: 2092438843630391402n, containerBookingId: 2092438843630391403n, - planNo: 'LP-1', cabinetNo: 'CB-1', containerNo: 'MSCU-1', status: 'READY_TO_START', version: '3', taxRefundCount: 1, coveredTaxRefundCount: 1, + planNo: 'LP-1', cabinetNo: 'CB-1', containerNo: 'MSCU-1', status: 'READY_TO_START', hasActualCargo: true, version: '3', taxRefundCount: 1, coveredTaxRefundCount: 1, inbounds: [{ inboundId: 2092438843630391404n, orderId: 2092438843630391405n, orderNo: 'O-1', inboundCode: 'RK-1', tenantId: 2092438843630391406n, customerName: '客户一', taxMode: 'TAX_REFUND', covered: true }], documents: [{ documentId: 2092438843630391407n, tenantId: 2092438843630391406n, source: { fileId: '2092438843630391408', fileName: 'source.pdf', fileHash: 'hash', sizeBytes: 1, version: 2, uploadedAt: '2026-08-28T10:00:00' }, inboundIds: ['2092438843630391404'], inboundCodes: ['RK-1'], frozen: true, completion: null }], startedAt: null, completedAt: null, diff --git a/src/modules/container-loading/api/platformContainerCustoms.ts b/src/modules/container-loading/api/platformContainerCustoms.ts index 92005b3a..9f38c679 100644 --- a/src/modules/container-loading/api/platformContainerCustoms.ts +++ b/src/modules/container-loading/api/platformContainerCustoms.ts @@ -41,6 +41,7 @@ export interface ContainerCustomsView { cabinetNo: string containerNo: string | null status: ContainerCustomsStatus + hasActualCargo: boolean version: number taxRefundCount: number coveredTaxRefundCount: number diff --git a/src/modules/container-loading/components/ContainerCustomsPanel.test.ts b/src/modules/container-loading/components/ContainerCustomsPanel.test.ts index f55bcad7..d181f38c 100644 --- a/src/modules/container-loading/components/ContainerCustomsPanel.test.ts +++ b/src/modules/container-loading/components/ContainerCustomsPanel.test.ts @@ -28,7 +28,7 @@ import ContainerCustomsPanel from './ContainerCustomsPanel.vue' function customs(status: ContainerCustomsStatus, hasCompletion = false): ContainerCustomsView { return { aggregateId: '2092438843630391401', loadingPlanId: '2092438843630391402', containerBookingId: '2092438843630391403', - planNo: 'LP-1', cabinetNo: 'MCR08290001', containerNo: 'MSCU-1', status, version: 3, taxRefundCount: 1, coveredTaxRefundCount: 1, + planNo: 'LP-1', cabinetNo: 'MCR08290001', containerNo: 'MSCU-1', status, hasActualCargo: true, version: 3, taxRefundCount: 1, coveredTaxRefundCount: 1, inbounds: [{ inboundId: '2092438843630391404', orderId: '2092438843630391405', orderNo: 'O-1', inboundCode: 'RK-1', tenantId: '2092438843630391406', customerName: '客户一', taxMode: 'TAX_REFUND', covered: true }], documents: [{ documentId: '2092438843630391407', tenantId: '2092438843630391406', @@ -78,6 +78,20 @@ describe('ContainerCustomsPanel', () => { expect(buttonTexts(wrapper)).not.toContain('提交') }) + it('shows a successful empty state and hides customs actions when the completed plan has no actual cargo', async () => { + api.get.mockResolvedValue({ ...customs('READY_TO_START'), hasActualCargo: false, taxRefundCount: 0, coveredTaxRefundCount: 0, inbounds: [], documents: [] }) + const wrapper = mount(ContainerCustomsPanel, { + props: { loadingPlanId: '2092438843630391402', canList: true, canManage: true, departureState: 'WAITING_OTHER_GATES' }, + global: { plugins: [ElementPlus] }, + }) + await flushPromises() + + expect(wrapper.text()).toContain('当前装柜计划没有实际装柜货物,无需报关') + expect(wrapper.text()).toContain('无需报关') + expect(buttonTexts(wrapper)).not.toContain('开始报关') + expect(buttonTexts(wrapper)).not.toContain('导出买单 XLSX') + }) + it('allows completion upload and overwrite only while DECLARING with manage permission', async () => { let wrapper = await render('DECLARING', true, false) expect(wrapper.text()).toContain('上传报关完成文件') diff --git a/src/modules/container-loading/components/ContainerCustomsPanel.vue b/src/modules/container-loading/components/ContainerCustomsPanel.vue index 3bb09b2d..89590a80 100644 --- a/src/modules/container-loading/components/ContainerCustomsPanel.vue +++ b/src/modules/container-loading/components/ContainerCustomsPanel.vue @@ -37,7 +37,7 @@ const completionFiles = reactive>({}) const missingInbounds = computed(() => customs.value?.inbounds.filter((item) => item.taxMode === 'TAX_REFUND' && !item.covered) || []) const missingCoverageCount = computed(() => Math.max(0, (customs.value?.taxRefundCount || 0) - (customs.value?.coveredTaxRefundCount || 0))) -const allBuy = computed(() => customs.value?.taxRefundCount === 0) +const allBuy = computed(() => customs.value?.hasActualCargo === true && customs.value.taxRefundCount === 0) const missingCompletionCount = computed(() => customs.value?.documents.filter((item) => !item.completion).length || 0) const statusText: Record = { WAITING_CUSTOMER_DOCUMENTS: '待客户补齐退税资料', READY_TO_START: '可开始报关', DECLARING: '报关中', COMPLETED: '报关已完成', @@ -156,9 +156,9 @@ onMounted(load)

整柜报关

客户退税资料与平台买单事实按柜冻结;报关完成和国内离仓分别展示。

- {{ statusText[customs.status] }} + {{ customs.hasActualCargo ? statusText[customs.status] : '无需报关' }} 导出买单 XLSX - 开始报关 + 开始报关 确认报关完成
@@ -166,6 +166,8 @@ onMounted(load)