129 lines
3.6 KiB
Vue
129 lines
3.6 KiB
Vue
<template>
|
|
<div>
|
|
<!-- 搜索 -->
|
|
<FundDetailSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
|
@reset="handleReset">
|
|
<template #button="{ form }">
|
|
<el-button type="primary" @click="handleExport()">
|
|
导出
|
|
</el-button>
|
|
</template>
|
|
</FundDetailSearch>
|
|
<!-- 表格 -->
|
|
<FundDetailTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" />
|
|
<!-- 分页 -->
|
|
<FundDetailPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
|
@pagination-change="handlePaginationChange" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
// 组件
|
|
import FundDetailSearch from '@/components/common/Search.vue'
|
|
import FundDetailTable from '@/components/common/Table.vue'
|
|
import FundDetailPagination from '@/components/common/Pagination.vue'
|
|
// 配置以及表单验证
|
|
import { search, tableColumns } from './options'
|
|
// 接口
|
|
import { getFundDetailListApi } from '@/api/modules/funding/fundDetail'
|
|
|
|
// 导出表格
|
|
import {exportToExcel} from '@/utils/exportToExcel'
|
|
/**
|
|
* @description: 定义搜索数据
|
|
*/
|
|
const searchOptions = ref(search)
|
|
const searchForm = ref({
|
|
username: '',
|
|
subAccountId: '',
|
|
startTime: '',
|
|
endTime: '',
|
|
})
|
|
/**
|
|
* @description: 定义表格数据
|
|
*/
|
|
const tableTree = ref([])
|
|
const tableColumnsOptions = ref(tableColumns)
|
|
/**
|
|
* @description: 定义分页数据
|
|
*/
|
|
const currentPage = ref(1)
|
|
const pageSize = ref(10)
|
|
const total = ref(0)
|
|
|
|
/**
|
|
* @description: 定义公共请求数据方法
|
|
*/
|
|
//获取资金明细列表
|
|
const getFundDetailList = async () => {
|
|
const params = {
|
|
page: currentPage.value,
|
|
page_size: pageSize.value,
|
|
start_time: searchForm.value.startTime.length > 0 ? `${searchForm.value.startTime} 0:00:00` : '2026-01-01 0:00:00',
|
|
end_time: searchForm.value.endTime.length > 0 ? `${searchForm.value.endTime} 23:59:59` : '2026-03-15 23:59:59',
|
|
user_name: searchForm.value.username,
|
|
account_id: searchForm.value.subAccountId,
|
|
}
|
|
// 调用接口获取数据
|
|
const data: any = await getFundDetailListApi(params)
|
|
console.log(data)
|
|
tableTree.value = data.data.map((item: any) => ({
|
|
// 用户名
|
|
username: item.user.username,
|
|
//单号
|
|
orderNo: item.trade_id,
|
|
//操作类型
|
|
type: item.enum_dic.value,
|
|
//原有金额
|
|
originalAmount: item.amount,
|
|
//余额变动
|
|
balanceChange: item.balance,
|
|
//创建时间
|
|
createTime: item.created_at,
|
|
//钱包类型
|
|
walletType: item.wallet_type === "1" ? '主钱包' : '子钱包',
|
|
}))
|
|
//分页数据
|
|
total.value = data.total
|
|
currentPage.value = data.current_page
|
|
pageSize.value = Number(data.per_page)
|
|
}
|
|
|
|
/**
|
|
* @description: 页面加载完成需要请求的数据
|
|
*/
|
|
onMounted(() => {
|
|
getFundDetailList()
|
|
})
|
|
/**
|
|
* @description: 定义搜索方法
|
|
*/
|
|
const handleSearch = () => {
|
|
getFundDetailList()
|
|
}
|
|
const handleReset = () => {
|
|
searchForm.value = {
|
|
username: '',
|
|
subAccountId: '',
|
|
startTime: '',
|
|
endTime: '',
|
|
}
|
|
getFundDetailList()
|
|
}
|
|
const handleExport = () => {
|
|
exportToExcel({
|
|
tableData: tableTree.value,
|
|
columns: tableColumnsOptions.value,
|
|
title: '导出资金明细',
|
|
defaultFileNamePrefix: '资金明细',
|
|
})
|
|
}
|
|
/**
|
|
* @description: 定义分页方法
|
|
*/
|
|
const handlePaginationChange = (page: any) => {
|
|
currentPage.value = page.currentPage
|
|
getFundDetailList()
|
|
}
|
|
</script>
|