|
|
|
@ -90,15 +90,16 @@ |
|
|
|
<div class="input-group-prepend"> |
|
|
|
<span class="input-group-text">{{ $t("contract.e1") }}</span> |
|
|
|
</div> |
|
|
|
<!-- v-model="form.amount" --> |
|
|
|
<input |
|
|
|
type="number" |
|
|
|
v-model="form.amount" |
|
|
|
v-model="margin" |
|
|
|
class="form-control" |
|
|
|
:placeholder="tips" |
|
|
|
/> |
|
|
|
<div class="input-group-append"> |
|
|
|
<!-- <div class="input-group-append"> |
|
|
|
<span class="input-group-text">{{ $t("contract.e2") }}</span> |
|
|
|
</div> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
<div class="px-2" v-if="this.tab == 1"> |
|
|
|
<el-slider |
|
|
|
@ -113,7 +114,8 @@ |
|
|
|
<div v-if="tab == 1"> |
|
|
|
<div class="d-flex justify-content-between"> |
|
|
|
<div>{{ $t("contract.e3") }}:</div> |
|
|
|
<div>{{ margin }} USDT</div> |
|
|
|
<div>{{ amount }} {{$t("contract.e2")}}</div> |
|
|
|
<!-- <div>{{ margin }} USDT</div> --> |
|
|
|
</div> |
|
|
|
<div class="d-flex justify-content-between mb-4"> |
|
|
|
<div>{{ $t("contract.a3") }}:</div> |
|
|
|
@ -208,7 +210,7 @@ export default { |
|
|
|
// 1:限价 2:市价 |
|
|
|
type: 2, |
|
|
|
entrust_price: undefined, |
|
|
|
amount: "", |
|
|
|
amount:"", |
|
|
|
lever_rate: "" |
|
|
|
}, |
|
|
|
// 最多可开张数 |
|
|
|
@ -216,7 +218,8 @@ export default { |
|
|
|
lever_rage: [], |
|
|
|
accountInfo: {}, |
|
|
|
_time: null, |
|
|
|
unit_amount:0 |
|
|
|
unit_amount:0, |
|
|
|
margin:"", |
|
|
|
}; |
|
|
|
}, |
|
|
|
props: { |
|
|
|
@ -316,9 +319,18 @@ export default { |
|
|
|
return num; |
|
|
|
}, |
|
|
|
// 保证金 |
|
|
|
margin() { |
|
|
|
if (!this.form.lever_rate) return 0; |
|
|
|
return math.omitTo(this.form.amount*this.unit_amount / this.form.lever_rate, 4); |
|
|
|
// margin() { |
|
|
|
// if (!this.form.lever_rate) return ''; |
|
|
|
// return math.omitTo(this.form.amount*this.unit_amount / this.form.lever_rate, 4); |
|
|
|
// }, |
|
|
|
amount(){ |
|
|
|
console.info(this.form.lever_rate) |
|
|
|
console.info(this.margin) |
|
|
|
if (!this.form.lever_rate || !this.margin) return 0; |
|
|
|
let p=this.margin*this.form.lever_rate; |
|
|
|
|
|
|
|
this.form.amount=p; |
|
|
|
return p |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -367,7 +379,9 @@ export default { |
|
|
|
}, |
|
|
|
// 设置数量 |
|
|
|
sliderChange($ev) { |
|
|
|
this.form.amount = Math.round((this.maxNum * $ev) / 100)||''; |
|
|
|
|
|
|
|
this.form.amount = Math.round((this.maxNum * $ev) / 100)||0; |
|
|
|
this.margin=this.form.amount/this.form.lever_rate |
|
|
|
}, |
|
|
|
// 选择杠杆 |
|
|
|
selectLever(idx) { |
|
|
|
@ -414,7 +428,7 @@ export default { |
|
|
|
}; |
|
|
|
Contract.openPosition(data).then(() => { |
|
|
|
this.contractAccount(); |
|
|
|
this.form.amount = ""; |
|
|
|
this.form.amount = 0; |
|
|
|
this.$message.success(this.$t("contract.f5")); |
|
|
|
this.$emit("position"); |
|
|
|
}); |
|
|
|
|