This commit is contained in:
parent
28c86ad0c4
commit
e9469bfd08
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -36,10 +36,39 @@
|
|||
</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>
|
||||
|
||||
|
|
@ -141,7 +170,7 @@
|
|||
>
|
||||
<!-- 'account' | 'acceptOrders' | 'transfer' | 'deposit' | 'withdraw' -->
|
||||
<MarketForm
|
||||
:marketForm="rightClickMarketForm"
|
||||
:form-data="rightClickMarketForm"
|
||||
:form-rules="rightClickMarketFormRules"
|
||||
:form-items="rightClickMarketFormItemOptions"
|
||||
></MarketForm>
|
||||
|
|
@ -149,9 +178,8 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
defineOptions({
|
||||
name: 'Business'
|
||||
name: 'Business',
|
||||
})
|
||||
// 组件
|
||||
import MarketSearch from '@/components/common/Search.vue'
|
||||
|
|
@ -167,8 +195,14 @@ import {
|
|||
marketPointTableColumns,
|
||||
countryOptions,
|
||||
viewMarketPointTableColumns,
|
||||
accountFormItemList,
|
||||
accountFormItemRules,
|
||||
acceptOrdersFormItemList,
|
||||
acceptOrdersFormItemRules,
|
||||
transferFormItemList,
|
||||
transferFormItemRules,
|
||||
} from './options'
|
||||
import {useUserStore} from '@/stores/modules/user.ts'
|
||||
import { useUserStore } from '@/stores/modules/user.ts'
|
||||
import { rules } from './rules'
|
||||
|
||||
//接口
|
||||
|
|
@ -179,7 +213,9 @@ import {
|
|||
getRiskTemplateListApi,
|
||||
addMarketApi,
|
||||
editMarketApi,
|
||||
} from '@/api/modules/account/market'
|
||||
updateCapital,
|
||||
editAgentBail,
|
||||
} from '@/api/modules/profile/business.ts'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
|
|
@ -282,13 +318,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
|
||||
|
|
@ -301,24 +339,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' },
|
||||
|
|
@ -51,35 +57,45 @@ export const marketTableColumns = [
|
|||
|
||||
//做市商添加配置
|
||||
export const marketFormItem = [
|
||||
//邮箱或手机号
|
||||
{ prop: 'phoneOrEmail', label: '', type: 'slot' as const, slotName: 'phoneOrEmail' },
|
||||
//账户名称
|
||||
{ label: '账户名称', prop: 'accountName', type: 'input' as const, placeholder: '请输入账户名称', },
|
||||
//级别
|
||||
{ label: '级别', prop: 'level', type: 'select' as const, placeholder: '请选择级别' },
|
||||
//所属上级
|
||||
{ label: '所属上级', prop: 'parentAccountName', type: 'select' as const, placeholder: '请选择所属上级账户名称', },
|
||||
// 风控模板
|
||||
{ label: '风控模板', prop: 'riskControlTemplate', type: 'select' as const, placeholder: '请选择风控模板' },
|
||||
//头寸
|
||||
{ label: '头寸', prop: 'positionRatio', type: 'input' as const, placeholder: '请输入头寸', },
|
||||
//手续费
|
||||
{ label: '手续费', prop: 'commissionRatio', type: 'input' as const, placeholder: '请输入手续费', },
|
||||
//邮箱或手机号
|
||||
{ prop: 'phoneOrEmail', label: '', type: 'slot' as const, slotName: 'phoneOrEmail' },
|
||||
//账户名称
|
||||
{ label: '账户名称', prop: 'accountName', type: 'input' as const, placeholder: '请输入账户名称' },
|
||||
//级别
|
||||
{ label: '级别', prop: 'level', type: 'select' as const, placeholder: '请选择级别' },
|
||||
//所属上级
|
||||
{
|
||||
label: '所属上级',
|
||||
prop: 'parentAccountName',
|
||||
type: 'select' as const,
|
||||
placeholder: '请选择所属上级账户名称',
|
||||
},
|
||||
// 风控模板
|
||||
{
|
||||
label: '风控模板',
|
||||
prop: 'riskControlTemplate',
|
||||
type: 'select' as const,
|
||||
placeholder: '请选择风控模板',
|
||||
},
|
||||
//头寸
|
||||
{ label: '头寸', prop: 'positionRatio', type: 'input' as const, placeholder: '请输入头寸' },
|
||||
//手续费
|
||||
{ label: '手续费', prop: 'commissionRatio', type: 'input' as const, placeholder: '请输入手续费' },
|
||||
]
|
||||
|
||||
// 国家码选项
|
||||
interface CountryItem {
|
||||
name: string
|
||||
code: string
|
||||
name: string
|
||||
code: string
|
||||
}
|
||||
export const countryOptions = ref<CountryItem[]>([
|
||||
{ name: '中国', code: '+86' },
|
||||
{ name: '中国台湾', code: '+886' },
|
||||
{ name: '中国香港', code: '+852' },
|
||||
{ name: '中国澳门', code: '+853' },
|
||||
{ name: '韩国', code: '+82' },
|
||||
{ name: '美国', code: '+1' },
|
||||
{ name: '新加坡', code: '+65' }
|
||||
{ name: '中国', code: '+86' },
|
||||
{ name: '中国台湾', code: '+886' },
|
||||
{ name: '中国香港', code: '+852' },
|
||||
{ name: '中国澳门', code: '+853' },
|
||||
{ name: '韩国', code: '+82' },
|
||||
{ name: '美国', code: '+1' },
|
||||
{ name: '新加坡', code: '+65' },
|
||||
])
|
||||
|
||||
//编辑点差表格列配置
|
||||
|
|
@ -96,9 +112,42 @@ export const marketPointTableColumns = [
|
|||
]
|
||||
|
||||
// 查看点差表格列配置
|
||||
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 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