feat:余额统计

This commit is contained in:
dzc committed 2025-07-09 17:05:06 +08:00
1 parent 2bfd3654d5
commit 4cb85e2dea
2 files changed
+57 -64

No files matched your search

+8
View File
@@ -34,6 +34,14 @@ export function fetchList(query?: Object) {
})
}
export function qbTotal(data: any) {
return request({
url: "/wallet/wallet-manage/qb-total",
method: "post",
data: data,
})
}
export function fetchListJoinQb(query: any) {
return request({
url: "/wallet/wallet-manage/page-join-qb",
+49 -64
View File
@@ -1,16 +1,9 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree
ref="draggableDepTreeRef"
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
@@ -18,60 +11,43 @@
<select-user v-model="state.queryForm.userId" />
</el-form-item>
<el-form-item style="width: 200px" label="饭卡类型" prop="walletTypeId">
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型"
clearable />
</el-form-item>
<el-form-item style="width: 200px" label="月份" prop="walletRecordMonth">
<el-date-picker
v-model="state.queryForm.walletRecordMonth"
value-format="YYYY-MM"
type="month"
:clearable="false"
placeholder="选择月份"
/>
<el-date-picker v-model="state.queryForm.walletRecordMonth" value-format="YYYY-MM"
type="month" :clearable="false" placeholder="选择月份" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
}}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
</el-form-item>
</el-row>
</el-form>
<el-row>
<div class="mb8 flex justify-between" style="width: 100%">
<el-button
plain
:disabled="multiple"
icon="Delete"
type="primary"
v-auth="'wallet_walletManage_del'"
@click="handleDelete(selectObjs)"
>
<el-button plain :disabled="multiple" icon="Delete" type="primary"
v-auth="'wallet_walletManage_del'" @click="handleDelete(selectObjs)">
删除
</el-button>
<div class="flex gap-5">
<el-button plain type="primary" @click="viewBalanceStatistics">余额统计</el-button>
<right-toolbar
v-model:showSearch="showSearch"
:export="'wallet_walletRecord_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
/>
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletRecord_export'"
@exportExcel="exportExcel" class="ml10 mr20" style="float: right"
@queryTable="getDataList">
<el-tooltip class="item" effect="dark" content="统计" placement="top">
<el-button icon="DataLine" circle @click="viewBalanceStatistics" />
</el-tooltip>
</right-toolbar>
</div>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:summary-method="getSummaries"
show-summary
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table-column v-auth="'wallet_walletManage_del'" type="selection" width="40" align="center" />
<el-table :data="state.dataList" v-loading="state.loading" border :summary-method="getSummaries"
show-summary :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle" @sort-change="sortChangeHandle">
<el-table-column v-auth="'wallet_walletManage_del'" type="selection" width="40"
align="center" />
<el-table-column type="index" label="#" width="80" />
<el-table-column prop="username" width="100" label="用户" />
<el-table-column prop="userAvatar" width="80" label="头像">
@@ -110,24 +86,39 @@
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</template>
</DraggableDepTree>
</div>
<el-drawer v-model="showDrawer" @closed="drawerClose">
<el-descriptions v-loading="balanceStatisticsLoading" :column="1" title="钱包余额统计" border>
<el-descriptions-item label="总余额:">{{ balanceStatistics.a }}</el-descriptions-item>
<el-descriptions-item label="饭卡钱包总余额:">{{ balanceStatistics.b }}</el-descriptions-item>
<el-descriptions-item label="消费钱包总余额:">{{ balanceStatistics.c }}</el-descriptions-item>
</el-descriptions>
<el-table :data="[balanceStatistics]" style="width: 100%">
<el-table-column align="center" label="余额统计">
<el-table-column align="center" prop="total" label="总余额">
<template #default="{ row }">
{{ displayPrice(row.total) }}
</template>
</el-table-column>
<el-table-column align="center" prop="eatTotal" label="饭卡钱包">
<template #default="{ row }">
{{ displayPrice(row.eatTotal) }}
</template>
</el-table-column>
<el-table-column align="center" prop="payTotal" label="消费钱包">
<template #default="{ row }">
{{ displayPrice(row.payTotal) }}
</template>
</el-table-column>
</el-table-column>
</el-table>
</el-drawer>
</div>
</template>
<script setup lang="ts" name="systemWalletManage">
import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchListJoinQb, delObjs } from "/@/api/wallet/wallet-manage"
import { fetchListJoinQb, delObjs, qbTotal } from "/@/api/wallet/wallet-manage"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
@@ -145,9 +136,7 @@ const multiple = ref(true)
const showDrawer = ref(false) // 余额统计抽屉开关
const balanceStatisticsLoading = ref(false)
const balanceStatistics = reactive<any>({
a: 0,
b: 0,
c: 0,
})
const state: BasicTableProps = reactive<BasicTableProps>({
@@ -177,13 +166,9 @@ const viewBalanceStatistics = async () => {
showDrawer.value = true
balanceStatisticsLoading.value = true
try {
const { code, data } = await getBalanceStatistics({
deptIds: state.queryForm.deptIds,
isInclude: state.queryForm.isInclude,
userId: state.queryForm.userId,
})
const { code, data } = await qbTotal({ ...state.queryForm })
if (code == 0) {
balanceStatistics.a = data.a
Object.assign(balanceStatistics, data)
return
}
return useMessage().error(data.msg || "获取数据失败")