This commit is contained in:
shilin
2025-02-22 17:52:59 +08:00
parent 5a1aa1febf
commit 397d9ca52f
2 changed files with 13 additions and 15 deletions

View File

@ -323,7 +323,7 @@
/> />
</el-form-item> </el-form-item>
<el-row v-else type="flex"> <el-row v-else type="flex">
<el-col :span="12"> <el-col :span="14">
<el-form-item label="下单价(实际价格)" prop="price"> <el-form-item label="下单价(实际价格)" prop="price">
<el-input <el-input
v-model="inForm.price" v-model="inForm.price"
@ -331,19 +331,19 @@
> >
<template #prepend> <template #prepend>
<el-select v-if="inForm.price_pattern === 'aicoin'" v-model="aicoinPrice" placeholder="请选择" style="width: 150px;" @change="onchangeAicoin"> <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] || ''"> <el-option v-for="o in JSON.stringify(aicoins) !== '{}' ? options : []" :key="o.label" :label="o.label" :value="aicoins[o.value] || ''">
<span style="float: left">{{ o.label }}</span> <span style="float: left">{{ o.label }}</span>
<span style="float: right">{{ aicoins[o.value] || 0 }}</span> <span style="float: right">{{ aicoins[o.value] || 0 }}</span>
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
<template #append> <template #append>
<span v-if="inForm.price_pattern === 'mixture'">{{ comPrice }}</span> <span v-if="inForm.price_pattern !== 'percentage'">{{ comPrice }}</span>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="5">
<el-form-item label="计算百分比"> <el-form-item label="计算百分比">
<el-inputNumber v-model="percenter" controls-position="right" :min="0" style="width: 100px;" /> <el-inputNumber v-model="percenter" controls-position="right" :min="0" style="width: 100px;" />
</el-form-item> </el-form-item>
@ -631,7 +631,7 @@ export default {
// (this.form.price-?)/? *100 + '%' // (this.form.price-?)/? *100 + '%'
// 主单委托实际价下 获取交易对行情价 // 主单委托实际价下 获取交易对行情价
const { symbol, price, price_pattern } = this.inForm const { symbol, price, price_pattern } = this.inForm
if (symbol && price_pattern === 'mixture') { if (symbol && price_pattern !== 'percentage') {
const s = this.comSymbols.find(item => item.symbol === symbol) const s = this.comSymbols.find(item => item.symbol === symbol)
if (s) { if (s) {
const res = ((price - s.lastPrice) / s.lastPrice) * 100 const res = ((price - s.lastPrice) / s.lastPrice) * 100
@ -693,7 +693,7 @@ export default {
} }
}, },
onchangeAicoin() { onchangeAicoin() {
this.inForm.price = this.aicoinPrice this.inForm.price = this.aicoinPrice || 0
}, },
onAddExt(type, index) { onAddExt(type, index) {
if (type === 0) { if (type === 0) {
@ -864,9 +864,7 @@ export default {
this.form.type === 2 && this.getSymbolGroup(this.inForm.symbol_type) this.form.type === 2 && this.getSymbolGroup(this.inForm.symbol_type)
this.form.type === 1 && this.onCalculate() this.form.type === 1 && this.onCalculate()
// 获取交易对用于计算 // 获取交易对用于计算
if (this.inForm.price_pattern === 'mixture') { this.getSymbol(this.inForm.symbol)
this.getSymbol(this.inForm.symbol)
}
this.open = true this.open = true
this.title = '修改委托下单模板' this.title = '修改委托下单模板'
this.isEdit = true this.isEdit = true

View File

@ -654,7 +654,7 @@
/> />
</el-form-item> </el-form-item>
<el-row v-else type="flex"> <el-row v-else type="flex">
<el-col :span="12"> <el-col :span="14">
<el-form-item label="下单价(实际价格)" prop="price"> <el-form-item label="下单价(实际价格)" prop="price">
<el-input <el-input
v-model="form.price" v-model="form.price"
@ -662,19 +662,19 @@
> >
<template #prepend> <template #prepend>
<el-select v-if="form.price_pattern === 'aicoin'" v-model="aicoinPrice" placeholder="请选择" style="width: 150px;" @change="onchangeAicoin"> <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] || ''"> <el-option v-for="o in JSON.stringify(aicoins) !== '{}' ? options : []" :key="o.label" :label="o.label" :value="aicoins[o.value] || ''">
<span style="float: left">{{ o.label }}</span> <span style="float: left">{{ o.label }}</span>
<span style="float: right">{{ aicoins[o.value] || 0 }}</span> <span style="float: right">{{ aicoins[o.value] || 0 }}</span>
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
<template #append> <template #append>
<span v-if="form.price_pattern === 'mixture'">{{ comPrice }}</span> <span v-if="form.price_pattern !== 'percentage'">{{ comPrice }}</span>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="5">
<el-form-item label="计算百分比"> <el-form-item label="计算百分比">
<el-inputNumber v-model="percenter" controls-position="right" :min="0" style="width: 100px;" /> <el-inputNumber v-model="percenter" controls-position="right" :min="0" style="width: 100px;" />
</el-form-item> </el-form-item>
@ -1502,7 +1502,7 @@ export default {
// (this.form.price-?)/? *100 + '%' // (this.form.price-?)/? *100 + '%'
// 主单委托实际价下 获取交易对行情价 // 主单委托实际价下 获取交易对行情价
const { symbol, price, price_pattern } = this.form const { symbol, price, price_pattern } = this.form
if (symbol && price_pattern === 'mixture') { if (symbol && price_pattern !== 'percentage') {
const s = this.comSymbols.find(item => item.symbol === symbol) const s = this.comSymbols.find(item => item.symbol === symbol)
if (s) { if (s) {
const res = ((price - s.lastPrice) / s.lastPrice) * 100 const res = ((price - s.lastPrice) / s.lastPrice) * 100
@ -1582,7 +1582,7 @@ export default {
} }
}, },
onchangeAicoin() { onchangeAicoin() {
this.form.price = this.aicoinPrice this.form.price = this.aicoinPrice || 0
}, },
onAddExt(type, index) { onAddExt(type, index) {
if (type === 0) { if (type === 0) {