This commit is contained in:
2026-05-11 18:21:11 +08:00
commit 480466ea9f
5 changed files with 273 additions and 82 deletions

View File

@ -1,31 +0,0 @@
import { request } from '@/api';
import type{ searchParams,pointDiffConfigParams } from '@/api/types/account/market'
// 查询和获取做市商列表
export async function getMarketListApi(params: searchParams): Promise<any> {
return request.get<any>('agent/getAgentList', { ...params })
}
//获取所属上级列表
export async function getParAgentListApi(params: pointDiffConfigParams): Promise<any> {
return request.get<any>('/agent/getParAgentListByRoleId',{...params})
}
//获取代理点差列表
export async function getPointDiffConfigListApi(params: pointDiffConfigParams): Promise<any> {
return request.get<any>('/agent/getSelfVarietyPointDiffConfig',{...params})
}
//获取风控模板选列表
export async function getRiskTemplateListApi(): Promise<any> {
return request.get<any>('/agent/getRiskControlOptions')
}
//添加做市商
export async function addMarketApi(params:any): Promise<any> {
return request.post<any>('/agent/createAgent',{...params})
}
//编辑做市商
export async function editMarketApi(params:any): Promise<any> {
return request.post<any>('/agent/editAgent',{...params})
}

View File

@ -0,0 +1,39 @@
import { request } from '@/api'
import type { searchParams, pointDiffConfigParams } from '@/api/types/account/market'
// 查询和获取做市商列表
export async function getMarketListApi(params: searchParams): Promise<any> {
return request.get<any>('agent/getAgentList', { ...params })
}
//获取所属上级列表
export async function getParAgentListApi(params: pointDiffConfigParams): Promise<any> {
return request.get<any>('/agent/getParAgentListByRoleId', { ...params })
}
//获取代理点差列表
export async function getPointDiffConfigListApi(params: pointDiffConfigParams): Promise<any> {
return request.get<any>('/agent/getSelfVarietyPointDiffConfig', { ...params })
}
//获取风控模板选列表
export async function getRiskTemplateListApi(): Promise<any> {
return request.get<any>('/agent/getRiskControlOptions')
}
//添加做市商
export async function addMarketApi(params: any): Promise<any> {
return request.post<any>('/agent/createAgent', { ...params })
}
//编辑做市商
export async function editMarketApi(params: any): Promise<any> {
return request.post<any>('/agent/editAgent', { ...params })
}
//编辑做市商账户基本信息
export async function updateCapital(params: any): Promise<any> {
return request.post<any>('/user/updateCapital', { ...params })
}
//编辑做市商保证金
export async function editAgentBail(params: any): Promise<any> {
return request.post<any>('/agent/editAgentBail', { ...params })
}

View File

