feat(报表模块): 更新增加妇幼生殖vip和退款功能相关

This commit is contained in:
2026-06-16 10:21:39 +08:00
parent 7eeecab824
commit 1f467a25be
13 changed files with 192 additions and 82 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="calendar" style="min-width: 1000px;overflow-x: auto;min-height: 100%;">
<div class="calendar" style="min-width: 1080px;overflow-x: auto;min-height: 100%;">
<div v-if="allMonthData.length>0" @click="handleExportAll()" style="position: absolute; left: 360px;top:30px;cursor: pointer;color: #006699;font-size: 14px;"><i class="el-icon-download"></i>下载 {{selectYear}} 年全部VIP报表</div>
<el-card class="box-card" v-for="(month, mIndex) in allMonthData"
@@ -76,6 +76,7 @@
allMonthData: [],
list: [
{title:'收入',val:'fee'} ,
{title:'退款',val:'refundFee'},
{title:'月摊销',val:'currentTanxiao'},
{title:'已摊销',val:'alreadyTanxiao'},
{title:'剩余摊销',val:'notyetTanxiao'},
@@ -296,7 +297,7 @@
.calendar {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
gap: 10px;
}
.month {
background: #fff;
@@ -311,15 +312,16 @@
}
.days {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-columns: repeat(5, minmax(max-content, 1fr));
font-size: 17px;
}
.day {
text-align: center;
padding: 4px;
padding: 4px 8px;
margin: 2px;
border-radius: 4px;
min-height: 20px;
white-space: nowrap;
}
.day.header {
font-weight: bold;
@@ -332,7 +334,7 @@
padding: 4px 20px !important;
}
/deep/ .el-card .el-card__body {
padding: 15px !important;
padding: 15px 5px !important;
overflow-x: auto !important;
}
</style>

View File

@@ -34,11 +34,7 @@
class="days"
style=""
:style="{
'grid-template-columns': `repeat(${
month.total.length && month.total.length > 2
? 2
: month.total.length
}, 1fr)`
'grid-template-columns': `repeat(${list.length}, 1fr)`
}"
>
<div
@@ -184,6 +180,29 @@ export default {
// {title:'报名VIP',val:'vip'},
{ title: "后台扣费", val: "deduction" }
]
},
{
title: "退款",
val: "refund",
bg: "#ff00000a",
list: [
{
title: "实物商品退款",
realTitle: "订单退款实物"
},
{
title: "课程退款",
realTitle: "订单退款课程"
},
{
title: "VIP商品退款",
realTitle: "订单退款VIP"
},
// {
// title: "培训班退款",
// realTitle: "订单退款培训班"
// }
]
}
],
weekDays: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
@@ -212,12 +231,18 @@ export default {
},
methods: {
getAmount(d, index, month) {
if (!month || !month.total || !Array.isArray(month.total)) {
const section = this.list[index];
const isRefund = section && section.val === "refund";
const dataSource = isRefund
? month && month.refundInfo
: month && month.total;
if (!dataSource || !Array.isArray(dataSource)) {
return "0";
}
if (d.val === "other") {
const list = month.total.filter(item => {
const list = dataSource.filter(item => {
return (
item.type === d.realTitle &&
(item.payMethod === "" || item.payMethod === "其他")
@@ -239,11 +264,12 @@ export default {
item => item.type === d.realTitle,
item => `${item.payMethod}${item.type}` === d.realTitle,
item => `${item.type}${item.payMethod}` === d.realTitle,
item => `${item.type}${item.goodsType}` === d.realTitle
item => `${item.type}${item.goodsType}` === d.realTitle,
item => item.goodsType === d.goodsType
];
for (const rule of matchRules) {
const matchedItem = month.total.find(rule);
const matchedItem = dataSource.find(rule);
if (matchedItem) {
return matchedItem.amount;
}
@@ -407,7 +433,8 @@ export default {
return {
month: monthNum,
total: res.data.total,
surplus: res.data.surplus
surplus: res.data.surplus,
refundInfo: res.data.refundInfo || []
};
} else {
return { month: monthNum, total: null, error: "获取失败" };
@@ -428,7 +455,10 @@ export default {
console.log("所有月份结果:", resArr);
loading.close();
this.allMonthData = resArr.filter(
r => r.total !== null && r.total.length !== 0
r =>
r.total !== null &&
(r.total.length !== 0 ||
(r.refundInfo && r.refundInfo.length !== 0))
);
if (this.allMonthData.length == 0) {
this.$message({

View File

@@ -35,9 +35,7 @@
style=""
:style="{
'grid-template-columns': `repeat(${
2
}, 1fr)`
'grid-template-columns': `repeat(${list.length}, 1fr)`
}"
>
<div
@@ -57,22 +55,29 @@
<div style="font-weight: 500;color: #888;margin-top:10px;font-size: 15px;padding:0 4px;">
<li v-for="item in d.list" style="text-align: left;margin-top: 10px;">
<span style=""> {{item.title}} :<span v-if="item.otherTitle" style="font-size: 12px;color: #808080;"><br/>{{ item.otherTitle}}</span> </span>
<span style="margin-left: 10px;color: #333;letter-spacing: 0.5px;" v-if="index==0" :style="{
color: getAmount(item, index, month) == 0 ? '#888' : '#333'
}">
{{ getAmount(item,index,month) }}
<span style="">
{{ item.title }} :<span
v-if="item.otherTitle"
style="font-size: 12px;color: #808080;"
><br />{{ item.otherTitle }}</span
>
</span>
<span style="margin-left: 10px;color: #333;letter-spacing: 0.5px;" v-if="index==1">
<span
style="margin-left: 10px;color: #333;letter-spacing: 0.5px;"
v-if="index == 0 || index == 2"
:style="{
color: getAmount(item, index, month) == 0 ? '#888' : '#333'
}"
>
{{ getAmount(item, index, month) }}
</span>
<span
style="margin-left: 10px;color: #333;letter-spacing: 0.5px;"
v-if="index == 1"
>
{{ month.total[0][item.val] }}
</span>
</li>
</div>
</div>
@@ -155,6 +160,16 @@ export default {
{title:'剩余摊销',val:'surplusTanxiao'},
]
},
{
title: "退款",
val: "refund",
bg: "#ff00000a",
list: [
{ title: "App微信退款", realTitle: "App微信" },
{ title: "App支付宝退款", realTitle: "App支付宝" },
{ title: "App天医币退款", realTitle: "App天医币" }
]
}
],
weekDays: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
monthNames: [
@@ -182,25 +197,28 @@ export default {
},
methods: {
getAmount(d, index, month) {
// 定义所有可能的匹配规则
const section = this.list[index];
const isRefund = section && section.val === "refund";
const dataSource = isRefund
? month && month.refund
: month && month.total;
if (!dataSource || !Array.isArray(dataSource)) {
return "0";
}
const matchRules = [
item => item.pay_type === d.title,
item => item.pay_type === d.realTitle,
// 更复杂的条件组合
item => item.pay_type === d.realTitle
];
// 依次检查每个规则,返回第一个匹配项
for (const rule of matchRules) {
const matchedItem = month.total.find(rule);
const matchedItem = dataSource.find(rule);
if (matchedItem) {
return matchedItem.fee;
}
}
// 没有匹配项时返回空字符串
return "0";
},
async handleExportAll() {
@@ -354,7 +372,11 @@ export default {
})
.then(res => {
if (res.data && res.data.code === 0) {
return { month: monthNum, total: [res.data.tanxiaoTotal[0],...res.data.income]};
return {
month: monthNum,
total: [res.data.tanxiaoTotal[0], ...res.data.income],
refund: res.data.refund || []
};
} else {
return { month: monthNum, total: null, error: "获取失败" };
}
@@ -374,7 +396,10 @@ export default {
console.log("所有月份结果:", resArr);
loading.close();
this.allMonthData = resArr.filter(
r => r.total !== null && r.total.length !== 0
r =>
r.total !== null &&
(r.total.length !== 0 ||
(r.refund && r.refund.length !== 0))
);
if (this.allMonthData.length == 0) {
this.$message({

View File

@@ -63,24 +63,15 @@
}`
"
>
<span style="font-size: 16px;color:#888;"
>共计{{
allMonthData[mIndex].total.filter(
item => item.payType == d.title
)[0] ? allMonthData[mIndex].total.filter(
item => item.payType == d.title
)[0].count : 0
}}</span
>
<span style="font-size: 16px;color:#888;">
共计{{ getPayTypeStat(allMonthData[mIndex].total, d.title, 'count') }}
</span>
<span style="display: block;margin-top: 10px;font-weight: bold;"
>{{
allMonthData[mIndex].total.filter(
item => item.payType == d.title
)[0] ? allMonthData[mIndex].total.filter(
item => item.payType == d.title
)[0].totalPrice : 0
}}
>{{ getPayTypeStat(allMonthData[mIndex].total, d.title, 'totalPrice') }}
</span>
<span style="display: block;font-weight: bold; color: red; font-size: 14px;"
>退款{{ getPayTypeStat(allMonthData[mIndex].total, d.title, 'refundTotalPrice') }}
</span>
</div>
</div>
@@ -285,6 +276,16 @@ export default {
pad(num) {
return num < 10 ? "0" + num : num;
},
hasMonthTotal(total) {
return Array.isArray(total) && total.some(item => item != null);
},
getPayTypeStat(total, payType, field) {
if (!Array.isArray(total)) {
return 0;
}
const item = total.find(entry => entry && entry.payType == payType);
return item && item[field] != null ? item[field] : 0;
},
fetchAllMonthData() {
const loading = this.$loading({
lock: true,
@@ -324,9 +325,7 @@ export default {
.then(resArr => {
console.log("所有月份结果:", resArr);
loading.close();
this.allMonthData = resArr.filter(
r => r.total !== null && r.total.length !== 0
);
this.allMonthData = resArr.filter(r => this.hasMonthTotal(r.total));
console.log("this.allMonthData at line 295:", this.allMonthData);
if(this.allMonthData.length==0){
this.$message({

View File

@@ -64,7 +64,7 @@
</el-table-column>
<el-table-column prop="vipType" label="VIP类型" min-width="160">
<template slot-scope="scope">
{{ formatText(scope.row.vipType) }}
{{ formatVipType(scope.row) }}
</template>
</el-table-column>
<el-table-column prop="year" label="年限" min-width="100">
@@ -90,6 +90,7 @@
<script>
import http from '@/utils/httpRequest'
import { formatVipType } from './vipStatisticsHelper'
function createEmptySummary() {
return {
@@ -99,6 +100,8 @@ function createEmptySummary() {
zxhtCount: 0,
zlCount: 0,
xlCount: 0,
fyszCount: 0,
gxCount: 0,
yxSuperCount: 0,
gxSuperCount: 0
}
@@ -153,9 +156,11 @@ export default {
return [
{ key: 'total', label: '总人数', value: summary.total },
{ key: 'zyCount', label: '中医学', value: summary.zyCount },
{ key: 'zjCount', label: '针灸学', value: summary.zjCount },
{ key: 'zxhtCount', label: '中西汇通学', value: summary.zxhtCount },
{ key: 'zjCount', label: '针灸学', value: summary.zjCount },
{ key: 'zlCount', label: '肿瘤学', value: summary.zlCount },
{ key: 'fyszCount', label: '妇幼生殖', value: summary.fyszCount },
{ key: 'gxCount', label: '国学', value: summary.gxCount },
{ key: 'xlCount', label: '心理学', value: summary.xlCount },
{ key: 'yxSuperCount', label: '医学超级', value: summary.yxSuperCount },
{ key: 'gxSuperCount', label: '国学心理学超级', value: summary.gxSuperCount }
@@ -169,6 +174,8 @@ export default {
zxhtCount: counts.zxhtCount || 0,
zlCount: counts.zlCount || counts.zlcount || 0,
xlCount: counts.xlCount || 0,
fyszCount: counts.fyszCount || 0,
gxCount: counts.gxCount || 0,
yxSuperCount: counts.yxSuperCount || 0,
gxSuperCount: counts.gxSuperCount || 0
}

View File

@@ -42,7 +42,11 @@
</template>
</el-table-column>
<el-table-column prop="tel" label="注册电话" min-width="140" />
<el-table-column prop="vipType" label="VIP类型" min-width="160" />
<el-table-column prop="vipType" label="VIP类型" min-width="160">
<template slot-scope="scope">
{{ formatVipType(scope.row) }}
</template>
</el-table-column>
<el-table-column prop="year" label="年限" min-width="100">
<template slot-scope="scope">
{{ formatYear(scope.row.year) }}
@@ -62,6 +66,7 @@
<script>
import http from '@/utils/httpRequest'
import { formatVipType } from './vipStatisticsHelper'
export default {
props: {
@@ -87,6 +92,8 @@ export default {
zxhtCount: 0,
zlcount: 0,
xlCount: 0,
fyszCount: 0,
gxCount: 0,
yxSuperCount: 0,
gxSuperCount: 0
}
@@ -100,9 +107,11 @@ export default {
return [
{ key: 'total', label: '总人数', value: this.summaryData.total },
{ key: 'zyCount', label: '中医学', value: this.summaryData.zyCount },
{ key: 'zjcount', label: '针灸学', value: this.summaryData.zjcount },
{ key: 'zxhtCount', label: '中西汇通学', value: this.summaryData.zxhtCount },
{ key: 'zjcount', label: '针灸学', value: this.summaryData.zjcount },
{ key: 'zlcount', label: '肿瘤学', value: this.summaryData.zlcount },
{ key: 'fyszCount', label: '妇幼生殖', value: this.summaryData.fyszCount },
{ key: 'gxCount', label: '国学', value: this.summaryData.gxCount },
{ key: 'xlCount', label: '心理学', value: this.summaryData.xlCount },
{ key: 'yxSuperCount', label: '医学超级', value: this.summaryData.yxSuperCount },
{ key: 'gxSuperCount', label: '国学心理学超级', value: this.summaryData.gxSuperCount }
@@ -157,6 +166,8 @@ export default {
zxhtCount: countData.zxhtCount || 0,
zlcount: countData.zlCount || countData.zlcount || 0,
xlCount: countData.xlCount || 0,
fyszCount: countData.fyszCount || 0,
gxCount: countData.gxCount || 0,
yxSuperCount: countData.yxSuperCount || 0,
gxSuperCount: countData.gxSuperCount || 0
}

View File

@@ -1,3 +1,5 @@
import { formatVipType } from './vipStatisticsHelper'
function toNumber(value) {
const num = Number(value)
return Number.isNaN(num) ? 0 : num
@@ -129,7 +131,7 @@ function buildTableRows(list) {
time: formatText(item.payTime),
name: formatText(item.name),
tel: formatText(item.tel),
vipType: formatText(item.vipType),
vipType: formatVipType(item),
isYan: formatText(item.isYan),
currentYear: formatYear(item.year),
currentAmount: getAmount(item.price),

View File

@@ -0,0 +1,26 @@
const VIP_TYPE_MAP = {
4: '中医学',
5: '针灸学',
6: '肿瘤学',
9: '中西汇通学',
10: '妇幼生殖',
7: '国学',
8: '心理学'
}
export function formatVipType(row = {}) {
const vipType = row.vipType
if (vipType !== '' && vipType !== null && vipType !== undefined) {
const text = String(vipType).trim()
if (text) {
return text
}
}
const type = row.type
if (type !== '' && type !== null && type !== undefined && VIP_TYPE_MAP[type]) {
return VIP_TYPE_MAP[type]
}
return '--'
}

View File

@@ -1,10 +1,11 @@
const TYPE_ORDER = [
'中医学',
'中西汇通学',
'肿瘤学',
'针灸学',
'心理学',
'肿瘤学',
'妇幼生殖',
'国学',
'心理学',
'医学超级',
'心理国学超级'
]

View File

@@ -27,6 +27,7 @@
<el-option label="针灸VIP" value="5"></el-option>
<el-option label="肿瘤VIP" value="6"></el-option>
<el-option label="中西汇通VIP" value="9"></el-option>
<el-option label="妇幼生殖VIP" value="10"></el-option>
<el-option label="国学VIP" value="7"></el-option>
<el-option label="心理学VIP" value="8"></el-option>
</el-select>
@@ -699,7 +700,8 @@ export default {
6: "肿瘤VIP",
7: "国学VIP",
8: "心理学VIP",
9: "中西汇通VIP"
9: "中西汇通VIP",
10: "妇幼生殖VIP"
};
// 将 userVips 转为数组形式,以便处理(如果是数字则转为数字数组)

View File

@@ -239,7 +239,7 @@ export default {
{ value: "4", label: "中医学" },
{ value: "5", label: "针灸学" },
{ value: "6", label: "肿瘤学" },
{ value: "10", label: "妇幼生殖" },
{ value: "9", label: "中西汇通学" },
{ value: "7", label: "国学" },
{ value: "8", label: "心理学" }
@@ -250,9 +250,9 @@ export default {
{ value: "4", label: "4年" }
],
superVipTypeDict: {
"11": ["4", "5", "6", "9", "7", "8"],
"12": ["4", "5", "6", "9", "8"],
"1": ["4", "5", "6", "9"],
"11": ["4", "5", "6", "9", "10", "7", "8"],
"12": ["4", "5", "6", "9", "10", "8"],
"1": ["4", "5", "6", "9", "10"],
"2": ["7", "8"]
},
hasVipList: [],

View File

@@ -45,6 +45,7 @@
<el-option label="中医VIP" value="4"></el-option>
<el-option label="针灸VIP" value="5"></el-option>
<el-option label="肿瘤VIP" value="6"></el-option>
<el-option label="妇幼生殖VIP" value="10"></el-option>
<el-option label="国学VIP" value="7"></el-option>
<el-option label="心理学VIP" value="8"></el-option>
<el-option label="中西汇通VIP" value="9"></el-option>
@@ -600,7 +601,8 @@ if (latest && latest.endTime) {
6: "肿瘤VIP",
7: "国学VIP",
8: "心理学VIP",
9: "中西汇通VIP"
9: "中西汇通VIP",
10: "妇幼生殖VIP"
};
// 将 userVips 转为数组形式,以便处理(如果是数字则转为数字数组)
@@ -620,7 +622,7 @@ if (latest && latest.endTime) {
const tags = [];
vipTypes.forEach(e => {
if (e.type == 4 || e.type == 5 || e.type == 6 || e.type == 9) {
if (e.type == 4 || e.type == 5 || e.type == 6 || e.type == 9 || e.type == 10) {
tags.push(
`<el-tag size="mini" type="info" style="text-align:center;width:76px;font-weight: bold; color: ${
e.state == 0 ? "#fff" : "#888"

View File

@@ -152,6 +152,7 @@
<span v-if="item.type == 7">国学VIP</span>
<span v-if="item.type == 8">心理学VIP</span>
<span v-if="item.type == 9">中西汇通VIP</span>
<span v-if="item.type == 10">妇幼生殖VIP</span>
明细
</el-button>
</div>
@@ -407,6 +408,7 @@ export default {
{ value: 5, label: "针灸学VIP" },
{ value: 6, label: "肿瘤学VIP" },
{ value: 9, label: "中西汇通学VIP" },
{ value: 10, label: "妇幼生殖VIP" },
{ value: 7, label: "国学VIP" },
{ value: 8, label: "心理学VIP" }
],
@@ -690,7 +692,8 @@ if (this.dataForm.type == "master") {
6: "肿瘤VIP",
7: "国学VIP",
8: "心理学VIP",
9: "中西汇通VIP"
9: "中西汇通VIP",
10: "妇幼生殖VIP"
};
console.log("at line 274:", vipMap[data.type]);
@@ -729,7 +732,8 @@ if (this.dataForm.type == "master") {
6: "肿瘤VIP",
7: "国学VIP",
8: "心理学VIP",
9: "中西汇通VIP"
9: "中西汇通VIP",
10: "妇幼生殖VIP"
};
console.log("at line 274:", vipMap[data.type]);
@@ -776,19 +780,18 @@ if (this.dataForm.type == "master") {
6: "肿瘤VIP",
7: "国学VIP",
8: "心理学VIP",
9: "中西汇通VIP"
9: "中西汇通VIP",
10: "妇幼生殖VIP"
};
const tags = [];
let vipTypes = [];
if (typeof userVips === "number") {
vipTypes = String(userVips)
.split("")
.map(Number); // 数字转为数组
vipTypes = [userVips];
} else {
vipTypes = userVips.map(vip => vip.type); // 如果是对象数组,获取每个对象的 type
}
vipTypes.forEach(type => {
if (type == 4 || type == 5 || type == 6 || type == 9) {
if (type == 4 || type == 5 || type == 6 || type == 9 || type == 10) {
tags.push(
`<span style="font-weight: bold; color: ${
data.state == 0 ? "#fff" : "#888"