单边
This commit is contained in:
@ -134,3 +134,20 @@ export function getOrderPage(params) {
|
||||
})
|
||||
}
|
||||
|
||||
// aicoin买入点
|
||||
export function aiCoinPrice(data) {
|
||||
return request({
|
||||
url: '/api/v1/line-pre-order/aiCoinPrice',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// aicoin交易对
|
||||
export function aicoinSymbol(params) {
|
||||
return request({
|
||||
url: '/api/v1/line-direction/symbol',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" :close-on-click-modal="false">
|
||||
<el-dialog :title="title" :visible.sync="open" width="1200px" :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input
|
||||
@ -190,20 +190,38 @@
|
||||
placeholder="模板名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form ref="inForm" :model="inForm" :rules="inRules" label-width="120px" style="height: 500px;overflow: hidden auto;">
|
||||
<el-form-item label="订单类型" prop="order_type">
|
||||
<el-radio-group v-model="inForm.order_type" @input="onRadioInput">
|
||||
<el-radio label="1">现货</el-radio>
|
||||
<el-radio label="2">合约</el-radio>
|
||||
<el-form ref="inForm" :model="inForm" :rules="inRules" label-width="180px" style="height: 500px;overflow: hidden auto;">
|
||||
<el-form-item label="交易所" prop="exchange_type">
|
||||
<el-select
|
||||
v-model="inForm.exchange_type"
|
||||
style="width: 100%;"
|
||||
placeholder="请选择交易所"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
@change="onchangeForm"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in exchangeTypes"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单类型" prop="symbol_type">
|
||||
<el-radio-group v-model="inForm.symbol_type" @change="onChangeSymbolType">
|
||||
<el-radio :label="1">现货</el-radio>
|
||||
<el-radio :label="2">合约</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="对冲类型" prop="cover_type">
|
||||
<!-- <el-form-item label="对冲类型" prop="cover_type">
|
||||
<el-radio-group v-model="inForm.cover_type">
|
||||
<el-radio :label="1" :disabled="inForm.order_type==2">现货对合约</el-radio>
|
||||
<el-radio :label="2" :disabled="inForm.order_type==1">合约对合约</el-radio>
|
||||
<el-radio :label="3" :disabled="inForm.order_type==1">合约对现货</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="api用户" prop="api_id">
|
||||
<el-row>
|
||||
<el-col :span="21">
|
||||
@ -258,6 +276,7 @@
|
||||
:remote-method="getSymbol"
|
||||
:loading="searchLoding"
|
||||
size="small"
|
||||
@change="onchangeSymbol"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in comSymbols"
|
||||
@ -291,9 +310,10 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格模式" prop="price_pattern">
|
||||
<el-radio-group v-model="inForm.price_pattern">
|
||||
<el-radio-group v-model="inForm.price_pattern" @change="onchangePattern">
|
||||
<el-radio label="percentage">百分比</el-radio>
|
||||
<el-radio label="mixture" :disabled="form.type===2">主单实价委托百分比</el-radio>
|
||||
<el-radio label="aicoin" :disabled="form.type===2">aiCoin买入点</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="inForm.price_pattern === 'percentage'" label="下单百分比" prop="price">
|
||||
@ -308,7 +328,16 @@
|
||||
<el-input
|
||||
v-model="inForm.price"
|
||||
placeholder="下单价(实际价格)"
|
||||
/>
|
||||
>
|
||||
<template #prepend>
|
||||
<el-select v-if="inForm.price_pattern === 'aicoin'" v-model="aicoinPrice" placeholder="请选择" style="width: 150px;" @change="onchangeAicoin">
|
||||
<el-option v-for="o in options" :key="o.label" :label="o.label" :value="aicoins[o.value]">
|
||||
<span style="float: left">{{ o.label }}</span>
|
||||
<span style="float: right">{{ aicoins[o.value] || 0 }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
@ -320,7 +349,7 @@
|
||||
<el-button type="primary" style="margin-left: 50px;" @click="onCalc">计算</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="止盈百分比" prop="profit">
|
||||
<!-- <el-form-item label="止盈百分比" prop="profit">
|
||||
<el-input
|
||||
v-model="inForm.profit"
|
||||
placeholder="止盈百分比"
|
||||
@ -356,14 +385,14 @@
|
||||
<el-col :span="11"><el-input v-model.number="inForm.hedge_trigger_percent" type="number" placeholder="最小值"><template #append>最小值</template></el-input></el-col>
|
||||
<el-col :span="11"><el-input v-model.number="inForm.hedge_trigger_percent_max" type="number" placeholder="最大值"><template #append>最大值</template></el-input></el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="主单类型" prop="main_order_type">
|
||||
<el-radio-group v-model="inForm.main_order_type">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="对冲单下单类型" prop="hedge_order_type">
|
||||
<!-- <el-form-item label="对冲单下单类型" prop="hedge_order_type">
|
||||
<el-radio-group v-model="inForm.hedge_order_type">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
@ -380,11 +409,12 @@
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="对标价类型" prop="price_type">
|
||||
<el-radio-group v-model="inForm.price_type">
|
||||
<el-radio label="new">最新价</el-radio>
|
||||
<el-radio label="mixture">标记价</el-radio>
|
||||
<el-radio label="mixture" :disabled="form.type===2">标记价</el-radio>
|
||||
<el-radio label="aicoin" :disabled="form.type===2">aicoin</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单过期时间" prop="profit_rate">
|
||||
@ -411,6 +441,50 @@
|
||||
<el-radio label="0">直接执行</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓价格百分比" prop="reduce_price">
|
||||
<el-input v-model.number="inForm.reduce_price" type="number" placeholder="主单减仓价格百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓数量百分比" prop="reduce_num">
|
||||
<el-input v-model.number="inForm.reduce_num" type="number" placeholder="主单减仓数量百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓后止盈价百分比" prop="reduce_take_profit">
|
||||
<el-input v-model.number="inForm.reduce_take_profit" type="number" placeholder="主单减仓后止盈价百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓后止损价百分比" prop="reduce_stop_price">
|
||||
<el-input v-model.number="inForm.reduce_stop_price" type="number" placeholder="主单减仓后止损价百分比" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="4"><el-form-item label="主单加仓配置" /></el-col>
|
||||
<el-col :span="20"><el-button type="primary" size="mini" @click="onAddExt(0)">新增</el-button></el-col>
|
||||
</el-row>
|
||||
<div v-for="(item,index) in inForm.ext" :key="index" class="exts">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓类型</div>
|
||||
<el-radio-group v-model="item.addPositionOrderType" size="mini">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓方式</div>
|
||||
<el-radio-group v-model="item.addPositionType" size="mini">
|
||||
<el-radio :label="1">百分比</el-radio>
|
||||
<el-radio :label="0">实际金额</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">加仓数值<el-input v-model.number="item.addPositionVal" size="mini" type="number" placeholder="加仓数值" /></el-col>
|
||||
<el-col :span="5">加仓价格百分比<el-input v-model.number="item.addPositionPriceRatio" size="mini" type="number" placeholder="加仓价格百分比" /></el-col>
|
||||
<el-col :span="4">加仓后止盈百分比<el-input v-model.number="item.takeProfitRatio" size="mini" type="number" placeholder="止盈百分比" /></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="margin-top: 10px;">
|
||||
<el-col :span="5">减仓价格百分比<el-input v-model.number="item.reducePriceRatio" size="mini" type="number" placeholder="减仓价格百分比" /></el-col>
|
||||
<el-col :span="5">减仓数量百分比<el-input v-model.number="item.reduceNumRatio" size="mini" type="number" placeholder="减仓数量百分比" /></el-col>
|
||||
<el-col :span="5">减仓后止盈百分比<el-input v-model.number="item.reduceTakeProfitRatio" size="mini" type="number" placeholder="减仓后止盈百分比" /></el-col>
|
||||
<el-col :span="5">减仓后止损百分比<el-input v-model.number="item.reduceStopLossRatio" size="mini" type="number" placeholder="减仓后止损百分比" /></el-col>
|
||||
<el-col :span="4"><div style="margin-bottom: 14px;" /><el-button size="mini" type="danger" @click="onAddExt(1,index)">删除</el-button></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- <el-form-item label="是否保存模板" prop="save_template">
|
||||
<el-radio-group v-model="inForm.save_template">
|
||||
<el-radio label="0">否</el-radio>
|
||||
@ -447,8 +521,8 @@
|
||||
import { listLineSymbol, getSameSymbol } from '@/api/admin/line-symbol'
|
||||
import { addLineOrderTemplateLogs, delLineOrderTemplateLogs, getLineOrderTemplateLogs, listLineOrderTemplateLogs, updateLineOrderTemplateLogs } from '@/api/admin/line-order-template-logs'
|
||||
import { listLineSymbolGroup } from '@/api/admin/line-symbol-group'
|
||||
import { getMainUser } from '@/api/admin/line-api-user'
|
||||
import { quickAddPreOrder } from '@/api/admin/line-pre-order'
|
||||
import { getMainUser, listLineApiUser } from '@/api/admin/line-api-user'
|
||||
import { aicoinSymbol, quickAddPreOrder } from '@/api/admin/line-pre-order'
|
||||
export default {
|
||||
name: 'LineOrderTemplateLogs',
|
||||
components: {
|
||||
@ -459,6 +533,14 @@ export default {
|
||||
{ v: 1, l: '单独添加' },
|
||||
{ v: 2, l: '批量添加' }
|
||||
],
|
||||
options: [
|
||||
{ label: '买入点1', value: 'buyPoint1' },
|
||||
{ label: '买入点2', value: 'buyPoint2' },
|
||||
{ label: '买入点3', value: 'buyPoint3' },
|
||||
{ label: '卖出点1', value: 'sellPoint1' },
|
||||
{ label: '卖出点2', value: 'sellPoint2' },
|
||||
{ label: '卖出点3', value: 'sellPoint3' }
|
||||
],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@ -494,7 +576,8 @@ export default {
|
||||
form: {
|
||||
},
|
||||
// 表单校验
|
||||
rules: { name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }],
|
||||
rules: {
|
||||
name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '用户id不能为空', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '模板类型:1=单独添加;2=批量添加不能为空', trigger: 'blur' }]
|
||||
},
|
||||
@ -507,6 +590,7 @@ export default {
|
||||
percenter: undefined,
|
||||
symbolGroups: [],
|
||||
inRules: {
|
||||
exchange_type: [{ required: true, message: '交易所不能为空', trigger: 'blur' }],
|
||||
api_id: [{ required: true, message: 'api用户不能为空', trigger: 'blur' }],
|
||||
symbol: [{ required: true, message: '交易对不能为空', trigger: 'blur' }],
|
||||
symbol_group_id: [{ required: true, message: '交易对组不能为空', trigger: 'blur' }],
|
||||
@ -514,7 +598,12 @@ export default {
|
||||
order_sn: [{ required: true, message: '订单号不能为空', trigger: 'blur' }]
|
||||
},
|
||||
inForm: {},
|
||||
searchLoding: false
|
||||
searchLoding: false,
|
||||
lineUsers: [],
|
||||
lineTotal: 0,
|
||||
exchangeTypes: [],
|
||||
aicoins: {},
|
||||
aicoinPrice: undefined
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -522,20 +611,77 @@ export default {
|
||||
return this.form.type === 2 ? this.symbolGroups : this.symbol.symbolList
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'inForm.cover_type'(newValue) {
|
||||
if (newValue === 3) {
|
||||
this.inForm.symbol = undefined
|
||||
this.getSymbol({})
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getLineApiUserItems()
|
||||
this.getSymbolGroup()
|
||||
// 获取交易所字典数据
|
||||
this.getDicts('exchange_type').then(response => {
|
||||
this.exchangeTypes = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onChangeSymbolType() {
|
||||
if (this.inForm.symbol_type === 1) {
|
||||
this.inForm.cover_type = 0
|
||||
} else {
|
||||
this.inForm.cover_type = 0
|
||||
}
|
||||
this.inForm.symbol_group_id = undefined
|
||||
this.inForm.symbol = undefined
|
||||
this.getSymbol({})
|
||||
this.getSymbolGroup(this.inForm.symbol_type, this.inForm.exchange_type)
|
||||
},
|
||||
onchangePattern(init = true) {
|
||||
if (this.inForm.price_pattern === 'aicoin') {
|
||||
init && (this.inForm.price = '')
|
||||
init && (this.inForm.price_type = 'aicoin')
|
||||
this.aicoinPrice = undefined
|
||||
if (this.inForm.symbol) {
|
||||
aicoinSymbol({ symbol: this.inForm.symbol, symbolType: this.inForm.symbol_type }).then(res => {
|
||||
this.aicoins = res.data
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.inForm.price_type = this.inForm.price_pattern === 'percentage' ? 'new' : this.inForm.price_pattern
|
||||
// this.inForm.sign_price_type = newValue
|
||||
}
|
||||
},
|
||||
onchangeSymbol() {
|
||||
if (this.inForm.price_pattern === 'aicoin') {
|
||||
aicoinSymbol({ symbol: this.inForm.symbol, symbolType: this.inForm.symbol_type }).then(res => {
|
||||
this.aicoinPrice = undefined
|
||||
this.inForm.price = undefined
|
||||
this.aicoins = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
onchangeAicoin() {
|
||||
this.inForm.price = this.aicoinPrice
|
||||
},
|
||||
onAddExt(type, index) {
|
||||
if (type === 0) {
|
||||
this.inForm.ext.push({
|
||||
reducePriceRatio: undefined,
|
||||
reduceNumRatio: undefined,
|
||||
reduceTakeProfitRatio: undefined,
|
||||
reduceStopLossRatio: undefined,
|
||||
|
||||
takeProfitRatio: undefined,
|
||||
addPositionPriceRatio: undefined,
|
||||
addPositionOrderType: 'LIMIT',
|
||||
addPositionType: 1,
|
||||
addPositionVal: undefined
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.inForm.ext.splice(index, 1)
|
||||
},
|
||||
onchangeForm() {
|
||||
this.getListLineApiUser(this.inForm.exchange_type)
|
||||
this.getSymbol({}, this.inForm.symbol_type, this.inForm.exchange_type)
|
||||
this.getSymbolGroup(this.inForm.symbol_type, this.inForm.exchange_type)
|
||||
},
|
||||
onSelectAll() {
|
||||
if (this.inForm.api_id && this.inForm.api_id.length > 0) {
|
||||
this.inForm.api_id = []
|
||||
@ -543,23 +689,20 @@ export default {
|
||||
}
|
||||
this.inForm.api_id = this.userIdOptions.map(item => item.key)
|
||||
},
|
||||
onRadioInput() {
|
||||
if (this.inForm.order_type === '1') {
|
||||
this.inForm.cover_type = 1
|
||||
} else {
|
||||
this.inForm.cover_type = 2
|
||||
}
|
||||
this.inForm.symbol_group_id = undefined
|
||||
this.inForm.symbol = undefined
|
||||
this.getSymbol({})
|
||||
// 获取杠杆api用户
|
||||
getListLineApiUser(exchangeType) {
|
||||
listLineApiUser({ pageIndex: 1, pageSize: 999, exchangeType: exchangeType || this.inForm.exchange_type }).then(response => {
|
||||
this.lineUsers = response.data.list
|
||||
this.lineTotal = response.data.count
|
||||
})
|
||||
},
|
||||
// 交易对列表
|
||||
getSymbol(e, type) {
|
||||
getSymbol(e, type, exchangeType) {
|
||||
this.searchLoding = true
|
||||
const { pageIndex } = this.symbol
|
||||
const symbol = typeof e === 'object' ? '' : e
|
||||
const apiCall = this.form.type === 1 && ([1, 3].includes(this.inForm.cover_type)) ? getSameSymbol : listLineSymbol
|
||||
apiCall({ pageIndex, pageSize: 6, type: type || this.inForm.order_type, symbol }).then(res => {
|
||||
apiCall({ pageIndex, pageSize: 6, type: type || this.inForm.symbol_type, symbol, exchangeType: exchangeType || this.inForm.exchange_type }).then(res => {
|
||||
this.symbol.total = res.data.count
|
||||
this.symbol.symbolList = res.data.list
|
||||
}).finally(() => {
|
||||
@ -567,8 +710,8 @@ export default {
|
||||
})
|
||||
},
|
||||
// 获取交易对组
|
||||
getSymbolGroup() {
|
||||
listLineSymbolGroup({ pageIndex: 1, pageSize: 999, beginTime: undefined, endTime: undefined }).then(res => {
|
||||
getSymbolGroup(type = 2, exchangeType) {
|
||||
listLineSymbolGroup({ pageIndex: 1, pageSize: 999, beginTime: undefined, endTime: undefined, type, exchangeType: exchangeType || this.inForm.exchange_type }).then(res => {
|
||||
this.symbolGroups = res.data.list
|
||||
})
|
||||
},
|
||||
@ -678,7 +821,9 @@ export default {
|
||||
this.form = response.data
|
||||
const x = JSON.parse(response.data.params)
|
||||
this.inForm = { ...x, api_id: x.api_id.split(','), symbol_group_id: x.symbol_group_id ? Number(x.symbol_group_id) : undefined }
|
||||
this.getSymbol(undefined, x.order_type)
|
||||
// this.getSymbol(undefined, x.symbol_type, x.exchange_type)
|
||||
this.onchangePattern(false)
|
||||
this.form.type === 2 && this.getSymbolGroup(this.inForm.symbol_type)
|
||||
this.open = true
|
||||
this.title = '修改委托下单模板'
|
||||
this.isEdit = true
|
||||
@ -786,4 +931,11 @@ export default {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.exts{
|
||||
font-size: 13px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ebebeb;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="对标价类型" prop="signPriceType"><el-select
|
||||
<!-- <el-form-item label="对标价类型" prop="signPriceType"><el-select
|
||||
v-model="queryParams.signPriceType"
|
||||
placeholder="请选择对标价类型"
|
||||
clearable
|
||||
@ -47,7 +47,7 @@
|
||||
:value="dict.v"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="购买方向" prop="site"><el-select
|
||||
v-model="queryParams.site"
|
||||
placeholder="请选择购买方向"
|
||||
@ -238,6 +238,7 @@
|
||||
>
|
||||
<template #default="{row}">
|
||||
<span v-if="row.pid===0">({{ row.child_num }})</span>
|
||||
<span v-else-if="row.child_num">({{ row.child_num }})</span>
|
||||
<span>{{ row.symbol }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -305,7 +306,7 @@
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<template #default="{row}">
|
||||
{{ orderTypes[row.orderType-1] ? orderTypes[row.orderType-1].l : '' }}
|
||||
{{ orderTypes[row.orderType] ? orderTypes[row.orderType].l : '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -331,7 +332,7 @@
|
||||
prop="desc"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
label="对冲状态"
|
||||
align="center"
|
||||
prop="status"
|
||||
@ -352,7 +353,7 @@
|
||||
<template #default="{row}">
|
||||
<el-tag v-if="row.pid===0" size="mini" :type="row.addPositionStatus===1?'success':'danger'">{{ ['未加仓','已加仓'][row.addPositionStatus] }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
label="计价货币"
|
||||
align="center"
|
||||
@ -1022,18 +1023,11 @@ export default {
|
||||
],
|
||||
// :1=现货;2=合约;3=合约止盈;4=合约止损;5=现货止盈;6=现货止损;7=止损补仓;8=现货加仓;9=现货平仓;10 = 合约止损补仓,11=合约加仓;12=合约平仓
|
||||
orderTypes: [
|
||||
{ v: 1, l: '现货' },
|
||||
{ v: 2, l: '合约' },
|
||||
{ v: 3, l: '合约止盈' },
|
||||
{ v: 4, l: '合约亏损' },
|
||||
{ v: 5, l: '现货止盈' },
|
||||
{ v: 6, l: '现货亏损' },
|
||||
{ v: 7, l: '现货对冲' },
|
||||
{ v: 8, l: '现货加仓' },
|
||||
{ v: 9, l: '现货平仓' },
|
||||
{ v: 10, l: '合约对冲' },
|
||||
{ v: 11, l: '合约加仓' },
|
||||
{ v: 12, l: '合约平仓' }
|
||||
{ v: 0, l: '主单' },
|
||||
{ v: 1, l: '止盈' },
|
||||
{ v: 2, l: '止损' },
|
||||
{ v: 3, l: '平仓' },
|
||||
{ v: 4, l: '减仓' }
|
||||
],
|
||||
buyer: [
|
||||
{ v: 'BUY', l: '买(多)' },
|
||||
@ -1044,17 +1038,13 @@ export default {
|
||||
{ v: 0, l: '待触发' },
|
||||
{ v: 1, l: '已触发' },
|
||||
{ v: 2, l: '下单失败' },
|
||||
{ v: 3, l: '已记录' },
|
||||
{ v: 3, l: '未知' },
|
||||
{ v: 4, l: '已取消' },
|
||||
{ v: 5, l: '委托中' },
|
||||
{ v: 6, l: '已平仓' },
|
||||
{ v: 7, l: '已补单' },
|
||||
{ v: 8, l: '补单失败' },
|
||||
{ v: 9, l: '现货已成交' },
|
||||
{ v: 10, l: '合约已补单' },
|
||||
{ v: 11, l: '合约补单失败' },
|
||||
{ v: 12, l: '合约已成交' },
|
||||
{ v: 13, l: '已开仓' }
|
||||
{ v: 6, l: '已成交' },
|
||||
{ v: 7, l: '未知' },
|
||||
{ v: 8, l: '未知' },
|
||||
{ v: 9, l: '已平仓' }
|
||||
],
|
||||
statuss: [
|
||||
{ v: '0', l: '待触发' },
|
||||
@ -1280,43 +1270,44 @@ export default {
|
||||
}
|
||||
},
|
||||
onExpand(row, expanded) {
|
||||
const { symbol, id } = row
|
||||
// const { symbol, id } = row
|
||||
|
||||
// 查询后更新数据
|
||||
if (Object.keys(row).length > 0) {
|
||||
for (const x in this.cacheRefresh) {
|
||||
// 当前的刷新
|
||||
if (`${row.symbol}${row.id}` === x) {
|
||||
const curr = this.cacheRefresh[`${symbol}${id}`]
|
||||
curr.expandCount++
|
||||
// 如果是展开状态,且展开次数大于1,且上一次的状态为折叠,则请求api数据,不需要更新子菜单
|
||||
if (expanded && curr.expandCount > 1 && !curr.prevStatus) {
|
||||
getChildOrder({ id }).then(res => {
|
||||
curr.resolve(res.data)
|
||||
}).finally(() => {})
|
||||
}
|
||||
curr.expandCount = 1
|
||||
curr.prevStatus = expanded
|
||||
} else {
|
||||
if (this.cacheRefresh[x].prevStatus) {
|
||||
const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
this.cacheRefresh[x].expandCount = 0
|
||||
this.cacheRefresh[x].prevStatus = false
|
||||
this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 查询后更新数据
|
||||
// if (Object.keys(row).length > 0) {
|
||||
// for (const x in this.cacheRefresh) {
|
||||
// // 当前的刷新
|
||||
// if (`${row.symbol}${row.id}` === x) {
|
||||
// const curr = this.cacheRefresh[`${symbol}${id}`]
|
||||
// curr.expandCount++
|
||||
// // 如果是展开状态,且展开次数大于1,且上一次的状态为折叠,则请求api数据,不需要更新子菜单
|
||||
// if (expanded && curr.expandCount > 1 && !curr.prevStatus) {
|
||||
// getChildOrder({ id }).then(res => {
|
||||
// curr.resolve(res.data)
|
||||
// }).finally(() => {})
|
||||
// }
|
||||
// curr.expandCount = 1
|
||||
// curr.prevStatus = expanded
|
||||
// } else {
|
||||
// if (this.cacheRefresh[x].prevStatus) {
|
||||
// const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
// this.cacheRefresh[x].expandCount = 0
|
||||
// this.cacheRefresh[x].prevStatus = false
|
||||
// this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
// 获取子数据
|
||||
onLoadChild(tree, treeNode, resolve) {
|
||||
const { symbol, id } = tree
|
||||
this.currentExpandId = tree.id
|
||||
this.cacheRefresh[`${symbol}${id}`] = {}
|
||||
this.cacheRefresh[`${symbol}${id}`].resolve = resolve
|
||||
this.cacheRefresh[`${symbol}${id}`].expandCount = 0
|
||||
const { id } = tree
|
||||
// this.currentExpandId = tree.id
|
||||
// this.cacheRefresh[`${symbol}${id}`] = {}
|
||||
// this.cacheRefresh[`${symbol}${id}`].resolve = resolve
|
||||
// this.cacheRefresh[`${symbol}${id}`].expandCount = 0
|
||||
getChildOrder({ id }).then(res => {
|
||||
resolve(res.data)
|
||||
const r = res.data.map((item) => ({ ...item, hasChildren: item.child_num > 0 }))
|
||||
resolve(r)
|
||||
}).finally(() => {})
|
||||
},
|
||||
/** 查询参数列表 */
|
||||
@ -1326,13 +1317,13 @@ export default {
|
||||
this.linePreOrderList = response.data.list.map(item => ({ ...item, hasChildren: true }))
|
||||
this.total = response.data.count
|
||||
// 查询后更新数据
|
||||
for (const x in this.cacheRefresh) {
|
||||
const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
if (flag !== -1 && this.cacheRefresh[x].prevStatus) {
|
||||
this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], true)
|
||||
}
|
||||
}
|
||||
// for (const x in this.cacheRefresh) {
|
||||
// const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
// if (flag !== -1 && this.cacheRefresh[x].prevStatus) {
|
||||
// this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
// this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], true)
|
||||
// }
|
||||
// }
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="对标价类型" prop="signPriceType"><el-select
|
||||
<!-- <el-form-item label="对标价类型" prop="signPriceType"><el-select
|
||||
v-model="queryParams.signPriceType"
|
||||
placeholder="请选择对标价类型"
|
||||
clearable
|
||||
@ -48,7 +48,7 @@
|
||||
:value="dict.v"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="购买方向" prop="site"><el-select
|
||||
v-model="queryParams.site"
|
||||
placeholder="请选择购买方向"
|
||||
@ -241,6 +241,7 @@
|
||||
>
|
||||
<template #default="{row}">
|
||||
<span v-if="row.pid===0">({{ row.child_num }})</span>
|
||||
<span v-else-if="row.child_num">({{ row.child_num }})</span>
|
||||
<span>{{ row.symbol }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -264,7 +265,7 @@
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ {new:'最新价',mixture:'标记价'}[row.signPriceType] }}
|
||||
{{ {new:'最新价',mixture:'标记价',aicoin:'aicoin'}[row.signPriceType] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -480,8 +481,8 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" style="height: 600px;overflow: hidden auto;">
|
||||
<el-dialog :title="title" :visible.sync="open" width="1200px" :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="180px" style="height: 600px;overflow: hidden auto;">
|
||||
<el-form-item label="交易所" prop="exchange_type">
|
||||
<el-select
|
||||
v-model="form.exchange_type"
|
||||
@ -490,6 +491,7 @@
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
@change="onchangeForm"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in exchangeTypes"
|
||||
@ -505,14 +507,14 @@
|
||||
<el-radio :label="2">合约</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="对冲类型" prop="cover_type">
|
||||
<!-- <el-form-item label="对冲类型" prop="cover_type">
|
||||
<el-radio-group v-model="form.cover_type">
|
||||
<el-radio :label="0">无对冲</el-radio>
|
||||
<el-radio :label="1" :disabled="form.symbol_type==2">现货对合约</el-radio>
|
||||
<el-radio :label="2" :disabled="form.symbol_type==1">合约对合约</el-radio>
|
||||
<!-- <el-radio :label="3" :disabled="form.symbol_type==1">合约对现货</el-radio> -->
|
||||
<el-radio :label="3" :disabled="form.symbol_type==1">合约对现货</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="api用户" prop="api_id">
|
||||
<el-row>
|
||||
<el-col :span="21">
|
||||
@ -573,6 +575,7 @@
|
||||
:loading="searchLoding"
|
||||
remote
|
||||
size="small"
|
||||
@change="onchangeSymbol"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in comSymbols"
|
||||
@ -609,6 +612,7 @@
|
||||
<el-radio-group v-model="form.price_pattern">
|
||||
<el-radio label="percentage">百分比</el-radio>
|
||||
<el-radio label="mixture" :disabled="title==='批量添加'">主单实价委托百分比</el-radio>
|
||||
<el-radio label="aicoin" :disabled="title==='批量添加'">aiCoin买入点</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.price_pattern === 'percentage'" label="下单百分比" prop="price">
|
||||
@ -623,7 +627,16 @@
|
||||
<el-input
|
||||
v-model="form.price"
|
||||
placeholder="下单价(实际价格)"
|
||||
/>
|
||||
>
|
||||
<template #prepend>
|
||||
<el-select v-if="form.price_pattern === 'aicoin'" v-model="aicoinPrice" placeholder="请选择" style="width: 150px;" @change="onchangeAicoin">
|
||||
<el-option v-for="o in options" :key="o.label" :label="o.label" :value="aicoins[o.value]">
|
||||
<span style="float: left">{{ o.label }}</span>
|
||||
<span style="float: right">{{ aicoins[o.value] || 0 }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
@ -641,13 +654,13 @@
|
||||
placeholder="止盈百分比"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="亏损百分比" prop="stop_price">
|
||||
<!-- <el-form-item label="亏损百分比" prop="stop_price">
|
||||
<el-input
|
||||
v-model="form.stop_price"
|
||||
placeholder="亏损百分比"
|
||||
/>
|
||||
</el-form-item>
|
||||
<template v-if="form.cover_type!=0">
|
||||
</el-form-item> -->
|
||||
<!-- <template v-if="form.cover_type!=0">
|
||||
<el-form-item label="对冲单购买类型" prop="hedge_buy_type">
|
||||
<el-radio-group v-model="form.hedge_buy_type">
|
||||
<el-radio :label="1">百分比</el-radio>
|
||||
@ -676,7 +689,7 @@
|
||||
"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</template> -->
|
||||
<!-- <el-form-item label="对冲百分比" prop="cover_rate">
|
||||
<el-input
|
||||
v-model="form.cover_rate"
|
||||
@ -708,12 +721,12 @@
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="对冲单下单类型" prop="hedge_order_type">
|
||||
<!-- <el-form-item label="对冲单下单类型" prop="hedge_order_type">
|
||||
<el-radio-group v-model="form.hedge_order_type">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="加仓主单类型" prop="add_position_main_type">
|
||||
<el-radio-group v-model="form.add_position_main_type">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
@ -729,7 +742,8 @@
|
||||
<el-form-item label="对标价类型" prop="price_type">
|
||||
<el-radio-group v-model="form.price_type">
|
||||
<el-radio label="new">最新价</el-radio>
|
||||
<el-radio label="mixture">标记价</el-radio>
|
||||
<el-radio label="mixture" :disabled="title==='批量添加'">标记价</el-radio>
|
||||
<el-radio label="aicoin" :disabled="title==='批量添加'">aicoin</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单过期时间" prop="profit_rate">
|
||||
@ -756,6 +770,50 @@
|
||||
<el-radio label="0">直接执行</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓价格百分比" prop="reduce_price">
|
||||
<el-input v-model.number="form.reduce_price" type="number" placeholder="主单减仓价格百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓数量百分比" prop="reduce_num">
|
||||
<el-input v-model.number="form.reduce_num" type="number" placeholder="主单减仓数量百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓后止盈价百分比" prop="reduce_take_profit">
|
||||
<el-input v-model.number="form.reduce_take_profit" type="number" placeholder="主单减仓后止盈价百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主单减仓后止损价百分比" prop="reduce_stop_price">
|
||||
<el-input v-model.number="form.reduce_stop_price" type="number" placeholder="主单减仓后止损价百分比" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="4"><el-form-item label="主单加仓配置" /></el-col>
|
||||
<el-col :span="20"><el-button type="primary" size="mini" @click="onAddExt(0)">新增</el-button></el-col>
|
||||
</el-row>
|
||||
<div v-for="(item,index) in form.ext" :key="index" class="exts">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓类型</div>
|
||||
<el-radio-group v-model="item.addPositionOrderType" size="mini">
|
||||
<el-radio label="LIMIT">限价</el-radio>
|
||||
<el-radio label="MARKET">市价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<div style="margin-bottom: 8px;">加仓方式</div>
|
||||
<el-radio-group v-model="item.addPositionType" size="mini">
|
||||
<el-radio :label="1">百分比</el-radio>
|
||||
<el-radio :label="0">实际金额</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="5">加仓数值<el-input v-model.number="item.addPositionVal" size="mini" type="number" placeholder="加仓数值" /></el-col>
|
||||
<el-col :span="5">加仓价格百分比<el-input v-model.number="item.addPositionPriceRatio" size="mini" type="number" placeholder="加仓价格百分比" /></el-col>
|
||||
<el-col :span="4">加仓后止盈百分比<el-input v-model.number="item.takeProfitRatio" size="mini" type="number" placeholder="止盈百分比" /></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="margin-top: 10px;">
|
||||
<el-col :span="5">减仓价格百分比<el-input v-model.number="item.reducePriceRatio" size="mini" type="number" placeholder="减仓价格百分比" /></el-col>
|
||||
<el-col :span="5">减仓数量百分比<el-input v-model.number="item.reduceNumRatio" size="mini" type="number" placeholder="减仓数量百分比" /></el-col>
|
||||
<el-col :span="5">减仓后止盈百分比<el-input v-model.number="item.reduceTakeProfitRatio" size="mini" type="number" placeholder="减仓后止盈百分比" /></el-col>
|
||||
<el-col :span="5">减仓后止损百分比<el-input v-model.number="item.reduceStopLossRatio" size="mini" type="number" placeholder="减仓后止损百分比" /></el-col>
|
||||
<el-col :span="4"><div style="margin-bottom: 14px;" /><el-button size="mini" type="danger" @click="onAddExt(1,index)">删除</el-button></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-form-item label="是否保存模板" prop="save_template">
|
||||
<el-radio-group v-model="form.save_template">
|
||||
<el-radio label="0">否</el-radio>
|
||||
@ -1027,9 +1085,9 @@
|
||||
<!-- 平仓 -->
|
||||
<el-dialog title="平仓" :visible.sync="positionOpen" width="700px" :close-on-click-modal="false">
|
||||
<el-form ref="formPosition" :model="positionForm" :rules="positionRules" label-width="120px">
|
||||
<el-form-item label="交易所" prop="exchangeType">
|
||||
<el-form-item label="交易所" prop="exchange_type">
|
||||
<el-select
|
||||
v-model="positionForm.exchangeType"
|
||||
v-model="positionForm.exchange_type"
|
||||
style="width: 100%;"
|
||||
placeholder="请选择交易所"
|
||||
clearable
|
||||
@ -1046,7 +1104,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单类型" prop="close_type">
|
||||
<el-radio-group v-model="positionForm.close_type">
|
||||
<el-radio-group v-model="positionForm.close_type" @change="onChangePosition">
|
||||
<el-radio :label="1">现货</el-radio>
|
||||
<el-radio :label="2">合约</el-radio>
|
||||
</el-radio-group>
|
||||
@ -1086,7 +1144,7 @@
|
||||
placeholder="请选择交易对"
|
||||
clearable
|
||||
filterable
|
||||
:remote-method="(e)=>getSymbol(e,positionForm.close_type,positionForm.exchangeType)"
|
||||
:remote-method="(e)=>getSymbol(e,positionForm.close_type,positionForm.exchange_type)"
|
||||
:loading="searchLoding"
|
||||
remote
|
||||
size="small"
|
||||
@ -1105,7 +1163,7 @@
|
||||
layout="prev, pager, next"
|
||||
:page.sync="symbol.pageIndex"
|
||||
:limit.sync="symbol.pageSize"
|
||||
@pagination="getSymbol($event,positionForm.close_type,positionForm.exchangeType)"
|
||||
@pagination="getSymbol($event,positionForm.close_type,positionForm.exchange_type)"
|
||||
/>
|
||||
</div>
|
||||
</el-select>
|
||||
@ -1179,7 +1237,7 @@
|
||||
|
||||
<script>
|
||||
import { listLineSymbol, getSameSymbol } from '@/api/admin/line-symbol'
|
||||
import { clearUnTriggered, clearAll, closePosition, manuallyCover, orderMarginType, orderLever, batchAddOrder, addOrder, delLinePreOrder, getLinePreOrder, listLinePreOrder, updateLinePreOrder, getChildOrder, cancelOpenOrder } from '@/api/admin/line-pre-order'
|
||||
import { aicoinSymbol, clearUnTriggered, clearAll, closePosition, manuallyCover, orderMarginType, orderLever, batchAddOrder, addOrder, delLinePreOrder, getLinePreOrder, listLinePreOrder, updateLinePreOrder, getChildOrder, cancelOpenOrder } from '@/api/admin/line-pre-order'
|
||||
import { getMainUser, listLineApiUser } from '@/api/admin/line-api-user'
|
||||
import { listLineSymbolGroup } from '@/api/admin/line-symbol-group'
|
||||
export default {
|
||||
@ -1197,10 +1255,11 @@ export default {
|
||||
],
|
||||
// :1=现货;2=合约;3=合约止盈;4=合约止损;5=现货止盈;6=现货止损;7=止损补仓;8=现货加仓;9=现货平仓;10 = 合约止损补仓,11=合约加仓;12=合约平仓
|
||||
orderTypes: [
|
||||
{ v: 1, l: '主单' },
|
||||
{ v: 2, l: '止盈' },
|
||||
{ v: 3, l: '止损' },
|
||||
{ v: 4, l: '平仓' }
|
||||
{ v: 0, l: '主单' },
|
||||
{ v: 1, l: '止盈' },
|
||||
{ v: 2, l: '止损' },
|
||||
{ v: 3, l: '平仓' },
|
||||
{ v: 4, l: '减仓' }
|
||||
// { v: 1, l: '现货' },
|
||||
// { v: 2, l: '合约' },
|
||||
// { v: 3, l: '合约止盈' },
|
||||
@ -1256,6 +1315,14 @@ export default {
|
||||
{ v: '12', l: '合约已成交' },
|
||||
{ v: '13', l: '已开仓' }
|
||||
],
|
||||
options: [
|
||||
{ label: '买入点1', value: 'buyPoint1' },
|
||||
{ label: '买入点2', value: 'buyPoint2' },
|
||||
{ label: '买入点3', value: 'buyPoint3' },
|
||||
{ label: '卖出点1', value: 'sellPoint1' },
|
||||
{ label: '卖出点2', value: 'sellPoint2' },
|
||||
{ label: '卖出点3', value: 'sellPoint3' }
|
||||
],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@ -1357,7 +1424,9 @@ export default {
|
||||
order_sn: undefined
|
||||
},
|
||||
btnLoading: false,
|
||||
exchangeTypes: []
|
||||
exchangeTypes: [],
|
||||
aicoins: {},
|
||||
aicoinPrice: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -1382,26 +1451,34 @@ export default {
|
||||
watch: {
|
||||
'form.symbol_type'(newValue) {
|
||||
if (newValue === 1) {
|
||||
this.form.cover_type = 1
|
||||
this.form.cover_type = 0
|
||||
} else {
|
||||
this.form.cover_type = 2
|
||||
this.form.cover_type = 0
|
||||
}
|
||||
this.form.symbol_group_id = undefined
|
||||
this.form.symbol = undefined
|
||||
this.getSymbol({})
|
||||
this.getSymbolGroup(this.form.cover_type, this.form.exchange_type)
|
||||
},
|
||||
'form.cover_type'(newValue) {
|
||||
if (newValue === 3) {
|
||||
this.form.symbol = undefined
|
||||
this.getSymbol({})
|
||||
}
|
||||
this.getSymbolGroup(this.form.symbol_type, this.form.exchange_type)
|
||||
},
|
||||
// 'form.cover_type'(newValue) {
|
||||
// if (newValue === 3) {
|
||||
// this.form.symbol = undefined
|
||||
// this.getSymbol({})
|
||||
// }
|
||||
// },
|
||||
'form.price_pattern'(newValue) {
|
||||
if (newValue === 'mixture') {
|
||||
this.form.sign_price_type = newValue
|
||||
if (newValue === 'aicoin') {
|
||||
this.aicoinPrice = undefined
|
||||
this.form.price = undefined
|
||||
this.form.price_type = 'aicoin'
|
||||
if (this.form.symbol) {
|
||||
aicoinSymbol({ symbol: this.form.symbol, symbolType: this.form.symbol_type }).then(res => {
|
||||
this.aicoins = res.data
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.form.sign_price_type = 'new'
|
||||
this.form.price_type = newValue === 'percentage' ? 'new' : newValue
|
||||
this.form.sign_price_type = newValue
|
||||
}
|
||||
},
|
||||
'storeForm.symbol_type'(newValue) {
|
||||
@ -1424,13 +1501,43 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onchangeSymbol() {
|
||||
if (this.form.price_pattern === 'aicoin') {
|
||||
aicoinSymbol({ symbol: this.form.symbol, symbolType: this.form.symbol_type }).then(res => {
|
||||
this.aicoinPrice = undefined
|
||||
this.form.price = undefined
|
||||
this.aicoins = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
onchangeAicoin() {
|
||||
this.form.price = this.aicoinPrice
|
||||
},
|
||||
onAddExt(type, index) {
|
||||
if (type === 0) {
|
||||
this.form.ext.push({
|
||||
reducePriceRatio: undefined,
|
||||
reduceNumRatio: undefined,
|
||||
reduceTakeProfitRatio: undefined,
|
||||
reduceStopLossRatio: undefined,
|
||||
|
||||
takeProfitRatio: undefined,
|
||||
addPositionPriceRatio: undefined,
|
||||
addPositionOrderType: 'LIMIT',
|
||||
addPositionType: 1,
|
||||
addPositionVal: undefined
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.form.ext.splice(index, 1)
|
||||
},
|
||||
exchangeTypeFormat(row) {
|
||||
return this.selectDictLabel(this.exchangeTypes || [], row.exchangeType)
|
||||
},
|
||||
onChangePosition() {
|
||||
this.getLineApiUserItems(this.positionForm.exchangeType)
|
||||
this.getLineApiUserItems(this.positionForm.exchange_type)
|
||||
this.$set(this.positionForm, 'symbol', undefined)
|
||||
this.getSymbol({}, this.positionForm.close_type, this.positionForm.exchangeType)
|
||||
this.getSymbol({}, this.positionForm.close_type, this.positionForm.exchange_type)
|
||||
},
|
||||
onChangeCancel() {
|
||||
this.cancelForm.api_id = undefined
|
||||
@ -1441,6 +1548,11 @@ export default {
|
||||
this.getSymbol({}, 2, this.modeForm.exchangeType)
|
||||
this.getSymbolGroup(2, this.modeForm.exchangeType)
|
||||
},
|
||||
onchangeForm() {
|
||||
this.getListLineApiUser(this.form.exchange_type)
|
||||
this.getSymbol({}, this.form.symbol_type, this.form.exchange_type)
|
||||
this.getSymbolGroup(this.form.symbol_type, this.form.exchange_type)
|
||||
},
|
||||
onSelectAll() {
|
||||
if (this.form.api_id && this.form.api_id.length > 0) {
|
||||
this.form.api_id = []
|
||||
@ -1468,7 +1580,7 @@ export default {
|
||||
const { pageIndex } = this.symbol
|
||||
const symbol = typeof e === 'object' ? '' : e
|
||||
const apiCall = this.title === '添加委托管理' && ([1, 3].includes(this.form.cover_type)) ? getSameSymbol : listLineSymbol
|
||||
apiCall({ pageIndex, pageSize: 6, type: type || this.form.order_type, symbol, exchangeType: exchangeType || this.form.exchange_type }).then(res => {
|
||||
apiCall({ pageIndex, pageSize: 6, type: type || this.form.symbol_type, symbol, exchangeType: exchangeType || this.form.exchange_type }).then(res => {
|
||||
this.symbol.total = res.data.count
|
||||
this.symbol.symbolList = res.data.list
|
||||
}).finally(() => {
|
||||
@ -1493,7 +1605,6 @@ export default {
|
||||
res = (1 + (this.percenter / 100)) * Number(this.form.price)
|
||||
}
|
||||
const [num, decimal] = String(res).split('.')
|
||||
console.log(num, decimal, '?')
|
||||
if (decimal) {
|
||||
this.form.price = decimal.length > 4 ? `${num}.${decimal.substring(0, 4)}` : res
|
||||
} else {
|
||||
@ -1501,43 +1612,45 @@ export default {
|
||||
}
|
||||
},
|
||||
onExpand(row, expanded) {
|
||||
const { symbol, id } = row
|
||||
// const { symbol, id } = row
|
||||
|
||||
// 查询后更新数据
|
||||
if (Object.keys(row).length > 0) {
|
||||
for (const x in this.cacheRefresh) {
|
||||
// 当前的刷新
|
||||
if (`${row.symbol}${row.id}` === x) {
|
||||
const curr = this.cacheRefresh[`${symbol}${id}`]
|
||||
curr.expandCount++
|
||||
// 如果是展开状态,且展开次数大于1,且上一次的状态为折叠,则请求api数据,不需要更新子菜单
|
||||
if (expanded && curr.expandCount > 1 && !curr.prevStatus) {
|
||||
getChildOrder({ id }).then(res => {
|
||||
curr.resolve(res.data)
|
||||
}).finally(() => {})
|
||||
}
|
||||
curr.expandCount = 1
|
||||
curr.prevStatus = expanded
|
||||
} else {
|
||||
if (this.cacheRefresh[x].prevStatus) {
|
||||
const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
this.cacheRefresh[x].expandCount = 0
|
||||
this.cacheRefresh[x].prevStatus = false
|
||||
this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 查询后更新数据
|
||||
// if (Object.keys(row).length > 0) {
|
||||
// for (const x in this.cacheRefresh) {
|
||||
// // 当前的刷新
|
||||
// if (`${row.symbol}${row.id}` === x) {
|
||||
// const curr = this.cacheRefresh[`${symbol}${id}`]
|
||||
// curr.expandCount++
|
||||
// // 如果是展开状态,且展开次数大于1,且上一次的状态为折叠,则请求api数据,不需要更新子菜单
|
||||
// if (expanded && curr.expandCount > 1 && !curr.prevStatus) {
|
||||
// getChildOrder({ id }).then(res => {
|
||||
// const r = res.data.map((item) => ({...item,hasChildren: item.child_num>0}))
|
||||
// curr.resolve(r)
|
||||
// }).finally(() => {})
|
||||
// }
|
||||
// curr.expandCount = 1
|
||||
// curr.prevStatus = expanded
|
||||
// } else {
|
||||
// if (this.cacheRefresh[x].prevStatus) {
|
||||
// const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
// this.cacheRefresh[x].expandCount = 0
|
||||
// this.cacheRefresh[x].prevStatus = false
|
||||
// this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
// 获取子数据
|
||||
onLoadChild(tree, treeNode, resolve) {
|
||||
const { symbol, id } = tree
|
||||
this.currentExpandId = tree.id
|
||||
this.cacheRefresh[`${symbol}${id}`] = {}
|
||||
this.cacheRefresh[`${symbol}${id}`].resolve = resolve
|
||||
this.cacheRefresh[`${symbol}${id}`].expandCount = 0
|
||||
const { id } = tree
|
||||
// this.currentExpandId = tree.id
|
||||
// this.cacheRefresh[`${symbol}${id}`] = {}
|
||||
// this.cacheRefresh[`${symbol}${id}`].resolve = resolve
|
||||
// this.cacheRefresh[`${symbol}${id}`].expandCount = 0
|
||||
getChildOrder({ id }).then(res => {
|
||||
resolve(res.data)
|
||||
const r = res.data.map((item) => ({ ...item, hasChildren: item.child_num > 0 }))
|
||||
resolve(r)
|
||||
}).finally(() => {})
|
||||
},
|
||||
/** 查询参数列表 */
|
||||
@ -1547,33 +1660,34 @@ export default {
|
||||
this.linePreOrderList = response.data.list.map(item => ({ ...item, hasChildren: true }))
|
||||
this.total = response.data.count
|
||||
// 查询后更新数据
|
||||
for (const x in this.cacheRefresh) {
|
||||
const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
if (flag !== -1 && this.cacheRefresh[x].prevStatus) {
|
||||
this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], true)
|
||||
}
|
||||
}
|
||||
// for (const x in this.cacheRefresh) {
|
||||
// const flag = this.linePreOrderList.findIndex(item => `${item.symbol}${item.id}` === x)
|
||||
// if (flag !== -1 && this.cacheRefresh[x].prevStatus) {
|
||||
// this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], false)
|
||||
// this.$refs.table && this.$refs.table.toggleRowExpansion(this.linePreOrderList[flag], true)
|
||||
// }
|
||||
// }
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
onPosition() {
|
||||
this.title = ''
|
||||
this.resetForm('formPosition')
|
||||
this.positionForm = {
|
||||
exchangeType: this.exchangeTypes.length ? this.exchangeTypes[0].value : '',
|
||||
exchange_type: this.exchangeTypes.length ? this.exchangeTypes[0].value : '',
|
||||
api_id: undefined,
|
||||
symbol: undefined,
|
||||
rate: '0',
|
||||
close_type: 1
|
||||
}
|
||||
this.resetForm('formPosition')
|
||||
this.getSymbol({}, 1)
|
||||
this.getLineApiUserItems(this.positionForm.exchange_type)
|
||||
this.positionOpen = true
|
||||
},
|
||||
positionCancel() {
|
||||
this.positionOpen = false
|
||||
this.positionForm = {
|
||||
exchangeType: this.exchangeTypes.length ? this.exchangeTypes[0].value : '',
|
||||
exchange_type: this.exchangeTypes.length ? this.exchangeTypes[0].value : '',
|
||||
api_id: undefined,
|
||||
symbol: undefined,
|
||||
rate: '0',
|
||||
@ -1741,6 +1855,7 @@ export default {
|
||||
close_type: undefined,
|
||||
direction: undefined,
|
||||
|
||||
ext: [],
|
||||
symbol_type: 1,
|
||||
hedge_buy_type: 1,
|
||||
HedgeBuyTotal: undefined,
|
||||
@ -1757,7 +1872,7 @@ export default {
|
||||
hedge_close_count: 0,
|
||||
expire_hour: 4,
|
||||
profit_rate: '',
|
||||
cover_type: 1,
|
||||
cover_type: 0,
|
||||
price_pattern: 'percentage',
|
||||
profit: '',
|
||||
stop_price: '',
|
||||
@ -1875,6 +1990,8 @@ export default {
|
||||
this.cancelOpen = true
|
||||
this.$refs.formCancel?.resetFields()
|
||||
this.cancelForm.exchangeType = this.exchangeTypes.length ? this.exchangeTypes[0].value : ''
|
||||
// 获取用户
|
||||
this.getLineApiUserItems(this.cancelForm.exchangeType)
|
||||
},
|
||||
handleCancel(row) {
|
||||
if (typeof row === 'string') {
|
||||
@ -1993,4 +2110,11 @@ export default {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
}
|
||||
.exts{
|
||||
font-size: 13px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ebebeb;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -5,15 +5,20 @@
|
||||
<el-card class="box-card">
|
||||
<el-table ref="table" v-loading="loading" :data="linePreOrderList">
|
||||
<el-table-column
|
||||
label="副账号限价对冲溢价买入百分比"
|
||||
align="center"
|
||||
prop="coverOrderTypeBRate"
|
||||
/>
|
||||
<el-table-column
|
||||
label="止损溢价百分比"
|
||||
label="限价止损溢价"
|
||||
align="center"
|
||||
prop="stopLossPremium"
|
||||
/>
|
||||
<el-table-column
|
||||
label="限价加仓溢价"
|
||||
align="center"
|
||||
prop="addPositionPremium"
|
||||
/>
|
||||
<el-table-column
|
||||
label="限价减仓溢价"
|
||||
align="center"
|
||||
prop="reducePremium"
|
||||
/>
|
||||
<!-- <el-table-column
|
||||
label="主账号加仓溢价百分比"
|
||||
align="center"
|
||||
@ -128,12 +133,15 @@
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" style="height: 600px;overflow: hidden auto;">
|
||||
<el-form-item label="副账号限价对冲溢价买入百分比" prop="coverOrderTypeBRate">
|
||||
<el-input v-model="form.coverOrderTypeBRate" placeholder="副账号限价对冲溢价买入百分比" />
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="限价止损溢价" prop="stopLossPremium">
|
||||
<el-input v-model="form.stopLossPremium" placeholder="限价止损溢价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="止损溢价百分比" prop="stopLossPremium">
|
||||
<el-input v-model="form.stopLossPremium" placeholder="止损溢价百分比" />
|
||||
<el-form-item label="限价加仓溢价" prop="addPositionPremium">
|
||||
<el-input v-model="form.addPositionPremium" placeholder="限价加仓溢价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="限价减仓溢价" prop="reducePremium">
|
||||
<el-input v-model="form.reducePremium" placeholder="限价减仓溢价" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="主账号加仓溢价百分比" prop="scaleOrderTypeARate">
|
||||
<el-input v-model="form.scaleOrderTypeARate" placeholder="主账号限价加仓买入百分比" />
|
||||
@ -211,8 +219,9 @@ export default {
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
scaleOrderTypeARate: [{ required: true, message: '主账号限价加仓买入百分比不能为空', trigger: 'blur' }],
|
||||
stopLossPremium: [{ required: true, message: '止损溢价百分比', trigger: 'blur' }]
|
||||
stopLossPremium: [{ required: true, message: '限价止损溢价不能为空', trigger: 'blur' }],
|
||||
addPositionPremium: [{ required: true, message: '限价加仓溢价不能为空', trigger: 'blur' }],
|
||||
reducePremium: [{ required: true, message: '限价减仓溢价不能为空', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user