BUG修复

This commit is contained in:
Songsl 2026-04-27 20:38:32 +08:00
parent bfe93f348d
commit adcbbb6752
15 changed files with 682 additions and 583 deletions

View File

@ -10,3 +10,8 @@ export async function getWalletCapital(): Promise<any> {
return await request.get<any>('/user/getWalletCapital')
}
//重置密码
export const editAccountPass = (params: any) => {
return request.post('/user/editAccountPass', { ...params })
}

View File

@ -42,7 +42,7 @@ const userInfo = getStorage<any>('userInfo')
const activeUserName = ref(userInfo?.username || '')
const activeItem = ref('currentUser')
const dropdownItems = [
{ label: '切换账户', command: 'account' },
// { label: '', command: 'account' },
{ label: '修改密码', command: 'password' },
{ label: '退出登录', command: 'logout' }
]

View File

@ -1,52 +1,95 @@
<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"
: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'"
style="height: 600px"
>
<template #assignedPointDiff="{ row }">
<el-form
:model="row"
:rules="marginRatioRules(row)"
:ref="(el) => setFormRef(el, row.id)"
>
<el-form-item style="margin-bottom: 0" prop="assignedPointDifference">
<el-input v-model="row.assignedPointDifference" 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 +103,11 @@ import CustomerListForm from '@/components/common/Form.vue'
import { search, tableColumns, marginRatioTableColumns, commissionRatioFormItem } from './options'
//
import { getCustomerListApi, getSelfVarietyPointDiffConfigApi, editCustomerApi } from '@/api/modules/agent/customerList'
import {
getCustomerListApi,
getSelfVarietyPointDiffConfigApi,
editCustomerApi,
} from '@/api/modules/agent/customerList'
//
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,175 @@ 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 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)
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,
}))
//
total.value = data.total
currentPage.value = data.current_page
pageSize.value = Number(data.per_page)
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,
}))
console.log('tableTree', tableTree.value)
//
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 params = {
user_id: id,
}
const data: any = await getSelfVarietyPointDiffConfigApi(params)
marginRatioTree.value = data.map((item: any) => {
return {
id: item.id,
varietyName: item.name,
varietyCode: item.code,
pointDifference: item.point_diff,
assignedPointDifference: item.target_point_diff,
}
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
}))
})
console.log('marginRatioTree', marginRatioTree.value)
}
/**
* @description: 页面加载完成需要请求的数据
*/
onMounted(() => {
getCustomerList(userId.value)
getCustomerList(userId.value)
})
/**
* @description: 定义搜索方法
*/
const handleSearch = async () => {
getCustomerList(userId.value)
getCustomerList(userId.value)
}
const handleReset = () => {
searchForm.value = {
accountName: '',
startTime: '',
endTime: '',
status: '',
}
getCustomerList(userId.value)
searchForm.value = {
accountName: '',
startTime: '',
endTime: '',
status: '',
}
getCustomerList(userId.value)
}
/**
* @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
}
//
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 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,
}))
}
/**
* @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(userId.value)
}
/**
@ -321,57 +386,60 @@ 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
} catch (err) {
console.log('提交失败:', err)
}
}
}
//
const handleCancel = () => {
dialogVisible.value = false
dialogVisible.value = false
}
//
const handleClose = () => {
dialogVisible.value = false
dialogVisible.value = false
}
/**
* @description: 定义弹窗表格方法
@ -380,8 +448,8 @@ const handleClose = () => {
<style scoped lang="scss">
:deep(.placeholder-row) {
text-align: center;
color: #909399;
/* 灰色和Element空状态颜色一致 */
text-align: center;
color: #909399;
/* 灰色和Element空状态颜色一致 */
}
</style>

View File

