Browse Source

优化

master
ltlzx 4 years ago
parent
commit
fc4ede4a68
  1. 46
      pages/exchange/open-position.vue

46
pages/exchange/open-position.vue

@ -115,14 +115,19 @@
></v-input> ></v-input>
</view> </view>
<view> <view>
<v-input <!-- :placeholder="$t('contract.d2')"
:placeholder="$t('contract.d2')" v-model="form.amount" -->
v-model="form.amount" <v-input
:placeholder="$t('common.c4')"
v-model="margin"
@input="sliderActive=-1" @input="sliderActive=-1"
class="h-30 p-x-sm p-y-xxs rounded bg-form-panel-3" class="h-30 p-x-sm p-y-xxs rounded bg-form-panel-3"
> >
<template #right> <template #right>
<span class="color-light fn-bold"> {{ $t("contract.d8") }} </span> <span class="color-light fn-bold">
<!-- {{ $t("contract.d8") }} -->
USDT
</span>
</template> </template>
</v-input> </v-input>
</view> </view>
@ -245,15 +250,18 @@
{{ $t("common.c3") }} {{ $t("common.c3") }}
</view> </view>
<view class=""> <view class="">
{{ maxNum }}{{ $t("contract.d8") }} {{ maxNum }}
<!-- {{ $t("contract.d8") }} -->
</view> </view>
</view> </view>
<view class="fn-sm m-t-xs d-flex justify-between"> <view class="fn-sm m-t-xs d-flex justify-between">
<view class=""> <view class="">
{{ $t("common.c4") }} <!-- {{ $t("common.c4") }} -->
{{ $t('contract.d2') }}
</view> </view>
<view class=""> <view class="">
{{ margin }} USDT <!-- {{ margin }} USDT -->
{{amount}}
</view> </view>
</view> </view>
</view> </view>
@ -729,6 +737,7 @@ export default {
}, },
data() { data() {
return { return {
margin:'',
sellList: [], sellList: [],
buyList: [], buyList: [],
tradeList: [], tradeList: [],
@ -812,12 +821,21 @@ export default {
// return this.commissionTypes.find((item) => this.form.type == item.value); // return this.commissionTypes.find((item) => this.form.type == item.value);
// }, // },
// //
margin() { // margin() {
return math.omitTo( // return math.omitTo(
(this.form.amount * this.unit_amount) / this.form.lever_rate, // (this.form.amount * this.unit_amount) / this.form.lever_rate,
0 // 0
); // );
}, // },
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
},
// //
activeStep() { activeStep() {
return (this.form.amount / this.maxNum) * 100; return (this.form.amount / this.maxNum) * 100;
@ -1317,6 +1335,8 @@ export default {
sliderChange(n,i) { sliderChange(n,i) {
this.form.amount = Math.round((this.maxNum * n) / 100); this.form.amount = Math.round((this.maxNum * n) / 100);
this.sliderActive=i this.sliderActive=i
this.margin=this.form.amount/this.form.lever_rate
}, },
pingChange(n,i) { pingChange(n,i) {
console.log(n) console.log(n)

Loading…
Cancel
Save