BUG修复及代理列表
This commit is contained in:
parent
12dd2268ac
commit
bfe93f348d
|
|
@ -1,23 +0,0 @@
|
|||
import { request } from '@/api';
|
||||
import type { searchParams, pointDiffConfigParams } from '@/api/types/account/agent'
|
||||
|
||||
// 获取代理列表
|
||||
export async function getAgentListApi(params: searchParams): Promise<any> {
|
||||
return request.get<any>('/agent/getAgentList2', { ...params })
|
||||
}
|
||||
//获取代理点差配置
|
||||
export async function getPointDiffConfigApi(params: pointDiffConfigParams): Promise<any> {
|
||||
return request.get<any>('/agent/getSelfVarietyPointDiffConfig',{...params})
|
||||
}
|
||||
//获取风控模板选项
|
||||
export async function getRiskTemplateOptionsApi(): Promise<any> {
|
||||
return request.get<any>('/agent/getRiskControlOptions')
|
||||
}
|
||||
//获取手续费模板选项
|
||||
export async function getFeeTemplateOptionsApi(): Promise<any> {
|
||||
return request.get<any>('user/getFeeSettingOptions')
|
||||
}
|
||||
//编辑代理点差
|
||||
export async function editPointDiffApi(params: pointDiffConfigParams): Promise<any> {
|
||||
return request.post<any>('/agent/editAgent',{...params})
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { request } from '@/api';
|
||||
import type { searchParams, pointDiffConfigParams } from '@/api/types/account/agent'
|
||||
|
||||
// 获取代理列表
|
||||
export async function getAgentListApi(params: searchParams): Promise<any> {
|
||||
return request.get<any>('/agent/getAgentList2', { ...params })
|
||||
}
|
||||
|
|
@ -1,21 +1,32 @@
|
|||
<template>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<TransferSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
||||
@reset="handleReset">
|
||||
<template #button="{ form }">
|
||||
<el-button type="primary" @click="handleExport()">
|
||||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
</TransferSearch>
|
||||
<!-- 表格 -->
|
||||
<TransferTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" ref="tableRef">
|
||||
</TransferTable>
|
||||
<!-- 分页 -->
|
||||
<TransferPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||
@pagination-change="handlePaginationChange" />
|
||||
</div>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<TransferSearch
|
||||
:search-form="searchForm"
|
||||
:search-options="searchOptions"
|
||||
@search="handleSearch"
|
||||
@reset="handleReset"
|
||||
>
|
||||
<template #button="{ form }">
|
||||
<el-button type="primary" @click="handleExport()"> 导出 </el-button>
|
||||
</template>
|
||||
</TransferSearch>
|
||||
<!-- 表格 -->
|
||||
<TransferTable
|
||||
:table-data="tableTree"
|
||||
:columns="tableColumnsOptions"
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
>
|
||||
</TransferTable>
|
||||
<!-- 分页 -->
|
||||
<TransferPagination
|
||||
v-model="currentPage"
|
||||
v-model:pageSizeValue="pageSize"
|
||||
:total="total"
|
||||
@pagination-change="handlePaginationChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
|
@ -30,14 +41,14 @@ import { search, tableColumns } from './options'
|
|||
import { getTransferDetailListApi } from '@/api/modules/funding/transferDetail'
|
||||
|
||||
// 导出表格
|
||||
import {exportToExcel} from '@/utils/exportToExcel'
|
||||
import { exportToExcel } from '@/utils/exportToExcel'
|
||||
/**
|
||||
* @description: 定义搜索数据
|
||||
*/
|
||||
const searchForm = ref({
|
||||
transferAccount: '',
|
||||
level: '',
|
||||
transferTime: '',
|
||||
transferAccount: '',
|
||||
type: '',
|
||||
transferTime: '',
|
||||
})
|
||||
const searchOptions = ref(search)
|
||||
/**
|
||||
|
|
@ -56,89 +67,88 @@ const total = ref(0)
|
|||
* @description: 定义公共请求数据方法
|
||||
*/
|
||||
const getTransferDetailList = async () => {
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
type: '',
|
||||
start_time: searchForm.value.transferTime?.[0] || '2026-02-20 0:00:00',
|
||||
end_time: searchForm.value.transferTime?.[1] || '2026-03-20 23:59:59',
|
||||
user_name: searchForm.value.transferAccount || '',
|
||||
order_id: '',
|
||||
}
|
||||
const data: any = await getTransferDetailListApi(params)
|
||||
// 表格数据
|
||||
tableTree.value = data.data.map((item: any) => ({
|
||||
//序号
|
||||
index: item.id,
|
||||
//订单ID
|
||||
orderId: item.order_id,
|
||||
// 转出账户
|
||||
transferAccount: item.user.username,
|
||||
// 所属代理
|
||||
agentName: '',
|
||||
// 转入账号
|
||||
transferAccountName: item.to,
|
||||
// 转账类型
|
||||
transferType: item.type === 1 ? '内部' : '三方',
|
||||
// 转账金额
|
||||
transferAmount: item.amount,
|
||||
// 到账金额
|
||||
arrivalAmount: item.amount,
|
||||
|
||||
}))
|
||||
// 分页数据
|
||||
total.value = data.total
|
||||
currentPage.value = data.current_page
|
||||
pageSize.value = Number(data.per_page)
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
type: searchForm.value.type || '',
|
||||
start_time: searchForm.value.transferTime?.[0] || '2026-02-20 0:00:00',
|
||||
end_time: searchForm.value.transferTime?.[1] || '2026-03-20 23:59:59',
|
||||
user_name: searchForm.value.transferAccount || '',
|
||||
order_id: '',
|
||||
}
|
||||
const data: any = await getTransferDetailListApi(params)
|
||||
// 表格数据
|
||||
tableTree.value = data.data.map((item: any) => ({
|
||||
//序号
|
||||
index: item.id,
|
||||
//订单ID
|
||||
orderId: item.order_id,
|
||||
// 转出账户
|
||||
transferAccount: item.user.username,
|
||||
// 所属代理
|
||||
agentName: '',
|
||||
// 转入账号
|
||||
transferAccountName: item.to,
|
||||
// 转账类型
|
||||
transferType: item.type === 1 ? '内部' : '三方',
|
||||
// 转账金额
|
||||
transferAmount: item.amount,
|
||||
// 到账金额
|
||||
arrivalAmount: item.amount,
|
||||
}))
|
||||
// 分页数据
|
||||
total.value = data.total
|
||||
currentPage.value = data.current_page
|
||||
pageSize.value = Number(data.per_page)
|
||||
}
|
||||
/**
|
||||
* @description: 页面加载完成需要请求的数据
|
||||
*/
|
||||
onMounted(() => {
|
||||
getTransferDetailList()
|
||||
getTransferDetailList()
|
||||
})
|
||||
/**
|
||||
* @description: 定义搜索方法
|
||||
*/
|
||||
const handleSearch = async () => {
|
||||
getTransferDetailList()
|
||||
getTransferDetailList()
|
||||
}
|
||||
const handleReset = async () => {
|
||||
searchForm.value.transferAccount = ''
|
||||
searchForm.value.level = ''
|
||||
searchForm.value.transferTime = ''
|
||||
getTransferDetailList()
|
||||
searchForm.value.transferAccount = ''
|
||||
searchForm.value.level = ''
|
||||
searchForm.value.transferTime = ''
|
||||
getTransferDetailList()
|
||||
}
|
||||
/**
|
||||
* @description: 导出表格(带表头+自定义文件名)
|
||||
*/
|
||||
const handleExport = async () => {
|
||||
await exportToExcel({
|
||||
tableData: tableTree.value,
|
||||
columns: tableColumnsOptions.value,
|
||||
title: '导出转账详情',
|
||||
defaultFileNamePrefix: '转账详情',
|
||||
})
|
||||
await exportToExcel({
|
||||
tableData: tableTree.value,
|
||||
columns: tableColumnsOptions.value,
|
||||
title: '导出转账详情',
|
||||
defaultFileNamePrefix: '转账详情',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = async () => {
|
||||
getTransferDetailList()
|
||||
getTransferDetailList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.search-container {
|
||||
:deep(.el-form) {
|
||||
.el-form-item {
|
||||
flex: none;
|
||||
:deep(.el-form) {
|
||||
.el-form-item {
|
||||
flex: none;
|
||||
|
||||
.el-select {
|
||||
width: 160px;
|
||||
}
|
||||
}
|
||||
.el-select {
|
||||
width: 160px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -2,36 +2,36 @@
|
|||
* @description: 搜索配置
|
||||
*/
|
||||
export const search = [
|
||||
//存款账户
|
||||
{
|
||||
label: '转账账户',
|
||||
prop: 'transferAccount',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入转账账户'
|
||||
},
|
||||
//级别
|
||||
{
|
||||
label: '转账类型',
|
||||
prop: 'level',
|
||||
type: 'select' as const,
|
||||
placeholder: '请选择转账类型',
|
||||
options: [
|
||||
{ label: '客户', value: '1' },
|
||||
{ label: '三方', value: '2' },
|
||||
]
|
||||
},
|
||||
//选择时间
|
||||
{
|
||||
label: '时间',
|
||||
prop: 'transferTime',
|
||||
type: 'date' as const,
|
||||
dateType: 'datetimerange' as const,
|
||||
placeholder: '请选择转账时间',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
},
|
||||
//存款账户
|
||||
{
|
||||
label: '转账账户',
|
||||
prop: 'transferAccount',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入转账账户',
|
||||
},
|
||||
//级别
|
||||
{
|
||||
label: '转账类型',
|
||||
prop: 'type',
|
||||
type: 'select' as const,
|
||||
placeholder: '请选择转账类型',
|
||||
options: [
|
||||
{ label: '客户', value: '1' },
|
||||
{ label: '三方', value: '2' },
|
||||
],
|
||||
},
|
||||
//选择时间
|
||||
{
|
||||
label: '时间',
|
||||
prop: 'transferTime',
|
||||
type: 'date' as const,
|
||||
dateType: 'datetimerange' as const,
|
||||
placeholder: '请选择转账时间',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
},
|
||||
]
|
||||
|
||||
// 表格配置
|
||||
|
|
|
|||
|
|
@ -1,52 +1,98 @@
|
|||
<template>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
||||
@reset="handleReset"></CustomerListSearch>
|
||||
<!-- 表格 -->
|
||||
<CustomerListTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="userId"
|
||||
:tree-props="treeProps" :default-sort="{ prop: 'createTime', order: 'descending' }"
|
||||
@expand-change="handleGetSubList">
|
||||
<template #marginRatio="{ row }">
|
||||
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleMarginRatio(row)">
|
||||
修改
|
||||
</el-button>
|
||||
</template>
|
||||
<template #commissionRatio="{ row }">
|
||||
{{ row.commissionRatio }}
|
||||
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleCommissionRatio(row)">
|
||||
修改
|
||||
</el-button>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleDetail(row)" v-if="row.userId">
|
||||
查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</CustomerListTable>
|
||||
<!-- 分页 -->
|
||||
<CustomerListPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||
@pagination-change="handlePaginationChange" />
|
||||
<!-- dialog -->
|
||||
<CustomerListDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType"
|
||||
:fullscreen="dialogFullscreen" :show-footer="dialogType !== 'view'" @confirm="handleSubmit"
|
||||
@cancel="handleCancel" @close="handleClose">
|
||||
<CustomerListTable :table-data="marginRatioTree" :columns="marginRatioTableColumnsOptions" row-key="id"
|
||||
v-if="dialogType === 'editMarginRatio'">
|
||||
<template #assignedPointDiff="{ row }">
|
||||
<el-form :model="row" :rules="marginRatioRules(row)" :ref="el => setFormRef(el, row.id)">
|
||||
<el-form-item prop="assignedPointDifference">
|
||||
<el-input v-model="row.assignedPointDifference" size="small" placeholder="请输入点差" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</CustomerListTable>
|
||||
<CustomerListForm :form-data="commissionRatioForm" :form-rules="commissionRatioFormRules"
|
||||
:form-items="commissionRatioFormItemOptions" ref="commissionRatioFormRef"
|
||||
v-if="dialogType === 'editCommissionRatio'"></CustomerListForm>
|
||||
</CustomerListDialog>
|
||||
<!-- dialog表格 -->
|
||||
</div>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<CustomerListSearch
|
||||
:search-form="searchForm"
|
||||
:search-options="searchOptions"
|
||||
@search="handleSearch"
|
||||
@reset="handleReset"
|
||||
></CustomerListSearch>
|
||||
<!-- 表格 -->
|
||||
<CustomerListTable
|
||||
:table-data="tableTree"
|
||||
:columns="tableColumnsOptions"
|
||||
row-key="userId"
|
||||
:default-sort="{ prop: 'createTime', order: 'descending' }"
|
||||
@expand-change="handleGetSubList"
|
||||
>
|
||||
<template #marginRatio="{ row }">
|
||||
<el-button
|
||||
v-if="row.role_id === 5"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleMarginRatio(row)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
</template>
|
||||
<template #commissionRatio="{ row }">
|
||||
{{ row.commissionRatio }}
|
||||
<el-button
|
||||
v-if="row.role_id === 5"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleCommissionRatio(row)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleDetail(row)" v-if="row.userId">
|
||||
查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</CustomerListTable>
|
||||
<!-- 分页 -->
|
||||
<CustomerListPagination
|
||||
v-model="currentPage"
|
||||
v-model:pageSizeValue="pageSize"
|
||||
:total="total"
|
||||
@pagination-change="handlePaginationChange"
|
||||
/>
|
||||
<!-- dialog -->
|
||||
<CustomerListDialog
|
||||
:visible="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
:type="dialogType"
|
||||
:fullscreen="dialogFullscreen"
|
||||
:show-footer="dialogType !== 'view'"
|
||||
@confirm="handleSubmit"
|
||||
@cancel="handleCancel"
|
||||
@close="handleClose"
|
||||
>
|
||||
<CustomerListTable
|
||||
:table-data="marginRatioTree"
|
||||
:columns="marginRatioTableColumnsOptions"
|
||||
row-key="id"
|
||||
v-if="dialogType === 'editMarginRatio'"
|
||||
style="height: 500px"
|
||||
>
|
||||
<template #assignedPointDiff="{ row }">
|
||||
<el-form
|
||||
:model="row"
|
||||
:rules="marginRatioRules(row)"
|
||||
:ref="(el) => setFormRef(el, row.id)"
|
||||
>
|
||||
<el-form-item prop="assignedPointDifference">
|
||||
<el-input
|
||||
v-model="row.assignedPointDifference"
|
||||
size="small"
|
||||
placeholder="请输入点差"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</CustomerListTable>
|
||||
<CustomerListForm
|
||||
:form-data="commissionRatioForm"
|
||||
:form-rules="commissionRatioFormRules"
|
||||
:form-items="commissionRatioFormItemOptions"
|
||||
ref="commissionRatioFormRef"
|
||||
v-if="dialogType === 'editCommissionRatio'"
|
||||
></CustomerListForm>
|
||||
</CustomerListDialog>
|
||||
<!-- dialog表格 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
|
@ -60,7 +106,8 @@ import CustomerListForm from '@/components/common/Form.vue'
|
|||
import { search, tableColumns, marginRatioTableColumns, commissionRatioFormItem } from './options'
|
||||
|
||||
// 接口
|
||||
import { getCustomerListApi, getSelfVarietyPointDiffConfigApi, editCustomerApi } from '@/api/modules/agent/customerList'
|
||||
import { getSelfVarietyPointDiffConfigApi, editCustomerApi } from '@/api/modules/agent/customerList'
|
||||
import { getAgentListApi } from '@/api/modules/profile/agent.ts'
|
||||
|
||||
// 公用方法
|
||||
import { getStorage } from '@/utils/storage'
|
||||
|
|
@ -71,15 +118,14 @@ const router = useRouter()
|
|||
const userInfo: any = getStorage('userInfo')
|
||||
const userId = ref(userInfo?.id || '')
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定义搜索数据
|
||||
*/
|
||||
const searchForm = ref({
|
||||
accountName: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
status: '',
|
||||
accountName: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
status: '',
|
||||
})
|
||||
const searchOptions = ref(search)
|
||||
const tableColumnsOptions = ref(tableColumns)
|
||||
|
|
@ -115,46 +161,47 @@ const formRefs: any = ref({})
|
|||
|
||||
// 动态存储每行表单
|
||||
const setFormRef = (el: any, id: any) => {
|
||||
if (el) formRefs.value[id] = el
|
||||
if (el) formRefs.value[id] = el
|
||||
}
|
||||
// 点差验证规则
|
||||
const marginRatioRules = (row: any) => {
|
||||
return {
|
||||
assignedPointDifference: [
|
||||
{ required: true, message: '请输入数字', trigger: ['blur', 'change'] },
|
||||
{ pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
const inputVal = Number(value || 0)
|
||||
const maxVal = Number(row.pointDifference || 0)
|
||||
return {
|
||||
assignedPointDifference: [
|
||||
{ required: true, message: '请输入数字', trigger: ['blur', 'change'] },
|
||||
{
|
||||
pattern: /^\d+(\.\d+)?$/,
|
||||
message: '只能输入数字(可带小数)',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
const inputVal = Number(value || 0)
|
||||
const maxVal = Number(row.pointDifference || 0)
|
||||
|
||||
if (inputVal > maxVal) {
|
||||
callback(new Error('不能大于可分配点数'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
]
|
||||
}
|
||||
if (inputVal > maxVal) {
|
||||
callback(new Error('不能大于可分配点数'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定义手续费form数据
|
||||
*/
|
||||
const commissionRatioForm = ref({
|
||||
commissionRatio: '',
|
||||
commissionRatio: '',
|
||||
})
|
||||
const commissionRatioFormRef = ref()
|
||||
const commissionRatioFormRules = {
|
||||
commissionRatio: [
|
||||
{ required: true, message: '请输入手续费分成比例', trigger: ['blur', 'change'] },
|
||||
{ pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] },
|
||||
]
|
||||
commissionRatio: [
|
||||
{ required: true, message: '请输入手续费分成比例', trigger: ['blur', 'change'] },
|
||||
{ pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] },
|
||||
],
|
||||
}
|
||||
const commissionRatioFormItemOptions = ref(commissionRatioFormItem)
|
||||
const selectId = ref('')
|
||||
|
|
@ -163,157 +210,158 @@ const selectId = ref('')
|
|||
* @description: 角色映射方法
|
||||
*/
|
||||
const roleMap: any = {
|
||||
1: '平台',
|
||||
2: '承包商',
|
||||
3: '特殊做市商',
|
||||
4: '普通做市商',
|
||||
5: '代理',
|
||||
6: '用户'
|
||||
1: '平台',
|
||||
2: '承包商',
|
||||
3: '特殊做市商',
|
||||
4: '普通做市商',
|
||||
5: '代理',
|
||||
6: '用户',
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定义公共请求数据方法
|
||||
*/
|
||||
// 获取客户列表
|
||||
const getCustomerList = async (id: string) => {
|
||||
const params = {
|
||||
user_id: id,
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
user_name: searchForm.value.accountName,
|
||||
reg_start_time: searchForm.value.startTime.length > 0 ? `${searchForm.value.startTime} 0:00:00` : '2026-01-01 0:00:00',
|
||||
reg_end_time: searchForm.value.endTime.length > 0 ? `${searchForm.value.endTime} 23:59:59` : '2026-03-01 23:59:59',
|
||||
status: searchForm.value.status,
|
||||
}
|
||||
const data: any = await getCustomerListApi(params)
|
||||
const getCustomerList = async () => {
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
user_name: searchForm.value.accountName,
|
||||
reg_start_time: searchForm.value.startTime,
|
||||
reg_end_time: searchForm.value.endTime,
|
||||
status: searchForm.value.status,
|
||||
}
|
||||
const data: any = await getAgentListApi(params)
|
||||
|
||||
tableTree.value = data.data.map((item: any) => ({
|
||||
accountName: item.username,
|
||||
userId: item.id,
|
||||
status: item.status === 1 ? '正常' : '禁用',
|
||||
role: roleMap[item.role_id] || '未知',
|
||||
accountQty: item.account[0].account_count,
|
||||
commissionRatio: item.wallet_capital.fee_handling_percent,
|
||||
createTime: item.created_at,
|
||||
role_id: item.role_id,
|
||||
children: item.role_id === 5 ? [{
|
||||
hasChildren: true,
|
||||
}] : undefined,
|
||||
}))
|
||||
tableTree.value = data.data.map((item: any) => ({
|
||||
accountName: item.username,
|
||||
userId: item.id,
|
||||
status: item.status === 1 ? '正常' : '禁用',
|
||||
role: item.role.title || '未知',
|
||||
accountQty: item.son_user[0].son_user_count,
|
||||
commissionRatio: item.wallet_capital.fee_handling_percent,
|
||||
createTime: item.created_at,
|
||||
role_id: item.role_id,
|
||||
}))
|
||||
|
||||
//分页数据
|
||||
total.value = data.total
|
||||
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)
|
||||
}
|
||||
|
||||
//获取代理点差数据
|
||||
const getSelfVarietyPointDiffConfig = async (id: string) => {
|
||||
const params = {
|
||||
user_id: id,
|
||||
}
|
||||
const data: any = await getSelfVarietyPointDiffConfigApi(params)
|
||||
marginRatioTree.value = data.data.map((item: any) => ({
|
||||
id: item.id,
|
||||
varietyName: item.name,
|
||||
varietyCode: item.code,
|
||||
pointDifference: item.point_diff,
|
||||
assignedPointDifference: item.target_point_diff
|
||||
}))
|
||||
const params = {
|
||||
user_id: id,
|
||||
}
|
||||
const data: any = await getSelfVarietyPointDiffConfigApi(params)
|
||||
marginRatioTree.value = data.map((item: any) => ({
|
||||
id: item.id,
|
||||
varietyName: item.name,
|
||||
varietyCode: item.code,
|
||||
pointDifference: item.point_diff,
|
||||
assignedPointDifference: item.target_point_diff,
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 页面加载完成需要请求的数据
|
||||
*/
|
||||
onMounted(() => {
|
||||
getCustomerList(userId.value)
|
||||
getCustomerList()
|
||||
})
|
||||
|
||||
/**
|
||||
* @description: 定义搜索方法
|
||||
*/
|
||||
const handleSearch = async () => {
|
||||
getCustomerList(userId.value)
|
||||
getCustomerList()
|
||||
}
|
||||
const handleReset = () => {
|
||||
searchForm.value = {
|
||||
accountName: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
status: '',
|
||||
}
|
||||
getCustomerList(userId.value)
|
||||
searchForm.value = {
|
||||
accountName: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
status: '',
|
||||
}
|
||||
getCustomerList()
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定义表格方法
|
||||
*/
|
||||
const handleDetail = (row: any) => {
|
||||
console.log('查看详情', row);
|
||||
router.push(`/agent/customerDetail/${row.userId}`)
|
||||
console.log('查看详情', row)
|
||||
router.push(`/agent/customerDetail/${row.userId}`)
|
||||
}
|
||||
|
||||
// 修改点差
|
||||
const handleMarginRatio = (row: any) => {
|
||||
getSelfVarietyPointDiffConfig(row.userId)
|
||||
console.log('修改点差', row);
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = '修改点差'
|
||||
dialogType.value = 'editMarginRatio'
|
||||
selectId.value = row.userId
|
||||
getSelfVarietyPointDiffConfig(row.userId)
|
||||
console.log('修改点差', row)
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = '修改点差'
|
||||
dialogType.value = 'editMarginRatio'
|
||||
selectId.value = row.userId
|
||||
}
|
||||
|
||||
// 修改手续费比例
|
||||
const handleCommissionRatio = (row: any) => {
|
||||
console.log('修改手续费比例', row);
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = '修改手续费'
|
||||
dialogType.value = 'editCommissionRatio'
|
||||
selectId.value = row.userId
|
||||
console.log('修改手续费比例', row)
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = '修改手续费'
|
||||
dialogType.value = 'editCommissionRatio'
|
||||
selectId.value = row.userId
|
||||
commissionRatioForm.value.commissionRatio = row.commissionRatio
|
||||
}
|
||||
|
||||
// 获取子列表
|
||||
const handleGetSubList = async (row: any) => {
|
||||
const params = {
|
||||
user_name: '',
|
||||
user_id: row.userId,
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
reg_start_time: '',
|
||||
reg_end_time: '',
|
||||
status: '',
|
||||
}
|
||||
const data: any = await getCustomerListApi(params)
|
||||
if (data.data.length === 0) {
|
||||
ElMessage({
|
||||
message: '暂无数据',
|
||||
type: 'error',
|
||||
})
|
||||
row.children = []
|
||||
return
|
||||
}
|
||||
row.children = data.data.map((item: any) => ({
|
||||
accountName: item.username,
|
||||
userId: item.id,
|
||||
status: item.status === 1 ? '正常' : '禁用',
|
||||
role: roleMap[item.role_id] || '未知',
|
||||
accountQty: item.account[0].account_count,
|
||||
commissionRatio: item.wallet_capital.fee_handling_percent,
|
||||
createTime: item.created_at,
|
||||
role_id: item.role_id,
|
||||
children: item.role_id === 5 ? [{
|
||||
hasChildren: true,
|
||||
}] : undefined,
|
||||
}))
|
||||
const params = {
|
||||
user_name: '',
|
||||
user_id: row.userId,
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
reg_start_time: '',
|
||||
reg_end_time: '',
|
||||
status: '',
|
||||
}
|
||||
const data: any = await getAgentListApi(params)
|
||||
if (data.data.length === 0) {
|
||||
ElMessage({
|
||||
message: '暂无数据',
|
||||
type: 'error',
|
||||
})
|
||||
row.children = []
|
||||
return
|
||||
}
|
||||
row.children = data.data.map((item: any) => ({
|
||||
accountName: item.username,
|
||||
userId: item.id,
|
||||
status: item.status === 1 ? '正常' : '禁用',
|
||||
role: roleMap[item.role_id] || '未知',
|
||||
accountQty: item.account[0].account_count,
|
||||
commissionRatio: item.wallet_capital.fee_handling_percent,
|
||||
createTime: item.created_at,
|
||||
role_id: item.role_id,
|
||||
children:
|
||||
item.role_id === 5
|
||||
? [
|
||||
{
|
||||
hasChildren: true,
|
||||
},
|
||||
]
|
||||
: undefined,
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = (page: { currentPage: number, size: number }) => {
|
||||
currentPage.value = page.currentPage
|
||||
getCustomerList(userId.value)
|
||||
const handlePaginationChange = (page: { currentPage: number; size: number }) => {
|
||||
currentPage.value = page.currentPage
|
||||
getCustomerList()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -321,57 +369,61 @@ const handlePaginationChange = (page: { currentPage: number, size: number }) =>
|
|||
*/
|
||||
//提交
|
||||
const handleSubmit = async () => {
|
||||
const params = {
|
||||
user_id: selectId.value,
|
||||
toucun_percent: '',
|
||||
point_diffs_json: '',
|
||||
fee_handling_percent: '',
|
||||
fee_setting_id: '',
|
||||
risk_control_id: '',
|
||||
const params = {
|
||||
user_id: selectId.value,
|
||||
toucun_percent: '',
|
||||
point_diffs_json: '',
|
||||
fee_handling_percent: '',
|
||||
fee_setting_id: '',
|
||||
risk_control_id: '',
|
||||
}
|
||||
if (dialogType.value === 'editMarginRatio') {
|
||||
// 逐行验证
|
||||
for (const row of marginRatioTree.value) {
|
||||
const form = formRefs.value[(row as any).id]
|
||||
if (!form) continue
|
||||
try {
|
||||
await form.validate()
|
||||
} catch (err) {
|
||||
console.error(`第 ${(row as any).id} 行验证不通过,请检查`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (dialogType.value === 'editMarginRatio') {
|
||||
// 逐行验证
|
||||
for (const row of marginRatioTree.value) {
|
||||
const form = formRefs.value[(row as any).id]
|
||||
if (!form) continue
|
||||
try {
|
||||
await form.validate()
|
||||
} catch (err) {
|
||||
console.error(`第 ${(row as any).id} 行验证不通过,请检查`)
|
||||
return
|
||||
}
|
||||
}
|
||||
//转换为接口需要的格式 { id: assignedPointDifference }
|
||||
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
||||
acc[cur.id] = cur.assignedPointDifference
|
||||
return acc
|
||||
}, {})
|
||||
//转换为接口需要的格式 { id: assignedPointDifference }
|
||||
const marginRatioJSON = marginRatioTree.value.reduce((acc: any, cur: any) => {
|
||||
acc[cur.id] = cur.assignedPointDifference
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
// 调用接口
|
||||
try {
|
||||
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
|
||||
dialogVisible.value = false
|
||||
} catch (err) {
|
||||
console.log('提交失败:', err)
|
||||
}
|
||||
// 调用接口
|
||||
try {
|
||||
await editCustomerApi({ ...params, point_diffs_json: JSON.stringify(marginRatioJSON) })
|
||||
dialogVisible.value = false
|
||||
} catch (err) {
|
||||
console.log('提交失败:', err)
|
||||
}
|
||||
if (dialogType.value === 'editCommissionRatio') {
|
||||
await commissionRatioFormRef.value.validate()
|
||||
try {
|
||||
await editCustomerApi({ ...params, fee_handling_percent: commissionRatioForm.value.commissionRatio })
|
||||
dialogVisible.value = false
|
||||
} catch (err) {
|
||||
console.log('提交失败:', err)
|
||||
}
|
||||
}
|
||||
if (dialogType.value === 'editCommissionRatio') {
|
||||
await commissionRatioFormRef.value.validate()
|
||||
try {
|
||||
await editCustomerApi({
|
||||
...params,
|
||||
fee_handling_percent: commissionRatioForm.value.commissionRatio,
|
||||
})
|
||||
dialogVisible.value = false
|
||||
await getCustomerList()
|
||||
} catch (err) {
|
||||
console.log('提交失败:', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 取消
|
||||
const handleCancel = () => {
|
||||
dialogVisible.value = false
|
||||
dialogVisible.value = false
|
||||
}
|
||||
// 关闭
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
dialogVisible.value = false
|
||||
}
|
||||
/**
|
||||
* @description: 定义弹窗表格方法
|
||||
|
|
@ -380,8 +432,8 @@ const handleClose = () => {
|
|||
|
||||
<style scoped lang="scss">
|
||||
:deep(.placeholder-row) {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
/* 灰色,和Element空状态颜色一致 */
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
/* 灰色,和Element空状态颜色一致 */
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,28 @@
|
|||
export const search = [
|
||||
// 账号名称
|
||||
{ prop: 'accountName', label: '账号名称', type: 'input' as const, placeholder: '请输入账号名称', width: '150px' },
|
||||
// 开始时间
|
||||
{
|
||||
prop: "startTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
// 结束时间
|
||||
{
|
||||
prop: "endTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
// 状态
|
||||
{ prop: 'status', label: '状态', type: 'select' as const, placeholder: '请选择状态' },
|
||||
// 账号名称
|
||||
{
|
||||
prop: 'accountName',
|
||||
label: '账号名称',
|
||||
type: 'input' as const,
|
||||
placeholder: '请输入账号名称',
|
||||
width: '150px',
|
||||
},
|
||||
// 开始时间
|
||||
{
|
||||
prop: 'startTime',
|
||||
label: '注册开始时间',
|
||||
type: 'date' as const,
|
||||
dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
// 结束时间
|
||||
{
|
||||
prop: 'endTime',
|
||||
label: '注册结束时间',
|
||||
type: 'date' as const,
|
||||
dateType: 'date' as const, // 时间范围选择器
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
]
|
||||
|
||||
export const tableColumns = [
|
||||
|
|
@ -33,7 +43,7 @@ export const tableColumns = [
|
|||
// 注册时间
|
||||
{ prop: 'createTime', label: '注册时间', sortable: true },
|
||||
// 操作
|
||||
{ label: '操作', slotName: 'action' }
|
||||
// { label: '操作', slotName: 'action' }
|
||||
]
|
||||
|
||||
// 点差表格配置
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -75,12 +75,17 @@ export const countryOptions = ref<CountryItem[]>([
|
|||
])
|
||||
|
||||
//编辑点差表格列配置
|
||||
export const marketPointTableColumns = ([
|
||||
{ prop: 'varietyName', label: '名称', align: 'center' as const },
|
||||
{ prop: 'varietyCode', label: '编号', align: 'center' as const },
|
||||
{ prop: 'pointDifference', label: '可分配点差', align: 'center' as const },
|
||||
{ prop: 'assignedPointDifference', label: '已分配点差', align: 'center' as const, slotName: 'assignedPointDiff' },
|
||||
])
|
||||
export const marketPointTableColumns = [
|
||||
{ prop: 'varietyName', label: '名称', align: 'center' as const },
|
||||
{ prop: 'varietyCode', label: '编号', align: 'center' as const },
|
||||
{ prop: 'point_diff', label: '可分配点差', align: 'center' as const },
|
||||
{
|
||||
prop: 'pointDifference',
|
||||
label: '已分配点差',
|
||||
align: 'center' as const,
|
||||
slotName: 'assignedPointDiff',
|
||||
},
|
||||
]
|
||||
|
||||
// 查看点差表格列配置
|
||||
export const viewMarketPointTableColumns = ([
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ import { rules } from './rules'
|
|||
const clientSearchOptions = ref(clientSearch)
|
||||
const clientSearchForm = ref({
|
||||
username: '',
|
||||
status: '正常',
|
||||
status: 1,
|
||||
startDateTime: '',
|
||||
endDateTime: '',
|
||||
})
|
||||
|
|
@ -172,7 +172,7 @@ const getClientList = async () => {
|
|||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
username: clientSearchForm.value.username,
|
||||
status: clientSearchForm.value.status === '正常' ? 1 : 2,
|
||||
status: clientSearchForm.value.status || '',
|
||||
reg_start_time: clientSearchForm.value.startDateTime.length > 0 ? `${clientSearchForm.value.startDateTime} 0:00:00` : '',
|
||||
reg_end_time: clientSearchForm.value.endDateTime.length > 0 ? `${clientSearchForm.value.endDateTime} 23:59:59` : '',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,12 +306,14 @@ const handleEdit = () => {
|
|||
dialogVisible.value = true
|
||||
dialogTitle.value = '编辑合约品种'
|
||||
dialogType.value = 'edit'
|
||||
dialogFormItemOptions.value[4]!.disabled = true
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = '添加合约品种'
|
||||
dialogType.value = 'add'
|
||||
dialogFormItemOptions.value[4]!.disabled = false
|
||||
varietyForm.value = {
|
||||
varietyName: '',
|
||||
varietyCode: '',
|
||||
|
|
@ -420,6 +422,8 @@ const handleSubmit = async () => {
|
|||
|
||||
if (dialogType.value === 'edit') {
|
||||
console.log(params)
|
||||
if (params.point_diff_max < params.point_diff)
|
||||
return ElMessage.warning('最大点差不能小于最小点差')
|
||||
await editVarietyApi({
|
||||
...params,
|
||||
is_default: varietyForm.value.isDefault,
|
||||
|
|
|
|||
Loading…
Reference in New Issue