From fc8480426d16452ce9d740355a7053d71c673a26 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Sat, 15 Aug 2026 09:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/FinanceCustomerAccountsView.vue | 1 + .../finance/pages/FinanceCustomerArapView.vue | 22 +++++++++++++++---- .../pages/FinanceFormalSettlementPage.vue | 7 +++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/modules/finance/pages/FinanceCustomerAccountsView.vue b/src/modules/finance/pages/FinanceCustomerAccountsView.vue index a1459ba7..f9c548bb 100644 --- a/src/modules/finance/pages/FinanceCustomerAccountsView.vue +++ b/src/modules/finance/pages/FinanceCustomerAccountsView.vue @@ -214,6 +214,7 @@ watch(() => [route.name, String(route.params.customerId || '')], ([name, custome + diff --git a/src/modules/finance/pages/FinanceCustomerArapView.vue b/src/modules/finance/pages/FinanceCustomerArapView.vue index bda59063..9eca5cd7 100644 --- a/src/modules/finance/pages/FinanceCustomerArapView.vue +++ b/src/modules/finance/pages/FinanceCustomerArapView.vue @@ -101,8 +101,21 @@ function customerName(customerId: string, snapshot?: string) { } function sourceTypeDisplay(value: unknown) { const code = String(value || '').trim().toUpperCase() - const label = financeSourceTypeLabel(code) - return label === '其他来源' ? (code ? `未识别来源(${code})` : '来源类型暂不可用') : label + const labels: Record = { + INBOUND_FEE: '入库费用', ORDER_FEE: '订单费用', CONTAINER_COST: '整柜成本', CONTAINER_FEE: '柜次费用', + MANUAL_COST: '人工成本', STORAGE_FEE: '仓储费用', + } + return labels[code] || (code ? '其他费用来源' : '来源类型暂不可用') +} +function feeDocumentLabel(direction: ArapRow['direction'], feeName: unknown) { + const prefix = direction === 'RECEIVABLE' ? '应收费用' : '应付费用' + const name = String(feeName || '').trim() + return name ? `${prefix} · ${name}` : prefix +} +function sourceSummary(sourceType: unknown, orderId: unknown, inboundId: unknown, containerId: unknown) { + const relations = [inboundId ? '关联入库单' : '', orderId ? '关联订单' : '', containerId ? '关联柜次' : ''].filter(Boolean) + const type = sourceTypeDisplay(sourceType) + return relations.length ? `${type} · ${relations.join('、')}` : type } function formatDateTime(value: unknown) { const raw = String(value || '').trim() @@ -137,7 +150,7 @@ async function load(model: QueryModel = filters.value) { try { const direction = String(filters.value.direction || '') as 'RECEIVABLE' | 'PAYABLE' | '' const items = await listFinanceFeePool(customerId || undefined, direction || undefined) - allRows.value = items.map((item): ArapRow => ({ id: item.poolItemId, feeSourceId: item.feeSourceId, customerId: item.customerId, customerName: customerName(item.customerId, item.customerName), direction: item.direction, documentNo: item.poolItemId, sourceType: item.sourceType, sourceId: [item.inboundId ? `入库单 ${item.inboundId}` : '', item.orderId ? `订单 ${item.orderId}` : '', item.containerId ? `柜次 ${item.containerId}` : '', `来源 ${item.sourceId}/v${item.sourceVersion}`].filter(Boolean).join(' · '), orderId: item.orderId || '', inboundId: item.inboundId || '', containerId: item.containerId || '', feeName: item.feeItemName, amount: item.amount, status: item.status, occurredAt: item.createdAt, businessDate: item.createdAt, reviewStatus: item.status, settlementIncluded: null, statementGenerated: null })) + allRows.value = items.map((item): ArapRow => ({ id: item.poolItemId, feeSourceId: item.feeSourceId, customerId: item.customerId, customerName: customerName(item.customerId, item.customerName), direction: item.direction, documentNo: feeDocumentLabel(item.direction, item.feeItemName), sourceType: item.sourceType, sourceId: sourceSummary(item.sourceType, item.orderId, item.inboundId, item.containerId), orderId: item.orderId || '', inboundId: item.inboundId || '', containerId: item.containerId || '', feeName: item.feeItemName, amount: item.amount, status: item.status, occurredAt: item.createdAt, businessDate: item.createdAt, reviewStatus: item.status, settlementIncluded: null, statementGenerated: null })) } catch (error) { loadError.value = getApiErrorDetails(error, '客户应收应付加载失败,请重试') } finally { loading.value = false } } @@ -233,10 +246,11 @@ watch(() => [route.name, String(route.params.feeSourceId || '')], ([name, feeSou + - + diff --git a/src/modules/finance/pages/FinanceFormalSettlementPage.vue b/src/modules/finance/pages/FinanceFormalSettlementPage.vue index 8429e2c9..1a122afb 100644 --- a/src/modules/finance/pages/FinanceFormalSettlementPage.vue +++ b/src/modules/finance/pages/FinanceFormalSettlementPage.vue @@ -137,7 +137,12 @@ function displayDate(value?: string) { return value || '—' } function rowTotal(value: unknown) { return totalAmount(value as SettlementRow) } function rowPaid(value: unknown) { return paidAmount(value as SettlementRow) } function rowOutstanding(value: unknown) { return Number((value as SettlementRow).outstandingAmount || 0) } -function customerName(customerId: string, snapshot?: string) { return snapshot || customers.value.find((item) => String(item.id) === String(customerId))?.tenantName || '—' } +function customerName(customerId: string, snapshot?: string) { + const mappedName = customers.value.find((item) => String(item.id) === String(customerId))?.tenantName + // Backend snapshots may contain the internal fallback label; never promote that ID to the finance UI. + if (snapshot && !/^客户\d+$/.test(snapshot.trim())) return snapshot + return mappedName || '—' +} function totalAmount(row: SettlementRow) { return props.kind === 'receivable' ? (row as FinanceReceivableSettlement).receivableAmount : (row as FinancePayableSettlement).payableAmount } function paidAmount(row: SettlementRow) { return props.kind === 'receivable' ? (row as FinanceReceivableSettlement).receivedAmount : (row as FinancePayableSettlement).paidAmount } function selectedSupplierName() { return selectedRow.value && 'supplierName' in selectedRow.value ? selectedRow.value.supplierName || '—' : '—' }