diff --git a/src/modules/container-loading/pages/ContainerDetailView.test.ts b/src/modules/container-loading/pages/ContainerDetailView.test.ts index 6506f05d..5a3df9f3 100644 --- a/src/modules/container-loading/pages/ContainerDetailView.test.ts +++ b/src/modules/container-loading/pages/ContainerDetailView.test.ts @@ -58,13 +58,15 @@ describe('ContainerDetailView customs integration', () => { it('separates domestic first-leg fees and connects the overseas fee lifecycle lazily', () => { expect(source).toContain('label="头程计费" name="first-leg-fees"') expect(source).toContain('label="尾程计费" name="last-leg-fees"') - expect(source).toContain('v-if="isDomestic && firstLegFeesOpened"') + expect(source).toContain('') + expect(source).toContain('') + expect(source).toContain('v-if="firstLegFeesOpened"') expect(source).toContain('v-show="activeTab === \'first-leg-fees\'"') expect(source).toContain('title="头程计费" :plan-id="overview.loadingPlanId" :container-booking-id="detail.id"') - expect(source).toContain('v-if="isOverseas && lastLegFeesOpened"') + expect(source).toContain('v-if="lastLegFeesOpened"') expect(source).toContain('') expect(source).toContain("if (isDomestic.value && activeTab.value === 'loading-list') await loadLoadingDetail(resource, aggregate)") - expect(source).toContain("tabName === 'loading-list' || tabName === 'first-leg-fees'") + expect(source).toContain("const needsLoadingDetail = tabName === 'first-leg-fees' || (isDomestic.value && tabName === 'loading-list')") expect(lastLegFeesSource.indexOf('label="操作"')).toBeLessThan(lastLegFeesSource.indexOf('label="客户"')) expect(lastLegFeesSource).toContain('show-overflow-tooltip') expect(lastLegFeesSource).toContain('尾程计费加载失败') @@ -76,6 +78,9 @@ describe('ContainerDetailView customs integration', () => { expect(lastLegFeesSource).toContain('uploadContainerFeePaymentVoucher(form.customerId, file.raw)') expect(lastLegFeesSource).toContain("access.can('platform:finance:fee-source:edit')") expect(lastLegFeesSource).toContain("access.can('platform:finance:fee-source:review')") + expect(source).toContain("if (!overview.value?.loadingPlanId) return '当前货柜尚未关联装柜计划,暂无头程计费归属。'") + expect(source).toContain(':description="firstLegFeesEmptyReason"') + expect(source).toContain("const needsLoadingDetail = tabName === 'first-leg-fees' || (isDomestic.value && tabName === 'loading-list')") }) it('mounts the new container customs panel only after loading completes', () => { diff --git a/src/modules/container-loading/pages/ContainerDetailView.vue b/src/modules/container-loading/pages/ContainerDetailView.vue index 9d4f9b90..04731419 100644 --- a/src/modules/container-loading/pages/ContainerDetailView.vue +++ b/src/modules/container-loading/pages/ContainerDetailView.vue @@ -56,10 +56,18 @@ const feeBusinessReferences = computed(() => (loadingDetail.value?.items || []). accountId: item.accountId, customerName: item.customerName, orderId: item.orderId, orderNo: item.orderNo, inboundId: item.inboundId, inboundCode: item.inboundCode, }))) +const firstLegFeesEmptyReason = computed(() => { + if (!overview.value?.loadingPlanId) return '当前货柜尚未关联装柜计划,暂无头程计费归属。' + if (!detail.value?.warehouseId) return '当前货柜尚未关联装柜仓库,无法加载头程计费归属。' + if (detail.value.planStatus === 'COMPLETED' && !canViewLoadingList.value) return '当前账号无权读取已确认装柜清单,无法查看头程计费。' + if (detail.value.planStatus !== 'COMPLETED' && !canViewPreload.value) return '当前账号无权读取预装计划,无法查看头程计费。' + return '当前柜次暂无可用费用归属明细。' +}) async function rememberWorkbenchTab(tabName: string | number) { if (tabName === 'first-leg-fees') firstLegFeesOpened.value = true if (tabName === 'last-leg-fees') lastLegFeesOpened.value = true - if (isDomestic.value && (tabName === 'loading-list' || tabName === 'first-leg-fees') && detail.value && overview.value) { + const needsLoadingDetail = tabName === 'first-leg-fees' || (isDomestic.value && tabName === 'loading-list') + if (needsLoadingDetail && detail.value && overview.value) { await loadLoadingDetail(detail.value, overview.value) } } @@ -210,7 +218,7 @@ async function loadOutboundDispatch() { async function loadLoadingDetail(resource: ContainerBookingResource, aggregate: ContainerOverview) { if (loadingDetail.value || loadingDetailLoading.value) return loadingDetail.value = null; loadingDetailError.value = null - if (!isDomestic.value || !aggregate.loadingPlanId || !resource.warehouseId) return + if (!aggregate.loadingPlanId || !resource.warehouseId) return loadingDetailLoading.value = true try { if (resource.planStatus === 'COMPLETED') { @@ -407,7 +415,7 @@ onMounted(async () => { await load(); if (isOverseas.value && route.query.action