存款,存款渠道,充值订单
This commit is contained in:
parent
f5b3faa318
commit
44e43d81f3
|
|
@ -0,0 +1,18 @@
|
|||
import { request } from '@/api'
|
||||
|
||||
// 获取入金渠道列表
|
||||
export const getChannelList = () => {
|
||||
return request.get('/channel/getChannelList')
|
||||
}
|
||||
// 创建入金渠道列表
|
||||
export const createChannel = (params: any) => {
|
||||
return request.post('/channel/createChannel', { ...params })
|
||||
}
|
||||
// 编辑入金渠道列表
|
||||
export const editChannel = (params: any) => {
|
||||
return request.post('/channel/editChannel', { ...params })
|
||||
}
|
||||
// 删除入金渠道列表
|
||||
export const delChannel = (params: any) => {
|
||||
return request.post('/channel/delChannel', { ...params })
|
||||
}
|
||||
|
|
@ -4,3 +4,7 @@ import { request } from '@/api';
|
|||
export const getRechargeCheckListApi = (params: any) => {
|
||||
return request.get('/user/rechargeReviewList', { ...params })
|
||||
}
|
||||
// 充值审核
|
||||
export const reviewRechargeOrder = (params: any) => {
|
||||
return request.post('/user/reviewRechargeOrder', { ...params })
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { request } from '@/api'
|
||||
|
||||
// 获取充值订单列表
|
||||
export const getRechargeOrderListApi = (params: any) => {
|
||||
return request.get('/user/rechargeList', { ...params })
|
||||
}
|
||||
|
||||
// 审核充值订单
|
||||
export const reviewRechargeOrder = (params: any) => {
|
||||
return request.post('/user/reviewRechargeOrder', { ...params })
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import { request } from '@/api';
|
||||
|
||||
// 获取充值订单列表
|
||||
export const getRechargeOrderListApi = (params: any) => {
|
||||
return request.get('/user/rechargeList', { ...params })
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
show-password
|
||||
type="password"
|
||||
/>
|
||||
<!-- 密码输入框 -->
|
||||
<!-- 长文本输入框 -->
|
||||
<el-input
|
||||
v-else-if="item.type === 'textarea'"
|
||||
v-model="formData[item.prop]"
|
||||
|
|
@ -75,6 +75,8 @@
|
|||
:max="item.max"
|
||||
:placeholder="item.placeholder"
|
||||
:disabled="item.disabled"
|
||||
:controls="item.controls ?? true"
|
||||
:align="item.align || 'left'"
|
||||
style="width: 100%"
|
||||
/>
|
||||
|
||||
|
|
@ -175,6 +177,8 @@ interface FormItem {
|
|||
clearable?: boolean
|
||||
disabledDate?: (time: Date) => boolean
|
||||
isRange?: boolean
|
||||
controls?: boolean
|
||||
align?: string
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,41 @@
|
|||
<template>
|
||||
<div class="table-container">
|
||||
<el-table height="100%" :data="tableData" :row-key="rowKey" :tree-props="treeProps" :border="border"
|
||||
:highlight-current-row="highlightCurrentRow" v-bind="$attrs" @row-click="handleRowClick">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
height="100%"
|
||||
:data="tableData"
|
||||
:row-key="rowKey"
|
||||
:tree-props="treeProps"
|
||||
:border="border"
|
||||
:highlight-current-row="highlightCurrentRow"
|
||||
v-bind="$attrs"
|
||||
@row-click="handleRowClick"
|
||||
>
|
||||
<!-- 动态表头列 -->
|
||||
<template v-for="(column, index) in columns" :key="index">
|
||||
<el-table-column v-if="!column.slotName" :prop="column.prop" :label="column.label" :width="column.width"
|
||||
:align="column.align || 'left'" :sortable="column.sortable" />
|
||||
<el-table-column
|
||||
v-if="column.type === 'index'"
|
||||
type="index"
|
||||
:label="column.label"
|
||||
:width="column.width || 60"
|
||||
:align="column.align || 'center'"
|
||||
/>
|
||||
<el-table-column
|
||||
v-else-if="!column.slotName"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
:width="column.width"
|
||||
:align="column.align || 'left'"
|
||||
:sortable="column.sortable"
|
||||
/>
|
||||
|
||||
<!-- 具名插槽列 -->
|
||||
<el-table-column v-else :label="column.label" :width="column.width" :align="column.align || 'left'">
|
||||
<el-table-column
|
||||
v-else
|
||||
:label="column.label"
|
||||
:width="column.width"
|
||||
:align="column.align || 'left'"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<slot :name="column.slotName" :row="row" />
|
||||
</template>
|
||||
|
|
@ -19,9 +46,11 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { TableInstance } from 'element-plus'
|
||||
// 定义表格列配置接口
|
||||
interface TableColumn {
|
||||
prop?: string
|
||||
type?: string
|
||||
label: string
|
||||
width?: string | number
|
||||
align?: 'left' | 'center' | 'right'
|
||||
|
|
@ -36,7 +65,7 @@ interface Props {
|
|||
treeProps?: {
|
||||
children: string
|
||||
}
|
||||
columns?: TableColumn[],
|
||||
columns?: TableColumn[]
|
||||
border?: boolean // 是否显示边框
|
||||
highlightCurrentRow?: boolean // 是否高亮当前行
|
||||
}
|
||||
|
|
@ -59,6 +88,13 @@ const handleRowClick = (row: any) => {
|
|||
if (!row) return
|
||||
emit('row-click', row)
|
||||
}
|
||||
|
||||
const tableRef = ref<TableInstance>()
|
||||
|
||||
// 暴露清除当前选中行的方法
|
||||
defineExpose({
|
||||
clearCurrentRow: () => tableRef.value?.setCurrentRow(),
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* 获取近七天的开始和结束时间
|
||||
* @param format 日期格式,默认 'YYYY-MM-DD HH:mm:ss'
|
||||
* YYYY - 年, MM - 月, DD - 日, HH - 时, mm - 分, ss - 秒
|
||||
* @returns { start: string, end: string }
|
||||
*/
|
||||
export const getRecentSevenDays = (format = 'YYYY-MM-DD HH:mm:ss'):{ start: string, end: string } => {
|
||||
const now = new Date()
|
||||
const sevenDaysAgo = new Date(now)
|
||||
sevenDaysAgo.setDate(now.getDate() - 7)
|
||||
|
||||
const formatDateTime = (date: Date) => {
|
||||
const tokens: Record<string, string> = {
|
||||
YYYY: String(date.getFullYear()),
|
||||
MM: String(date.getMonth() + 1).padStart(2, '0'),
|
||||
DD: String(date.getDate()).padStart(2, '0'),
|
||||
HH: String(date.getHours()).padStart(2, '0'),
|
||||
mm: String(date.getMinutes()).padStart(2, '0'),
|
||||
ss: String(date.getSeconds()).padStart(2, '0'),
|
||||
}
|
||||
let result = format
|
||||
for (const [token, value] of Object.entries(tokens)) {
|
||||
result = result.replace(token, value)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
return {
|
||||
start: formatDateTime(sevenDaysAgo),
|
||||
end: formatDateTime(now),
|
||||
}
|
||||
}
|
||||
|
|
@ -2,21 +2,176 @@
|
|||
<div class="deposit-channel">
|
||||
<div class="bar">
|
||||
<el-button type="primary" @click="handleAdd">添加</el-button>
|
||||
<el-button type="danger" @click="handleEnable">启用</el-button>
|
||||
<el-button type="danger" @click="handleDisable">禁用</el-button>
|
||||
<el-button type="primary" @click="handleEdit">编辑</el-button>
|
||||
<el-button type="danger" @click="handleDelete">删除</el-button>
|
||||
</div>
|
||||
<DepositChannelTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id"/>
|
||||
<DepositChannelTable
|
||||
ref="tableRef"
|
||||
:table-data="tableData"
|
||||
:columns="tableColumnsOptions"
|
||||
row-key="id"
|
||||
@rowClick="handleRowClick"
|
||||
/>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="dialogTitleType === 1 ? '添加充值渠道' : '编辑充值渠道'"
|
||||
width="700"
|
||||
>
|
||||
<Form
|
||||
:formItems="formItems"
|
||||
:formRules="formRules"
|
||||
:formData="formData"
|
||||
:optionsMap="optionsMap"
|
||||
/>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitDetail">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
//组件
|
||||
import DepositChannelTable from '@/components/common/Table.vue'
|
||||
import { tableColumns } from './options'
|
||||
import Form from '@/components/common/Form.vue'
|
||||
import { tableColumns, formItemsData, formRulesData, optionsMapData } from './options'
|
||||
import {
|
||||
getChannelList,
|
||||
createChannel,
|
||||
editChannel,
|
||||
delChannel,
|
||||
} from '@/api/modules/capital/rechangeChanl.ts'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
type ChannelType = {
|
||||
id?: number
|
||||
name: string
|
||||
channel_fee: number | null
|
||||
type: number | null
|
||||
api_url: string
|
||||
api_appid: string
|
||||
api_key: string
|
||||
status: number
|
||||
}
|
||||
|
||||
const getTypeText = (type: number | string) => {
|
||||
return ['', '法币', '数字货币'][type]
|
||||
}
|
||||
|
||||
const getStatusText = (status: number | string) => {
|
||||
return ['', '正常', '禁用'][status]
|
||||
}
|
||||
|
||||
const initData = async () => {
|
||||
const res = await getChannelList()
|
||||
console.log(res)
|
||||
tableData.value = res.map((item: ChannelType) => ({
|
||||
...item,
|
||||
typeStr: getTypeText(item.type),
|
||||
statusStr: getStatusText(item.status),
|
||||
})) as ChannelType[]
|
||||
clearSelection()
|
||||
}
|
||||
|
||||
//表格数据
|
||||
const tableColumnsOptions = ref(tableColumns)
|
||||
const tableTree = ref([])
|
||||
const tableData = ref([])
|
||||
const tableRef = ref()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitleType = ref(1)
|
||||
const formData = ref({
|
||||
name: '',
|
||||
channel_fee: null,
|
||||
type: null,
|
||||
api_url: '',
|
||||
api_appid: '',
|
||||
api_key: '',
|
||||
status: 1,
|
||||
})
|
||||
const formItems = ref(formItemsData)
|
||||
const formRules = ref(formRulesData)
|
||||
const optionsMap = ref(optionsMapData)
|
||||
const submitDetail = async () => {
|
||||
dialogVisible.value = false
|
||||
if (dialogTitleType.value === 1) {
|
||||
await createChannel(formData.value)
|
||||
} else {
|
||||
await editChannel(formData.value)
|
||||
}
|
||||
await initData()
|
||||
}
|
||||
|
||||
let currentRow: any = {}
|
||||
|
||||
const handleRowClick = (row: any) => {
|
||||
console.log('handleRowClick', row)
|
||||
currentRow = row
|
||||
}
|
||||
|
||||
const resetFormData = () => {
|
||||
formData.value = {
|
||||
name: '',
|
||||
channel_fee: null,
|
||||
type: null,
|
||||
api_url: '',
|
||||
api_appid: '',
|
||||
api_key: '',
|
||||
status: 1,
|
||||
}
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
dialogVisible.value = true
|
||||
dialogTitleType.value = 1
|
||||
resetFormData()
|
||||
}
|
||||
|
||||
const handleEdit = () => {
|
||||
if (!currentRow.id) return ElMessage.warning('请先选择要编辑的记录')
|
||||
|
||||
dialogVisible.value = true
|
||||
dialogTitleType.value = 2
|
||||
formData.value = {
|
||||
id: currentRow.id,
|
||||
name: currentRow.name,
|
||||
channel_fee: currentRow.channel_fee,
|
||||
type: currentRow.type,
|
||||
api_url: currentRow.api_url,
|
||||
api_appid: currentRow.api_appid,
|
||||
api_key: currentRow.api_key,
|
||||
status: currentRow.status,
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = () => {
|
||||
console.log('handleDisable')
|
||||
ElMessageBox.confirm('确认删除吗?', '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
.then(async () => {
|
||||
await delChannel({ id: currentRow.id })
|
||||
await initData()
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('取消删除')
|
||||
})
|
||||
}
|
||||
|
||||
const clearSelection = () => {
|
||||
currentRow = {}
|
||||
nextTick(() => {
|
||||
tableRef.value?.clearCurrentRow() // 调用子组件方法取消高亮
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initData()
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.deposit-channel {
|
||||
|
|
@ -29,6 +184,5 @@ const tableTree = ref([])
|
|||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,60 @@
|
|||
export const tableColumns = [
|
||||
//序号
|
||||
{ label: '序号', prop: 'index' },
|
||||
{ label: '序号', type: 'index', width: 60, align: 'center' },
|
||||
//存款渠道名称
|
||||
{ label: '存款渠道名称', prop: 'depositChannelName' },
|
||||
//状态
|
||||
{ label: '状态', slotName: 'status' },
|
||||
|
||||
{ label: '渠道名称', prop: 'name' },
|
||||
//存款渠道费用
|
||||
{ label: '渠道费用', prop: 'channel_fee' },
|
||||
//存款渠道类型
|
||||
{ label: '类型', prop: 'typeStr' },
|
||||
// 接口地址
|
||||
{ label: '接口地址', prop: 'api_url' },
|
||||
// 接口appid
|
||||
{ label: '接口appid', prop: 'api_appid' },
|
||||
{ label: '状态', prop: 'statusStr' },
|
||||
]
|
||||
|
||||
export const formItemsData = [
|
||||
{ label: '渠道名称', prop: 'name', type: 'input', placeholder: '请输入渠道名称' },
|
||||
{
|
||||
label: '渠道费用',
|
||||
prop: 'channel_fee',
|
||||
type: 'number',
|
||||
min: 0,
|
||||
max: 999999,
|
||||
controls: false,
|
||||
placeholder: '请输入渠道费用',
|
||||
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
prop: 'type',
|
||||
type: 'select',
|
||||
placeholder: '请选择类型',
|
||||
}, // 类型:1法币,2数字货币
|
||||
{ label: '接口地址', prop: 'api_url', type: 'input', placeholder: '请输入接口地址' },
|
||||
{ label: '接口appid', prop: 'api_appid', type: 'input', placeholder: '请输入接口appid' },
|
||||
{ label: '接口密钥', prop: 'api_key', type: 'input', placeholder: '请输入接口密钥' },
|
||||
{ label: '状态', prop: 'status', type: 'radio' },
|
||||
]
|
||||
|
||||
export const formRulesData = {
|
||||
name: [{ required: true, message: '请输入渠道名称', trigger: ['change'] }],
|
||||
channel_fee: [{ required: true, message: '请输入渠道费用', trigger: ['change'] }],
|
||||
type: [{ required: true, message: '请选择类型', trigger: ['change'] }],
|
||||
api_url: [{ required: true, message: '请输入接口地址', trigger: ['change'] }],
|
||||
api_appid: [{ required: true, message: '请输入接口appid', trigger: ['change'] }],
|
||||
api_key: [{ required: true, message: '请输入接口密钥', trigger: ['change'] }],
|
||||
status: [{ required: true, message: '请选择状态', trigger: ['change'] }],
|
||||
}
|
||||
|
||||
export const optionsMapData = {
|
||||
type: [
|
||||
{ label: '法币', value: 1 },
|
||||
{ label: '数字货币', value: 2 },
|
||||
],
|
||||
status: [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 2 },
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
<template>
|
||||
<div class="rechange-check">
|
||||
<!-- 搜索区域:默认把当天 0 点到当前时间写入时间输入框 -->
|
||||
<RechangeSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch" @reset="handleReset">
|
||||
<RechangeSearch
|
||||
:search-form="searchForm"
|
||||
:search-options="searchOptions"
|
||||
@search="handleSearch"
|
||||
@reset="handleReset"
|
||||
>
|
||||
<template #button>
|
||||
<!-- 审核动作先保留按钮交互,后续可直接接接口 -->
|
||||
<el-button type="danger" plain @click="handleReject">驳回</el-button>
|
||||
|
|
@ -12,8 +17,15 @@
|
|||
|
||||
<!-- 列表区域:改为真实接口数据,仍保留勾选列供后续审核动作使用 -->
|
||||
<div class="table-wrapper">
|
||||
<el-table v-loading="loading" :data="tableData" border height="100%" row-key="id"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
border
|
||||
height="100%"
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<el-table-column label="序号" width="70" align="center">
|
||||
|
|
@ -22,14 +34,25 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-for="column in tableColumns" :key="column.prop" :prop="column.prop" :label="column.label"
|
||||
:min-width="column.width" :align="column.align || 'center'" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
v-for="column in tableColumns"
|
||||
:key="column.prop"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
:min-width="column.width"
|
||||
:align="column.align || 'center'"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 分页区域:使用接口返回的 total / current_page / per_page -->
|
||||
<RechangePagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||
@pagination-change="handlePaginationChange" />
|
||||
<RechangePagination
|
||||
v-model="currentPage"
|
||||
v-model:pageSizeValue="pageSize"
|
||||
:total="total"
|
||||
@pagination-change="handlePaginationChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -39,8 +62,9 @@ import { onMounted, ref } from 'vue'
|
|||
import RechangeSearch from '@/components/common/Search.vue'
|
||||
import RechangePagination from '@/components/common/Pagination.vue'
|
||||
import { exportToExcel } from '@/utils/exportToExcel'
|
||||
import { getRechargeCheckListApi } from '@/api/modules/system/rechargeCheck'
|
||||
import { getRechargeCheckListApi, reviewRechargeOrder } from '@/api/modules/capital/rechargeCheck'
|
||||
import { rechangeCheckSearch, rechangeCheckTableColumns } from './options'
|
||||
import { getRecentSevenDays } from '@/utils/handleTime.ts'
|
||||
|
||||
// 审核列表单行数据结构:直接对应 `rechargeOrder` 那套返回结果映射。
|
||||
interface TableRow {
|
||||
|
|
@ -79,34 +103,14 @@ const total = ref(0)
|
|||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
|
||||
// 时间格式化工具:用于生成接口必传的开始/结束时间默认值。
|
||||
const padZero = (value: number) => String(value).padStart(2, '0')
|
||||
|
||||
const formatDateTime = (date: Date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = padZero(date.getMonth() + 1)
|
||||
const day = padZero(date.getDate())
|
||||
const hours = padZero(date.getHours())
|
||||
const minutes = padZero(date.getMinutes())
|
||||
const seconds = padZero(date.getSeconds())
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
|
||||
const getTodayStartTime = () => {
|
||||
const now = new Date()
|
||||
now.setHours(0, 0, 0, 0)
|
||||
return formatDateTime(now)
|
||||
}
|
||||
|
||||
const getCurrentTime = () => formatDateTime(new Date())
|
||||
const initTime = getRecentSevenDays()
|
||||
|
||||
// 默认搜索表单:开始时间固定为当天 0 点,结束时间固定为当前时间,并直接显示在输入框里。
|
||||
const createDefaultSearchForm = (): SearchFormData => ({
|
||||
orderNo: '',
|
||||
userName: '',
|
||||
startTime: getTodayStartTime(),
|
||||
endTime: getCurrentTime(),
|
||||
startTime: initTime.start,
|
||||
endTime: initTime.end,
|
||||
})
|
||||
|
||||
const searchForm = ref<SearchFormData>(createDefaultSearchForm())
|
||||
|
|
@ -132,8 +136,8 @@ const getList = async () => {
|
|||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
trade_id: searchForm.value.orderNo || null,
|
||||
start_time: searchForm.value.startTime || getTodayStartTime(),
|
||||
end_time: searchForm.value.endTime || getCurrentTime(),
|
||||
start_time: searchForm.value.startTime || initTime.start,
|
||||
end_time: searchForm.value.endTime || initTime.end,
|
||||
user_name: searchForm.value.userName || null,
|
||||
}
|
||||
|
||||
|
|
@ -186,10 +190,21 @@ const handleReset = () => {
|
|||
getList()
|
||||
}
|
||||
|
||||
const tableRef = ref()
|
||||
// 表格勾选变化。
|
||||
const handleSelectionChange = (rows: TableRow[]) => {
|
||||
if (rows.length > 1) {
|
||||
// 超过1个时,移除最早选中的那个(保留最后一个)
|
||||
const lastRow = rows[rows.length - 1]
|
||||
// 先清除所有选择
|
||||
tableRef.value?.clearSelection()
|
||||
// 再单独选中最后点击的这行
|
||||
tableRef.value?.toggleRowSelection(lastRow, true)
|
||||
selectedRows.value = [lastRow]
|
||||
} else {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
}
|
||||
|
||||
// 审核通过:当前保留前端提示,等待后续接接口。
|
||||
const handleApprove = () => {
|
||||
|
|
@ -197,7 +212,10 @@ const handleApprove = () => {
|
|||
ElMessage.warning('请先选择要通过的记录')
|
||||
return
|
||||
}
|
||||
ElMessage.success('审核通过接口待接入')
|
||||
console.log(selectedRows.value)
|
||||
reviewRechargeOrder({ id: selectedRows.value[0].id, status: '3' })
|
||||
ElMessage.success('审核通过')
|
||||
getList()
|
||||
}
|
||||
|
||||
// 审核驳回:当前保留前端提示,等待后续接接口。
|
||||
|
|
@ -206,7 +224,10 @@ const handleReject = () => {
|
|||
ElMessage.warning('请先选择要驳回的记录')
|
||||
return
|
||||
}
|
||||
ElMessage.success('审核驳回接口待接入')
|
||||
//充值状态:1未审核,2未付款,3已付款,4驳回
|
||||
reviewRechargeOrder({ id: selectedRows.value[0].id, status: '4' })
|
||||
ElMessage.success('审核驳回')
|
||||
getList()
|
||||
}
|
||||
|
||||
// 导出:先导出当前页接口数据,后续如需全量导出可切成独立导出接口。
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ export const rechangeCheckSearch = [
|
|||
dateType: 'datetime' as const,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: '请选择开始时间',
|
||||
width: '220px',
|
||||
clearable: false,
|
||||
width: '260px',
|
||||
},
|
||||
{
|
||||
prop: 'endTime',
|
||||
|
|
@ -30,7 +31,8 @@ export const rechangeCheckSearch = [
|
|||
dateType: 'datetime' as const,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: '请选择结束时间',
|
||||
width: '220px',
|
||||
clearable: false,
|
||||
width: '260px',
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, nextTick } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import {
|
||||
getFeeSettingList,
|
||||
getFeeSettingDetail,
|
||||
|
|
@ -90,8 +90,6 @@ import {
|
|||
import Form from '@/components/common/Form.vue'
|
||||
import { formDataList, formRulesList } from './option.ts'
|
||||
|
||||
const title = ref('手续费模板')
|
||||
const buttons = ref([{ label: '新增', type: 'primary' as const, key: 'add' }])
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitleType = ref(1)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,37 @@
|
|||
<template>
|
||||
<div class="order-rechange-page">
|
||||
<!-- 搜索区域:按接口参数保留订单号、用户名称、状态、开始/结束时间 -->
|
||||
<OrderRechangeSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
||||
@reset="handleReset" />
|
||||
<OrderRechangeSearch
|
||||
:search-form="searchForm"
|
||||
:search-options="searchOptions"
|
||||
@search="handleSearch"
|
||||
@reset="handleReset"
|
||||
></OrderRechangeSearch>
|
||||
|
||||
<!-- 列表区域:改为真实接口数据,保留原有表格结构 -->
|
||||
<OrderRechangeTable :table-data="tableTree" :columns="tableColumnsOptions" :highlight-current-row="false" />
|
||||
<OrderRechangeTable
|
||||
:table-data="tableTree"
|
||||
:columns="tableColumnsOptions"
|
||||
:highlight-current-row="false"
|
||||
>
|
||||
<!-- 操作列插槽 -->
|
||||
<template #operation="{ row }">
|
||||
<el-button type="primary" :disabled="row.status !== '1'" @click="handleAudit(row, 3)"
|
||||
>审核通过</el-button
|
||||
>
|
||||
<el-button type="danger" :disabled="row.status !== '1'" @click="handleAudit(row, 4)"
|
||||
>审核驳回</el-button
|
||||
>
|
||||
</template>
|
||||
</OrderRechangeTable>
|
||||
|
||||
<!-- 分页区域:使用接口返回的 total / current_page / per_page -->
|
||||
<OrderRechangePagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||
@pagination-change="handlePaginationChange" />
|
||||
<OrderRechangePagination
|
||||
v-model="currentPage"
|
||||
v-model:pageSizeValue="pageSize"
|
||||
:total="total"
|
||||
@pagination-change="handlePaginationChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -18,8 +40,9 @@ import { onMounted, ref } from 'vue'
|
|||
import OrderRechangeSearch from '@/components/common/Search.vue'
|
||||
import OrderRechangeTable from '@/components/common/Table.vue'
|
||||
import OrderRechangePagination from '@/components/common/Pagination.vue'
|
||||
import { getRechargeOrderListApi } from '@/api/modules/system/rechargeOrder'
|
||||
import { getRechargeOrderListApi, reviewRechargeOrder } from '@/api/modules/order/rechange.ts'
|
||||
import { search, tableColumns } from './options'
|
||||
import { getRecentSevenDays } from '@/utils/handleTime.ts'
|
||||
|
||||
// 充值订单数据结构:只保留页面展示所需字段,接口原始字段在请求后统一映射。
|
||||
interface RechangeOrderItem {
|
||||
|
|
@ -34,13 +57,15 @@ interface RechangeOrderItem {
|
|||
rechangeAccount: string
|
||||
}
|
||||
|
||||
const initTime = getRecentSevenDays('YYYY-MM-DD')
|
||||
|
||||
// 搜索表单结构:与接口查询参数一一对应,页面字段名保持可读性。
|
||||
interface SearchFormData {
|
||||
orderNo: string
|
||||
userName: string
|
||||
trade_id: string
|
||||
user_name: string
|
||||
status: string
|
||||
startTime: string
|
||||
endTime: string
|
||||
start_time: string
|
||||
end_time: string
|
||||
}
|
||||
|
||||
// 搜索项配置。
|
||||
|
|
@ -48,11 +73,11 @@ const searchOptions = ref(search)
|
|||
|
||||
// 搜索表单:由公共 Search 组件双向绑定。
|
||||
const createDefaultSearchForm = (): SearchFormData => ({
|
||||
orderNo: '',
|
||||
userName: '',
|
||||
trade_id: '',
|
||||
user_name: '',
|
||||
status: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
start_time: initTime.start,
|
||||
end_time: initTime.end,
|
||||
})
|
||||
|
||||
const searchForm = ref<SearchFormData>(createDefaultSearchForm())
|
||||
|
|
@ -78,37 +103,17 @@ const getRechargeStatusText = (status: string | number | null | undefined) => {
|
|||
return statusMap[String(status ?? '')] || '--'
|
||||
}
|
||||
|
||||
// 格式化日期时间:用于生成接口需要的 `YYYY-MM-DD HH:mm:ss`。
|
||||
const padZero = (value: number) => String(value).padStart(2, '0')
|
||||
|
||||
const formatDateTime = (date: Date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = padZero(date.getMonth() + 1)
|
||||
const day = padZero(date.getDate())
|
||||
const hours = padZero(date.getHours())
|
||||
const minutes = padZero(date.getMinutes())
|
||||
const seconds = padZero(date.getSeconds())
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
|
||||
const getTodayStartTime = () => {
|
||||
const now = new Date()
|
||||
now.setHours(0, 0, 0, 0)
|
||||
return formatDateTime(now)
|
||||
}
|
||||
|
||||
const getCurrentTime = () => formatDateTime(new Date())
|
||||
|
||||
// 获取充值订单列表:把接口返回字段统一映射成页面表格结构。
|
||||
const getRechargeOrderList = async () => {
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
trade_id: searchForm.value.orderNo || null,
|
||||
start_time: searchForm.value.startTime ? `${searchForm.value.startTime} 00:00:00` : getTodayStartTime(),
|
||||
end_time: searchForm.value.endTime ? `${searchForm.value.endTime} 23:59:59` : getCurrentTime(),
|
||||
user_name: searchForm.value.userName || null,
|
||||
trade_id: searchForm.value.trade_id || null,
|
||||
start_time: searchForm.value.start_time
|
||||
? `${searchForm.value.start_time} 00:00:00`
|
||||
: initTime.start,
|
||||
end_time: searchForm.value.end_time ? `${searchForm.value.end_time} 23:59:59` : initTime.end,
|
||||
user_name: searchForm.value.user_name || null,
|
||||
status: searchForm.value.status || null,
|
||||
}
|
||||
|
||||
|
|
@ -169,6 +174,18 @@ const handlePaginationChange = (page: { currentPage: number; pageSize: number })
|
|||
pageSize.value = page.pageSize
|
||||
getRechargeOrderList()
|
||||
}
|
||||
|
||||
// 审核通过:调用接口修改状态为 3 已付款。
|
||||
const handleAudit = async (row: RechangeOrderItem, status: number) => {
|
||||
try {
|
||||
await reviewRechargeOrder({ id: row.id, status: status })
|
||||
ElMessage.success('审核通过')
|
||||
await getRechargeOrderList()
|
||||
} catch (error) {
|
||||
ElMessage.error('审核失败')
|
||||
console.error('审核失败', error)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
// 充值订单搜索项:按接口参数保留订单号、用户名称、状态、结束时间、开始时间。
|
||||
export const search = [
|
||||
{
|
||||
prop: 'orderNo',
|
||||
prop: 'trade_id',
|
||||
label: '订单号',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入流水号',
|
||||
width: '210px',
|
||||
},
|
||||
{
|
||||
prop: 'userName',
|
||||
prop: 'user_name',
|
||||
label: '用户名称',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入用户名',
|
||||
|
|
@ -28,24 +28,23 @@ export const search = [
|
|||
],
|
||||
},
|
||||
{
|
||||
prop: 'startTime',
|
||||
prop: 'start_time',
|
||||
label: '开始时间',
|
||||
type: 'date' as const,
|
||||
dateType: 'date' as const,
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
placeholder: '请选择开始时间',
|
||||
width: '150px',
|
||||
width: '260px',
|
||||
},
|
||||
{
|
||||
prop: 'endTime',
|
||||
prop: 'end_time',
|
||||
label: '结束时间',
|
||||
type: 'date' as const,
|
||||
dateType: 'date' as const,
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
placeholder: '请选择结束时间',
|
||||
width: '150px',
|
||||
width: '260px',
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
// 充值订单表格列:对应接口数据映射后的列表字段。
|
||||
|
|
@ -56,5 +55,6 @@ export const tableColumns = [
|
|||
{ prop: 'statusText', label: '状态', align: 'center' as const },
|
||||
{ prop: 'rechangeTime', label: '充值时间', align: 'center' as const },
|
||||
{ prop: 'rechangeAccount', label: '充值账号', align: 'center' as const },
|
||||
{ label: '操作', width: '240px', align: 'center' as const, slotName: 'operation' },
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue