feat:部门交易金额导出

This commit is contained in:
dzc committed 2025-01-23 14:22:16 +08:00
1 parent abdaa1a557
commit ec29b18fca
1 file changed
+62 -36
+62 -36
View File
@@ -3,20 +3,10 @@
<div class="layout-padding-auto layout-padding-view">
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row :gutter="24">
<el-col :span="4">
<el-form-item class="w100" label="饭卡类型" prop="walletTypeId">
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="w100" label="审核状态" prop="processStatus">
<dict-select v-model="state.queryForm.processStatus" dict-code="check_status" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="w100" label="审核时间" prop="processTimeList">
<el-form-item class="w100" label="时间" prop="createTimeList">
<el-date-picker
v-model="state.queryForm.processTimeList"
v-model="state.queryForm.createTimeList"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange"
/>
@@ -30,6 +20,19 @@
</el-col>
</el-row>
</el-form>
<el-row>
<div class="mb8" style="width: 100%">
<right-toolbar
:search="false"
v-model:showSearch="showSearch"
:export="'hard_hardTotal_export_dept'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
></right-toolbar>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -43,35 +46,41 @@
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="80" />
<el-table-column width="200" label="用户">
<el-table-column prop="deptName" min-width="150" label="部门" />
<el-table-column prop="walletPrice" label="充值金额" align="center">
<template #default="{ row }">
<div class="flex flex-row items-center justify-center">
<preview-image width="50px" height="50px" :src="row.userAvatar" />
<div class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<span> {{ row.username }} </span>
<span> {{ row.userMobile }} </span>
<span> {{ row.userDeptName }} </span>
</div>
<div :class="{ 'color-success': row.walletPrice != 0 }">{{ displayPrice(row.walletPrice) }}</div>
</template>
</el-table-column>
<el-table-column prop="walletCount" label="充值次数" align="center">
<template #default="{ row }">
<div :class="{ 'color-success': row.walletCount != 0 }">{{ row.walletCount }}次</div>
</template>
</el-table-column>
<el-table-column prop="orderPayPrice" label="消费金额" align="center">
<template #default="{ row }">
<div :class="{ 'color-primary': row.orderPayPrice != 0 }">{{ displayPrice(row.orderPayPrice) }}</div>
</template>
</el-table-column>
<el-table-column prop="orderPayCount" label="消费次数" align="center">
<template #default="{ row }">
<div :class="{ 'color-primary': row.orderPayCount != 0 }">{{ row.orderPayCount }}次</div>
</template>
</el-table-column>
<el-table-column prop="orderRefundPrice" label="退款金额" align="center">
<template #default="{ row }">
<div :class="{ 'color-danger': row.orderRefundPrice != 0 }">
{{ displayPrice(row.orderRefundPrice) }}
</div>
</template>
</el-table-column>
<el-table-column prop="importTime" label="充值月" />
<el-table-column prop="processTime" label="审核时间" align="center" />
<el-table-column prop="beforePrice" label="操作前的金额" align="center">
<el-table-column prop="orderRefundCont" label="退款次数" align="center">
<template #default="{ row }">
<div class="color-primary">{{ displayPrice(row.beforePrice) }}</div>
<div :class="{ 'color-danger': row.orderRefundCont != 0 }">{{ row.orderRefundCont }}次</div>
</template>
</el-table-column>
<el-table-column prop="price" label="操作金额" align="center">
<template #default="{ row }">
<div class="color-success">{{ displayPrice(row.price) }}</div>
</template>
</el-table-column>
<el-table-column v-if="false" label="操作" width="300">
<template #default="{ row }"> </template>
</el-table-column>
<el-table-column v-if="false" label="操作" width="300"> </el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</div>
</div>
</template>
@@ -90,6 +99,7 @@ const selectObjs = ref([]) as any
const multiple = ref(true)
// 表格变量
const state: BasicTableProps = reactive<BasicTableProps>({
isPage: false,
queryForm: {},
pageList: hardTotalApi.pageListDept,
})
@@ -98,17 +108,33 @@ const state: BasicTableProps = reactive<BasicTableProps>({
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
useTable(state)
// 导出excel
const exportExcel = () => {
downBlobFile("/hard/hard-total/export-dept", Object.assign(state.queryForm), "部门交易记录导出.xlsx")
}
const getSummaries = (param: any) => {
const { columns, data } = param
const totalColumns = ["beforePrice", "price"]
const totalColumns = [
"walletPrice",
"walletCount",
"orderPayPrice",
"orderPayCount",
"orderRefundPrice",
"orderRefundCont",
]
const totalRow = Array.from({ length: columns.length })
columns.forEach((i: any, index: number) => {
if (totalColumns.includes(i.property)) {
const total = data
.filter((v: any) => v[i.property] != null)
.map((v: any) => v[i.property])
.map((v: any) => Number(v[i.property]))
.reduce((pren: number, next: number) => pren + next, 0)
totalRow[index] = displayPrice(total)
if (i.property.includes("Price")) {
totalRow[index] = displayPrice(total)
} else {
totalRow[index] = total + "次"
}
}
})
return totalRow