做市商列表
This commit is contained in:
parent
1710f687a6
commit
b6a75f5fd2
|
|
@ -76,9 +76,13 @@ const responseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>
|
|||
//关闭loading(无论成功失败都要关)
|
||||
hideLoading()
|
||||
const config = response.config
|
||||
if (response.headers['new_token'] !== undefined) {
|
||||
setStorage('token', response.headers['new_token'] as string)
|
||||
// axios 会将响应头规范化为小写,同时尝试大小写版本以兼容不同服务器
|
||||
const newToken = response.headers['new-token'] || response.headers['New-Token']
|
||||
if (newToken) {
|
||||
setStorage('token', newToken as string, 'local')
|
||||
console.log('Token 已更新:', newToken)
|
||||
}
|
||||
|
||||
console.log('响应response', response)
|
||||
const { data } = response
|
||||
console.log('响应数据data', data)
|
||||
|
|
|
|||
|
|
@ -37,3 +37,8 @@ export async function updateCapital(params: any): Promise<any> {
|
|||
export async function editAgentBail(params: any): Promise<any> {
|
||||
return request.post<any>('/agent/editAgentBail', { ...params })
|
||||
}
|
||||
|
||||
//获取承接特殊做市选项
|
||||
export async function getBasetsOptionsApi(): Promise<any> {
|
||||
return request.get<any>('/agent/getBasetsOptions')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-bind="$attrs">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="110px" v-bind="$attrs">
|
||||
<!-- 动态表单项 -->
|
||||
<el-row :gutter="props.rowGutter || 0">
|
||||
<template v-for="(item, index) in formItems" :key="index">
|
||||
<el-col :span="props.colSpan || 24">
|
||||
<el-col v-if="item.show !== false" :span="props.colSpan || 24">
|
||||
<el-form-item
|
||||
:label="item.label"
|
||||
:prop="item.prop"
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
/>
|
||||
|
||||
<!-- 单选框组 -->
|
||||
<el-radio-group v-else-if="item.type === 'radio'" v-model="formData[item.prop]">
|
||||
<el-radio-group v-else-if="item.type === 'radio'" v-model="formData[item.prop]" :disabled="item.disabled">
|
||||
<el-radio
|
||||
v-for="option in props.optionsMap?.[item.prop] || []"
|
||||
:key="option.value"
|
||||
|
|
@ -163,6 +163,7 @@ interface FormItem {
|
|||
placeholder?: string
|
||||
required?: boolean
|
||||
disabled?: boolean
|
||||
show?: boolean // 控制是否显示
|
||||
min?: number
|
||||
max?: number
|
||||
slotName?: string // 自定义插槽名称
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ const getCustomerTradeOrderList = async () => {
|
|||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
user_name: searchForm.value.accountName,
|
||||
account_id: searchForm.value.subAccountName,
|
||||
account_id: searchForm.value.subAccountName || '',
|
||||
order_no: '',
|
||||
type: searchForm.value.tradeType,
|
||||
start_time: startTime,
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ import {
|
|||
getPointDiffConfigListApi,
|
||||
getParAgentListApi,
|
||||
getRiskTemplateListApi,
|
||||
getBasetsOptionsApi,
|
||||
addMarketApi,
|
||||
editMarketApi,
|
||||
updateCapital,
|
||||
|
|
@ -331,6 +332,18 @@ const marketFormItemOptions = computed(() => {
|
|||
if (item.prop === 'parentAccountName' || item.prop === 'level') {
|
||||
return { ...item, disabled: dialogType.value === 'edit' }
|
||||
}
|
||||
// 只有当级别为特殊做市(level='3')时才显示 is_base_ts,且编辑时禁用
|
||||
if (item.prop === 'is_base_ts') {
|
||||
const show = marketForm.value.level === '3'
|
||||
return { ...item, show, disabled: dialogType.value === 'edit' }
|
||||
}
|
||||
// 只有当级别为特殊做市(level='3')且 is_base_ts=2 时才显示 base_ts
|
||||
if (item.prop === 'base_ts') {
|
||||
if (marketForm.value.level !== '3' || marketForm.value.is_base_ts !== 2) {
|
||||
return { ...item, show: false }
|
||||
}
|
||||
return { ...item, show: true }
|
||||
}
|
||||
return item
|
||||
})
|
||||
})
|
||||
|
|
@ -343,6 +356,8 @@ const marketFormOptionsMap = ref<{
|
|||
level: SelectOption[]
|
||||
parentAccountName: SelectOption[]
|
||||
riskControlTemplate: SelectOption[]
|
||||
is_base_ts: SelectOption[]
|
||||
base_ts: SelectOption[]
|
||||
}>({
|
||||
level: [
|
||||
// { label: '平台', value: '1' },
|
||||
|
|
@ -354,6 +369,11 @@ const marketFormOptionsMap = ref<{
|
|||
],
|
||||
parentAccountName: [],
|
||||
riskControlTemplate: [],
|
||||
is_base_ts: [
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 2 },
|
||||
],
|
||||
base_ts: [],
|
||||
})
|
||||
const activeTab = ref('email')
|
||||
/**
|
||||
|
|
@ -521,6 +541,8 @@ const mapMarketTree = (data: any) => {
|
|||
agentRelation: item.path_name, //代理关系
|
||||
accountName: item.username, //账户名
|
||||
level: item.role_id * 1 === 5 && item.type * 1 === 2 ? 6 : item.role_id, //级别
|
||||
is_base_ts: item.is_base_ts, //是否为承接特殊做市
|
||||
base_ts: item.base_ts, //承接特殊做市ID
|
||||
basicAccount: item.wallet_capital.amount, //基本账户
|
||||
margin: item.wallet_capital.bail, //保证金
|
||||
stopOrderMargin: item.wallet_capital.bail_stop_order, //停止接单保证金
|
||||
|
|
@ -641,6 +663,16 @@ const getRiskTemplateList = async () => {
|
|||
}))
|
||||
}
|
||||
|
||||
//获取承接特殊做市选项
|
||||
const getBasetsOptions = async () => {
|
||||
const data = await getBasetsOptionsApi()
|
||||
// 格式化下拉选项
|
||||
marketFormOptionsMap.value.base_ts = data.map((item: any) => ({
|
||||
label: item.username,
|
||||
value: item.id, // 按实际接口返回字段调整
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 请求所有做市商的浮动盈亏数据
|
||||
*/
|
||||
|
|
@ -686,6 +718,26 @@ watch(
|
|||
{ immediate: false },
|
||||
)
|
||||
|
||||
// 监听是否为承接特殊做市变化
|
||||
watch(
|
||||
() => marketForm.value.is_base_ts,
|
||||
(newVal) => {
|
||||
if (newVal === 1) {
|
||||
marketForm.value.base_ts = ''
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// 是否显示承接特殊做市下拉框
|
||||
const showBaseTsSelect = computed(() => {
|
||||
return marketForm.value.level === '3' && marketForm.value.is_base_ts === 2
|
||||
})
|
||||
|
||||
// 是否禁用承接特殊做市单选框(编辑时禁用)
|
||||
const isBaseTsDisabled = computed(() => {
|
||||
return dialogType.value === 'edit'
|
||||
})
|
||||
|
||||
/**
|
||||
* @description 定义表单初始值方法
|
||||
*/
|
||||
|
|
@ -696,6 +748,8 @@ const initMarketForm = {
|
|||
countryCode: '+86',
|
||||
accountName: '',
|
||||
level: '',
|
||||
is_base_ts: 1,
|
||||
base_ts: '',
|
||||
parentAccountName: '',
|
||||
riskControlTemplate: '',
|
||||
positionRatio: '',
|
||||
|
|
@ -724,6 +778,7 @@ const handleReset = async () => {
|
|||
|
||||
// 添加做市商
|
||||
const handleAddMarket = async () => {
|
||||
getBasetsOptions()
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = '添加'
|
||||
dialogType.value = 'add'
|
||||
|
|
@ -733,6 +788,7 @@ const handleAddMarket = async () => {
|
|||
|
||||
// 编辑做市商
|
||||
const handleEditMarket = async () => {
|
||||
getBasetsOptions()
|
||||
const row = selectedRow.value
|
||||
console.log('rowrowrowrowrow', row)
|
||||
|
||||
|
|
@ -751,7 +807,9 @@ const handleEditMarket = async () => {
|
|||
marketForm.value = {
|
||||
...initMarketForm,
|
||||
accountName: row.accountName || '',
|
||||
level: row.level || '',
|
||||
level: row.level+ '' || '',
|
||||
is_base_ts: row.is_base_ts || 1,
|
||||
base_ts: row.base_ts || '',
|
||||
parentAccountName: '',
|
||||
riskControlTemplate: row.wallet_capital.risk_control_id || '',
|
||||
positionRatio: row.positionRatio || '',
|
||||
|
|
@ -889,6 +947,11 @@ const handleSubmit = async () => {
|
|||
params.flag = 2
|
||||
params.role_id = '5'
|
||||
}
|
||||
// 添加承接特殊做市字段
|
||||
if (marketForm.value.level === '3') {
|
||||
params.is_base_ts = marketForm.value.is_base_ts
|
||||
params.base_ts = marketForm.value.is_base_ts === 1 ? 0 : marketForm.value.base_ts
|
||||
}
|
||||
await addMarketApi(params)
|
||||
// 5. 刷新表格数据
|
||||
await getMarketList()
|
||||
|
|
@ -898,7 +961,7 @@ const handleSubmit = async () => {
|
|||
let flag = null
|
||||
if (selectedRow.value.role_id * 1 === 5 && selectedRow.value.type * 1 === 1) flag = 1
|
||||
if (selectedRow.value.role_id * 1 === 6 && selectedRow.value.type * 1 === 2) flag = 2
|
||||
const params = {
|
||||
const params: Record<string, any> = {
|
||||
user_id: selectedRow.value.id,
|
||||
toucun_percent: marketForm.value.positionRatio,
|
||||
point_diffs_json: JSON.stringify(pointDiffObj),
|
||||
|
|
@ -907,6 +970,11 @@ const handleSubmit = async () => {
|
|||
flag: flag,
|
||||
fee_setting_id: '',
|
||||
}
|
||||
// 添加承接特殊做市字段
|
||||
if (marketForm.value.level === '3') {
|
||||
params.is_base_ts = marketForm.value.is_base_ts
|
||||
params.base_ts = marketForm.value.is_base_ts === 1 ? 0 : marketForm.value.base_ts
|
||||
}
|
||||
// 4. 调用编辑接口
|
||||
await editMarketApi(params)
|
||||
// 5. 刷新表格数据
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ export const marketFormItem = [
|
|||
{ label: '账户名称', prop: 'accountName', type: 'input' as const, placeholder: '请输入账户名称', },
|
||||
//级别
|
||||
{ label: '级别', prop: 'level', type: 'select' as const, placeholder: '请选择级别' },
|
||||
//是否为承接特殊做市
|
||||
{ label: '是否为承接特殊做市', labelWidth:"160px", prop: 'is_base_ts', type: 'radio' as const, show: false },
|
||||
//承接特殊做市
|
||||
{ label: '承接特殊做市', prop: 'base_ts', type: 'select' as const, placeholder: '请选择承接特殊做市', show: false },
|
||||
//所属上级
|
||||
{ label: '所属上级', prop: 'parentAccountName', type: 'select' as const, placeholder: '请选择所属上级账户名称', },
|
||||
// 风控模板
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@ export const rules = (marketForm: any, row?: any, isEdit?: boolean): FormRules =
|
|||
accountName: [
|
||||
{ required: true, message: '请输入账号名称', trigger: 'blur' }
|
||||
],
|
||||
is_base_ts: [
|
||||
{ required: true, message: '请选择是否为承接特殊做市', trigger: 'blur' }
|
||||
],
|
||||
base_ts: [
|
||||
{ required: true, message: '请选择承接特殊做市', trigger: 'blur' }
|
||||
],
|
||||
level: [
|
||||
{ required: !isEdit, message: '请选择等级', trigger: 'change' }
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue