fix: 添加缺失的 getWithdrawOrderList 导出函数

This commit is contained in:
2026-05-25 17:54:46 +08:00
parent 453dde2eaa
commit 539b92a0ed
4 changed files with 183 additions and 96 deletions

View File

@ -60,4 +60,17 @@ export const getWithdrawReviewList = (params: {
// 提现审核操作(通过/驳回) // 提现审核操作(通过/驳回)
export const withdrawReviewOrder = (params: { id: number; status: number }) => { export const withdrawReviewOrder = (params: { id: number; status: number }) => {
return request.post('/withdraw/withdrawReviewOrder', params) return request.post('/withdraw/withdrawReviewOrder', params)
}
// 获取取款订单列表
export const getWithdrawOrderList = (params: {
page: number
page_size: number
order_no?: string
start_time?: string
end_time?: string
status?: number
user_name?: string
}) => {
return request.get('/withdraw/withdrawOrderList', params as any)
} }

View File

@ -38,6 +38,9 @@
<template v-if="column.isNumber" #default="{ row }"> <template v-if="column.isNumber" #default="{ row }">
<span>{{ formatDecimalTruncate(row[column.prop]) }}</span> <span>{{ formatDecimalTruncate(row[column.prop]) }}</span>
</template> </template>
<template v-else-if="column.options && column.prop" #default="{ row }">
<span>{{ getOptionLabel(column.options, row[column.prop]) }}</span>
</template>
</el-table-column> </el-table-column>
<!-- 具名插槽列 --> <!-- 具名插槽列 -->
@ -61,6 +64,13 @@ import { ref, watch } from 'vue'
import type { TableInstance } from 'element-plus' import type { TableInstance } from 'element-plus'
import { formatDecimalTruncate } from '@/utils/formatDecimal' import { formatDecimalTruncate } from '@/utils/formatDecimal'
//
const getOptionLabel = (options: { label: string; value: string | number }[], value: any): string => {
if (value === null || value === undefined) return ''
const option = options.find((opt) => opt.value === value)
return option?.label || String(value)
}
// //
interface TableColumn { interface TableColumn {
prop?: string prop?: string
@ -71,6 +81,7 @@ interface TableColumn {
slotName?: string // slotName?: string //
sortable?: boolean // sortable?: boolean //
isNumber?: boolean // isNumber?: boolean //
options?: { label: string; value: string | number }[] //
} }
// //

View File

@ -10,145 +10,179 @@
</template> </template>
</OrderWithdrawSearch> </OrderWithdrawSearch>
<!-- 列表区域当前使用本地 mock 数据后续可直接替换为接口返回 --> <!-- 列表区域 -->
<OrderWithdrawTable :table-data="pagedTableData" :columns="tableColumnsOptions" :highlight-current-row="false" /> <OrderWithdrawTable :table-data="pagedTableData" :columns="tableColumnsOptions" :highlight-current-row="false" :loading="loading" />
<!-- 分页区域保持和订单模块其他页面一致的交互结构 --> <!-- 分页区域保持和订单模块其他页面一致的交互结构 -->
<OrderWithdrawPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="filteredTableData.length" <OrderWithdrawPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
@pagination-change="handlePaginationChange" /> @pagination-change="handlePaginationChange" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage } from 'element-plus'
import dayjs from 'dayjs'
defineOptions({ defineOptions({
name: 'Withdraw' name: 'Withdraw'
}) })
import { computed, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import OrderWithdrawSearch from '@/components/common/Search.vue' import OrderWithdrawSearch from '@/components/common/Search.vue'
import OrderWithdrawTable from '@/components/common/Table.vue' import OrderWithdrawTable from '@/components/common/Table.vue'
import OrderWithdrawPagination from '@/components/common/Pagination.vue' import OrderWithdrawPagination from '@/components/common/Pagination.vue'
import { exportToExcel } from '@/utils/exportToExcel' import { exportToExcel } from '@/utils/exportToExcel'
import { usePageLoading } from '@/composables/useLoading'
import { search, tableColumns } from './options' import { search, tableColumns } from './options'
import { getWithdrawOrderList } from '@/api/modules/capital/withdraw'
// //
interface WithdrawOrderItem { interface WithdrawOrderListItem {
id: number id: number
orderNo: string user_id: number
currency: string order_no: string
channel_id: number
amount: string amount: string
status: 'success' | 'pending' | 'failed' withdraw_fee: string
statusText: string status: number
withdrawTime: string created_at: string
withdrawAccount: string updated_at: string
user?: {
username?: string
}
withdraw_currency?: {
symbol?: string
}
real_currency?: {
symbol?: string
}
channel?: {
name?: string
}
} }
// 便 interface WithdrawOrderVo {
id: number
user_id: number
order_no: string
channel_id: number
amount: string
withdraw_fee: string
status: number
created_at: string
updated_at: string
//
user_name: string
withdraw_currency_symbol: string
real_currency_symbol: string
channel_name: string
}
//
interface SearchFormData { interface SearchFormData {
orderNo: string user_name: string
startTime: string startTime: string
endTime: string endTime: string
} }
// //
const searchOptions = ref(search) const searchOptions = ref(search)
// Search //
const createDefaultSearchForm = (): SearchFormData => ({ const createDefaultSearchForm = (): SearchFormData => ({
orderNo: '', user_name: '',
startTime: '', startTime: dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
endTime: '', endTime: dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
}) })
const searchForm = ref<SearchFormData>(createDefaultSearchForm()) const searchForm = ref<SearchFormData>(createDefaultSearchForm())
// mock //
const tableData = ref<WithdrawOrderItem[]>([ const tableData = ref<WithdrawOrderVo[]>([])
{
id: 1,
orderNo: '1111111',
currency: 'USD',
amount: 'USD 10.000000',
status: 'success',
statusText: '成功',
withdrawTime: '2026.01.30 10:05:15',
withdrawAccount: '123',
},
{
id: 2,
orderNo: 'WD202604250002',
currency: 'USDT',
amount: 'USDT 520.000000',
status: 'pending',
statusText: '待处理',
withdrawTime: '2026.02.18 08:20:11',
withdrawAccount: 'TRC20-9001',
},
{
id: 3,
orderNo: 'WD202604250003',
currency: 'CNY',
amount: 'CNY 1800.000000',
status: 'failed',
statusText: '失败',
withdrawTime: '2026.03.06 14:30:56',
withdrawAccount: 'BANK-3245',
},
])
// //
const tableColumnsOptions = ref(tableColumns) const tableColumnsOptions = ref(tableColumns)
// //
const currentPage = ref(1) const currentPage = ref(1)
const pageSize = ref(10) const pageSize = ref(10)
const total = ref(0)
// //
const filteredTableData = computed(() => { const { loading, startLoading, stopLoading } = usePageLoading()
return tableData.value.filter((item) => {
const matchOrderNo = !searchForm.value.orderNo || item.orderNo.includes(searchForm.value.orderNo)
const itemDate = item.withdrawTime.slice(0, 10).replace(/\./g, '-') //
const matchStartTime = !searchForm.value.startTime || itemDate >= searchForm.value.startTime const mapToVo = (item: WithdrawOrderListItem): WithdrawOrderVo => {
const matchEndTime = !searchForm.value.endTime || itemDate <= searchForm.value.endTime return {
...item,
return matchOrderNo && matchStartTime && matchEndTime user_name: item.user?.username || '',
}) withdraw_currency_symbol: item.withdraw_currency?.symbol || '',
}) real_currency_symbol: item.real_currency?.symbol || '',
channel_name: item.channel?.name || '',
// // options
const pagedTableData = computed(() => { }
const start = (currentPage.value - 1) * pageSize.value
const end = start + pageSize.value
return filteredTableData.value.slice(start, end)
})
// 便
const handleSearch = () => {
currentPage.value = 1
} }
// //
const fetchList = async () => {
startLoading()
try {
const data = await getWithdrawOrderList({
page: currentPage.value,
page_size: pageSize.value,
start_time: searchForm.value.startTime || undefined,
end_time: searchForm.value.endTime || undefined,
user_name: searchForm.value.user_name || undefined,
})
tableData.value = ((data as any)?.data || []).map(mapToVo)
// total
total.value = (data as any)?.total || tableData.value.length
stopLoading()
} catch (error) {
stopLoading()
console.error('获取提现订单列表失败', error)
// ElMessage.error('')
}
}
//
const handleSearch = () => {
currentPage.value = 1
fetchList()
}
//
const handleReset = () => { const handleReset = () => {
searchForm.value = createDefaultSearchForm() searchForm.value = createDefaultSearchForm()
currentPage.value = 1 currentPage.value = 1
fetchList()
} }
// //
const handleExport = async () => { const handleExport = async () => {
await exportToExcel({ await exportToExcel({
tableData: filteredTableData.value, tableData: tableData.value,
columns: tableColumnsOptions.value, columns: tableColumnsOptions.value,
title: '导出提现订单', title: '导出提现订单',
defaultFileNamePrefix: '提现订单', defaultFileNamePrefix: '提现订单',
}) })
} }
// //
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => { const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage currentPage.value = page.currentPage
pageSize.value = page.pageSize pageSize.value = page.pageSize
fetchList()
} }
//
const pagedTableData = computed(() => {
return tableData.value
})
//
onMounted(() => {
fetchList()
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -178,3 +212,4 @@ const handlePaginationChange = (page: { currentPage: number; pageSize: number })
} }
} }
</style> </style>

