|
|
@ -15,7 +15,7 @@ |
|
|
|
<view class="content" v-if="list.length"> |
|
|
|
<view class="card" v-for="(item, index) in list" :key="index"> |
|
|
|
<view class="header"> |
|
|
|
<text class="dealType" :class="{ long: item.direction === 'long' }">{{item.direction}}</text> |
|
|
|
<text :class="item.direction" >{{item.direction}}</text> |
|
|
|
<text class="time">{{item.timestr}}</text> |
|
|
|
<text class="closeTimeTitle" v-show="type === 2 || type === 3">{{ i18n.CloseTime }}</text> |
|
|
|
<text class="closeTime" v-show="type === 2 || type === 3">{{item.timestr2}}</text> |
|
|
@ -38,7 +38,7 @@ |
|
|
|
<!-- 公共的 --> |
|
|
|
<view class="center"> |
|
|
|
<view class="title">{{ i18n.AmountLeverage }}</view> |
|
|
|
<view class="value">{{getHand(item)}}</view> |
|
|
|
<view class="value">{{item.hand}} * {{item.leverage}}</view> |
|
|
|
<view class="title">{{ i18n.Fee }}</view> |
|
|
|
<view class="value">{{item.fee}}</view> |
|
|
|
<view class="title" v-show="type !== 3">{{ i18n.StsPrice }}</view> |
|
|
@ -47,7 +47,7 @@ |
|
|
|
<!-- Current Entrust 和 Position--> |
|
|
|
<view class="right" v-show="type === 0 || type === 1"> |
|
|
|
<view class="title">{{ i18n.CurrentPrice }}</view> |
|
|
|
<view class="value" style="color:#F4506A;">{{item.currentPrice}}</view> |
|
|
|
<view class="value" style="color:#F4506A;">{{marketDetail.close}}</view> |
|
|
|
<view class="title" v-show="type === 0">{{ i18n.status }}</view> |
|
|
|
<view class="value" v-show="type === 0">{{item.status}}</view> |
|
|
|
<view class="title" v-show="type === 1">{{ i18n.do }}</view> |
|
|
@ -100,22 +100,22 @@ |
|
|
|
<view class="stopModel"> |
|
|
|
<view class="title"> |
|
|
|
<text class="left">{{ i18n.StyPrice }}</text> |
|
|
|
<text class="right">{{ i18n.ExpectProfit }} {{ stopLimitData.winStopPrice }}</text> |
|
|
|
<text class="right">{{ i18n.ExpectProfit }} {{ profit }}</text> |
|
|
|
</view> |
|
|
|
<view class="numberInput"> |
|
|
|
<button class="btn sub" :class="{ disabled: stySubBtnDisabled || styValue <= 0 }" |
|
|
|
:disabled="stySubBtnDisabled" @click="styValueChange('sub')"></button> |
|
|
|
<input class="number" type="number" v-model="styValue" /> |
|
|
|
<input class="number" type="number" v-model="styValue" @input="stopModalChange" /> |
|
|
|
<button class="btn add" @click="styValueChange('add')"></button> |
|
|
|
</view> |
|
|
|
<view class="title"> |
|
|
|
<text class="left">{{ i18n.StsPrice }}</text> |
|
|
|
<text class="right">{{ i18n.ExpectLoss }} {{ stopLimitData.lossStopPrice }}</text> |
|
|
|
<text class="right">{{ i18n.ExpectLoss }} {{ loss }}</text> |
|
|
|
</view> |
|
|
|
<view class="numberInput"> |
|
|
|
<button class="btn sub" :class="{ disabled: stsSubBtnDisabled || stsValue <= 0 }" |
|
|
|
:disabled="stsSubBtnDisabled" @click="stsValueChange('sub')"></button> |
|
|
|
<input class="number" type="number" v-model="stsValue" /> |
|
|
|
<input class="number" type="number" v-model="stsValue" @input="stopModalChange"/> |
|
|
|
<button class="btn add" @click="stsValueChange('add')"></button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -199,6 +199,8 @@ |
|
|
|
itemData: {}, |
|
|
|
// 设置止盈数据 |
|
|
|
stopLimitData: {}, |
|
|
|
profit:0, |
|
|
|
loss:0 |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -230,6 +232,20 @@ |
|
|
|
timer2 = null; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
stopModalChange(){ |
|
|
|
if(this.stopLimitData.direction==='buy'){ |
|
|
|
if(this.styValue) |
|
|
|
this.profit=this.getItem((this.styValue-this.stopLimitData.openedPrice)*this.stopLimitData.hand) |
|
|
|
if(this.stsValue) |
|
|
|
this.loss=this.getItem((this.stsValue-this.stopLimitData.openedPrice)*this.stopLimitData.hand) |
|
|
|
|
|
|
|
}else{ |
|
|
|
if(this.styValue) |
|
|
|
this.profit=this.getItem((this.stopLimitData.openedPrice-this.styValue)*this.stopLimitData.hand) |
|
|
|
if(this.stsValue) |
|
|
|
this.loss=this.getItem((this.stopLimitData.openedPrice-this.stsValue)*this.stopLimitData.hand) |
|
|
|
} |
|
|
|
}, |
|
|
|
getItem(i) { |
|
|
|
i = parseFloat(i.toPrecision(10)) |
|
|
|
i = String(i) |
|
|
@ -239,20 +255,12 @@ |
|
|
|
getStopLimit(i) { |
|
|
|
this.stopLimitData = i |
|
|
|
this.stopModalShow = true |
|
|
|
this.styValue=0; |
|
|
|
this.stsValue=0; |
|
|
|
this.profit=0 |
|
|
|
this.loss=0 |
|
|
|
}, |
|
|
|
getHand(e) { |
|
|
|
let i = e.leverage * e.hand |
|
|
|
// i = '' + i |
|
|
|
// i = parseFloat(i) |
|
|
|
// let eformat = i.toExponential() // 转换为标准的科学计数法形式(字符串) |
|
|
|
// let tmpArray = eformat.match(/\d(?:\.(\d*))?e([+-]\d+)/) // 分离出小数值和指数值 |
|
|
|
// let number = i.toFixed(Math.max(0, (tmpArray[1] || '').length - tmpArray[2])) |
|
|
|
i = parseFloat(i.toPrecision(10)) |
|
|
|
// number = String(number) |
|
|
|
i = String(i) |
|
|
|
// return number.substring(0, number.indexOf(".") + 9); |
|
|
|
return i.substring(0, i.indexOf(".") + 9); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取撤销订单 |
|
|
|
closeItem(item, i) { |
|
|
|
this.itemData = item |
|
|
@ -268,7 +276,7 @@ |
|
|
|
this.list = res.data |
|
|
|
for (var i = 0; i < this.list.length; i++) { |
|
|
|
if (this.list[i].addTime) { |
|
|
|
this.list[i].timestr = this.$index.getformatyymmddhhmmss(this.list[ |
|
|
|
this.list[i].timestr = this.$index.formatyymmddhhmmss(this.list[ |
|
|
|
i].addTime) |
|
|
|
} |
|
|
|
if (this.list[i].closedTime) { |
|
|
@ -451,10 +459,14 @@ |
|
|
|
margin-bottom: 30rpx; |
|
|
|
|
|
|
|
.header { |
|
|
|
.dealType { |
|
|
|
.buy { |
|
|
|
color: #00E8A2; |
|
|
|
margin-right: 28rpx; |
|
|
|
} |
|
|
|
.sell { |
|
|
|
color: #F4506A; |
|
|
|
margin-right: 28rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.time { |
|
|
|
margin-right: 16rpx; |
|
|
|