x
This commit is contained in:
@@ -37,22 +37,22 @@ onMounted(() => {
|
||||
refreshFinance()
|
||||
})
|
||||
|
||||
// 字段名对齐后端 FinanceSummaryResponse:
|
||||
// receivable_total / payable_total / period_receipt_total / period_payment_total
|
||||
// 字段名对齐后端 FinanceSummaryResponse。
|
||||
// 后端 Decimal 序列化为 JSON 字符串,故用 Number() 转换再填充 0。
|
||||
const totalReceivable = computed(() => {
|
||||
return state.financeSummary?.receivable_total ?? 0
|
||||
return Number(state.financeSummary?.receivable_total) || 0
|
||||
})
|
||||
|
||||
const totalPayable = computed(() => {
|
||||
return state.financeSummary?.payable_total ?? 0
|
||||
return Number(state.financeSummary?.payable_total) || 0
|
||||
})
|
||||
|
||||
const periodReceived = computed(() => {
|
||||
return state.financeSummary?.period_receipt_total ?? 0
|
||||
return Number(state.financeSummary?.period_receipt_total) || 0
|
||||
})
|
||||
|
||||
const periodPaid = computed(() => {
|
||||
return state.financeSummary?.period_payment_total ?? 0
|
||||
return Number(state.financeSummary?.period_payment_total) || 0
|
||||
})
|
||||
|
||||
function getTransactionTypeLabel(type: string): string {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { reactive, ref, computed } from 'vue'
|
||||
import { apiRequest } from '@/shared/api'
|
||||
import { addNotification, handleApiError } from '@/shared/notification'
|
||||
import { formatCurrency, formatNumber, formatDateTime, formatDate } from '@/shared/utils'
|
||||
import type { Schema } from '@/types/schemas'
|
||||
|
||||
declare const AirDatepicker: any
|
||||
|
||||
@@ -10,19 +11,19 @@ const state = reactive({
|
||||
backendDbReady: true,
|
||||
backendDbMessage: '' as string,
|
||||
productCategory: 'finished' as string,
|
||||
dashboard: null as any,
|
||||
financeSummary: null as any,
|
||||
dashboard: null as any, // 后端 /api/dashboard 无 response_model,暂未生成类型
|
||||
financeSummary: null as Schema<'FinanceSummaryResponse'> | null,
|
||||
financePeriod: {
|
||||
year: new Date().getFullYear(),
|
||||
quarter: '' as string
|
||||
},
|
||||
financeTransactions: [] as any[],
|
||||
receivables: [] as any[],
|
||||
payables: [] as any[],
|
||||
customerFinanceStatement: [] as any[],
|
||||
supplierFinanceStatement: [] as any[],
|
||||
customerProductStatement: [] as any[],
|
||||
supplierProductStatement: [] as any[],
|
||||
financeTransactions: [] as Schema<'FinanceTransactionResponse'>[],
|
||||
receivables: [] as Schema<'ReceivableItemResponse'>[],
|
||||
payables: [] as Schema<'PayableItemResponse'>[],
|
||||
customerFinanceStatement: [] as Schema<'PartnerStatementItemResponse'>[],
|
||||
supplierFinanceStatement: [] as Schema<'PartnerStatementItemResponse'>[],
|
||||
customerProductStatement: [] as Schema<'PartnerProductStatementItemResponse'>[],
|
||||
supplierProductStatement: [] as Schema<'PartnerProductStatementItemResponse'>[],
|
||||
products: [] as any[],
|
||||
materials: [] as any[],
|
||||
finishedProducts: [] as any[],
|
||||
@@ -392,7 +393,7 @@ export function useInventory() {
|
||||
apiRequest(`/api/finance/partner-product-statement/supplier?${periodQuery}`)
|
||||
])
|
||||
state.financeSummary = summary
|
||||
state.financeTransactions = transactions
|
||||
state.financeTransactions = transactions?.items || []
|
||||
state.receivables = receivables
|
||||
state.payables = payables
|
||||
state.customerFinanceStatement = customerStatement.items || []
|
||||
|
||||
Reference in New Issue
Block a user