View File

@ -1,38 +1,66 @@
// 提现订单搜索项:按截图保留订单号、开始时间、结束时间。 // 提现订单搜索项:按截图保留订单号、开始时间、结束时间。
export const search = [ export const search = [
{ {
prop: 'orderNo', prop: 'user_name',
label: '订单号', label: '账户持有人',
type: 'input' as const, type: 'input' as const,
placeholder: '请输入流水号', placeholder: '请输入账户持有人',
width: '210px', width: '210',
}, },
{ {
prop: 'startTime', prop: 'startTime',
label: '开始时间', label: '开始时间',
type: 'date' as const, type: 'date' as const,
dateType: 'date' as const, dateType: 'datetime' as const,
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD HH:mm:ss',
placeholder: '请选择开始时间', placeholder: '请选择开始时间',
width: '150px', width: '200',
}, },
{ {
prop: 'endTime', prop: 'endTime',
label: '结束时间', label: '结束时间',
type: 'date' as const, type: 'date' as const,
dateType: 'date' as const, dateType: 'datetime' as const,
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD HH:mm:ss',
placeholder: '请选择结束时间', placeholder: '请选择结束时间',
width: '150px', width: '200',
}, },
] ]
// 提现订单表格列:对应截图中的列表表头。 // 提现订单表格列:对应截图中的列表表头。
export const tableColumns = [ export const tableColumns = [
{ prop: 'orderNo', label: '订单号', align: 'center' as const }, { prop: 'trade_id', label: '订单号', align: 'center' as const, width: 200 },
{ prop: 'currency', label: '提现币种', align: 'center' as const }, { prop: 'user_name', label: '账户持有人', width: 160, align: 'center' as const },
{ prop: 'amount', label: '金额', align: 'center' as const, isNumber: true }, { prop: 'withdraw_currency_symbol', label: '取款币种', align: 'center' as const, width: 100 },
{ prop: 'statusText', label: '状态', align: 'center' as const }, { prop: 'withdraw_amount', label: '取款金额', align: 'center' as const, width: 120, isNumber: true },
{ prop: 'withdrawTime', label: '提现时间', align: 'center' as const }, { prop: 'real_currency_symbol', label: '到账币种', align: 'center' as const, width: 100 },
{ prop: 'withdrawAccount', label: '提现账号', align: 'center' as const }, { prop: 'real_amount', label: '到账金额', align: 'center' as const, width: 120, isNumber: true },
{ prop: 'rate', label: '汇率', align: 'center' as const, width: 100 },
{ prop: 'channel_name', label: '渠道', align: 'center' as const, width: 140 },
{ prop: 'withdraw_service_fee', label: '服务费', align: 'center' as const, width: 100, isNumber: true },
{ prop: 'withdraw_head_fee', label: '总部手续费', align: 'center' as const, width: 120, isNumber: true },
{ prop: 'withdraw_fee_handle', label: '代理手续费', align: 'center' as const, width: 120, isNumber: true },
{ prop: 'withdraw_point_diff', label: '点差', align: 'center' as const, width: 100, isNumber: true },
{ prop: 'withdraw_risk_fee', label: '风控费', width: 140, align: 'center' as const, isNumber: true },
{ prop: 'withdraw_address', label: '提现地址', width: 140, align: 'center' as const },
{
prop: 'status', label: '状态', align: 'center' as const, width: 140, options: [{
label: '未审核',
value: 1
},
{
label: '审核成功',
value: 2
},
{
label: '已提交',
value: 3
},
{
label: '驳回',
value: 4
},]
},
{ prop: 'created_at', label: '申请时间', width: 240, align: 'center' as const }
] ]