feat(报表): 扩展天医币报表收入项显示点数和金额

修改收入项数据结构,支持同时显示金额和点数
调整前端布局和显示格式,当点数与金额不同时显示点数信息
This commit is contained in:
2026-01-27 14:34:35 +08:00
parent 4b9f79192f
commit 5c2c5b92dd

View File

@@ -6,8 +6,13 @@ import MonthReportView from '#/views/statistics/common/MonthReportView.vue';
import { useMonthReport } from '../common/useMonthReport';
interface IncomeItem {
fee: number;
point: number;
}
interface Report {
incomes: Record<string, number>;
incomes: Record<string, IncomeItem>;
consumes: Record<string, number>;
surplus: number;
}
@@ -15,6 +20,7 @@ interface Report {
interface ReportItem {
type: string;
fee: number;
point: number;
}
const { year, disabledDate, list, loading, getList, downloadReport, downloadAllReport } =
@@ -24,10 +30,15 @@ const { year, disabledDate, list, loading, getList, downloadReport, downloadAllR
fileNameBuilder: (y, m) => `天医币报表_${y}${m}月_文件.xlsx`,
normalize: (data) => ({
incomes: {
微信: 0,
支付宝: 0,
银行: 0,
...Object.fromEntries(data.map.incomes.map((item: ReportItem) => [item.type, item.fee])),
微信: { fee: 0, point: 0 },
支付宝: { fee: 0, point: 0 },
银行: { fee: 0, point: 0 },
...Object.fromEntries(
data.map.incomes.map((item: ReportItem) => [
item.type,
{ fee: item.fee, point: item.point },
]),
),
},
consumes: {
实物: 0,
@@ -63,11 +74,13 @@ onMounted(() => {
<template #default="{ item }">
<div class="-m-2 text-[16px]">
<div class="flex">
<div class="flex-1 bg-[#F6FFF5] px-2 pb-1">
<div class="min-w-[50%] bg-[#F6FFF5] px-2 pb-1">
<div class="p-1 text-center font-bold">进项</div>
<div v-for="(fee, type) in item.incomes" :key="type" class="p-1">
<div v-for="(value, type) in item.incomes" :key="type" class="p-1">
<span class="text-gray-500">{{ type }}</span>
<span class="text-black">{{ fee }}</span>
<span class="text-black">{{
`${value.fee}${!value.point || value.fee === value.point ? '' : `(天医币${value.point}`}`
}}</span>
</div>
</div>
<div class="flex-1 bg-[#FFFBF0] px-2 pb-1">