BUG修复
This commit is contained in:
parent
aadff7e389
commit
e75b9f797a
|
|
@ -43,7 +43,6 @@ body,
|
|||
main {
|
||||
padding: 20px;
|
||||
overflow: auto;
|
||||
max-height: calc(1080px - 200px);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
|
|
|||
|
|
@ -1,106 +1,120 @@
|
|||
<template>
|
||||
<div class="pagination-container">
|
||||
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="pageSizes"
|
||||
:total="total" :disabled="disabled" :background="background" size="small" :layout="layout"
|
||||
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="pageSizes"
|
||||
:total="total"
|
||||
:disabled="disabled"
|
||||
:background="background"
|
||||
size="small"
|
||||
:layout="layout"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
// 定义组件接收的属性
|
||||
const props = defineProps({
|
||||
// 当前页码(双向绑定)
|
||||
modelValue: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 1
|
||||
},
|
||||
// 每页显示条数(双向绑定)
|
||||
pageSizeValue: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 10
|
||||
},
|
||||
// 总数据条数
|
||||
total: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 0
|
||||
},
|
||||
// 可选的每页条数
|
||||
pageSizes: {
|
||||
type: Array as PropType<number[]>,
|
||||
default: () => [1, 10, 20, 50, 100] as unknown[]
|
||||
},
|
||||
// 是否禁用分页
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 是否显示分页背景
|
||||
background: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 分页布局(Element Plus 原生配置)
|
||||
layout: {
|
||||
type: String,
|
||||
default: 'total, sizes, prev, pager, next, jumper'
|
||||
}
|
||||
// 当前页码(双向绑定)
|
||||
modelValue: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 1,
|
||||
},
|
||||
// 每页显示条数(双向绑定)
|
||||
pageSizeValue: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 10,
|
||||
},
|
||||
// 总数据条数
|
||||
total: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 0,
|
||||
},
|
||||
// 可选的每页条数
|
||||
pageSizes: {
|
||||
type: Array as PropType<number[]>,
|
||||
default: () => [1, 10, 20, 50, 100] as unknown[],
|
||||
},
|
||||
// 是否禁用分页
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 是否显示分页背景
|
||||
background: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页布局(Element Plus 原生配置)
|
||||
layout: {
|
||||
type: String,
|
||||
default: 'total, sizes, prev, pager, next, jumper',
|
||||
},
|
||||
})
|
||||
|
||||
// 定义派发的事件
|
||||
const emit = defineEmits([
|
||||
// 页码变更事件(v-model 双向绑定)
|
||||
'update:modelValue',
|
||||
// 每页条数变更事件(v-model 双向绑定)
|
||||
'update:pageSizeValue',
|
||||
// 分页变更统一回调(方便父组件处理)
|
||||
'pagination-change'
|
||||
// 页码变更事件(v-model 双向绑定)
|
||||
'update:modelValue',
|
||||
// 每页条数变更事件(v-model 双向绑定)
|
||||
'update:pageSizeValue',
|
||||
// 分页变更统一回调(方便父组件处理)
|
||||
'pagination-change',
|
||||
])
|
||||
|
||||
// 内部当前页(同步props)
|
||||
const currentPage = props.modelValue
|
||||
const currentPage = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val: number) => emit('update:modelValue', val),
|
||||
})
|
||||
// 内部每页条数(同步props)
|
||||
const pageSize = props.pageSizeValue
|
||||
const pageSize = computed({
|
||||
get: () => props.pageSizeValue,
|
||||
set: (val: number) => emit('update:pageSizeValue', val),
|
||||
})
|
||||
|
||||
// 监听当前页变化,派发事件
|
||||
watch(
|
||||
() => currentPage,
|
||||
(newVal) => {
|
||||
emit('update:modelValue', newVal)
|
||||
emit('pagination-change', { currentPage: newVal, pageSize })
|
||||
}
|
||||
() => currentPage,
|
||||
(newVal) => {
|
||||
emit('update:modelValue', newVal)
|
||||
emit('pagination-change', { currentPage: newVal, pageSize })
|
||||
},
|
||||
)
|
||||
|
||||
// 监听每页条数变化,派发事件
|
||||
watch(
|
||||
() => pageSize,
|
||||
(newVal) => {
|
||||
emit('update:pageSizeValue', newVal)
|
||||
emit('pagination-change', { currentPage, pageSize: newVal })
|
||||
}
|
||||
() => pageSize,
|
||||
(newVal) => {
|
||||
emit('update:pageSizeValue', newVal)
|
||||
emit('pagination-change', { currentPage, pageSize: newVal })
|
||||
},
|
||||
)
|
||||
|
||||
// 每页条数变更处理(兼容Element Plus原生事件)
|
||||
const handleSizeChange = (val: number) => {
|
||||
emit('update:pageSizeValue', val)
|
||||
emit('pagination-change', { currentPage, pageSize: val })
|
||||
emit('update:pageSizeValue', val)
|
||||
emit('pagination-change', { currentPage, pageSize: val })
|
||||
}
|
||||
|
||||
// 当前页变更处理(兼容Element Plus原生事件)
|
||||
const handleCurrentChange = (val: number) => {
|
||||
emit('update:modelValue', val)
|
||||
emit('pagination-change', { currentPage: val, pageSize })
|
||||
emit('update:modelValue', val)
|
||||
emit('pagination-change', { currentPage: val, pageSize })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pagination-container {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
z-index: 1000;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -30,3 +30,29 @@ export const getRecentSevenDays = (format = 'YYYY-MM-DD HH:mm:ss'):{ start: stri
|
|||
end: formatDateTime(now),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 UTC 时间字符串 (YYYY-MM-DD HH:mm:ss) 转换为 UTC+8 时间字符串
|
||||
* @param {string} utcStr - UTC 时间字符串,格式:YYYY-MM-DD HH:mm:ss
|
||||
* @returns {string} UTC+8 时间字符串,格式:YYYY-MM-DD HH:mm:ss
|
||||
*/
|
||||
export function utcToUtc8(utcStr: string): string {
|
||||
// 将字符串解析为 UTC 时间
|
||||
const utcDate = new Date(utcStr.replace(' ', 'T') + 'Z')
|
||||
|
||||
// 转换为 UTC+8(东八区)
|
||||
const utc8Date = new Date(utcDate.getTime() + 8 * 60 * 60 * 1000)
|
||||
|
||||
// 格式化为 YYYY-MM-DD HH:mm:ss
|
||||
const pad = (n) => String(n).padStart(2, '0')
|
||||
|
||||
const year = utc8Date.getUTCFullYear()
|
||||
const month = pad(utc8Date.getUTCMonth() + 1)
|
||||
const day = pad(utc8Date.getUTCDate())
|
||||
const hour = pad(utc8Date.getUTCHours())
|
||||
const minute = pad(utc8Date.getUTCMinutes())
|
||||
const second = pad(utc8Date.getUTCSeconds())
|
||||
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,26 @@
|
|||
<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>
|
||||
<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">
|
||||
|
|
@ -26,18 +32,20 @@ import FundDetailPagination from '@/components/common/Pagination.vue'
|
|||
import { search, tableColumns } from './options'
|
||||
// 接口
|
||||
import { getFundDetailListApi } from '@/api/modules/funding/fundDetail'
|
||||
import { getRecentSevenDays, utcToUtc8 } from '@/utils/handleTime.ts'
|
||||
|
||||
// 导出表格
|
||||
import {exportToExcel} from '@/utils/exportToExcel'
|
||||
import { exportToExcel } from '@/utils/exportToExcel'
|
||||
/**
|
||||
* @description: 定义搜索数据
|
||||
*/
|
||||
const initTime = getRecentSevenDays('YYYY-MM-DD')
|
||||
const searchOptions = ref(search)
|
||||
const searchForm = ref({
|
||||
username: '',
|
||||
subAccountId: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
username: '',
|
||||
subAccountId: '',
|
||||
startTime: initTime.start,
|
||||
endTime: initTime.end,
|
||||
})
|
||||
/**
|
||||
* @description: 定义表格数据
|
||||
|
|
@ -56,73 +64,76 @@ const total = ref(0)
|
|||
*/
|
||||
//获取资金明细列表
|
||||
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)
|
||||
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) => ({
|
||||
...item,
|
||||
// 用户名
|
||||
username: item.user.username,
|
||||
//单号
|
||||
orderNo: item.trade_id,
|
||||
//操作类型
|
||||
type: item.enum_dic.value,
|
||||
//创建时间
|
||||
createTime: utcToUtc8(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()
|
||||
getFundDetailList()
|
||||
})
|
||||
/**
|
||||
* @description: 定义搜索方法
|
||||
*/
|
||||
const handleSearch = () => {
|
||||
getFundDetailList()
|
||||
getFundDetailList()
|
||||
}
|
||||
const handleReset = () => {
|
||||
searchForm.value = {
|
||||
username: '',
|
||||
subAccountId: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
}
|
||||
getFundDetailList()
|
||||
searchForm.value = {
|
||||
username: '',
|
||||
subAccountId: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
}
|
||||
getFundDetailList()
|
||||
}
|
||||
const handleExport = () => {
|
||||
exportToExcel({
|
||||
tableData: tableTree.value,
|
||||
columns: tableColumnsOptions.value,
|
||||
title: '导出资金明细',
|
||||
defaultFileNamePrefix: '资金明细',
|
||||
})
|
||||
exportToExcel({
|
||||
tableData: tableTree.value,
|
||||
columns: tableColumnsOptions.value,
|
||||
title: '导出资金明细',
|
||||
defaultFileNamePrefix: '资金明细',
|
||||
})
|
||||
}
|
||||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = (page: any) => {
|
||||
currentPage.value = page.currentPage
|
||||
getFundDetailList()
|
||||
currentPage.value = page.currentPage
|
||||
getFundDetailList()
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,54 +2,74 @@
|
|||
* @description: 搜索配置
|
||||
*/
|
||||
export const search = [
|
||||
//单号
|
||||
// { prop: 'orderNo', label: '单号', type: 'input' as const, placeholder: '请输入流水单号', width: '140px' },
|
||||
//用户名
|
||||
{ prop: 'username', label: '用户名', type: 'input' as const, placeholder: '请输入用户名', width: '140px' },
|
||||
// 子账号
|
||||
{ prop: 'subAccountId', label: '子账号ID', type: 'input' as const, placeholder: '请输入子账号ID', width: '140px' },
|
||||
//操作类型
|
||||
// { prop: 'type', label: '操作类型', type: 'select' as const, placeholder: '请选择操作类型', width: '140px', options: [
|
||||
// {label:"充值",value:"1"},
|
||||
// {label:"提现",value:"2"},
|
||||
// ] },
|
||||
//钱包
|
||||
// { prop: 'wallet', label: '钱包', type: 'select' as const, placeholder: '请选择钱包', width: '140px', options: [
|
||||
// {label:"主钱包",value:"1"},
|
||||
// {label:"子钱包",value:"2"},
|
||||
// ] },
|
||||
//开始时间
|
||||
{
|
||||
prop: 'startTime', label: '开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD', placeholder: '请选择开始时间', width: '150px'
|
||||
},
|
||||
//结束时间
|
||||
{
|
||||
prop: 'endTime', label: '结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD', placeholder: '请选择结束时间', width: '150px'
|
||||
},
|
||||
|
||||
|
||||
//单号
|
||||
// { prop: 'orderNo', label: '单号', type: 'input' as const, placeholder: '请输入流水单号', width: '140px' },
|
||||
//用户名
|
||||
{
|
||||
prop: 'username',
|
||||
label: '用户名',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入用户名',
|
||||
width: '220px',
|
||||
},
|
||||
// 子账号
|
||||
{
|
||||
prop: 'subAccountId',
|
||||
label: '子账号ID',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入子账号ID',
|
||||
width: '220px',
|
||||
},
|
||||
//操作类型
|
||||
// { prop: 'type', label: '操作类型', type: 'select' as const, placeholder: '请选择操作类型', width: '140px', options: [
|
||||
// {label:"充值",value:"1"},
|
||||
// {label:"提现",value:"2"},
|
||||
// ] },
|
||||
//钱包
|
||||
// { prop: 'wallet', label: '钱包', type: 'select' as const, placeholder: '请选择钱包', width: '140px', options: [
|
||||
// {label:"主钱包",value:"1"},
|
||||
// {label:"子钱包",value:"2"},
|
||||
// ] },
|
||||
//开始时间
|
||||
{
|
||||
prop: 'startTime',
|
||||
label: '开始时间',
|
||||
type: 'date' as const,
|
||||
dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
placeholder: '请选择开始时间',
|
||||
width: '220px',
|
||||
},
|
||||
//结束时间
|
||||
{
|
||||
prop: 'endTime',
|
||||
label: '结束时间',
|
||||
type: 'date' as const,
|
||||
dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
placeholder: '请选择结束时间',
|
||||
width: '220px',
|
||||
},
|
||||
]
|
||||
export const tableColumns = [
|
||||
// 用户名
|
||||
{ prop: 'username', label: '用户名' },
|
||||
//单号
|
||||
{ prop: 'orderNo', label: '单号' },
|
||||
//操作类型
|
||||
{ prop: 'type', label: '操作类型' },
|
||||
//资金流向
|
||||
// { prop: 'fundDirection', label: '资金流向' },
|
||||
//原有金额
|
||||
{ prop: 'originalAmount', label: '原有金额' },
|
||||
//余额变动
|
||||
{ prop: 'balanceChange', label: '余额变动' },
|
||||
//现有余额
|
||||
// { prop: 'currentBalance', label: '现有余额' },
|
||||
//状态
|
||||
// { prop: 'status', label: '状态' },
|
||||
//创建时间
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
//钱包类型
|
||||
{ prop: 'walletType', label: '钱包类型' },
|
||||
// 用户名
|
||||
{ prop: 'username', label: '用户名' },
|
||||
//单号
|
||||
{ prop: 'orderNo', label: '单号' },
|
||||
//操作类型
|
||||
{ prop: 'type', label: '操作类型' },
|
||||
//资金流向
|
||||
// { prop: 'fundDirection', label: '资金流向' },
|
||||
//原有金额
|
||||
{ prop: 'amount', label: '变动金额' },
|
||||
//余额变动
|
||||
{ prop: 'balance', label: '变动后余额' },
|
||||
//现有余额
|
||||
// { prop: 'currentBalance', label: '现有余额' },
|
||||
//状态
|
||||
// { prop: 'status', label: '状态' },
|
||||
//创建时间
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
//钱包类型
|
||||
{ prop: 'walletType', label: '钱包类型' },
|
||||
]
|
||||
|
|
@ -394,7 +394,7 @@ const handleSubmit = async () => {
|
|||
}
|
||||
//转换为接口需要的格式 { id: assignedPointDifference }
|
||||
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
||||
acc[cur.id] = cur.assignedPointDifference
|
||||
acc[cur.id] = cur.assignedPointDifference * 1
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
|
|
|
|||
|
|
@ -251,9 +251,9 @@ const mapMarketTree = (data: any) => {
|
|||
margin: item.wallet_capital.bail, //保证金
|
||||
stopOrderMargin: item.wallet_capital.bail_stop_order, //停止接单保证金
|
||||
positionTransferMargin: item.wallet_capital.bail_change_order, //持仓转移保证金
|
||||
positionRatio: item.wallet_capital.toucun_percent, //头寸比率
|
||||
positionRatio: (item.wallet_capital.toucun_percent * 1).toFixed(2), //头寸比率
|
||||
pointSpreadCommission: item.wallet_capital.commission_point_diff, //点差返佣
|
||||
commissionRatio: item.wallet_capital.fee_handling_percent, //手续费比例
|
||||
commissionRatio: (item.wallet_capital.fee_handling_percent * 1).toFixed(2), //手续费比例
|
||||
commissionReturn: item.wallet_capital.commission_fee_handling, //手续费返佣
|
||||
floatProfitLoss: '后续添加', //浮动盈亏
|
||||
closeProfitLoss: item.wallet_capital.closing_profit, //平仓盈亏
|
||||
|
|
|
|||
Loading…
Reference in New Issue