@ -38,14 +38,19 @@ export const tableColumns = [
// 点差表格配置
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' },
// 品种名称
{ 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配置

View File

@ -7,21 +7,21 @@
<el-icon color="#409eff">
<CircleCheckFilled />
</el-icon>
<span>实名认证</span>
<router-link to="/profile/kyc">实名认证</router-link>
</div>
<div class="line"></div>
<div class="item">
<el-icon color="#409eff">
<CircleCheckFilled />
</el-icon>
<span>存款</span>
<router-link to="/capital/rechange">存款</router-link>
</div>
<div class="line"></div>
<div class="item">
<el-icon color="#409eff">
<CircleCheckFilled />
</el-icon>
<span>交易</span>
<router-link to="/trade/exe">交易</router-link>
</div>
</div>
</el-card>
@ -32,19 +32,19 @@
<el-icon color="#409eff">
<CircleCheckFilled />
</el-icon>
<span>存款</span>
<router-link to="/capital/rechange">存款</router-link>
</router-link>
<router-link to="" class="item">
<el-icon color="#409eff">
<CircleCheckFilled />
</el-icon>
<span>取款</span>
<router-link to="/capital/withdraw">取款</router-link>
</router-link>
<router-link to="" class="item">
<el-icon color="#409eff">
<CircleCheckFilled />
</el-icon>
<span>交易</span>
<router-link to="/trade/exe">交易</router-link>
</router-link>
</div>
</el-card>
@ -53,9 +53,9 @@
<el-popover placement="right" trigger="hover" class="wallet-popover">
<div class="link">
<router-link to="" class="item">转账</router-link>
<router-link to="" class="item">取款</router-link>
<router-link to="" class="item">资金明细</router-link>
<router-link to="/capital/transfer" class="item">转账</router-link>
<router-link to="/capital/withdraw" class="item">取款</router-link>
<router-link to="/capital/fundFlow" class="item">资金明细</router-link>
</div>
<template #reference>
<div class="wallet">
@ -102,30 +102,28 @@
<div class="account-list">
<div class="list" v-for="item in accountList" :key="item.id">
<div class="item item-setting">
<div class="setting-content" v-if="!isEdit">
<div class="setting-content" v-if="isEdit !== item.account_id">
<span>账户名称:</span>
<span>{{ accountName }}</span>
<span>{{ item.account_name }}</span>
</div>
<div class="setting-content" v-else>
<span class="setting-label">账户名称:</span>
<span v-if="!isEdit">{{ accountName }}</span>
<el-input
v-model="editName"
@blur="handleSave"
@keyup.enter="handleSave"
ref="inputRef"
size="small"
v-else
/>
</div>
<div class="setting-group">
<span>
<el-icon @click="handleEdit">
<el-icon @click="handleEdit(item.account_name, item.account_id)">
<EditPen />
</el-icon>
</span>
<span>
<el-icon @click="handleSetting">
<el-icon @click="handleSetting(item.account_id)">
<Setting />
</el-icon>
</span>
@ -229,7 +227,7 @@ import {
resetPasswordApi,
leverageLeverApi,
} from '@/api/modules/agent'
import { getAllAccount, getWalletCapital } from '@/api/modules/dashboard.ts'
import { getAllAccount, getWalletCapital, editAccountPass } from '@/api/modules/dashboard.ts'
//
import { getStorage, setStorage } from '@/utils/storage'
@ -246,7 +244,7 @@ const dialogType = ref('add')
const accountList = ref([])
const getAccoundList = async () => {
const res = await getAllAccount({ username: userStore.userInfo.username })
const res = await getAllAccount({ username: '' })
console.log(res)
accountList.value = res
}
@ -292,8 +290,8 @@ const colSpan = ref(12)
//
const userInfo = getStorage<any>('userInfo')
const accountName = ref(userInfo?.username || '')
const editName = ref(accountName.value)
const isEdit = ref(false)
const editName = ref('')
const isEdit = ref('')
const inputRef = ref<HTMLInputElement>()
/*
@ -349,24 +347,26 @@ const handleSubmit = async () => {
}
if (dialogType.value === 'add') {
await createAgentApi(params)
await getAccoundList()
dialogVisible.value = false
} else if (dialogType.value === 'setting') {
const params = {
reg_type: userInfo?.reg_type || '',
login_password1: subAccountForm.value.resetPassword,
login_password2: subAccountForm.value.confirmPassword,
email: userInfo?.email || '',
mobile: userInfo?.mobile || '',
code: '123456',
account_id: account_id || '',
user_password: subAccountForm.value.resetPassword,
account_password: subAccountForm.value.confirmPassword,
}
await resetPasswordApi(params)
await editAccountPass(params)
await getAccoundList()
subAccountForm.value.resetPassword = ''
subAccountForm.value.confirmPassword = ''
dialogVisible.value = false
} else if (dialogType.value === 'leverage') {
const params = {
account_id: userInfo?.id || '',
account_id: account_id || '',
lever: subAccountForm.value.leverage,
}
await leverageLeverApi(params)
await getAccoundList()
dialogVisible.value = false
}
}
@ -382,36 +382,34 @@ const handleCancel = () => {
*/
//
const handleEdit = async () => {
isEdit.value = true
// DOM
await nextTick()
inputRef.value?.focus()
let account_id = ''
const handleEdit = async (name: string, id: string) => {
if (isEdit.value) return (isEdit.value = '')
isEdit.value = id
editName.value = name
account_id = id
}
//
const handleSave = async () => {
if (editName.value.trim()) {
await editAgentNameApi({
account_id: userInfo?.id || '',
account_name: accountName.value,
})
accountName.value = editName.value.trim()
setStorage('userInfo', {
...userInfo,
username: accountName.value,
})
} else {
editName.value = accountName.value //
}
if (account_id === '') return ElMessage.error('请先选择账户')
if (editName.value === '') return ElMessage.error('请输入账号')
editName.value.trim()
await editAgentNameApi({
account_id: account_id,
account_name: editName.value,
})
await getAccoundList()
isEdit.value = false
}
/**
* @description: 设置方法
*/
const handleSetting = () => {
const handleSetting = (id: string) => {
dialogVisible.value = true
account_id = id
dialogTitle.value = '编辑账号'
dialogType.value = 'setting'
}

View File

@ -5,8 +5,18 @@ export const formItem = [
//重置密码formItem
export const resetPasswordFormItem = [
{label: '密码',prop: 'resetPassword',type: 'password' as const,placeholder: '请输入密码',},
{label: '确认密码',prop: 'confirmPassword',type: 'password' as const,placeholder: '请确认密码',},
{
label: '登录密码',
prop: 'resetPassword',
type: 'password' as const,
placeholder: '请输入登录密码',
},
{
label: '新密码',
prop: 'confirmPassword',
type: 'password' as const,
placeholder: '请确认新密码',
},
]
//修改杠杆formItem

View File

@ -9,14 +9,7 @@ export const rules = (subAccountForm: any): FormRules => {
{ required: true, message: '请选择杠杆比例', trigger: ['change'] }
],
confirmPassword: [
{ required: true, message: '请确认密码', trigger: ['blur'] },
{ validator: (rule: any, value: string, callback: any) => {
if (value !== subAccountForm.resetPassword) {
callback(new Error('两次密码不一致'))
} else {
callback()
}
}, trigger: ['blur'] }
{ required: true, message: '请确认密码', trigger: ['blur'] }
]
}
}

View File

@ -1,46 +1,54 @@
<template>
<div class="risk">
<div class="bar">
<span>风控管理</span>
<el-button type="primary" @click="handleAddRisk">添加</el-button>
<el-button type="primary" @click="handleModifyRisk">修改</el-button>
<el-button type="danger" @click="handleRiskStatus">停用</el-button>
</div>
<!-- 表格 -->
<div class="risk-table-content">
<RiskTableSwitch :columns="tableColumnsSwitch" :table-data="tableTreeSwitch" class="table-switch"
@row-click="handleRowClick" row-key="id" highlight-current-row :current-row-key="selectedRowId">
<template #status="{ row }">
<span>{{ row.status === 1 ? '启用' : '停用' }}</span>
</template>
</RiskTableSwitch>
<RiskTableContent :columns="tableColumnsContent" :table-data="[currentContent]" class="table-content"
row-key="id">
<template #contentName="{ row }">
<div class="risk-content-group">
<span>单笔开仓最大数量:{{ row.maxOpenPosition }}</span>
<span>单品种最大持仓数量:{{ row.maxPositionPerSymbol }}</span>
<span>总品种最大持仓数量:{{ row.maxTotalPosition }}</span>
<span>强平比例:{{ row.strongCloseRatio }}</span>
<span>每次出金最大金额:{{ row.maxWithdrawalAmount }}</span>
<span>是否允许出金:{{ row.isWithdrawalAllowed }}</span>
<span>出金时间设置:{{ row.withdrawalTimeSetting }}</span>
<span>是否需要出金审核:{{ row.isWithdrawalAuditRequired }}</span>
<span>建仓多少秒不能平仓:{{ row.buildCloseTime }}</span>
<span>每次出金最小金额:{{ row.minWithdrawalAmount }}</span>
<span>滑点:{{ row.slippage }}</span>
<span>每次入金最小金额:{{ row.minDepositAmount }}</span>
</div>
</template>
</RiskTableContent>
</div>
<!-- dialog -->
<RiskDialog :visible="dialogVisible" :title="dialogTitle" :type="dialogType" @confirm="handleSubmit"
@cancel="handleCancel" @close="handleClose">
<RiskForm :form-data="dialogForm" :form-rules="riskRules" :form-items="RiskFormItems"
:options-map="riskFormOptionsMap" :row-gutter="rowGutter" :col-span="colSpan" ref="riskFormRef" />
</RiskDialog>
<div class="risk">
<div class="bar">
<span>风控管理</span>
<el-button type="primary" @click="handleAddRisk">添加</el-button>
<el-button type="primary" @click="handleModifyRisk">修改</el-button>
<el-button type="danger" @click="handleRiskStatus">停用</el-button>
</div>
<!-- 表格 -->
<div class="risk-table-content">
<RiskTableSwitch
:columns="tableColumnsSwitch"
:table-data="tableTreeSwitch"
class="table-switch"
@row-click="handleRowClick"
row-key="id"
highlight-current-row
:current-row-key="selectedRowId"
>
<template #status="{ row }">
<span>{{ row.status === 1 ? '启用' : '停用' }}</span>
</template>
</RiskTableSwitch>
<RiskTableContent
:columns="tableColumnsContent"
:table-data="currentContent"
class="table-content"
row-key="id"
>
</RiskTableContent>
</div>
<!-- dialog -->
<RiskDialog
:visible="dialogVisible"
:title="dialogTitle"
:type="dialogType"
@confirm="handleSubmit"
@cancel="handleCancel"
@close="handleClose"
>
<RiskForm
:form-data="dialogForm"
:form-rules="riskRules"
:form-items="RiskFormItems"
:options-map="riskFormOptionsMap"
:row-gutter="rowGutter"
:col-span="colSpan"
ref="riskFormRef"
/>
</RiskDialog>
</div>
</template>
<script setup lang="ts">
@ -70,7 +78,7 @@ const riskOriginData = ref<any[]>([])
//
const selectedRow = ref<any>({})
//
const currentContent = ref<any>({})
const currentContent = ref<any>([])
/**
* @description: 定义弹窗数据
@ -82,6 +90,116 @@ const dialogType = ref('')
* @description: 定义弹窗表单数据
*/
const dialogForm = ref({
id: null,
name: '',
status: 1,
//
isDefault: 1,
maxOpenPosition: null,
maxPositionPerSymbol: null,
maxTotalPosition: null,
strongCloseRatio: null,
maxWithdrawalAmount: null,
isWithdrawalAllowed: 1,
withdrawalTimeSetting: '',
isWithdrawalAuditRequired: 1,
buildCloseTime: null,
minWithdrawalAmount: null,
slippage: null,
minDepositAmount: null,
})
const riskRules = ref(rules())
const riskFormRef = ref()
const RiskFormItems = ref(formItem)
const riskFormOptionsMap = ref({
//
status: [
{ label: '启用', value: 1 },
{ label: '停用', value: 2 },
],
//
isDefault: [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
],
//
isWithdrawalAllowed: [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
],
//
isWithdrawalAuditRequired: [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
],
})
const rowGutter = ref(20)
const colSpan = ref(12)
/**
* @description: 定义公共数据处理方法
*/
/**
* @description: 定义请求数据方法
*/
const getRiskList = async () => {
const data: any = await getRiskListApi()
//
riskOriginData.value = data
//
tableTreeSwitch.value = data.map((item: any) => ({
id: item.id,
name: item.name,
status: item.status,
}))
tableTreeContent.value = data.map((item: any) => ({
id: item.id,
isDefault: item.is_default,
//
maxOpenPosition: item.max_opening_quantity_per_transaction,
//
maxPositionPerSymbol: item.max_holding_quantity_per_variety,
//
maxTotalPosition: item.max_holding_quantity_per_transaction,
//
strongCloseRatio: item.strong_to_average_ratio,
//
maxWithdrawalAmount: item.max_withdrawal_amount_per_transaction,
//
isWithdrawalAllowed: item.withdraw_status === 1 ? '是' : '否',
//
withdrawalTimeSetting: item.withdraw_time,
//
isWithdrawalAuditRequired: item.withdraw_is_check === 1 ? '是' : '否',
//
buildCloseTime: item.open_close_time,
//
minWithdrawalAmount: item.min_withdrawal_amount_per_transaction,
//
slippage: item.slippage,
//
minDepositAmount: item.min_recharge_amount_per_transaction,
}))
//
if (tableTreeSwitch.value.length > 0) {
handleRowClick(tableTreeSwitch.value[0])
}
}
/**
* @description: 页面加载完成需要请求的数据
*/
onMounted(() => {
getRiskList()
})
/**
* @description: 定义bar方法
*/
const handleAddRisk = () => {
dialogVisible.value = true
dialogTitle.value = '添加'
dialogType.value = 'add'
dialogForm.value = {
id: null,
name: '',
status: 1,
@ -99,264 +217,168 @@ const dialogForm = ref({
minWithdrawalAmount: null,
slippage: null,
minDepositAmount: null,
})
const riskRules = ref(rules())
const riskFormRef = ref()
const RiskFormItems = ref(formItem)
const riskFormOptionsMap = ref({
//
status: [
{ label: '启用', value: 1 },
{ label: '停用', value: 2 },
],
//
isDefault: [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
],
//
isWithdrawalAllowed: [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
],
//
isWithdrawalAuditRequired: [
{ label: '是', value: 1 },
{ label: '否', value: 2 },
],
})
const rowGutter = ref(20)
const colSpan = ref(12)
/**
* @description: 定义公共数据处理方法
*/
/**
* @description: 定义请求数据方法
*/
const getRiskList = async () => {
const data: any = await getRiskListApi()
//
riskOriginData.value = data
//
tableTreeSwitch.value = data.map((item: any) => ({
id: item.id,
name: item.name,
status: item.status,
}))
tableTreeContent.value = data.map((item: any) => ({
id: item.id,
isDefault: item.is_default,
//
maxOpenPosition: item.max_opening_quantity_per_transaction,
//
maxPositionPerSymbol: item.max_holding_quantity_per_variety,
//
maxTotalPosition: item.max_holding_quantity_per_transaction,
//
strongCloseRatio: item.strong_to_average_ratio,
//
maxWithdrawalAmount: item.max_withdrawal_amount_per_transaction,
//
isWithdrawalAllowed: item.withdraw_status === 1 ? '是' : '否',
//
withdrawalTimeSetting: item.withdraw_time,
//
isWithdrawalAuditRequired: item.withdraw_is_check === 1 ? '是' : '否',
//
buildCloseTime: item.open_close_time,
//
minWithdrawalAmount: item.min_withdrawal_amount_per_transaction,
//
slippage: item.slippage,
//
minDepositAmount: item.min_recharge_amount_per_transaction,
}))
//
if (tableTreeSwitch.value.length > 0) {
handleRowClick(tableTreeSwitch.value[0])
}
}
/**
* @description: 页面加载完成需要请求的数据
*/
onMounted(() => {
getRiskList()
})
/**
* @description: 定义bar方法
*/
const handleAddRisk = () => {
dialogVisible.value = true
dialogTitle.value = '添加'
dialogType.value = 'add'
dialogForm.value = {
id: null,
name: '',
status: 1,
//
isDefault: 1,
maxOpenPosition: null,
maxPositionPerSymbol: null,
maxTotalPosition: null,
strongCloseRatio: null,
maxWithdrawalAmount: null,
isWithdrawalAllowed: 1,
withdrawalTimeSetting: '',
isWithdrawalAuditRequired: 1,
buildCloseTime: null,
minWithdrawalAmount: null,
slippage: null,
minDepositAmount: null,
}
}
}
const handleModifyRisk = () => {
dialogVisible.value = true
dialogTitle.value = '修改'
dialogType.value = 'edit'
dialogForm.value = {
name: selectedRow.value.name,
status: selectedRow.value.status,
//
isDefault: selectedRow.value.is_default,
maxOpenPosition: selectedRow.value.max_opening_quantity_per_transaction,
maxPositionPerSymbol: selectedRow.value.max_holding_quantity_per_variety,
maxTotalPosition: selectedRow.value.max_holding_quantity_per_transaction,
strongCloseRatio: selectedRow.value.strong_to_average_ratio,
maxWithdrawalAmount: selectedRow.value.max_withdrawal_amount_per_transaction,
isWithdrawalAllowed: selectedRow.value.withdraw_status,
withdrawalTimeSetting: selectedRow.value.withdraw_time.split('-'),
isWithdrawalAuditRequired: selectedRow.value.withdraw_is_check,
buildCloseTime: selectedRow.value.open_close_time,
minWithdrawalAmount: selectedRow.value.min_withdrawal_amount_per_transaction,
slippage: selectedRow.value.slippage,
minDepositAmount: selectedRow.value.min_recharge_amount_per_transaction,
} as any
dialogVisible.value = true
dialogTitle.value = '修改'
dialogType.value = 'edit'
dialogForm.value = {
name: selectedRow.value.name,
status: selectedRow.value.status,
//
isDefault: selectedRow.value.is_default,
maxOpenPosition: selectedRow.value.max_opening_quantity_per_transaction,
maxPositionPerSymbol: selectedRow.value.max_holding_quantity_per_variety,
maxTotalPosition: selectedRow.value.max_holding_quantity_per_transaction,
strongCloseRatio: selectedRow.value.strong_to_average_ratio,
maxWithdrawalAmount: selectedRow.value.max_withdrawal_amount_per_transaction,
isWithdrawalAllowed: selectedRow.value.withdraw_status,
withdrawalTimeSetting: selectedRow.value.withdraw_time.split('-'),
isWithdrawalAuditRequired: selectedRow.value.withdraw_is_check,
buildCloseTime: selectedRow.value.open_close_time,
minWithdrawalAmount: selectedRow.value.min_withdrawal_amount_per_transaction,
slippage: selectedRow.value.slippage,
minDepositAmount: selectedRow.value.min_recharge_amount_per_transaction,
} as any
}
const handleRiskStatus = async () => {
dialogTitle.value = '停用'
dialogType.value = 'status'
await editRiskApi({ ...selectedRow.value, status: 2 })
getRiskList()
dialogTitle.value = '停用'
dialogType.value = 'status'
await editRiskApi({ ...selectedRow.value, status: 2 })
getRiskList()
}
/**
* @description: 定义表格方法
*/
const handleRowClick = (row: any) => {
//
const originRow = riskOriginData.value.find(item => item.id === row.id)
if (originRow) {
selectedRow.value = originRow //
} else {
selectedRow.value = row
}
selectedRowId.value = row.id
//
const targetItem = tableTreeContent.value.find((item: any) => item.id === row.id)
if (targetItem) {
currentContent.value = targetItem
}
//
const originRow = riskOriginData.value.find((item) => item.id === row.id)
if (originRow) {
selectedRow.value = originRow //
} else {
selectedRow.value = row
}
selectedRowId.value = row.id
//
const targetItem = tableTreeContent.value.find((item: any) => item.id === row.id)
const fields = [
{ text: '单笔开仓最大数量' + targetItem.maxOpenPosition },
{ text: '单品种最大持仓数量' + targetItem.maxPositionPerSymbol },
{ text: '总品种最大持仓数量' + targetItem.maxTotalPosition },
{ text: '强平比例' + targetItem.strongCloseRatio },
{ text: '每次出金最大金额' + targetItem.maxWithdrawalAmount },
{ text: '是否允许出金' + targetItem.isWithdrawalAllowed },
{ text: '出金时间设置' + targetItem.withdrawalTimeSetting },
{ text: '是否需要出金审核' + targetItem.isWithdrawalAuditRequired },
{ text: '建仓多少秒不能平仓' + targetItem.buildCloseTime },
{ text: '每次出金最小金额' + targetItem.minWithdrawalAmount },
{ text: '滑点' + targetItem.slippage },
{ text: '每次入金最小金额' + targetItem.minDepositAmount },
]
if (targetItem) {
currentContent.value = fields
}
}
/**
* @description: 定义弹窗方法
*/
const handleSubmit = async () => {
await riskFormRef.value?.validate()
const params = {
name: dialogForm.value.name,
status: dialogForm.value.status,
//
is_default: dialogForm.value.isDefault,
//
max_opening_quantity_per_transaction: dialogForm.value.maxOpenPosition,
//
max_holding_quantity_per_variety: dialogForm.value.maxPositionPerSymbol,
//
max_holding_quantity_per_transaction: dialogForm.value.maxTotalPosition,
//
strong_to_average_ratio: dialogForm.value.strongCloseRatio,
//
max_withdrawal_amount_per_transaction: dialogForm.value.maxWithdrawalAmount,
//
withdraw_status: dialogForm.value.isWithdrawalAllowed,
//
withdraw_time: Array.from(dialogForm.value.withdrawalTimeSetting || []).join('-'),
//
withdraw_is_check: dialogForm.value.isWithdrawalAuditRequired,
//
open_close_time: dialogForm.value.buildCloseTime,
//
min_withdrawal_amount_per_transaction: dialogForm.value.minWithdrawalAmount,
//
slippage: dialogForm.value.slippage,
//
min_recharge_amount_per_transaction: dialogForm.value.minDepositAmount,
}
await riskFormRef.value?.validate()
const params = {
name: dialogForm.value.name,
status: dialogForm.value.status,
//
is_default: dialogForm.value.isDefault,
//
max_opening_quantity_per_transaction: dialogForm.value.maxOpenPosition,
//
max_holding_quantity_per_variety: dialogForm.value.maxPositionPerSymbol,
//
max_holding_quantity_per_transaction: dialogForm.value.maxTotalPosition,
//
strong_to_average_ratio: dialogForm.value.strongCloseRatio,
//
max_withdrawal_amount_per_transaction: dialogForm.value.maxWithdrawalAmount,
//
withdraw_status: dialogForm.value.isWithdrawalAllowed,
//
withdraw_time: Array.from(dialogForm.value.withdrawalTimeSetting || []).join('-'),
//
withdraw_is_check: dialogForm.value.isWithdrawalAuditRequired,
//
open_close_time: dialogForm.value.buildCloseTime,
//
min_withdrawal_amount_per_transaction: dialogForm.value.minWithdrawalAmount,
//
slippage: dialogForm.value.slippage,
//
min_recharge_amount_per_transaction: dialogForm.value.minDepositAmount,
}
//
if (dialogType.value === 'add') {
//
if (dialogType.value === 'add') {
//
await addRiskApi(params)
getRiskList()
dialogVisible.value = false
dialogTitle.value = '添加'
dialogType.value = 'add'
}
else {
//
await editRiskApi({ ...params, id: selectedRow.value.id })
getRiskList()
dialogVisible.value = false
dialogTitle.value = '编辑'
dialogType.value = 'edit'
}
await addRiskApi(params)
getRiskList()
dialogVisible.value = false
dialogTitle.value = '添加'
dialogType.value = 'add'
} else {
//
await editRiskApi({ ...params, id: selectedRow.value.id })
getRiskList()
dialogVisible.value = false
dialogTitle.value = '编辑'
dialogType.value = 'edit'
}
}
const handleCancel = () => {
dialogVisible.value = false
dialogVisible.value = false
}
const handleClose = () => {
dialogVisible.value = false
dialogVisible.value = false
}
</script>
<style scoped>
.risk {
.bar {
margin-bottom: 10px;
display: flex;
align-items: center;
.bar {
margin-bottom: 10px;
display: flex;
align-items: center;
span {
margin-right: 10px;
}
span {
margin-right: 10px;
}
}
.risk-table-content {
display: flex;
gap: 10px;
.risk-table-content {
display: flex;
gap: 10px;
.table-switch {
flex-basis: 20%;
min-width: 200px;
.table-switch {
flex-basis: 20%;
min-width: 200px;
:deep(.el-table__row.current-row) {
background-color: #ecf5ff !important;
}
}
:deep(.el-table__row.current-row) {
background-color: #ecf5ff !important;
}
}
}
.table-content {
flex: 1;
.table-content {
flex: 1;
.risk-content-group {
display: flex;
flex-direction: column;
gap: 5px;
}
.risk-content-group {
display: flex;
flex-direction: column;
gap: 5px;
}
}
}
</style>

View File

@ -11,9 +11,9 @@ export const tableColumnsSwitch = [
},
]
export const tableColumnsContent = [
// 内容
{label: '内容', prop: 'content', align: 'center' as const,slotName: 'contentName'},
]
// 内容
{ label: '内容', prop: 'text', align: 'center' as const },
]
export const formItem = [
// 名称
{label: '名称', prop: 'name', type: 'input' as const, placeholder: '请输入名称',labelWidth: '150px'},

View File

@ -238,8 +238,8 @@ const getCustomerList = async () => {
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,
accountQty: item.son_user[0]?.son_user_count,
commissionRatio: item?.wallet_capital?.fee_handling_percent,
createTime: item.created_at,
role_id: item.role_id,
}))

View File

@ -10,9 +10,6 @@
<div class="tab-item">
<el-button :type="tabType === 'identity' ? 'primary' : 'default'" @click="tabType = 'identity'">身份信息</el-button>
</div>
<div class="tab-item">
<el-button :type="tabType === 'contact' ? 'primary' : 'default'" @click="tabType = 'contact'">联系信息</el-button>
</div>
</div>
<article>
<p class="warn">

View File

@ -1,14 +1,15 @@
export const identityFormItems = [
// 国籍
{ prop: 'nationality', label: '国籍', type: 'select' as const ,width: "200px"},
// 证件类型
{ prop: 'idType', label: '证件类型', type: 'select' as const ,width: "200px"},
// 上传证件
{ prop: 'idCard', slotName: 'upload', label: '上传证件' ,type: 'upload' as const},
]
// 联系电话
{ prop: 'phone', label: '联系电话', type: 'input' as const, width: '200px' },
// 国籍
{ prop: 'nationality', label: '国籍', type: 'select' as const, width: '200px' },
// 证件类型
{ prop: 'idType', label: '证件类型', type: 'select' as const, width: '200px' },
// 上传证件
{ prop: 'idCard', slotName: 'upload', label: '上传证件', type: 'upload' as const },
]
export const contactFormItems = [
// 联系电话
{ prop: 'phone', label: '联系电话', type: 'input' as const ,width: "200px"},
]

View File

@ -13,7 +13,7 @@
<!-- 表格组件 -->
<ClientTable :table-data="clientTree" :columns="clientTableColumns">
<template #status="{ row }">
<el-switch :model-value="row.status === 1" :active-value="true" :inactive-value="false" />
{{row.status === 1 ? '正常' : '禁用'}}
</template>
<template #action="{ row }">
<el-button type="primary" size="small" @click="handleChange(row)">
@ -287,7 +287,7 @@ const handleChange = (row: any) => {
riskTemplate: row.wallet_capital.risk_control_id,
userName: row.username,
status: row.status,
isUpgrade: 1,
isUpgrade: 2,
} as any
console.log('rowrowrowrowrowrowrowrowrow', clientForm.value)
getOptions()

View File

@ -21,14 +21,10 @@
@row-click="handleRowClick"
>
<template #onlineStatus="{ row }">
<el-switch
:model-value="row.onlineStatus === 1"
:active-value="true"
:inactive-value="false"
/>
{{ ['', '上线', '下线'][row.onlineStatus] }}
</template>
<template #tradeStatus="{ row }">
<el-switch :model-value="row.status === 1" :active-value="true" :inactive-value="false" />
{{ ['', '开启', '禁用'][row.tradeStatus] }}
</template>
</VarietyTable>
</div>
@ -296,6 +292,8 @@ const handleEdit = () => {
pointDecimalPlaces: row.point_diff_decimal_place,
imageUrl: row.image,
feeInventoryTime: row.fee_inventory_time,
tradeStatus: row.status,
onlineStatus: row.online_status,
//
isDefault: row.is_default,
} as any

View File

@ -276,8 +276,10 @@ const handleForgotPassword = async () => {
email: forgotPasswordForm.value.email,
reg_type: getForgotType === 'email' ? 1 : 2,
code: forgotPasswordForm.value.code,
login_password1: md5Encrypt(forgotPasswordForm.value.password),
login_password2: md5Encrypt(forgotPasswordForm.value.confirmPassword),
// login_password1: md5Encrypt(forgotPasswordForm.value.password),
// login_password2: md5Encrypt(forgotPasswordForm.value.confirmPassword),
login_password1: forgotPasswordForm.value.password,
login_password2: forgotPasswordForm.value.confirmPassword,
}
//