git
This commit is contained in:
commit
7a87748328
|
|
@ -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})
|
||||
}
|
||||
|
|
@ -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 })
|
||||
}
|
||||
|
|
@ -271,14 +271,6 @@ const handleMockSubmit = async () => {
|
|||
padding-left: 12px;
|
||||
font-size: 16px;
|
||||
color: #303133;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 1px;
|
||||
color: #f56c6c;
|
||||
content: '*';
|
||||
}
|
||||
}
|
||||
|
||||
.currency-box {
|
||||
|
|
|
|||
|
|
@ -1,55 +1,119 @@
|
|||
<template>
|
||||
<div class="market table_form-container">
|
||||
<!-- 搜索 -->
|
||||
<MarketSearch :search-form="marketSearchForm" :search-options="marketSearchOptions" @search="handleSearch"
|
||||
@reset="handleReset">
|
||||
<MarketSearch
|
||||
:search-form="marketSearchForm"
|
||||
:search-options="marketSearchOptions"
|
||||
@search="handleSearch"
|
||||
@reset="handleReset"
|
||||
>
|
||||
<template #button="{ form }">
|
||||
<el-button type="primary" @click="handleAddMarket()" v-auth="'agent_createAgent'">
|
||||
添加
|
||||
</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>
|
||||
</template>
|
||||
</MarketSearch>
|
||||
|
||||
<!-- 表格 -->
|
||||
<MarketTable :table-data="marketTree" :columns="marketTableColumnsOptions" row-key="id" @row-click="handleRowClick"
|
||||
@row-contextmenu="handleRowContextMenu">
|
||||
<MarketTable
|
||||
:table-data="marketTree"
|
||||
:columns="marketTableColumnsOptions"
|
||||
row-key="id"
|
||||
@row-click="handleRowClick"
|
||||
@row-contextmenu="handleRowContextMenu"
|
||||
>
|
||||
<template #pointSpread="{ row }">
|
||||
<el-button type="primary" size="small" @click="handleViewPointDiff(row)"> 查看 </el-button>
|
||||
</template>
|
||||
</MarketTable>
|
||||
<!-- 行右键菜单 -->
|
||||
<context-menu v-model:show="menuVisible" :options="menuOptions">
|
||||
<context-menu-item label="调整基本账户" @click="handleAction('account')" />
|
||||
<context-menu-item label="设置停止接单金额" @click="handleAction('acceptOrders')" />
|
||||
<context-menu-item label="设置持仓转移金额" @click="handleAction('transfer')" />
|
||||
<context-menu-item label="取款" divided @click="handleAction('deposit')" />
|
||||
<context-menu-item
|
||||
v-if="[3, 4].includes(currentRow.role_id) && userStore!.userInfo!.role_id === 1"
|
||||
label="调整基本账户"
|
||||
@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>
|
||||
|
||||
<!-- 分页 -->
|
||||
<MarketPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
|
||||
@pagination-change="handlePaginationChange" />
|
||||
<MarketPagination
|
||||
v-model="currentPage"
|
||||
v-model:pageSizeValue="pageSize"
|
||||
:total="total"
|
||||
@pagination-change="handlePaginationChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 抽屉 -->
|
||||
<el-drawer class="my-drawer" :append-to-body="false" v-model="dialogVisible" :title="dialogTitle"
|
||||
:size="dialogType === 'view' ? '60%' : '50%'" :destroy-on-close="true">
|
||||
<!-- dialog -->
|
||||
<el-drawer
|
||||
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">
|
||||
<MarketForm :form-data="marketForm" :form-rules="marketFormRules" :form-items="marketFormItemOptions"
|
||||
:options-map="marketFormOptionsMap" ref="marketFormRef">
|
||||
<MarketForm
|
||||
:form-data="marketForm"
|
||||
:form-rules="marketFormRules"
|
||||
:form-items="marketFormItemOptions"
|
||||
:options-map="marketFormOptionsMap"
|
||||
ref="marketFormRef"
|
||||
>
|
||||
<template #phoneOrEmail="{ formData }" v-if="dialogType === 'add'">
|
||||
<div class="phone-email">
|
||||
<div class="tab-btn">
|
||||
<el-button :type="activeTab === 'email' ? 'primary' : 'default'" size="small"
|
||||
@click="activeTab = 'email'">
|
||||
<el-button
|
||||
:type="activeTab === 'email' ? 'primary' : 'default'"
|
||||
size="small"
|
||||
@click="activeTab = 'email'"
|
||||
>
|
||||
邮箱
|
||||
</el-button>
|
||||
<el-button :type="activeTab === 'phone' ? 'primary' : 'default'" size="small"
|
||||
@click="activeTab = 'phone'">
|
||||
<el-button
|
||||
:type="activeTab === 'phone' ? 'primary' : 'default'"
|
||||
size="small"
|
||||
@click="activeTab = 'phone'"
|
||||
>
|
||||
手机号
|
||||
</el-button>
|
||||
</div>
|
||||
|
|
@ -59,7 +123,12 @@
|
|||
</el-form-item>
|
||||
<el-form-item prop="phone" class="phone-item" v-if="activeTab === 'phone'">
|
||||
<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">
|
||||
<span class="country-name">{{ item.name }}</span>
|
||||
<span class="country-code">{{ item.code }}</span>
|
||||
|
|
@ -78,7 +147,11 @@
|
|||
<div class="drawer-table">
|
||||
<div class="table-header" v-if="dialogType !== 'view'">点差配置</div>
|
||||
<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 }">
|
||||
<el-form :model="row" :rules="rules(marketForm, row)">
|
||||
<el-form-item prop="pointDifference">
|
||||
|
|
@ -99,23 +172,31 @@
|
|||
</template>
|
||||
</el-drawer>
|
||||
|
||||
<MarketDialog :visible="rightClickDialogVisible" :title="rightClickDialogTitleEnum[rightClickDialogType]"
|
||||
@confirm="handleRightClickDialogSubmit" @cancel="handleRightClickDialogCancel" @close="handleRightClickDialogClose">
|
||||
<MarketDialog
|
||||
:visible="rightClickDialogVisible"
|
||||
:title="rightClickDialogTitleEnum[rightClickDialogType]"
|
||||
@confirm="handleRightClickDialogSubmit"
|
||||
@cancel="handleRightClickDialogCancel"
|
||||
@close="handleRightClickDialogClose"
|
||||
>
|
||||
<!-- 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw' -->
|
||||
<MarketForm :marketForm="rightClickMarketForm" :form-rules="rightClickMarketFormRules"
|
||||
:form-items="rightClickMarketFormItemOptions"></MarketForm>
|
||||
<MarketForm
|
||||
:form-data="rightClickMarketForm"
|
||||
:form-rules="rightClickMarketFormRules"
|
||||
:form-items="rightClickMarketFormItemOptions"
|
||||
></MarketForm>
|
||||
</MarketDialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
defineOptions({
|
||||
name: 'Business'
|
||||
name: 'Business',
|
||||
})
|
||||
// 组件
|
||||
import MarketSearch from '@/components/common/Search.vue'
|
||||
import MarketTable from '@/components/common/Table.vue'
|
||||
import MarketPagination from '@/components/common/Pagination.vue'
|
||||
import MarketDialog from '@/components/common/Dialog.vue'
|
||||
import MarketForm from '@/components/common/Form.vue'
|
||||
//配置选项和表单验证
|
||||
import {
|
||||
|
|
@ -125,6 +206,12 @@ import {
|
|||
marketPointTableColumns,
|
||||
countryOptions,
|
||||
viewMarketPointTableColumns,
|
||||
accountFormItemList,
|
||||
accountFormItemRules,
|
||||
acceptOrdersFormItemList,
|
||||
acceptOrdersFormItemRules,
|
||||
transferFormItemList,
|
||||
transferFormItemRules,
|
||||
} from './options'
|
||||
import { useUserStore } from '@/stores/modules/user.ts'
|
||||
import { rules } from './rules'
|
||||
|
|
@ -137,7 +224,9 @@ import {
|
|||
getRiskTemplateListApi,
|
||||
addMarketApi,
|
||||
editMarketApi,
|
||||
} from '@/api/modules/account/market'
|
||||
updateCapital,
|
||||
editAgentBail,
|
||||
} from '@/api/modules/profile/business.ts'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
|
|
@ -246,13 +335,15 @@ const rightClickDialogTitleEnum = {
|
|||
deposit: '取款',
|
||||
withdraw: '存款',
|
||||
}
|
||||
const rightClickMarketForm = ref({})
|
||||
const rightClickMarketFormRules = ref({})
|
||||
const rightClickMarketFormItemOptions = ref([])
|
||||
const rightClickMarketForm = ref<any>({})
|
||||
const rightClickMarketFormRules = ref(accountFormItemRules)
|
||||
const rightClickMarketFormItemOptions = ref(accountFormItemList)
|
||||
|
||||
// 行右键点击
|
||||
const handleRowContextMenu = (row: any, column: any, event: any) => {
|
||||
console.log('handleRowContextMenu', row, column, event)
|
||||
if (userStore?.userInfo?.role_id !== 1 && userStore?.userInfo?.id !== row.wallet_capital.user_id)
|
||||
return
|
||||
event?.preventDefault()
|
||||
currentRow.value = row
|
||||
menuOptions.x = event?.clientX
|
||||
|
|
@ -265,24 +356,85 @@ const handleRowContextMenu = (row: any, column: any, event: any) => {
|
|||
* @description 处理右键菜单
|
||||
* */
|
||||
const handleAction = (key: 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw') => {
|
||||
console.log('handleAction', key)
|
||||
console.log('handleAction', key, currentRow.value)
|
||||
if (!currentRow.value) return
|
||||
switch (key) {
|
||||
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
|
||||
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
|
||||
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
|
||||
case 'deposit':
|
||||
break
|
||||
case 'withdraw':
|
||||
return ElMessage.warning('暂无此功能')
|
||||
break
|
||||
}
|
||||
rightClickDialogType.value = key
|
||||
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 = () => {
|
||||
rightClickDialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
//做市商搜索配置
|
||||
|
||||
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 = [
|
||||
|
|
@ -14,7 +20,7 @@ export const marketTableColumns = [
|
|||
//级别
|
||||
{ label: '级别', prop: 'level', align: 'center' as const, width: '120px' },
|
||||
{ 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: 'basicAccount', align: 'center' as const, width: '200px' },
|
||||
|
|
@ -58,7 +64,7 @@ export const marketFormItem = [
|
|||
//级别
|
||||
{ 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: '请选择风控模板' },
|
||||
//头寸
|
||||
|
|
@ -96,9 +102,42 @@ export const marketPointTableColumns = [
|
|||
]
|
||||
|
||||
// 查看点差表格列配置
|
||||
export const viewMarketPointTableColumns = ([
|
||||
export const viewMarketPointTableColumns = [
|
||||
{ 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 },
|
||||
])
|
||||
]
|
||||
|
||||
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'] }],
|
||||
}
|
||||
Loading…
Reference in New Issue