@ -271,14 +271,6 @@ const handleMockSubmit = async () => {
padding-left: 12px; padding-left: 12px;
font-size: 16px; font-size: 16px;
color: #303133; color: #303133;
&::before {
position: absolute;
left: 0;
top: 1px;
color: #f56c6c;
content: '*';
}
} }
.currency-box { .currency-box {

View File

@ -1,55 +1,119 @@
<template> <template>
<div class="market table_form-container"> <div class="market table_form-container">
<!-- 搜索 --> <!-- 搜索 -->
<MarketSearch :search-form="marketSearchForm" :search-options="marketSearchOptions" @search="handleSearch" <MarketSearch
@reset="handleReset"> :search-form="marketSearchForm"
:search-options="marketSearchOptions"
@search="handleSearch"
@reset="handleReset"
>
<template #button="{ form }"> <template #button="{ form }">
<el-button type="primary" @click="handleAddMarket()" v-auth="'agent_createAgent'"> <el-button type="primary" @click="handleAddMarket()" v-auth="'agent_createAgent'">
添加 添加
</el-button> </el-button>
<el-button type="primary" :disabled="!selectedRow" v-auth="'agent_editAgent'" @click="handleEditMarket()"> <el-button
type="primary"
:disabled="!selectedRow"
v-auth="'agent_editAgent'"
@click="handleEditMarket()"
>
编辑 编辑
</el-button> </el-button>
</template> </template>
</MarketSearch> </MarketSearch>
<!-- 表格 --> <!-- 表格 -->
<MarketTable :table-data="marketTree" :columns="marketTableColumnsOptions" row-key="id" @row-click="handleRowClick" <MarketTable
@row-contextmenu="handleRowContextMenu"> :table-data="marketTree"
:columns="marketTableColumnsOptions"
row-key="id"
@row-click="handleRowClick"
@row-contextmenu="handleRowContextMenu"
>
<template #pointSpread="{ row }"> <template #pointSpread="{ row }">
<el-button type="primary" size="small" @click="handleViewPointDiff(row)"> 查看 </el-button> <el-button type="primary" size="small" @click="handleViewPointDiff(row)"> 查看 </el-button>
</template> </template>
</MarketTable> </MarketTable>
<!-- 行右键菜单 --> <!-- 行右键菜单 -->
<context-menu v-model:show="menuVisible" :options="menuOptions"> <context-menu v-model:show="menuVisible" :options="menuOptions">
<context-menu-item label="调整基本账户" @click="handleAction('account')" /> <context-menu-item
<context-menu-item label="设置停止接单金额" @click="handleAction('acceptOrders')" /> v-if="[3, 4].includes(currentRow.role_id) && userStore!.userInfo!.role_id === 1"
<context-menu-item label="设置持仓转移金额" @click="handleAction('transfer')" /> label="调整基本账户"
<context-menu-item label="取款" divided @click="handleAction('deposit')" /> @click="handleAction('account')"
/>
<context-menu-item
v-if="
([1, 3, 4].includes(currentRow.role_id) && userStore!.userInfo!.role_id === 1) ||
([3, 4].includes(userStore!.userInfo!.role_id) &&
userStore!.userInfo!.role_id === currentRow.role_id)
"
label="设置停止接单金额"
@click="handleAction('acceptOrders')"
/>
<context-menu-item
v-if="
([1, 3, 4].includes(currentRow.role_id) && userStore!.userInfo!.role_id === 1) ||
([3, 4].includes(userStore!.userInfo!.role_id) &&
userStore!.userInfo!.role_id === currentRow.role_id)
"
label="设置持仓转移金额"
@click="handleAction('transfer')"
/>
<context-menu-item
v-if="
([1, 2, 3, 4].includes(userStore!.userInfo!.role_id) ||
(userStore!.userInfo!.role_id === 5 && userStore!.userInfo!.type === 1)) &&
userStore!.userInfo!.role_id === currentRow.role_id
"
label="取款"
divided
@click="handleAction('deposit')"
/>
<context-menu-item label="存款" divided @click="handleAction('withdraw')" /> <context-menu-item label="存款" divided @click="handleAction('withdraw')" />
</context-menu> </context-menu>
<!-- 分页 --> <!-- 分页 -->
<MarketPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total" <MarketPagination
@pagination-change="handlePaginationChange" /> v-model="currentPage"
v-model:pageSizeValue="pageSize"
:total="total"
@pagination-change="handlePaginationChange"
/>
</div> </div>
<!-- 抽屉 --> <!-- dialog -->
<el-drawer class="my-drawer" :append-to-body="false" v-model="dialogVisible" :title="dialogTitle" <el-drawer
:size="dialogType === 'view' ? '60%' : '50%'" :destroy-on-close="true"> class="my-drawer"
:append-to-body="false"
v-model="dialogVisible"
:title="dialogTitle"
:size="dialogType === 'view' ? '60%' : '50%'"
:destroy-on-close="true"
>
<!-- 表单 --> <!-- 表单 -->
<div v-if="dialogType !== 'view'" class="drawer-form"> <div v-if="dialogType !== 'view'" class="drawer-form">
<MarketForm :form-data="marketForm" :form-rules="marketFormRules" :form-items="marketFormItemOptions" <MarketForm
:options-map="marketFormOptionsMap" ref="marketFormRef"> :form-data="marketForm"
:form-rules="marketFormRules"
:form-items="marketFormItemOptions"
:options-map="marketFormOptionsMap"
ref="marketFormRef"
>
<template #phoneOrEmail="{ formData }" v-if="dialogType === 'add'"> <template #phoneOrEmail="{ formData }" v-if="dialogType === 'add'">
<div class="phone-email"> <div class="phone-email">
<div class="tab-btn"> <div class="tab-btn">
<el-button :type="activeTab === 'email' ? 'primary' : 'default'" size="small" <el-button
@click="activeTab = 'email'"> :type="activeTab === 'email' ? 'primary' : 'default'"
size="small"
@click="activeTab = 'email'"
>
邮箱 邮箱
</el-button> </el-button>
<el-button :type="activeTab === 'phone' ? 'primary' : 'default'" size="small" <el-button
@click="activeTab = 'phone'"> :type="activeTab === 'phone' ? 'primary' : 'default'"
size="small"
@click="activeTab = 'phone'"
>
手机号 手机号
</el-button> </el-button>
</div> </div>
@ -59,7 +123,12 @@
</el-form-item> </el-form-item>
<el-form-item prop="phone" class="phone-item" v-if="activeTab === 'phone'"> <el-form-item prop="phone" class="phone-item" v-if="activeTab === 'phone'">
<el-select v-model="marketForm.countryCode" placeholder="请选择国家区号"> <el-select v-model="marketForm.countryCode" placeholder="请选择国家区号">
<el-option v-for="item in countryOptions" :key="item.code" :label="item.code" :value="item.code"> <el-option
v-for="item in countryOptions"
:key="item.code"
:label="item.code"
:value="item.code"
>
<div class="country-option"> <div class="country-option">
<span class="country-name">{{ item.name }}</span> <span class="country-name">{{ item.name }}</span>
<span class="country-code">{{ item.code }}</span> <span class="country-code">{{ item.code }}</span>
@ -78,7 +147,11 @@
<div class="drawer-table"> <div class="drawer-table">
<div class="table-header" v-if="dialogType !== 'view'">点差配置</div> <div class="table-header" v-if="dialogType !== 'view'">点差配置</div>
<div class="table-wrapper"> <div class="table-wrapper">
<MarketTable :table-data="marketPointTree" :columns="marketPointTableColumnsOptions" row-key="id"> <MarketTable
:table-data="marketPointTree"
:columns="marketPointTableColumnsOptions"
row-key="id"
>
<template #assignedPointDiff="{ row }"> <template #assignedPointDiff="{ row }">
<el-form :model="row" :rules="rules(marketForm, row)"> <el-form :model="row" :rules="rules(marketForm, row)">
<el-form-item prop="pointDifference"> <el-form-item prop="pointDifference">
@ -99,23 +172,31 @@
</template> </template>
</el-drawer> </el-drawer>
<MarketDialog :visible="rightClickDialogVisible" :title="rightClickDialogTitleEnum[rightClickDialogType]" <MarketDialog
@confirm="handleRightClickDialogSubmit" @cancel="handleRightClickDialogCancel" @close="handleRightClickDialogClose"> :visible="rightClickDialogVisible"
:title="rightClickDialogTitleEnum[rightClickDialogType]"
@confirm="handleRightClickDialogSubmit"
@cancel="handleRightClickDialogCancel"
@close="handleRightClickDialogClose"
>
<!-- 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw' --> <!-- 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw' -->
<MarketForm :marketForm="rightClickMarketForm" :form-rules="rightClickMarketFormRules" <MarketForm
:form-items="rightClickMarketFormItemOptions"></MarketForm> :form-data="rightClickMarketForm"
:form-rules="rightClickMarketFormRules"
:form-items="rightClickMarketFormItemOptions"
></MarketForm>
</MarketDialog> </MarketDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
defineOptions({ defineOptions({
name: 'Business' name: 'Business',
}) })
// //
import MarketSearch from '@/components/common/Search.vue' import MarketSearch from '@/components/common/Search.vue'
import MarketTable from '@/components/common/Table.vue' import MarketTable from '@/components/common/Table.vue'
import MarketPagination from '@/components/common/Pagination.vue' import MarketPagination from '@/components/common/Pagination.vue'
import MarketDialog from '@/components/common/Dialog.vue'
import MarketForm from '@/components/common/Form.vue' import MarketForm from '@/components/common/Form.vue'
// //
import { import {
@ -125,6 +206,12 @@ import {
marketPointTableColumns, marketPointTableColumns,
countryOptions, countryOptions,
viewMarketPointTableColumns, viewMarketPointTableColumns,
accountFormItemList,
accountFormItemRules,
acceptOrdersFormItemList,
acceptOrdersFormItemRules,
transferFormItemList,
transferFormItemRules,
} from './options' } from './options'
import { useUserStore } from '@/stores/modules/user.ts' import { useUserStore } from '@/stores/modules/user.ts'
import { rules } from './rules' import { rules } from './rules'
@ -137,7 +224,9 @@ import {
getRiskTemplateListApi, getRiskTemplateListApi,
addMarketApi, addMarketApi,
editMarketApi, editMarketApi,
} from '@/api/modules/account/market' updateCapital,
editAgentBail,
} from '@/api/modules/profile/business.ts'
const userStore = useUserStore() const userStore = useUserStore()
@ -246,13 +335,15 @@ const rightClickDialogTitleEnum = {
deposit: '取款', deposit: '取款',
withdraw: '存款', withdraw: '存款',
} }
const rightClickMarketForm = ref({}) const rightClickMarketForm = ref<any>({})
const rightClickMarketFormRules = ref({}) const rightClickMarketFormRules = ref(accountFormItemRules)
const rightClickMarketFormItemOptions = ref([]) const rightClickMarketFormItemOptions = ref(accountFormItemList)
// //
const handleRowContextMenu = (row: any, column: any, event: any) => { const handleRowContextMenu = (row: any, column: any, event: any) => {
console.log('handleRowContextMenu', row, column, event) console.log('handleRowContextMenu', row, column, event)
if (userStore?.userInfo?.role_id !== 1 && userStore?.userInfo?.id !== row.wallet_capital.user_id)
return
event?.preventDefault() event?.preventDefault()
currentRow.value = row currentRow.value = row
menuOptions.x = event?.clientX menuOptions.x = event?.clientX
@ -265,24 +356,85 @@ const handleRowContextMenu = (row: any, column: any, event: any) => {
* @description 处理右键菜单 * @description 处理右键菜单
* */ * */
const handleAction = (key: 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw') => { const handleAction = (key: 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw') => {
console.log('handleAction', key) console.log('handleAction', key, currentRow.value)
if (!currentRow.value) return
switch (key) { switch (key) {
case 'account': case 'account':
rightClickMarketFormItemOptions.value = accountFormItemList
rightClickMarketFormRules.value = accountFormItemRules
rightClickMarketForm.value = {
target_user_id: currentRow.value!.wallet_capital.user_id,
username: currentRow.value!.username,
currency: 'USD',
amount_old: currentRow.value!.wallet_capital.amount,
amount: null,
amount_new: null,
}
break break
case 'acceptOrders': case 'acceptOrders':
rightClickMarketFormItemOptions.value = acceptOrdersFormItemList
rightClickMarketFormRules.value = acceptOrdersFormItemRules
rightClickMarketForm.value = {
target_user_id: currentRow.value!.wallet_capital.user_id,
username: currentRow.value!.username,
currency: 'USD',
bail_stop_order_old: currentRow.value!.wallet_capital.bail_stop_order,
bail_stop_order: '',
}
break break
case 'transfer': case 'transfer':
rightClickMarketFormItemOptions.value = transferFormItemList
rightClickMarketFormRules.value = transferFormItemRules
rightClickMarketForm.value = {
target_user_id: currentRow.value!.wallet_capital.user_id,
username: currentRow.value!.username,
currency: 'USD',
bail_change_order_old: currentRow.value!.wallet_capital.bail_change_order,
bail_change_order: '',
}
break break
case 'deposit': case 'deposit':
break break
case 'withdraw': case 'withdraw':
return ElMessage.warning('暂无此功能')
break break
} }
rightClickDialogType.value = key rightClickDialogType.value = key
rightClickDialogVisible.value = true rightClickDialogVisible.value = true
} }
const handleRightClickDialogSubmit = () => { } const handleRightClickDialogSubmit = () => {
switch (rightClickDialogType.value) {
case 'account':
updateCapital({
target_user_id: rightClickMarketForm.value.target_user_id,
amount: rightClickMarketForm.value.amount,
})
break
case 'acceptOrders':
editAgentBail({
user_id: rightClickMarketForm.value.target_user_id,
bail: null,
bail_change_order: null,
bail_stop_order: rightClickMarketForm.value.bail_stop_order,
})
break
case 'transfer':
editAgentBail({
user_id: rightClickMarketForm.value.target_user_id,
bail: null,
bail_change_order: rightClickMarketForm.value.bail_change_order,
bail_stop_order: null,
})
break
case 'deposit':
break
case 'withdraw':
ElMessage.warning('暂无此功能')
break
}
rightClickDialogVisible.value = false
}
const handleRightClickDialogCancel = () => { const handleRightClickDialogCancel = () => {
rightClickDialogVisible.value = false rightClickDialogVisible.value = false

View File

@ -1,7 +1,13 @@
//做市商搜索配置 //做市商搜索配置
export const marketSearch = [ export const marketSearch = [
{ label: '账户名', prop: 'accountName', type: 'input' as const, placeholder: '请输入账户名', width: '340px', }, {
label: '账户名',
prop: 'accountName',
type: 'input' as const,
placeholder: '请输入账户名',
width: '340px',
},
] ]
export const marketTableColumns = [ export const marketTableColumns = [
@ -14,7 +20,7 @@ export const marketTableColumns = [
//级别 //级别
{ label: '级别', prop: 'level', align: 'center' as const, width: '120px' }, { label: '级别', prop: 'level', align: 'center' as const, width: '120px' },
{ label: '邮箱', prop: 'email', align: 'center' as const, width: '160px' }, { label: '邮箱', prop: 'email', align: 'center' as const, width: '160px' },
{ label: '手机号', prop: 'mobile', align: 'center' as const, width: '120px' }, { label: '手机号', prop: 'mobile', align: 'center' as const, width: '140px' },
{ label: '风险率', prop: 'ratio', align: 'center' as const, width: '120px' }, { label: '风险率', prop: 'ratio', align: 'center' as const, width: '120px' },
//基本账户 //基本账户
{ label: '基本账户', prop: 'basicAccount', align: 'center' as const, width: '200px' }, { label: '基本账户', prop: 'basicAccount', align: 'center' as const, width: '200px' },
@ -58,7 +64,7 @@ export const marketFormItem = [
//级别 //级别
{ label: '级别', prop: 'level', type: 'select' as const, placeholder: '请选择级别' }, { label: '级别', prop: 'level', type: 'select' as const, placeholder: '请选择级别' },
//所属上级 //所属上级
{ label: '所属上级', prop: 'parentAccountName', type: 'select' as const, placeholder: '请选择所属上级账户名称' }, { label: '所属上级', prop: 'parentAccountName', type: 'select' as const, placeholder: '请选择所属上级账户名称', },
// 风控模板 // 风控模板
{ label: '风控模板', prop: 'riskControlTemplate', type: 'select' as const, placeholder: '请选择风控模板' }, { label: '风控模板', prop: 'riskControlTemplate', type: 'select' as const, placeholder: '请选择风控模板' },
//头寸 //头寸
@ -96,9 +102,42 @@ export const marketPointTableColumns = [
] ]
// 查看点差表格列配置 // 查看点差表格列配置
export const viewMarketPointTableColumns = ([ export const viewMarketPointTableColumns = [
{ prop: 'varietyName', label: '名称', align: 'center' as const }, { prop: 'varietyName', label: '名称', align: 'center' as const },
{ prop: 'varietyCode', label: '编号', align: 'center' as const }, { prop: 'varietyCode', label: '编号', align: 'center' as const },
{ prop: 'pointDifference', label: '可分配点差', align: 'center' as const }, { prop: 'pointDifference', label: '可分配点差', align: 'center' as const },
{ prop: 'assignedPointDifference', label: '已分配点差', align: 'center' as const }, { prop: 'assignedPointDifference', label: '已分配点差', align: 'center' as const },
]) ]
export const accountFormItemList = [
{ label: '账户名', prop: 'username', type: 'input', disabled: true },
{ label: '币种', prop: 'currency', type: 'input', disabled: true },
{ label: '当前余额', prop: 'amount_old', type: 'input', disabled: true },
{ label: '调整金额', prop: 'amount', type: 'input' },
{ label: '调整后余额', prop: 'amount_new', type: 'input', disabled: true },
]
export const accountFormItemRules = {
amount: [{ required: true, message: '请输入调整金额', trigger: ['blur', 'change'] }],
}
export const acceptOrdersFormItemList = [
{ label: '账户名', prop: 'username', type: 'input', disabled: true },
{ label: '币种', prop: 'currency', type: 'input', disabled: true },
{ label: '当前停止接单金额', prop: 'bail_stop_order_old', type: 'input', disabled: true },
{ label: '调整金额', prop: 'bail_stop_order', type: 'input' },
]
export const acceptOrdersFormItemRules = {
bail_stop_order: [{ required: true, message: '请输入调整金额', trigger: ['blur', 'change'] }],
}
export const transferFormItemList = [
{ label: '账户名', prop: 'username', type: 'input', disabled: true },
{ label: '币种', prop: 'currency', type: 'input', disabled: true },
{ label: '当前持仓转移金额', prop: 'bail_change_order_old', type: 'input', disabled: true },
{ label: '调整金额', prop: 'bail_change_order', type: 'input' },
]
export const transferFormItemRules = {
bail_change_order: [{ required: true, message: '请输入调整金额', trigger: ['blur', 'change'] }],
}