|
@@ -1,30 +1,18 @@
|
|
|
<!-- 交易商管理-个性化管理-交易商个性化-编辑 -->
|
|
<!-- 交易商管理-个性化管理-交易商个性化-编辑 -->
|
|
|
<template>
|
|
<template>
|
|
|
- <app-drawer :title="t('investor.custom.tradecfg.edit.title')" width="1100" v-model:show="show" :refresh="refresh" :loading="loading">
|
|
|
|
|
- <el-form ref="formRef" label-width="140px" :model="formData" :rules="formRules" :show-message="false">
|
|
|
|
|
|
|
+ <app-drawer :title="t('investor.custom.tradecfg.edit.title')" width="1100" v-model:show="show" :refresh="refresh"
|
|
|
|
|
+ :loading="loading">
|
|
|
|
|
+ <el-form ref="formRef" label-width="140px" :model="formData" :show-message="false">
|
|
|
<fieldset class="g-fieldset el-form--horizontal">
|
|
<fieldset class="g-fieldset el-form--horizontal">
|
|
|
<legend class="g-fieldset__legend">{{ t('investor.custom.tradecfg.edit.subtitle1') }}</legend>
|
|
<legend class="g-fieldset__legend">{{ t('investor.custom.tradecfg.edit.subtitle1') }}</legend>
|
|
|
- <el-form-item :label="t('investor.custom.tradecfg.edit.usergroupid')" prop="usergroupid">
|
|
|
|
|
- <el-select v-model="formData.usergroupid" @change="onGroupChange">
|
|
|
|
|
- <template v-for="(item, index) in groupTrees" :key="index">
|
|
|
|
|
- <el-option :label="item.name" :value="item.usergroupid" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ <el-form-item :label="t('investor.custom.tradecfg.edit.usergroupid')">
|
|
|
|
|
+ {{ handleNoneValue(groupItem?.name) }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('investor.custom.tradecfg.edit.marketid')" prop="marketid">
|
|
|
|
|
- <el-select v-model="formData.marketid" :empty-values="[null, undefined, 0]"
|
|
|
|
|
- @change="onMarketChange">
|
|
|
|
|
- <template v-for="(item, index) in marketData?.markets" :key="index">
|
|
|
|
|
- <el-option :label="item.marketname" :value="item.marketid" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ <el-form-item :label="t('investor.custom.tradecfg.edit.marketid')">
|
|
|
|
|
+ {{ handleNoneValue(marketItem?.name) }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('investor.custom.tradecfg.edit.goodsid')" prop="goodsid">
|
|
|
|
|
- <el-select v-model="formData.goodsid" :empty-values="[null, undefined, 0]" @change="onGoodsChange">
|
|
|
|
|
- <template v-for="(item, index) in goodsData?.goods" :key="index">
|
|
|
|
|
- <el-option :label="item.goodsname" :value="item.goodsid" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ <el-form-item :label="t('investor.custom.tradecfg.edit.goodsid')">
|
|
|
|
|
+ {{ handleNoneValue(goodsItem?.name) }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item :label="t('investor.custom.tradecfg.edit.paramid')" prop="paramid">
|
|
<el-form-item :label="t('investor.custom.tradecfg.edit.paramid')" prop="paramid">
|
|
|
<el-select v-model="formData.paramid" :empty-values="[null, undefined, 0]" @change="onResultChange"
|
|
<el-select v-model="formData.paramid" :empty-values="[null, undefined, 0]" @change="onResultChange"
|
|
@@ -51,12 +39,13 @@
|
|
|
<!-- 个性化 -->
|
|
<!-- 个性化 -->
|
|
|
<template #cvalue="{ row, index }">
|
|
<template #cvalue="{ row, index }">
|
|
|
<template v-if="formData.ruleList[index]">
|
|
<template v-if="formData.ruleList[index]">
|
|
|
- <el-select v-model="formData.ruleList[index].paramvalue" v-if="row.ruleid === 105">
|
|
|
|
|
|
|
+ <el-select v-model="formData.ruleList[index].paramvalue" :empty-values="[null, undefined, 0]" v-if="row.ruleid === 105">
|
|
|
<template v-for="item in feetypeEnum.getEnumOptions()" :key="item.id">
|
|
<template v-for="item in feetypeEnum.getEnumOptions()" :key="item.id">
|
|
|
<el-option :label="item.label" :value="item.value" />
|
|
<el-option :label="item.label" :value="item.value" />
|
|
|
</template>
|
|
</template>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
- <el-input-number v-model="formData.ruleList[index].paramvalue" :placeholder="t('common.pleaseenter')" v-else />
|
|
|
|
|
|
|
+ <el-input-number v-model="formData.ruleList[index].paramvalue"
|
|
|
|
|
+ :placeholder="t('common.pleaseenter')" v-else />
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
|
</app-table>
|
|
</app-table>
|
|
@@ -89,8 +78,10 @@
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 服务费 -->
|
|
<!-- 服务费 -->
|
|
|
<template #fee="{ row, index }">
|
|
<template #fee="{ row, index }">
|
|
|
- <el-input-number v-model="formData.feeList[index].paramvalue" :min="row.memberminvalue"
|
|
|
|
|
- :max="row.membermaxvalue" :placeholder="t('common.pleaseenter')" />
|
|
|
|
|
|
|
+ <template v-if="formData.feeList[index]">
|
|
|
|
|
+ <el-input-number v-model="formData.feeList[index].paramvalue" :min="row.memberminvalue"
|
|
|
|
|
+ :max="row.membermaxvalue" :placeholder="t('common.pleaseenter')" />
|
|
|
|
|
+ </template>
|
|
|
</template>
|
|
</template>
|
|
|
</app-table>
|
|
</app-table>
|
|
|
</el-form>
|
|
</el-form>
|
|
@@ -102,8 +93,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import { ref, PropType, computed, onMounted } from 'vue'
|
|
|
|
|
-import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
|
|
|
|
+import { reactive, shallowRef, PropType, computed } from 'vue'
|
|
|
|
|
+import { ElMessage, FormInstance } from 'element-plus'
|
|
|
import { handleNoneValue } from '@/filters'
|
|
import { handleNoneValue } from '@/filters'
|
|
|
import { getFeeAlgorithmName } from '@/constants/order'
|
|
import { getFeeAlgorithmName } from '@/constants/order'
|
|
|
import { useEnum } from '@/hooks/enum'
|
|
import { useEnum } from '@/hooks/enum'
|
|
@@ -115,62 +106,63 @@ import { i18n } from '@/stores'
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
record: {
|
|
record: {
|
|
|
- type: Object as PropType<Model.TradeConfigViewRsp>
|
|
|
|
|
|
|
+ type: Object as PropType<Model.TradeConfigViewRsp>,
|
|
|
|
|
+ required: true
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const feetypeEnum = useEnum('feetype')
|
|
const feetypeEnum = useEnum('feetype')
|
|
|
|
|
|
|
|
const { global: { t } } = i18n
|
|
const { global: { t } } = i18n
|
|
|
-const formRef = ref<FormInstance>()
|
|
|
|
|
-const show = ref(true)
|
|
|
|
|
-const refresh = ref(false)
|
|
|
|
|
-const loading = ref(false)
|
|
|
|
|
|
|
+const formRef = shallowRef<FormInstance>()
|
|
|
|
|
+const show = shallowRef(true)
|
|
|
|
|
+const refresh = shallowRef(false)
|
|
|
|
|
+const loading = shallowRef(false)
|
|
|
|
|
|
|
|
-const formData = ref<Model.TraderPersonAddReq>({
|
|
|
|
|
|
|
+const formData = reactive<Model.TraderPersonAddReq>({
|
|
|
feeList: [],
|
|
feeList: [],
|
|
|
- flag: 0,
|
|
|
|
|
- goodsid: 0,
|
|
|
|
|
- marketid: 0,
|
|
|
|
|
|
|
+ flag: 1,
|
|
|
|
|
+ goodsid: props.record.goodsid,
|
|
|
|
|
+ marketid: props.record.marketid,
|
|
|
ruleList: [],
|
|
ruleList: [],
|
|
|
- usergroupid: 0
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
-// 分组树列表
|
|
|
|
|
-const groupTrees = computed(() => {
|
|
|
|
|
- return nodeList.value.filter((e) => e.pid === '-1')
|
|
|
|
|
|
|
+ paramid: props.record.paramid,
|
|
|
|
|
+ usergroupid: props.record.usergroupid
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 获取分组列表
|
|
// 获取分组列表
|
|
|
const { dataList: nodeList } = useRequest(getInvestorTree)
|
|
const { dataList: nodeList } = useRequest(getInvestorTree)
|
|
|
|
|
|
|
|
-// 获取市场列表
|
|
|
|
|
-const { data: marketData, run: getMarketList } = useRequest(initInvestorPerson)
|
|
|
|
|
|
|
+// 分组对象
|
|
|
|
|
+const groupItem = computed(() => nodeList.value.find((e) => e.pid === '-1' && e.usergroupid === formData.usergroupid))
|
|
|
|
|
|
|
|
-// 获取商品列表
|
|
|
|
|
-const { data: goodsData, run: getGoodsList } = useRequest(initInvestorPerson, {
|
|
|
|
|
- manual: true,
|
|
|
|
|
-})
|
|
|
|
|
|
|
+// 市场对象
|
|
|
|
|
+const marketItem = computed(() => nodeList.value.find((e) => e.pid === groupItem.value?.id && e.marketid === formData.marketid))
|
|
|
|
|
+
|
|
|
|
|
+// 商品对象
|
|
|
|
|
+const goodsItem = computed(() => nodeList.value.find((e) => e.pid === marketItem.value?.id && e.goodsid === formData.goodsid))
|
|
|
|
|
|
|
|
// 获取保证金类别列表
|
|
// 获取保证金类别列表
|
|
|
-const { data: resultData, run: getResultList } = useRequest(initInvestorPerson, {
|
|
|
|
|
- manual: true,
|
|
|
|
|
|
|
+const { data: resultData } = useRequest(initInvestorPerson, {
|
|
|
|
|
+ params: {
|
|
|
|
|
+ usergroupid: formData.usergroupid,
|
|
|
|
|
+ marketid: formData.marketid,
|
|
|
|
|
+ goodsid: formData.goodsid
|
|
|
|
|
+ },
|
|
|
onSuccess: (res) => {
|
|
onSuccess: (res) => {
|
|
|
- formData.value.ruleList = []
|
|
|
|
|
- formData.value.feeList = []
|
|
|
|
|
-
|
|
|
|
|
res.data.rulesConfigVos.forEach((e) => {
|
|
res.data.rulesConfigVos.forEach((e) => {
|
|
|
- formData.value.ruleList.push({
|
|
|
|
|
|
|
+ const rule = props.record.druleList.find((d) => d.ruleid === e.ruleid)
|
|
|
|
|
+ formData.ruleList.push({
|
|
|
paramid: e.ruleid,
|
|
paramid: e.ruleid,
|
|
|
- paramvalue: 0
|
|
|
|
|
|
|
+ paramvalue: rule ? rule.cvalue : 0
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
res.data.feesConfigVos.forEach((e) => {
|
|
res.data.feesConfigVos.forEach((e) => {
|
|
|
- formData.value.feeList.push({
|
|
|
|
|
|
|
+ const fee = props.record.dfeeList.find((d) => d.tradefeeid === e.tradefeeid)
|
|
|
|
|
+ formData.feeList.push({
|
|
|
feealgorithm: e.feealgorithm,
|
|
feealgorithm: e.feealgorithm,
|
|
|
paramid: e.tradefeeid,
|
|
paramid: e.tradefeeid,
|
|
|
- paramvalue: 0
|
|
|
|
|
|
|
+ paramvalue: fee ? fee.cvalue : 0
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -179,7 +171,7 @@ const { data: resultData, run: getResultList } = useRequest(initInvestorPerson,
|
|
|
const ruleColumns = computed<Model.TableColumn[]>(() => [
|
|
const ruleColumns = computed<Model.TableColumn[]>(() => [
|
|
|
{ field: 'rulename', label: 'investor.custom.tradecfg.edit.rulename' },
|
|
{ field: 'rulename', label: 'investor.custom.tradecfg.edit.rulename' },
|
|
|
{ field: 'paramvalue', label: 'investor.custom.tradecfg.edit.paramvalue' },
|
|
{ field: 'paramvalue', label: 'investor.custom.tradecfg.edit.paramvalue' },
|
|
|
- { field: 'dvalue', label: 'investor.custom.tradecfg.edit.dvalue', show: formData.value.usergroupid !== 0 },
|
|
|
|
|
|
|
+ { field: 'dvalue', label: 'investor.custom.tradecfg.edit.dvalue', show: formData.usergroupid !== 0 },
|
|
|
{ field: 'cvalue', label: 'investor.custom.tradecfg.edit.cvalue' },
|
|
{ field: 'cvalue', label: 'investor.custom.tradecfg.edit.cvalue' },
|
|
|
])
|
|
])
|
|
|
|
|
|
|
@@ -187,58 +179,16 @@ const feeColumns = computed<Model.TableColumn[]>(() => [
|
|
|
{ field: 'tradefeename', label: 'investor.custom.tradecfg.edit.tradefeename' },
|
|
{ field: 'tradefeename', label: 'investor.custom.tradecfg.edit.tradefeename' },
|
|
|
{ field: 'feealgorithm', label: 'investor.custom.tradecfg.edit.feealgorithm', formatValue: (val) => getFeeAlgorithmName(val) },
|
|
{ field: 'feealgorithm', label: 'investor.custom.tradecfg.edit.feealgorithm', formatValue: (val) => getFeeAlgorithmName(val) },
|
|
|
{ field: 'exchangevalue', label: 'investor.custom.tradecfg.edit.exchangevalue' },
|
|
{ field: 'exchangevalue', label: 'investor.custom.tradecfg.edit.exchangevalue' },
|
|
|
- { field: 'dvalue', label: 'investor.custom.tradecfg.edit.dvalue', show: formData.value.usergroupid !== 0 },
|
|
|
|
|
|
|
+ { field: 'dvalue', label: 'investor.custom.tradecfg.edit.dvalue', show: formData.usergroupid !== 0 },
|
|
|
{ field: 'memberminvalue', label: 'investor.custom.tradecfg.edit.memberminvalue' },
|
|
{ field: 'memberminvalue', label: 'investor.custom.tradecfg.edit.memberminvalue' },
|
|
|
{ field: 'fee', label: 'investor.custom.tradecfg.edit.fee', width: 200 },
|
|
{ field: 'fee', label: 'investor.custom.tradecfg.edit.fee', width: 200 },
|
|
|
{ field: 'membermaxvalue', label: 'investor.custom.tradecfg.edit.membermaxvalue' },
|
|
{ field: 'membermaxvalue', label: 'investor.custom.tradecfg.edit.membermaxvalue' },
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
-// 表单验证规则
|
|
|
|
|
-const formRules: FormRules = {
|
|
|
|
|
- usergroupid: [{ required: true }],
|
|
|
|
|
- marketid: [{ required: true }],
|
|
|
|
|
- goodsid: [{ required: true }],
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 选择分组
|
|
|
|
|
-const onGroupChange = (value: number) => {
|
|
|
|
|
- formData.value.marketid = 0
|
|
|
|
|
- formData.value.goodsid = 0
|
|
|
|
|
- formData.value.paramid = 0
|
|
|
|
|
- formData.value.feealgorithm = 0
|
|
|
|
|
- resultData.value = undefined
|
|
|
|
|
- getMarketList({
|
|
|
|
|
- usergroupid: value,
|
|
|
|
|
- })
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 选择市场
|
|
|
|
|
-const onMarketChange = (value: number) => {
|
|
|
|
|
- formData.value.goodsid = 0
|
|
|
|
|
- formData.value.paramid = 0
|
|
|
|
|
- formData.value.feealgorithm = 0
|
|
|
|
|
- resultData.value = undefined
|
|
|
|
|
- getGoodsList({
|
|
|
|
|
- usergroupid: formData.value.usergroupid,
|
|
|
|
|
- marketid: value,
|
|
|
|
|
- })
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 选择商品
|
|
|
|
|
-const onGoodsChange = (value: number) => {
|
|
|
|
|
- formData.value.paramid = 0
|
|
|
|
|
- formData.value.feealgorithm = 0
|
|
|
|
|
- getResultList({
|
|
|
|
|
- marketid: formData.value.marketid,
|
|
|
|
|
- usergroupid: formData.value.usergroupid,
|
|
|
|
|
- goodsid: value
|
|
|
|
|
- })
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// 选择保证金类别
|
|
// 选择保证金类别
|
|
|
const onResultChange = (value?: number) => {
|
|
const onResultChange = (value?: number) => {
|
|
|
const res = resultData.value?.results.find((e) => e.enumitemname === value?.toString())
|
|
const res = resultData.value?.results.find((e) => e.enumitemname === value?.toString())
|
|
|
- formData.value.feealgorithm = res?.marginalgorithm
|
|
|
|
|
|
|
+ formData.feealgorithm = res?.marginalgorithm
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const onSubmit = () => {
|
|
const onSubmit = () => {
|
|
@@ -246,7 +196,7 @@ const onSubmit = () => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
traderPersonAdd({
|
|
traderPersonAdd({
|
|
|
- data: formData.value
|
|
|
|
|
|
|
+ data: formData
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
ElMessage.success(t('common.tips3'))
|
|
ElMessage.success(t('common.tips3'))
|
|
|
onCancel(true)
|
|
onCancel(true)
|
|
@@ -263,16 +213,4 @@ const onCancel = (isRefresh = false) => {
|
|
|
show.value = false
|
|
show.value = false
|
|
|
refresh.value = isRefresh
|
|
refresh.value = isRefresh
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
- const record = props.record
|
|
|
|
|
- if (record) {
|
|
|
|
|
- console.log(record)
|
|
|
|
|
- // formData.value = {
|
|
|
|
|
- // accountid: record.accountid,
|
|
|
|
|
- // customertype: record.customertype,
|
|
|
|
|
- // userid: record.userid
|
|
|
|
|
- // }
|
|
|
|
|
- }
|
|
|
|
|
-})
|
|
|
|
|
</script>
|
|
</script>
|