BUG修复

This commit is contained in:
Songsl 2026-04-30 16:14:20 +08:00
parent aadff7e389
commit e75b9f797a
7 changed files with 261 additions and 191 deletions

View File

@ -43,7 +43,6 @@ body,
main { main {
padding: 20px; padding: 20px;
overflow: auto; overflow: auto;
max-height: calc(1080px - 200px);
height: 100%; height: 100%;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;

View File

@ -1,106 +1,120 @@
<template> <template>
<div class="pagination-container"> <div class="pagination-container">
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="pageSizes" <el-pagination
:total="total" :disabled="disabled" :background="background" size="small" :layout="layout" v-model:current-page="currentPage"
@size-change="handleSizeChange" @current-change="handleCurrentChange" /> v-model:page-size="pageSize"
</div> :page-sizes="pageSizes"
:total="total"
:disabled="disabled"
:background="background"
size="small"
:layout="layout"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
// //
const props = defineProps({ const props = defineProps({
// //
modelValue: { modelValue: {
type: Number, type: Number,
required: true, required: true,
default: 1 default: 1,
}, },
// //
pageSizeValue: { pageSizeValue: {
type: Number, type: Number,
required: true, required: true,
default: 10 default: 10,
}, },
// //
total: { total: {
type: Number, type: Number,
required: true, required: true,
default: 0 default: 0,
}, },
// //
pageSizes: { pageSizes: {
type: Array as PropType<number[]>, type: Array as PropType<number[]>,
default: () => [1, 10, 20, 50, 100] as unknown[] default: () => [1, 10, 20, 50, 100] as unknown[],
}, },
// //
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
// //
background: { background: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
// Element Plus // Element Plus
layout: { layout: {
type: String, type: String,
default: 'total, sizes, prev, pager, next, jumper' default: 'total, sizes, prev, pager, next, jumper',
} },
}) })
// //
const emit = defineEmits([ const emit = defineEmits([
// v-model // v-model
'update:modelValue', 'update:modelValue',
// v-model // v-model
'update:pageSizeValue', 'update:pageSizeValue',
// 便 // 便
'pagination-change' 'pagination-change',
]) ])
// props // props
const currentPage = props.modelValue const currentPage = computed({
get: () => props.modelValue,
set: (val: number) => emit('update:modelValue', val),
})
// props // props
const pageSize = props.pageSizeValue const pageSize = computed({
get: () => props.pageSizeValue,
set: (val: number) => emit('update:pageSizeValue', val),
})
// //
watch( watch(
() => currentPage, () => currentPage,
(newVal) => { (newVal) => {
emit('update:modelValue', newVal) emit('update:modelValue', newVal)
emit('pagination-change', { currentPage: newVal, pageSize }) emit('pagination-change', { currentPage: newVal, pageSize })
} },
) )
// //
watch( watch(
() => pageSize, () => pageSize,
(newVal) => { (newVal) => {
emit('update:pageSizeValue', newVal) emit('update:pageSizeValue', newVal)
emit('pagination-change', { currentPage, pageSize: newVal }) emit('pagination-change', { currentPage, pageSize: newVal })
} },
) )
// Element Plus // Element Plus
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {
emit('update:pageSizeValue', val) emit('update:pageSizeValue', val)
emit('pagination-change', { currentPage, pageSize: val }) emit('pagination-change', { currentPage, pageSize: val })
} }
// Element Plus // Element Plus
const handleCurrentChange = (val: number) => { const handleCurrentChange = (val: number) => {
emit('update:modelValue', val) emit('update:modelValue', val)
emit('pagination-change', { currentPage: val, pageSize }) emit('pagination-change', { currentPage: val, pageSize })
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.pagination-container { .pagination-container {
position: fixed; position: fixed;
bottom: 20px; bottom: 20px;
right: 20px; right: 20px;
z-index: 1000; z-index: 1000;
} }
</style> </style>

View File

@ -30,3 +30,29 @@ export const getRecentSevenDays = (format = 'YYYY-MM-DD HH:mm:ss'):{ start: stri
end: formatDateTime(now), 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}`
}

View File

@ -1,20 +1,26 @@
<template> <template>
<div> <div>
<!-- 搜索 --> <!-- 搜索 -->
<FundDetailSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch" <FundDetailSearch
@reset="handleReset"> :search-form="searchForm"
<template #button="{ form }"> :search-options="searchOptions"
<el-button type="primary" @click="handleExport()"> @search="handleSearch"
导出 @reset="handleReset"
</el-button> >
</template> <template #button="{ form }">
</FundDetailSearch> <el-button type="primary" @click="handleExport()"> 导出 </el-button>
<!-- 表格 --> </template>
<FundDetailTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" /> </FundDetailSearch>
<!-- 分页 --> <!-- 表格 -->
<FundDetailPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total" <FundDetailTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" />
@pagination-change="handlePaginationChange" /> <!-- 分页 -->
</div> <FundDetailPagination
v-model="currentPage"
v-model:pageSizeValue="pageSize"
:total="total"
@pagination-change="handlePaginationChange"
/>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -26,18 +32,20 @@ import FundDetailPagination from '@/components/common/Pagination.vue'
import { search, tableColumns } from './options' import { search, tableColumns } from './options'
// //
import { getFundDetailListApi } from '@/api/modules/funding/fundDetail' 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: 定义搜索数据 * @description: 定义搜索数据
*/ */
const initTime = getRecentSevenDays('YYYY-MM-DD')
const searchOptions = ref(search) const searchOptions = ref(search)
const searchForm = ref({ const searchForm = ref({
username: '', username: '',
subAccountId: '', subAccountId: '',
startTime: '', startTime: initTime.start,
endTime: '', endTime: initTime.end,
}) })
/** /**
* @description: 定义表格数据 * @description: 定义表格数据
@ -56,73 +64,76 @@ const total = ref(0)
*/ */
// //
const getFundDetailList = async () => { const getFundDetailList = async () => {
const params = { const params = {
page: currentPage.value, page: currentPage.value,
page_size: pageSize.value, page_size: pageSize.value,
start_time: searchForm.value.startTime.length > 0 ? `${searchForm.value.startTime} 0:00:00` : '2026-01-01 0:00:00', start_time:
end_time: searchForm.value.endTime.length > 0 ? `${searchForm.value.endTime} 23:59:59` : '2026-03-15 23:59:59', searchForm.value.startTime.length > 0
user_name: searchForm.value.username, ? `${searchForm.value.startTime} 0:00:00`
account_id: searchForm.value.subAccountId, : '2026-01-01 0:00:00',
} end_time:
// searchForm.value.endTime.length > 0
const data: any = await getFundDetailListApi(params) ? `${searchForm.value.endTime} 23:59:59`
console.log(data) : '2026-03-15 23:59:59',
tableTree.value = data.data.map((item: any) => ({ user_name: searchForm.value.username,
// account_id: searchForm.value.subAccountId,
username: item.user.username, }
// //
orderNo: item.trade_id, const data: any = await getFundDetailListApi(params)
// console.log(data)
type: item.enum_dic.value, tableTree.value = data.data.map((item: any) => ({
// ...item,
originalAmount: item.amount, //
// username: item.user.username,
balanceChange: item.balance, //
// orderNo: item.trade_id,
createTime: item.created_at, //
// type: item.enum_dic.value,
walletType: item.wallet_type === "1" ? '主钱包' : '子钱包', //
})) createTime: utcToUtc8(item.created_at),
// //
total.value = data.total walletType: item.wallet_type === '1' ? '主钱包' : '子钱包',
currentPage.value = data.current_page }))
pageSize.value = Number(data.per_page) //
total.value = data.total
currentPage.value = data.current_page
pageSize.value = Number(data.per_page)
} }
/** /**
* @description: 页面加载完成需要请求的数据 * @description: 页面加载完成需要请求的数据
*/ */
onMounted(() => { onMounted(() => {
getFundDetailList() getFundDetailList()
}) })
/** /**
* @description: 定义搜索方法 * @description: 定义搜索方法
*/ */
const handleSearch = () => { const handleSearch = () => {
getFundDetailList() getFundDetailList()
} }
const handleReset = () => { const handleReset = () => {
searchForm.value = { searchForm.value = {
username: '', username: '',
subAccountId: '', subAccountId: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
} }
getFundDetailList() getFundDetailList()
} }
const handleExport = () => { const handleExport = () => {
exportToExcel({ exportToExcel({
tableData: tableTree.value, tableData: tableTree.value,
columns: tableColumnsOptions.value, columns: tableColumnsOptions.value,
title: '导出资金明细', title: '导出资金明细',
defaultFileNamePrefix: '资金明细', defaultFileNamePrefix: '资金明细',
}) })
} }
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = (page: any) => { const handlePaginationChange = (page: any) => {
currentPage.value = page.currentPage currentPage.value = page.currentPage
getFundDetailList() getFundDetailList()
} }
</script> </script>

View File

@ -2,54 +2,74 @@
* @description: * @description:
*/ */
export const search = [ export const search = [
//单号 //单号
// { prop: 'orderNo', label: '单号', type: 'input' as const, placeholder: '请输入流水单号', width: '140px' }, // { prop: 'orderNo', label: '单号', type: 'input' as const, placeholder: '请输入流水单号', width: '140px' },
//用户名 //用户名
{ prop: 'username', label: '用户名', type: 'input' as const, placeholder: '请输入用户名', width: '140px' }, {
// 子账号 prop: 'username',
{ prop: 'subAccountId', label: '子账号ID', type: 'input' as const, placeholder: '请输入子账号ID', width: '140px' }, label: '用户名',
//操作类型 type: 'input' as const,
// { prop: 'type', label: '操作类型', type: 'select' as const, placeholder: '请选择操作类型', width: '140px', options: [ placeholder: '请输入用户名',
// {label:"充值",value:"1"}, width: '220px',
// {label:"提现",value:"2"}, },
// ] }, // 子账号
//钱包 {
// { prop: 'wallet', label: '钱包', type: 'select' as const, placeholder: '请选择钱包', width: '140px', options: [ prop: 'subAccountId',
// {label:"主钱包",value:"1"}, label: '子账号ID',
// {label:"子钱包",value:"2"}, type: 'input' as const,
// ] }, placeholder: '请输入子账号ID',
//开始时间 width: '220px',
{ },
prop: 'startTime', label: '开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 //操作类型
valueFormat: 'YYYY-MM-DD', placeholder: '请选择开始时间', width: '150px' // { prop: 'type', label: '操作类型', type: 'select' as const, placeholder: '请选择操作类型', width: '140px', options: [
}, // {label:"充值",value:"1"},
//结束时间 // {label:"提现",value:"2"},
{ // ] },
prop: 'endTime', label: '结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 //钱包
valueFormat: 'YYYY-MM-DD', placeholder: '请选择结束时间', width: '150px' // { 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 = [ export const tableColumns = [
// 用户名 // 用户名
{ prop: 'username', label: '用户名' }, { prop: 'username', label: '用户名' },
//单号 //单号
{ prop: 'orderNo', label: '单号' }, { prop: 'orderNo', label: '单号' },
//操作类型 //操作类型
{ prop: 'type', label: '操作类型' }, { prop: 'type', label: '操作类型' },
//资金流向 //资金流向
// { prop: 'fundDirection', label: '资金流向' }, // { prop: 'fundDirection', label: '资金流向' },
//原有金额 //原有金额
{ prop: 'originalAmount', label: '原有金额' }, { prop: 'amount', label: '变动金额' },
//余额变动 //余额变动
{ prop: 'balanceChange', label: '余额变动' }, { prop: 'balance', label: '变动后余额' },
//现有余额 //现有余额
// { prop: 'currentBalance', label: '现有余额' }, // { prop: 'currentBalance', label: '现有余额' },
//状态 //状态
// { prop: 'status', label: '状态' }, // { prop: 'status', label: '状态' },
//创建时间 //创建时间
{ prop: 'createTime', label: '创建时间' }, { prop: 'createTime', label: '创建时间' },
//钱包类型 //钱包类型
{ prop: 'walletType', label: '钱包类型' }, { prop: 'walletType', label: '钱包类型' },
] ]

View File

@ -394,7 +394,7 @@ const handleSubmit = async () => {
} }
// { id: assignedPointDifference } // { id: assignedPointDifference }
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => { const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
acc[cur.id] = cur.assignedPointDifference acc[cur.id] = cur.assignedPointDifference * 1
return acc return acc
}, {}) }, {})

View File

@ -251,9 +251,9 @@ const mapMarketTree = (data: any) => {
margin: item.wallet_capital.bail, // margin: item.wallet_capital.bail, //
stopOrderMargin: item.wallet_capital.bail_stop_order, // stopOrderMargin: item.wallet_capital.bail_stop_order, //
positionTransferMargin: item.wallet_capital.bail_change_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, // 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, // commissionReturn: item.wallet_capital.commission_fee_handling, //
floatProfitLoss: '后续添加', // floatProfitLoss: '后续添加', //
closeProfitLoss: item.wallet_capital.closing_profit, // closeProfitLoss: item.wallet_capital.closing_profit, //