报表功能提交
This commit is contained in:
parent
4768bdfc93
commit
1e61cf7d13
|
|
@ -160,7 +160,21 @@
|
|||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付时间" prop="payTime" align="center" />
|
||||
<el-table-column label="钱包类型" prop="amount" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.walletId === '1'">
|
||||
个人钱包
|
||||
</span>
|
||||
<span v-else-if="scope.row.walletId === '2'">
|
||||
补贴钱包
|
||||
</span>
|
||||
<span v-else-if="scope.row.walletId === '3'">
|
||||
补贴钱包+个人钱包
|
||||
</span>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="下单时间" prop="payTime" align="center" />
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
</el-table>
|
||||
<!-- 详情分页 -->
|
||||
|
|
@ -276,11 +290,13 @@ export default {
|
|||
|
||||
// 设置列宽 + 居中
|
||||
sheet.columns = [
|
||||
{ header: "所属组织", key: "orgFullName", width: 40 },
|
||||
{ header: "人员姓名", key: "custName", width: 10 },
|
||||
{ header: "消费金额", key: "amount", width: 10 },
|
||||
{ header: "消费类型", key: "flow_type_name", width: 10 },
|
||||
{ header: "支付时间", key: "payTime", width: 30 },
|
||||
{ header: "食堂名称", key: "orgFullName", width: 40 },
|
||||
{ header: "预订餐消费", key: "custName", width: 10 },
|
||||
{ header: "食堂消费", key: "amount", width: 10 },
|
||||
{ header: "超市消费", key: "flow_type_name", width: 10 },
|
||||
{ header: "驿站消费", key: "payTime", width: 30 },
|
||||
{ header: "消费补扣", key: "payTime", width: 30 },
|
||||
{ header: "总和", key: "payTime", width: 30 }
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -334,7 +350,7 @@ export default {
|
|||
const sheet = workbook.addWorksheet("消费详情");
|
||||
|
||||
// 表头
|
||||
const header = ["所属组织", "人员姓名", "消费金额", "消费类型", "支付时间"];
|
||||
const header = ["所属组织", "人员姓名", "消费金额", "消费类型","钱包类型", "下单时间"];
|
||||
sheet.addRow(header);
|
||||
|
||||
// 数据行
|
||||
|
|
@ -355,11 +371,20 @@ export default {
|
|||
} else if (ft === 130) {
|
||||
item.amount = Math.abs(item.amount); // 退款为正
|
||||
}
|
||||
let wallType = item.walletId || "";
|
||||
if (wallType ==='1') {
|
||||
wallType="个人钱包"
|
||||
}else if(wallType ==='2'){
|
||||
wallType="补贴钱包"
|
||||
}else{
|
||||
wallType="补贴钱包+个人钱包"
|
||||
}
|
||||
sheet.addRow([
|
||||
item.orgFullName || "",
|
||||
item.custName || "",
|
||||
item.amount,
|
||||
flowTypeLabel,
|
||||
wallType,
|
||||
item.payTime || ""
|
||||
]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户姓名">
|
||||
<el-input v-model="queryParams.custName" placeholder="请输入组织名称" clearable />
|
||||
<el-input v-model="queryParams.custName" placeholder="请输入用户姓名" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="支付开始时间">
|
||||
<el-date-picker
|
||||
|
|
@ -51,7 +51,14 @@
|
|||
<el-button type="success" @click="newexportExcel">导出列表</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 金额汇总信息 -->
|
||||
<el-card class="summary-card" shadow="never" style="padding: 12px;">
|
||||
<div style="display: flex; justify-content: space-around; align-items: center; font-weight: bold;">
|
||||
<div style="color: #F56C6C;">消费总额: {{ (totalConsume / 100).toFixed(2) }} 元</div>
|
||||
<div style="color: #67C23A;">退款总额: {{ (totalRefund / 100).toFixed(2) }} 元</div>
|
||||
<div style="color: #409EFF;">净收入: {{ ((totalConsume - totalRefund) / 100).toFixed(2) }} 元</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 主表格 -->
|
||||
<el-table
|
||||
:data="tableData.slice((pageNum-1)*pageSize,pageNum*pageSize)"
|
||||
|
|
@ -168,6 +175,8 @@ export default {
|
|||
const startOfDay = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, "0")}-${String(today.getDate()).padStart(2,"0")} 00:00:00`;
|
||||
const endOfDay = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2,"0")}-${String(today.getDate()).padStart(2,"0")} 23:59:59`;
|
||||
return {
|
||||
totalConsume: 0, // 消费总额
|
||||
totalRefund: 0, // 退款总额
|
||||
selectedOrg: [], // 支持多选
|
||||
orgOptions:[],
|
||||
queryParams: {
|
||||
|
|
@ -259,7 +268,17 @@ export default {
|
|||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 计算总金额
|
||||
calculateTotalAmounts() {
|
||||
this.totalConsume = 0;
|
||||
this.totalRefund = 0;
|
||||
if (this.tableData.length > 0) {
|
||||
const first = this.tableData[0]; // 只取第一条
|
||||
this.totalConsume = first.totalConsume; // 用第一条的金额
|
||||
this.totalRefund = first.totalRefund; // 用第一条的金额
|
||||
}
|
||||
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 取最后一级 orgId
|
||||
|
|
@ -269,14 +288,28 @@ export default {
|
|||
peoplelistRecord(this.queryParams).then(res => {
|
||||
this.tableData = res.rows || [];
|
||||
this.total = Number(res.total) || 0; // 转成数字
|
||||
this.calculateTotalAmounts();
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出主表 */
|
||||
newexportExcel(){
|
||||
this.queryParams.selectedOrg = this.getSelectedOrgIds(); // 二级或三级下的所有 id
|
||||
this.download('/smart-canteen/api/v2/report/consume/exportExcel', { ...this.queryParams }, `人员信息报表_${Date.now()}.xlsx`)
|
||||
},
|
||||
newexportExcel() {
|
||||
// 获取选中的组织 ID
|
||||
this.queryParams.selectedOrg = this.getSelectedOrgIds();
|
||||
|
||||
// 克隆参数,单独对中文参数进行 encodeURIComponent
|
||||
const params = { ...this.queryParams };
|
||||
if (params.custName) {
|
||||
params.custName = encodeURIComponent(params.custName); // 中文名编码
|
||||
}
|
||||
|
||||
// 调用下载方法
|
||||
this.download(
|
||||
'/smart-canteen/api/v2/report/consume/exportExcel',
|
||||
params,
|
||||
`人员信息报表_${Date.now()}.xlsx`
|
||||
);
|
||||
},
|
||||
handleDetail(row) {
|
||||
this.detail = row;
|
||||
this.detailVisible = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue