This commit is contained in:
2026-07-13 17:44:50 +08:00
parent 975fa1ffac
commit 8493f0df03
25 changed files with 1050 additions and 734 deletions
@@ -6,7 +6,7 @@ const { state, formatCurrency } = useInventory()
<template>
<t-row :gutter="16">
<t-col :span="8" v-for="card in [
{ icon: '📦', value: state.dashboard?.product_count || 0, label: '成品数量' },
{ icon: '📦', value: state.dashboard?.finished_product_count || 0, label: '成品数量' },
{ icon: '📊', value: state.dashboard?.total_stock || 0, label: '物料库存总量' },
{ icon: '💰', value: formatCurrency(state.dashboard?.total_value || 0), label: '库存价值' },
{ icon: '🏭', value: state.dashboard?.supplier_count || 0, label: '供应商' },
@@ -37,20 +37,22 @@ onMounted(() => {
refreshFinance()
})
// 字段名对齐后端 FinanceSummaryResponse:
// receivable_total / payable_total / period_receipt_total / period_payment_total
const totalReceivable = computed(() => {
return state.financeSummary?.total_receivable ?? 0
return state.financeSummary?.receivable_total ?? 0
})
const totalPayable = computed(() => {
return state.financeSummary?.total_payable ?? 0
return state.financeSummary?.payable_total ?? 0
})
const periodReceived = computed(() => {
return state.financeSummary?.period_received ?? 0
return state.financeSummary?.period_receipt_total ?? 0
})
const periodPaid = computed(() => {
return state.financeSummary?.period_paid ?? 0
return state.financeSummary?.period_payment_total ?? 0
})
function getTransactionTypeLabel(type: string): string {
@@ -136,6 +138,7 @@ function getTransactionStatusLabel(status: string): string {
</t-col>
</t-row>
<!-- 字段对齐 PartnerStatementItemResponse:order_total / settled_total / transaction_total / outstanding_total -->
<t-card style="margin-bottom: 16px;">
<template #header>
<span style="font-weight: 600;">客户账款(周期)</span>
@@ -145,16 +148,16 @@ function getTransactionStatusLabel(status: string): string {
<t-table-column prop="order_count" label="订单数" />
<t-table-column prop="transaction_count" label="流水数" />
<t-table-column label="订单金额">
<template #default="{ row }">{{ formatCurrency(row.order_amount) }}</template>
<template #default="{ row }">{{ formatCurrency(row.order_total) }}</template>
</t-table-column>
<t-table-column label="订单已收">
<template #default="{ row }">{{ formatCurrency(row.order_received) }}</template>
<template #default="{ row }">{{ formatCurrency(row.settled_total) }}</template>
</t-table-column>
<t-table-column label="实收流水">
<template #default="{ row }">{{ formatCurrency(row.transaction_received) }}</template>
<template #default="{ row }">{{ formatCurrency(row.transaction_total) }}</template>
</t-table-column>
<t-table-column label="应收余额">
<template #default="{ row }">{{ formatCurrency(row.receivable_balance) }}</template>
<template #default="{ row }">{{ formatCurrency(row.outstanding_total) }}</template>
</t-table-column>
</t-table>
<t-empty v-if="!state.loading && state.customerFinanceStatement.length === 0" description="暂无数据" />
@@ -169,21 +172,22 @@ function getTransactionStatusLabel(status: string): string {
<t-table-column prop="order_count" label="订单数" />
<t-table-column prop="transaction_count" label="流水数" />
<t-table-column label="订单金额">
<template #default="{ row }">{{ formatCurrency(row.order_amount) }}</template>
<template #default="{ row }">{{ formatCurrency(row.order_total) }}</template>
</t-table-column>
<t-table-column label="订单已付">
<template #default="{ row }">{{ formatCurrency(row.order_paid) }}</template>
<template #default="{ row }">{{ formatCurrency(row.settled_total) }}</template>
</t-table-column>
<t-table-column label="实付流水">
<template #default="{ row }">{{ formatCurrency(row.transaction_paid) }}</template>
<template #default="{ row }">{{ formatCurrency(row.transaction_total) }}</template>
</t-table-column>
<t-table-column label="应付余额">
<template #default="{ row }">{{ formatCurrency(row.payable_balance) }}</template>
<template #default="{ row }">{{ formatCurrency(row.outstanding_total) }}</template>
</t-table-column>
</t-table>
<t-empty v-if="!state.loading && state.supplierFinanceStatement.length === 0" description="暂无数据" />
</t-card>
<!-- 字段对齐 PartnerProductStatementItemResponse:order_quantity / order_amount / settled_amount / outstanding_amount -->
<t-card style="margin-bottom: 16px;">
<template #header>
<span style="font-weight: 600;">客户-商品追溯(周期)</span>
@@ -193,7 +197,7 @@ function getTransactionStatusLabel(status: string): string {
<t-table-column prop="product_sku" label="SKU" />
<t-table-column prop="product_name" label="商品" />
<t-table-column prop="order_count" label="订单数" />
<t-table-column prop="quantity" label="数量" />
<t-table-column prop="order_quantity" label="数量" />
<t-table-column label="订单金额">
<template #default="{ row }">{{ formatCurrency(row.order_amount) }}</template>
</t-table-column>
@@ -201,7 +205,7 @@ function getTransactionStatusLabel(status: string): string {
<template #default="{ row }">{{ formatCurrency(row.settled_amount) }}</template>
</t-table-column>
<t-table-column label="未结款">
<template #default="{ row }">{{ formatCurrency(row.unsettled_amount) }}</template>
<template #default="{ row }">{{ formatCurrency(row.outstanding_amount) }}</template>
</t-table-column>
</t-table>
<t-empty v-if="!state.loading && state.customerProductStatement.length === 0" description="暂无数据" />
@@ -216,7 +220,7 @@ function getTransactionStatusLabel(status: string): string {
<t-table-column prop="product_sku" label="SKU" />
<t-table-column prop="product_name" label="商品" />
<t-table-column prop="order_count" label="订单数" />
<t-table-column prop="quantity" label="数量" />
<t-table-column prop="order_quantity" label="数量" />
<t-table-column label="订单金额">
<template #default="{ row }">{{ formatCurrency(row.order_amount) }}</template>
</t-table-column>
@@ -224,22 +228,24 @@ function getTransactionStatusLabel(status: string): string {
<template #default="{ row }">{{ formatCurrency(row.settled_amount) }}</template>
</t-table-column>
<t-table-column label="未结款">
<template #default="{ row }">{{ formatCurrency(row.unsettled_amount) }}</template>
<template #default="{ row }">{{ formatCurrency(row.outstanding_amount) }}</template>
</t-table-column>
</t-table>
<t-empty v-if="!state.loading && state.supplierProductStatement.length === 0" description="暂无数据" />
</t-card>
<!-- 字段对齐 FinanceTransactionResponse:txn_no / txn_type / txn_date
TODO: 往来方列依赖 partner_name,后端 FinanceTransactionResponse 暂未返回,需补 -->
<t-card>
<template #header>
<span style="font-weight: 600;">最近财务流水</span>
</template>
<t-table :data="state.financeTransactions" :loading="state.loading" stripe size="small">
<t-table-column prop="order_no" label="单号" />
<t-table-column prop="txn_no" label="单号" />
<t-table-column label="类型">
<template #default="{ row }">
<t-tag :type="getTransactionTypeTag(row.type)" size="small">
{{ getTransactionTypeLabel(row.type) }}
<t-tag :type="getTransactionTypeTag(row.txn_type)" size="small">
{{ getTransactionTypeLabel(row.txn_type) }}
</t-tag>
</template>
</t-table-column>
@@ -255,7 +261,7 @@ function getTransactionStatusLabel(status: string): string {
</template>
</t-table-column>
<t-table-column label="日期">
<template #default="{ row }">{{ formatDate(row.transaction_date) }}</template>
<template #default="{ row }">{{ formatDate(row.txn_date) }}</template>
</t-table-column>
</t-table>
<t-empty v-if="!state.loading && state.financeTransactions.length === 0" description="暂无数据" />
@@ -325,10 +325,10 @@ onMounted(() => {
<template #default="{ row }">{{ formatDate(row.expected_date) }}</template>
</t-table-column>
<t-table-column label="实际到货">
<template #default="{ row }">{{ row.received_at ? formatDateTime(row.received_at) : '-' }}</template>
<template #default="{ row }">{{ row.received_date ? formatDateTime(row.received_date) : '-' }}</template>
</t-table-column>
<t-table-column label="实际付款">
<template #default="{ row }">{{ row.paid_at ? formatDateTime(row.paid_at) : '-' }}</template>
<template #default="{ row }">{{ row.paid_date ? formatDateTime(row.paid_date) : '-' }}</template>
</t-table-column>
<t-table-column label="总金额">
<template #default="{ row }">{{ formatCurrency(row.total_amount) }}</template>