This commit is contained in:
parent
dc548d1d53
commit
fc2e3284b5
|
|
@ -0,0 +1,6 @@
|
||||||
|
//获取代理客户列表接口
|
||||||
|
import { request } from '@/api';
|
||||||
|
|
||||||
|
export const getCustomerDetailApi = (params: any) => {
|
||||||
|
return request.get('/agent/getAgentUserDetail', {...params})
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,16 @@
|
||||||
//获取代理客户列表接口
|
//获取代理客户列表接口
|
||||||
import { request } from '@/api';
|
import { request } from '@/api';
|
||||||
|
|
||||||
export const getCustomerListApi = (params: any) => {
|
export const getCustomerListApi = (params: any) => {
|
||||||
return request.get('/agent/getAgentUserList', {...params})
|
return request.get('/agent/getAgentUserList', {...params})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取代理点差数据接口
|
||||||
|
export const getSelfVarietyPointDiffConfigApi = (params: any) => {
|
||||||
|
return request.get('/agent/getSelfVarietyPointDiffConfig', {...params})
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑代理客户接口
|
||||||
|
export const editCustomerApi = (params: any) => {
|
||||||
|
return request.post('/agent/editAgent', {...params})
|
||||||
|
}
|
||||||
|
|
@ -115,7 +115,7 @@ const staticMenuList = ref<ElMenuItem[]>(
|
||||||
{
|
{
|
||||||
id: 32,
|
id: 32,
|
||||||
label: '代理管理',
|
label: '代理管理',
|
||||||
path: '/account/agent', // index="3-2"
|
path: '/account/agentList', // index="3-2"
|
||||||
icon: ''
|
icon: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,9 @@ const routes = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'agent',
|
path: 'agentList',
|
||||||
name: 'Agent',
|
name: 'AgentList',
|
||||||
component: () => import('@/views/account/agent/index.vue'),
|
component: () => import('@/views/account/agentList/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '代理管理', // 左侧菜单显示的标题
|
title: '代理管理', // 左侧菜单显示的标题
|
||||||
}
|
}
|
||||||
|
|
@ -314,24 +314,24 @@ const routes = [
|
||||||
title: '个性化交易', // 左侧菜单显示的标题
|
title: '个性化交易', // 左侧菜单显示的标题
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
// 跟单记录
|
// 跟单记录
|
||||||
{
|
{
|
||||||
path: 'followRecord',
|
path: 'followRecord',
|
||||||
name: 'FollowRecord',
|
name: 'FollowRecord',
|
||||||
component: () => import('@/views/personalized/followRecord/index.vue'),
|
component: () => import('@/views/personalized/followRecord/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '跟单记录', // 左侧菜单显示的标题
|
title: '跟单记录', // 左侧菜单显示的标题
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 带单记录
|
// 带单记录
|
||||||
{
|
{
|
||||||
path: 'leadRecord',
|
path: 'leadRecord',
|
||||||
name: 'LeadRecord',
|
name: 'LeadRecord',
|
||||||
component: () => import('@/views/personalized/leadRecord/index.vue'),
|
component: () => import('@/views/personalized/leadRecord/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '带单记录', // 左侧菜单显示的标题
|
title: '带单记录', // 左侧菜单显示的标题
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
//代理管理
|
//代理管理
|
||||||
|
|
@ -351,6 +351,15 @@ const routes = [
|
||||||
title: '客户列表', // 左侧菜单显示的标题
|
title: '客户列表', // 左侧菜单显示的标题
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//客户详情
|
||||||
|
{
|
||||||
|
path: 'customerDetail/:id',
|
||||||
|
name: 'CustomerDetail',
|
||||||
|
component: () => import('@/views/agent/customerDetail/index.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '客户详情', // 左侧菜单显示的标题
|
||||||
|
}
|
||||||
|
},
|
||||||
//客户交易订单
|
//客户交易订单
|
||||||
{
|
{
|
||||||
path: 'customerTradeOrder',
|
path: 'customerTradeOrder',
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,12 @@ const getCustomerCapitalFlowList = async () => {
|
||||||
// table数据映射
|
// table数据映射
|
||||||
tableTree.value = data.data.map((item: any) => ({
|
tableTree.value = data.data.map((item: any) => ({
|
||||||
id:item.account_id,
|
id:item.account_id,
|
||||||
flowNo:'',
|
flowNo:item.trade_id,
|
||||||
accountName:item.user.username,
|
accountName:item.user.username,
|
||||||
amount:item.amount,
|
amount:item.amount,
|
||||||
fundType:'',
|
fundType:item.wallet_type === "1" ? '主账户' : '子账户',
|
||||||
status:'',
|
// status:'',
|
||||||
operationType:'',
|
operationType:item.enum_dic.value,
|
||||||
createTime:item.created_at,
|
createTime:item.created_at,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export const tableColumns = [
|
||||||
// 资金类别
|
// 资金类别
|
||||||
{ prop: 'fundType', label: '资金类别' },
|
{ prop: 'fundType', label: '资金类别' },
|
||||||
// 状态
|
// 状态
|
||||||
{ prop: 'status', label: '状态' },
|
// { prop: 'status', label: '状态' },
|
||||||
// 操作方式
|
// 操作方式
|
||||||
{ prop: 'operationType', label: '操作方式' },
|
{ prop: 'operationType', label: '操作方式' },
|
||||||
// 时间
|
// 时间
|
||||||
|
|
|
||||||
|
|
@ -1 +1,212 @@
|
||||||
<template></template>
|
<template>
|
||||||
|
<div class="customer-detail">
|
||||||
|
<div class="back">
|
||||||
|
<div class="title" @click="handleBack">
|
||||||
|
<el-icon>
|
||||||
|
<ArrowLeft />
|
||||||
|
</el-icon>
|
||||||
|
返回上层
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="detail">
|
||||||
|
<el-card class="user-card">
|
||||||
|
<el-icon>
|
||||||
|
<UserFilled />
|
||||||
|
</el-icon>
|
||||||
|
<div class="user-item">
|
||||||
|
<span>账户名称:{{customerDetail.accountName}}</span>
|
||||||
|
<span>账户id:{{customerDetail.userId}}</span>
|
||||||
|
<span>账户角色:{{customerDetail.userRole}}</span>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-card class="information-card">
|
||||||
|
<div class="information-item">
|
||||||
|
<div class="group">
|
||||||
|
<p>手机号</p>
|
||||||
|
<p>{{customerDetail.phone}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="group">
|
||||||
|
<p>邮箱</p>
|
||||||
|
<p>{{customerDetail.email}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="information-item">
|
||||||
|
<div class="group">
|
||||||
|
<p>存款金额</p>
|
||||||
|
<p>{{customerDetail.depositAmount}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="group">
|
||||||
|
<p>账户余额</p>
|
||||||
|
<p>{{customerDetail.balance}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="information-item">
|
||||||
|
<div class="group">
|
||||||
|
<p>注册时间</p>
|
||||||
|
<p>{{customerDetail.registerTime}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="group">
|
||||||
|
<p>历史交易金额</p>
|
||||||
|
<p>{{customerDetail.historyTradeAmount}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
<CustomerDetailTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" :default-sort="{ prop: 'balance', order: 'descending' }"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ArrowLeft, UserFilled } from '@element-plus/icons-vue'
|
||||||
|
// 组件
|
||||||
|
import CustomerDetailTable from '@/components/common/Table.vue'
|
||||||
|
// 配置
|
||||||
|
import { tableColumns } from './options'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import { getCustomerDetailApi } from '@/api/modules/agent/customerDetail'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 定义客户详情数据
|
||||||
|
*/
|
||||||
|
const customerDetail = ref({
|
||||||
|
// 账户名称
|
||||||
|
accountName: '',
|
||||||
|
// 账户id
|
||||||
|
userId: '',
|
||||||
|
// 账户角色
|
||||||
|
userRole: '',
|
||||||
|
// 手机号
|
||||||
|
phone: '',
|
||||||
|
// 邮箱
|
||||||
|
email: '',
|
||||||
|
// 存款金额
|
||||||
|
depositAmount: '',
|
||||||
|
// 账户余额
|
||||||
|
balance: '',
|
||||||
|
// 注册时间
|
||||||
|
registerTime: '',
|
||||||
|
// 历史交易金额
|
||||||
|
historyTradeAmount: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 客户角色映射
|
||||||
|
const roleMap: any = {
|
||||||
|
1: '平台',
|
||||||
|
2: '承包商',
|
||||||
|
3: '特殊做市商',
|
||||||
|
4: '普通做市商',
|
||||||
|
5: '代理',
|
||||||
|
6: '用户'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 定义表格数据
|
||||||
|
*/
|
||||||
|
const tableTree = ref([])
|
||||||
|
const tableColumnsOptions = ref(tableColumns)
|
||||||
|
/**
|
||||||
|
* @description: 获取客户详情
|
||||||
|
*/
|
||||||
|
const getCustomerDetail = async () => {
|
||||||
|
const id = route.params.id
|
||||||
|
const data: any = await getCustomerDetailApi({
|
||||||
|
user_id: id,
|
||||||
|
})
|
||||||
|
// 客户详情数据
|
||||||
|
customerDetail.value = {
|
||||||
|
// 账户名称
|
||||||
|
accountName: data.user.username,
|
||||||
|
// 账户id
|
||||||
|
userId: data.user.id,
|
||||||
|
// 账户角色
|
||||||
|
userRole: roleMap[data.user.role_id],
|
||||||
|
// 手机号
|
||||||
|
phone: data.user.phone,
|
||||||
|
// 邮箱
|
||||||
|
email: data.user.email,
|
||||||
|
// 存款金额
|
||||||
|
depositAmount: data.user.total_recharge_amount,
|
||||||
|
// 账户余额
|
||||||
|
balance: data.user.total_recharge_amount,
|
||||||
|
// 注册时间
|
||||||
|
registerTime: data.user.created_at,
|
||||||
|
// 历史交易金额
|
||||||
|
historyTradeAmount: data.user.history_transfer_amount,
|
||||||
|
}
|
||||||
|
// 客户详情表格数据
|
||||||
|
tableTree.value = data.accounts.map((item: any) => ({
|
||||||
|
tradeAccount:item.wallets_trade.account_id,
|
||||||
|
accountName:item.account_name,
|
||||||
|
balance:item.wallets_trade.amount,
|
||||||
|
leverage:item.wallets_trade.lever,
|
||||||
|
historyTradeVolume: item.collect_data !== null ? item.collect_data.total_order: '',
|
||||||
|
createTime:item.created_at,
|
||||||
|
}))
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 页面加载完成需要加载的数据
|
||||||
|
*/
|
||||||
|
onMounted(() => {
|
||||||
|
getCustomerDetail()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 定义返回上层方法
|
||||||
|
*/
|
||||||
|
const handleBack = () => {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.back {
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.el-card {
|
||||||
|
:deep(.el-card__body) {
|
||||||
|
padding: 20px 10px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-card {
|
||||||
|
max-width: 300px;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 74px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.information-card {
|
||||||
|
width: calc(100% - 350px);
|
||||||
|
|
||||||
|
:deep(.el-card__body) {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.information-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
export const tableColumns = [
|
||||||
|
//交易账号
|
||||||
|
{label: '交易账号', prop: 'tradeAccount'},
|
||||||
|
//账户名称
|
||||||
|
{label: '账户名称', prop: 'accountName'},
|
||||||
|
//余额
|
||||||
|
{label: '余额', prop: 'balance', sortable: true},
|
||||||
|
//交易杠杆
|
||||||
|
{label: '交易杠杆', prop: 'leverage'},
|
||||||
|
//历史交易量
|
||||||
|
{label: '历史交易量', prop: 'historyTradeVolume'},
|
||||||
|
//添加时间
|
||||||
|
{label: '添加时间', prop: 'createTime'},
|
||||||
|
]
|
||||||
|
|
@ -4,23 +4,24 @@
|
||||||
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
<CustomerListSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
|
||||||
@reset="handleReset"></CustomerListSearch>
|
@reset="handleReset"></CustomerListSearch>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<CustomerListTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" :tree-props="treeProps" :default-sort="{ prop: 'createTime', order: 'descending' }">
|
<CustomerListTable :table-data="tableTree" :columns="tableColumnsOptions" row-key="id" :tree-props="treeProps"
|
||||||
|
:default-sort="{ prop: 'createTime', order: 'descending' }">
|
||||||
<template #accountName="{ row }">
|
<template #accountName="{ row }">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
{{ row.accountName }}
|
{{ row.accountName }}
|
||||||
<el-icon style="margin-left: 5px; cursor: pointer;" @click="handleGetSubList(row)">
|
<el-icon style="margin-left: 5px; cursor: pointer;" v-if="row.role_id === 5" @click="handleGetSubList(row)">
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #marginRatio="{ row }">
|
<template #marginRatio="{ row }">
|
||||||
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleEdit(row)">
|
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleMarginRatio(row)">
|
||||||
修改
|
修改
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #commissionRatio="{ row }">
|
<template #commissionRatio="{ row }">
|
||||||
{{ row.commissionRatio }}
|
{{ row.commissionRatio }}
|
||||||
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleEdit(row)">
|
<el-button v-if="row.role_id === 5" type="primary" size="small" @click="handleCommissionRatio(row)">
|
||||||
修改
|
修改
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -29,14 +30,28 @@
|
||||||
查看详情
|
查看详情
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #empty="{ row }">
|
|
||||||
<el-empty v-if="row.isEmpty" description="暂无下级" style="padding: 10px 0; text-align: center;" />
|
|
||||||
</template>
|
|
||||||
</CustomerListTable>
|
</CustomerListTable>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<CustomerListPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
<CustomerListPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||||
@pagination-change="handlePaginationChange" />
|
@pagination-change="handlePaginationChange" />
|
||||||
<!-- dialog -->
|
<!-- 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表格 -->
|
<!-- dialog表格 -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -50,13 +65,14 @@ import CustomerListPagination from '@/components/common/Pagination.vue'
|
||||||
import CustomerListDialog from '@/components/common/Dialog.vue'
|
import CustomerListDialog from '@/components/common/Dialog.vue'
|
||||||
import CustomerListForm from '@/components/common/Form.vue'
|
import CustomerListForm from '@/components/common/Form.vue'
|
||||||
// 配置以及表单验证
|
// 配置以及表单验证
|
||||||
import { search, tableColumns } from './options'
|
import { search, tableColumns, marginRatioTableColumns, commissionRatioFormItem } from './options'
|
||||||
|
|
||||||
// 接口
|
// 接口
|
||||||
import { getCustomerListApi } from '@/api/modules/agent/customerList'
|
import { getCustomerListApi, getSelfVarietyPointDiffConfigApi, editCustomerApi } from '@/api/modules/agent/customerList'
|
||||||
|
|
||||||
// 公用方法
|
// 公用方法
|
||||||
import { getStorage } from '@/utils/storage'
|
import { getStorage } from '@/utils/storage'
|
||||||
|
const router = useRouter()
|
||||||
/**
|
/**
|
||||||
* @description: 获取用户id
|
* @description: 获取用户id
|
||||||
*/
|
*/
|
||||||
|
|
@ -75,23 +91,82 @@ const searchForm = ref({
|
||||||
})
|
})
|
||||||
const searchOptions = ref(search)
|
const searchOptions = ref(search)
|
||||||
const tableColumnsOptions = ref(tableColumns)
|
const tableColumnsOptions = ref(tableColumns)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义表格数据
|
* @description: 定义表格数据
|
||||||
*/
|
*/
|
||||||
const tableTree = ref([])
|
const tableTree = ref([])
|
||||||
const treeProps = { children: 'children' }
|
const treeProps = { children: 'children' }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义分页数据
|
* @description: 定义分页数据
|
||||||
*/
|
*/
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const currentPage = ref(1)
|
const currentPage = ref(1)
|
||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义弹窗数据
|
* @description: 定义弹窗数据
|
||||||
*/
|
*/
|
||||||
|
const dialogVisible = ref<boolean>(false)
|
||||||
|
const dialogTitle = ref<string>('')
|
||||||
|
const dialogType = ref<string>('')
|
||||||
|
const dialogFullscreen = ref(false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义弹窗表格数据
|
* @description: 定义点差表格数据
|
||||||
*/
|
*/
|
||||||
|
const marginRatioTree = ref([])
|
||||||
|
const marginRatioTableColumnsOptions = ref(marginRatioTableColumns)
|
||||||
|
// 存储所有行的表单
|
||||||
|
const formRefs: any = ref({})
|
||||||
|
|
||||||
|
// 动态存储每行表单
|
||||||
|
const setFormRef = (el: any, id: any) => {
|
||||||
|
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)
|
||||||
|
|
||||||
|
if (inputVal > maxVal) {
|
||||||
|
callback(new Error('不能大于可分配点数'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 定义手续费form数据
|
||||||
|
*/
|
||||||
|
const commissionRatioForm = ref({
|
||||||
|
commissionRatio: '',
|
||||||
|
})
|
||||||
|
const commissionRatioFormRef = ref()
|
||||||
|
const commissionRatioFormRules = {
|
||||||
|
commissionRatio: [
|
||||||
|
{ required: true, message: '请输入手续费分成比例', trigger: ['blur', 'change'] },
|
||||||
|
{ pattern: /^\d+(\.\d+)?$/, message: '只能输入数字(可带小数)', trigger: ['blur', 'change'] },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
const commissionRatioFormItemOptions = ref(commissionRatioFormItem)
|
||||||
|
const selectId = ref('')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 角色映射方法
|
* @description: 角色映射方法
|
||||||
*/
|
*/
|
||||||
|
|
@ -108,8 +183,8 @@ const roleMap: any = {
|
||||||
/**
|
/**
|
||||||
* @description: 定义公共请求数据方法
|
* @description: 定义公共请求数据方法
|
||||||
*/
|
*/
|
||||||
|
// 获取客户列表
|
||||||
const getCustomerList = async (id: string) => {
|
const getCustomerList = async (id: string) => {
|
||||||
console.log('用户id', id);
|
|
||||||
const params = {
|
const params = {
|
||||||
user_id: id,
|
user_id: id,
|
||||||
page: currentPage.value,
|
page: currentPage.value,
|
||||||
|
|
@ -127,11 +202,9 @@ const getCustomerList = async (id: string) => {
|
||||||
status: item.status === 1 ? '正常' : '禁用',
|
status: item.status === 1 ? '正常' : '禁用',
|
||||||
role: roleMap[item.role_id] || '未知',
|
role: roleMap[item.role_id] || '未知',
|
||||||
accountQty: item.account[0].account_count,
|
accountQty: item.account[0].account_count,
|
||||||
marginRatio: "这是按钮",
|
|
||||||
commissionRatio: item.wallet_capital.fee_handling_percent,
|
commissionRatio: item.wallet_capital.fee_handling_percent,
|
||||||
createTime: item.created_at,
|
createTime: item.created_at,
|
||||||
role_id: item.role_id,
|
role_id: item.role_id,
|
||||||
children: [],
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
//分页数据
|
//分页数据
|
||||||
|
|
@ -139,12 +212,29 @@ const getCustomerList = async (id: string) => {
|
||||||
currentPage.value = data.current_page
|
currentPage.value = data.current_page
|
||||||
pageSize.value = Number(data.per_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
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 页面加载完成需要请求的数据
|
* @description: 页面加载完成需要请求的数据
|
||||||
*/
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getCustomerList(userId.value)
|
getCustomerList(userId.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义搜索方法
|
* @description: 定义搜索方法
|
||||||
*/
|
*/
|
||||||
|
|
@ -160,14 +250,39 @@ const handleReset = () => {
|
||||||
}
|
}
|
||||||
getCustomerList(userId.value)
|
getCustomerList(userId.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义表格方法
|
* @description: 定义表格方法
|
||||||
*/
|
*/
|
||||||
|
const handleDetail = (row: any) => {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改手续费比例
|
||||||
|
const handleCommissionRatio = (row: any) => {
|
||||||
|
console.log('修改手续费比例', row);
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = '修改手续费'
|
||||||
|
dialogType.value = 'editCommissionRatio'
|
||||||
|
selectId.value = row.userId
|
||||||
|
}
|
||||||
|
|
||||||
// 获取子列表
|
// 获取子列表
|
||||||
const handleGetSubList = async (row: any) => {
|
const handleGetSubList = async (row: any) => {
|
||||||
console.log('获取子列表', row);
|
console.log('获取子列表', row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义分页方法
|
* @description: 定义分页方法
|
||||||
*/
|
*/
|
||||||
|
|
@ -175,9 +290,64 @@ const handlePaginationChange = (page: { currentPage: number, size: number }) =>
|
||||||
currentPage.value = page.currentPage
|
currentPage.value = page.currentPage
|
||||||
getCustomerList(userId.value)
|
getCustomerList(userId.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义弹窗方法
|
* @description: 定义弹窗方法
|
||||||
*/
|
*/
|
||||||
|
//提交
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//转换为接口需要的格式 { 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 取消
|
||||||
|
const handleCancel = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
// 关闭
|
||||||
|
const handleClose = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @description: 定义弹窗表格方法
|
* @description: 定义弹窗表格方法
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export const search = [
|
||||||
|
|
||||||
export const tableColumns = [
|
export const tableColumns = [
|
||||||
// 账号名称
|
// 账号名称
|
||||||
{ label: '账号名称', slotName: 'accountName', emptySpan: { colspan: 999 } },
|
{ label: '账号名称', slotName: 'accountName'},
|
||||||
// 账号id
|
// 账号id
|
||||||
{ prop: 'userId', label: '账号id' },
|
{ prop: 'userId', label: '账号id' },
|
||||||
// 状态
|
// 状态
|
||||||
|
|
@ -31,7 +31,25 @@ export const tableColumns = [
|
||||||
// 手续费分成比例
|
// 手续费分成比例
|
||||||
{ prop: 'commissionRatio', label: '手续费分成比例', slotName: 'commissionRatio' },
|
{ prop: 'commissionRatio', label: '手续费分成比例', slotName: 'commissionRatio' },
|
||||||
// 注册时间
|
// 注册时间
|
||||||
{ prop: 'createTime', label: '注册时间' ,sortable:true},
|
{ prop: 'createTime', label: '注册时间', sortable: true },
|
||||||
// 操作
|
// 操作
|
||||||
{ label: '操作', slotName: 'action' }
|
{ label: '操作', slotName: 'action' }
|
||||||
|
]
|
||||||
|
|
||||||
|
// 点差表格配置
|
||||||
|
export const marginRatioTableColumns = [
|
||||||
|
// 品种名称
|
||||||
|
{ 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' },
|
||||||
|
]
|
||||||
|
|
||||||
|
// 手续费分成比例form配置
|
||||||
|
export const commissionRatioFormItem = [
|
||||||
|
// 手续费分成比例
|
||||||
|
{ prop: 'commissionRatio', label: '手续费分成比例', type: 'input' as const, placeholder: '请输入手续费分成比例',labelWidth: '140px'},
|
||||||
]
|
]
|
||||||
|
|
@ -118,7 +118,6 @@ const fetchMenuList = async () => {
|
||||||
]
|
]
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取菜单列表失败', err)
|
console.error('获取菜单列表失败', err)
|
||||||
ElMessage.error('获取菜单列表失败,请稍后重试')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 页面加载时获取菜单列表
|
// 页面加载时获取菜单列表
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ export const menuiconOptions = [
|
||||||
|
|
||||||
//定义table配置
|
//定义table配置
|
||||||
export const menuTableColumns = [
|
export const menuTableColumns = [
|
||||||
{ prop: 'name', label: '菜单名称', align: 'center' as const, width: '120px' },
|
{ prop: 'name', label: '菜单名称', align: 'center' as const},
|
||||||
{ prop: 'path', label: '路由路径', align: 'center' as const, width: '120px' },
|
{ prop: 'path', label: '路由路径', align: 'center' as const},
|
||||||
{ label: '图标', slotName: 'icon', align: 'center' as const },
|
{ label: '图标', slotName: 'icon', align: 'center' as const },
|
||||||
{ label: '类型', slotName: 'type', align: 'center' as const },
|
{ label: '类型', slotName: 'type', align: 'center' as const },
|
||||||
{ label: '状态', slotName: 'status', align: 'center' as const },
|
{ label: '状态', slotName: 'status', align: 'center' as const },
|
||||||
|
|
|
||||||
|
|
@ -117,12 +117,37 @@ const varietyFormRules = ref(rules())
|
||||||
const dialogFormItemOptions = ref(editDialogFormItem)
|
const dialogFormItemOptions = ref(editDialogFormItem)
|
||||||
const varietyFormOptionsMap = ref({
|
const varietyFormOptionsMap = ref({
|
||||||
tradeGroup: [],
|
tradeGroup: [],
|
||||||
|
type: [
|
||||||
|
{
|
||||||
|
label: '金属',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '能源',
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '指数',
|
||||||
|
value: 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '股票',
|
||||||
|
value: 4,
|
||||||
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
// 选中行
|
// 选中行
|
||||||
const selectedRow = ref<any>(null)
|
const selectedRow = ref<any>(null)
|
||||||
const rowGutter = ref(20)
|
const rowGutter = ref(20)
|
||||||
const colSpan = ref(12)
|
const colSpan = ref(12)
|
||||||
|
|
||||||
|
const typeMap:any = {
|
||||||
|
1: '金属',
|
||||||
|
2: '能源',
|
||||||
|
3: '指数',
|
||||||
|
4: '股票',
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 定义公共请求数据方法
|
* @description: 定义公共请求数据方法
|
||||||
*/
|
*/
|
||||||
|
|
@ -151,6 +176,7 @@ const getVarietyList = async () => {
|
||||||
longStockFee: item.fee_inventory_long,
|
longStockFee: item.fee_inventory_long,
|
||||||
shortStockFee: item.fee_inventory_short,
|
shortStockFee: item.fee_inventory_short,
|
||||||
profitLevel: item.stop_loss_level,
|
profitLevel: item.stop_loss_level,
|
||||||
|
type: typeMap[item.type],
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ export const tableColumns = [
|
||||||
{ prop: 'longStockFee', label: '多头库存费', align: 'center' as const },
|
{ prop: 'longStockFee', label: '多头库存费', align: 'center' as const },
|
||||||
// 空头库存费
|
// 空头库存费
|
||||||
{ prop: 'shortStockFee', label: '空头库存费', align: 'center' as const },
|
{ prop: 'shortStockFee', label: '空头库存费', align: 'center' as const },
|
||||||
|
// 类型
|
||||||
|
{ prop: 'type', label: '类型', align: 'center' as const },
|
||||||
// 止盈水平
|
// 止盈水平
|
||||||
{ prop: 'profitLevel', label: '止盈水平', align: 'center' as const },
|
{ prop: 'profitLevel', label: '止盈水平', align: 'center' as const },
|
||||||
]
|
]
|
||||||
|
|
@ -74,6 +76,8 @@ export const editDialogFormItem = [
|
||||||
{ prop: 'unit', label: '单位', type: 'input' as const, placeholder: '请输入单位' },
|
{ prop: 'unit', label: '单位', type: 'input' as const, placeholder: '请输入单位' },
|
||||||
// 最小波动
|
// 最小波动
|
||||||
{ prop: 'minFlux', label: '最小波动', type: 'input' as const, placeholder: '请输入最小波动' },
|
{ prop: 'minFlux', label: '最小波动', type: 'input' as const, placeholder: '请输入最小波动' },
|
||||||
|
// 类型
|
||||||
|
{ prop: 'type', label: '类型', type: 'select' as const, placeholder: '请选择类型' },
|
||||||
// 上下线状态
|
// 上下线状态
|
||||||
{ prop: 'onlineStatus', label: '上下线状态', type: 'switch' as const},
|
{ prop: 'onlineStatus', label: '上下线状态', type: 'switch' as const},
|
||||||
// 交易状态
|
// 交易状态
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue