|
@ -16,9 +16,9 @@ |
|
|
<view class="card" v-for="(item, index) in list" :key="index"> |
|
|
<view class="card" v-for="(item, index) in list" :key="index"> |
|
|
<view class="header"> |
|
|
<view class="header"> |
|
|
<text class="dealType" :class="{ long: item.direction === 'long' }">{{item.direction}}</text> |
|
|
<text class="dealType" :class="{ long: item.direction === 'long' }">{{item.direction}}</text> |
|
|
<text class="time">02-17 09:18:20</text> |
|
|
<text class="time">{{item.timestr}}</text> |
|
|
<text class="closeTimeTitle" v-show="type === 2 || type === 3">{{ i18n.CloseTime }}</text> |
|
|
<text class="closeTimeTitle" v-show="type === 2 || type === 3">{{ i18n.CloseTime }}</text> |
|
|
<text class="closeTime" v-show="type === 2 || type === 3">02-17 16:11:35</text> |
|
|
<text class="closeTime" v-show="type === 2 || type === 3">{{item.timestr2}}</text> |
|
|
<view class="closeBtn" v-show="type === 0 || type === 1" @click="closeItem(item,index)">{{ |
|
|
<view class="closeBtn" v-show="type === 0 || type === 1" @click="closeItem(item,index)">{{ |
|
|
i18n.close |
|
|
i18n.close |
|
|
}}</view> |
|
|
}}</view> |
|
@ -29,47 +29,51 @@ |
|
|
<!-- 公共的 --> |
|
|
<!-- 公共的 --> |
|
|
<view class="left"> |
|
|
<view class="left"> |
|
|
<view class="title">{{ item.pair }}</view> |
|
|
<view class="title">{{ item.pair }}</view> |
|
|
<view class="value">1 * 10</view> |
|
|
<view class="value">{{item.openedPrice}}</view> |
|
|
<view class="title">{{ i18n.Bond }}</view> |
|
|
<view class="title">{{ i18n.Bond }}</view> |
|
|
<view class="value">{{item.bondAmount}}</view> |
|
|
<view class="value">{{item.bondAmount}}</view> |
|
|
<view class="title" v-show="type !== 3">{{ i18n.StyPrice }}</view> |
|
|
<view class="title" v-show="type !== 3">{{ i18n.StyPrice }}</view> |
|
|
<view class="value" v-show="type !== 3">0.00</view> |
|
|
<view class="value" v-show="type !== 3">{{item.winStopPrice}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<!-- 公共的 --> |
|
|
<!-- 公共的 --> |
|
|
<view class="center"> |
|
|
<view class="center"> |
|
|
<view class="title">{{ i18n.AmountLeverage }}</view> |
|
|
<view class="title">{{ i18n.AmountLeverage }}</view> |
|
|
<view class="value">40700</view> |
|
|
<view class="value">{{getHand(item)}}</view> |
|
|
<view class="title">{{ i18n.Fee }}</view> |
|
|
<view class="title">{{ i18n.Fee }}</view> |
|
|
<view class="value">{{item.fee}}</view> |
|
|
<view class="value">{{item.fee}}</view> |
|
|
<view class="title" v-show="type !== 3">{{ i18n.StsPrice }}</view> |
|
|
<view class="title" v-show="type !== 3">{{ i18n.StsPrice }}</view> |
|
|
<view class="value" v-show="type !== 3">0.00</view> |
|
|
<view class="value" v-show="type !== 3">{{item.lossStopPrice}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<!-- Current Entrust 和 Position--> |
|
|
<!-- Current Entrust 和 Position--> |
|
|
<view class="right" v-show="type === 0 || type === 1"> |
|
|
<view class="right" v-show="type === 0 || type === 1"> |
|
|
<view class="title">{{ i18n.CurrentPrice }}</view> |
|
|
<view class="title">{{ i18n.CurrentPrice }}</view> |
|
|
<view class="value" style="color:#F4506A;">39952.64</view> |
|
|
<view class="value" style="color:#F4506A;">{{item.currentPrice}}</view> |
|
|
<view class="title" v-show="type === 0">{{ i18n.status }}</view> |
|
|
<view class="title" v-show="type === 0">{{ i18n.status }}</view> |
|
|
<view class="value" v-show="type === 0">{{item.status}}</view> |
|
|
<view class="value" v-show="type === 0">{{item.status}}</view> |
|
|
<view class="title" v-show="type === 1">{{ i18n.do }}</view> |
|
|
<view class="title" v-show="type === 1">{{ i18n.do }}</view> |
|
|
<view class="value" style="color:#00E8A2;" v-show="type === 1" |
|
|
<view class="value" style="color:#00E8A2;" v-show="type === 1" @click="getStopLimit(item)"> |
|
|
@click="stopModalShow = true"> |
|
|
|
|
|
Stop/Limit</view> |
|
|
Stop/Limit</view> |
|
|
<view class="title">{{ i18n.ExpectProfit }}</view> |
|
|
<view class="title">{{ i18n.ExpectProfit }}</view> |
|
|
<view class="value" style="color:#F4506A;">{{parseInt(item.profitAmount,16)}}</view> |
|
|
<view class="value" v-show="type === 1" :style="parseFloat(getItem(item.direction=='buy'?(marketDetail.close-item.openedPrice)*item.hand:(item.openedPrice-marketDetail.close)*item.hand))>=0?'color:#00E8A2':'color:#F4506A'"> |
|
|
|
|
|
{{getItem(item.direction=='buy'?(marketDetail.close-item.openedPrice)*item.hand:(item.openedPrice-marketDetail.close)*item.hand)}} |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="value" style="color:#00E8A2;" v-show="type === 2">0</view> |
|
|
</view> |
|
|
</view> |
|
|
<!-- Closed --> |
|
|
<!-- Closed --> |
|
|
<view class="right" v-show="type === 2"> |
|
|
<view class="right" v-show="type === 2"> |
|
|
<view class="title">{{ i18n.ClosePrice }}</view> |
|
|
<view class="title">{{ i18n.ClosePrice }}</view> |
|
|
<view class="value" style="color:#00E8A2;">39952.64</view> |
|
|
<view class="value" style="color:#00E8A2;">{{item.currentPrice}}</view> |
|
|
<view class="title">{{ i18n.status }}</view> |
|
|
<view class="title">{{ i18n.status }}</view> |
|
|
<view class="value">{{item.status}}</view> |
|
|
<view class="value">{{item.status}}</view> |
|
|
<view class="title">{{ i18n.PL }}</view> |
|
|
<view class="title">{{ i18n.PL }}</view> |
|
|
<view class="value" style="color:#00E8A2;">112.02</view> |
|
|
<view class="value" :style="item.profitAmount-item.fee>=0?'color:#00E8A2;':'color:#F4506A'">{{item.profitAmount-item.fee}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<!-- Revoked --> |
|
|
<!-- Revoked --> |
|
|
<view class="right" v-show="type === 3"> |
|
|
<view class="right" v-show="type === 3"> |
|
|
<view class="title">{{ i18n.status }}</view> |
|
|
<view class="title">{{ i18n.status }}</view> |
|
|
<view class="value" style="color:#F4506A;">{{item.status}}</view> |
|
|
<view class="value" style="color:#F4506A;">{{item.status}}</view> |
|
|
|
|
|
<view class="title">{{ i18n.PL }}</view> |
|
|
|
|
|
<view class="value" style="color:#00E8A2;"><!-- {{item.currentPl}} --> 0</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -78,7 +82,6 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<u-empty :text="i18n.Dataisempty" mode="data" v-if="!list.length"></u-empty> |
|
|
|
|
|
|
|
|
|
|
|
<!-- close确认框 --> |
|
|
<!-- close确认框 --> |
|
|
<u-modal :show="closeModalShow" :confirmText="i18n.Confirm" :cancelText="i18n.Cancel" :showCancelButton="true" |
|
|
<u-modal :show="closeModalShow" :confirmText="i18n.Confirm" :cancelText="i18n.Cancel" :showCancelButton="true" |
|
@ -89,11 +92,11 @@ |
|
|
<!-- stop确认框 --> |
|
|
<!-- stop确认框 --> |
|
|
<u-modal :show="stopModalShow" :confirmText="i18n.Confirm" :cancelText="i18n.Cancel" :showCancelButton="true" |
|
|
<u-modal :show="stopModalShow" :confirmText="i18n.Confirm" :cancelText="i18n.Cancel" :showCancelButton="true" |
|
|
:title="i18n.StopLimit" :content='i18n.WarmTipsText' @confirm="stopConfirm" @cancel="stopModalShow = false" |
|
|
:title="i18n.StopLimit" :content='i18n.WarmTipsText' @confirm="stopConfirm" @cancel="stopModalShow = false" |
|
|
confirmColor="#00E8A2"> |
|
|
confirmColor="#00E8A2" cancelColor="#96959E"> |
|
|
<view class="stopModel"> |
|
|
<view class="stopModel"> |
|
|
<view class="title"> |
|
|
<view class="title"> |
|
|
<text class="left">{{ i18n.StyPrice }}</text> |
|
|
<text class="left">{{ i18n.StyPrice }}</text> |
|
|
<text class="right">{{ i18n.ExpectProfit }} {{ 0.01 }}</text> |
|
|
<text class="right">{{ i18n.ExpectProfit }} {{ stopLimitData.winStopPrice }}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="numberInput"> |
|
|
<view class="numberInput"> |
|
|
<button class="btn sub" :class="{ disabled: stySubBtnDisabled || styValue <= 0 }" |
|
|
<button class="btn sub" :class="{ disabled: stySubBtnDisabled || styValue <= 0 }" |
|
@ -103,7 +106,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view class="title"> |
|
|
<view class="title"> |
|
|
<text class="left">{{ i18n.StsPrice }}</text> |
|
|
<text class="left">{{ i18n.StsPrice }}</text> |
|
|
<text class="right">{{ i18n.ExpectLoss }} {{ 0.01 }}</text> |
|
|
<text class="right">{{ i18n.ExpectLoss }} {{ stopLimitData.lossStopPrice }}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="numberInput"> |
|
|
<view class="numberInput"> |
|
|
<button class="btn sub" :class="{ disabled: stsSubBtnDisabled || stsValue <= 0 }" |
|
|
<button class="btn sub" :class="{ disabled: stsSubBtnDisabled || stsValue <= 0 }" |
|
@ -116,7 +119,7 @@ |
|
|
|
|
|
|
|
|
</u-modal> |
|
|
</u-modal> |
|
|
|
|
|
|
|
|
|
|
|
<u-empty :text="i18n.Dataisempty" mode="data" v-if="!list.length"></u-empty> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -126,9 +129,18 @@ const COMPONENT_NAME = 'transaction' |
|
|
let timer1 = null; |
|
|
let timer1 = null; |
|
|
let timer2 = null; |
|
|
let timer2 = null; |
|
|
export default { |
|
|
export default { |
|
|
components: { KeyValueRow }, |
|
|
components: { |
|
|
|
|
|
KeyValueRow |
|
|
|
|
|
}, |
|
|
name: COMPONENT_NAME, |
|
|
name: COMPONENT_NAME, |
|
|
props: { |
|
|
props: { |
|
|
|
|
|
|
|
|
|
|
|
marketDetail: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
default () { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
symbol: { |
|
|
symbol: { |
|
|
type: Object, |
|
|
type: Object, |
|
|
default () { |
|
|
default () { |
|
@ -168,20 +180,21 @@ export default { |
|
|
stopModalShow: false, |
|
|
stopModalShow: false, |
|
|
type: 0, |
|
|
type: 0, |
|
|
test: 0, |
|
|
test: 0, |
|
|
dealList: [ |
|
|
dealList: [{ |
|
|
{ |
|
|
|
|
|
dealType: 'long' |
|
|
dealType: 'long' |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
dealType: 'long' |
|
|
dealType: 'long' |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
styValue: 2.55, |
|
|
styValue: 0, |
|
|
stsValue: 0.3284974928739487, |
|
|
stsValue: 0, |
|
|
stySubBtnDisabled: false, |
|
|
stySubBtnDisabled: false, |
|
|
stsSubBtnDisabled: false, |
|
|
stsSubBtnDisabled: false, |
|
|
// 撤销订单数据 |
|
|
// 撤销订单数据 |
|
|
itemData: {}, |
|
|
itemData: {}, |
|
|
|
|
|
// 设置止盈数据 |
|
|
|
|
|
stopLimitData: {}, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
@ -191,9 +204,9 @@ export default { |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
symbol: { |
|
|
symbol: { |
|
|
handler: function () { |
|
|
handler: function() {} |
|
|
} |
|
|
}, |
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
this.getContractOrderList() |
|
|
this.getContractOrderList() |
|
@ -205,6 +218,29 @@ export default { |
|
|
timer2 = null; |
|
|
timer2 = null; |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
getItem(i) { |
|
|
|
|
|
i = parseFloat(i.toPrecision(10)) |
|
|
|
|
|
i = String(i) |
|
|
|
|
|
return i.substring(0, i.indexOf(".") + 9); |
|
|
|
|
|
}, |
|
|
|
|
|
// 获取设置止盈数据 |
|
|
|
|
|
getStopLimit(i) { |
|
|
|
|
|
this.stopLimitData = i |
|
|
|
|
|
this.stopModalShow = true |
|
|
|
|
|
}, |
|
|
|
|
|
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) { |
|
|
closeItem(item, i) { |
|
|
this.itemData = item |
|
|
this.itemData = item |
|
@ -218,6 +254,17 @@ export default { |
|
|
}); |
|
|
}); |
|
|
orderList.then(res => { |
|
|
orderList.then(res => { |
|
|
this.list = res.data |
|
|
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[ |
|
|
|
|
|
i].addTime) |
|
|
|
|
|
} |
|
|
|
|
|
if (this.list[i].closedTime) { |
|
|
|
|
|
this.list[i].timestr2 = this.$index.getformatyymmddhhmmss(this.list[ |
|
|
|
|
|
i].closedTime) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
@ -244,13 +291,30 @@ export default { |
|
|
* close确认弹窗 |
|
|
* close确认弹窗 |
|
|
*/ |
|
|
*/ |
|
|
closeConfirm() { |
|
|
closeConfirm() { |
|
|
|
|
|
// 类型是undo调用 订单撤销 |
|
|
|
|
|
if (this.type == 0) { |
|
|
const orderList = this.$api.contractCancel({ |
|
|
const orderList = this.$api.contractCancel({ |
|
|
"orderNo": this.itemData.orderNo, |
|
|
"orderNo": this.itemData.orderNo, |
|
|
}); |
|
|
}); |
|
|
orderList.then(res => { |
|
|
orderList.then(res => { |
|
|
uni.$u.toast(res.errMsg) |
|
|
uni.$u.toast(this.$t("markets").Succeeded) |
|
|
|
|
|
this.closeModalShow = false |
|
|
|
|
|
this.getContractOrderList() |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 类型是opened 调用 合约订单平仓 |
|
|
|
|
|
if (this.type == 1) { |
|
|
|
|
|
const orderList = this.$api.contractClosed({ |
|
|
|
|
|
"orderNo": this.itemData.orderNo, |
|
|
|
|
|
}); |
|
|
|
|
|
orderList.then(res => { |
|
|
|
|
|
uni.$u.toast(this.$t("markets").Succeeded) |
|
|
this.closeModalShow = false |
|
|
this.closeModalShow = false |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.getContractOrderList() |
|
|
|
|
|
}, 600) |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* stop确认弹窗 |
|
|
* stop确认弹窗 |
|
@ -264,7 +328,18 @@ export default { |
|
|
}) |
|
|
}) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
const orderList = this.$api.setWinOrLossStopPrice({ |
|
|
|
|
|
"orderNo": this.stopLimitData.orderNo, |
|
|
|
|
|
"winStopPrice": this.styValue, |
|
|
|
|
|
"lossStopPrice": this.stsValue, |
|
|
|
|
|
}); |
|
|
|
|
|
orderList.then(res => { |
|
|
|
|
|
uni.$u.toast(this.$t("markets").Succeeded) |
|
|
this.stopModalShow = false |
|
|
this.stopModalShow = false |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.getContractOrderList() |
|
|
|
|
|
}, 600) |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* styValue值变化 |
|
|
* styValue值变化 |
|
@ -320,14 +395,14 @@ export default { |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
<style scoped lang="scss"> |
|
|
|
|
|
/deep/ .u-empty { |
|
|
|
|
|
top: 500% !important; |
|
|
|
|
|
} |
|
|
/deep/ .u-modal__content__text { |
|
|
/deep/ .u-modal__content__text { |
|
|
color: #96959E !important; |
|
|
color: #96959E !important; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/deep/ .u-empty{ |
|
|
|
|
|
top: 60% !important; |
|
|
|
|
|
} |
|
|
|
|
|
.entrustOrderList { |
|
|
.entrustOrderList { |
|
|
|
|
|
position: relative; |
|
|
.tab { |
|
|
.tab { |
|
|
display: flex; |
|
|
display: flex; |
|
|
background: #211F32; |
|
|
background: #211F32; |
|
|