|
|
@@ -144,11 +144,11 @@
|
|
|
{{sxfMoney}}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="buttomSubmit" :class="{'bg-success':typeIndex==1,'bg-danger':typeIndex==2}">
|
|
|
+ <view class="buttomSubmit" :class="{'bg-success':typeIndex==1,'bg-danger':typeIndex==2}" @click="UpOrderHandle()">
|
|
|
{{typeIndex==1?'做多':'做空'}}
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
</view>
|
|
|
<view class="box margin-t-30 padding-t-30 padding-b-30">
|
|
|
<view class="flex listTitleBox">
|
|
|
@@ -177,11 +177,11 @@
|
|
|
做空
|
|
|
</text>
|
|
|
<text>
|
|
|
- BTC/USDT
|
|
|
+ {{item.symbol}}
|
|
|
</text>
|
|
|
<text v-if="ddType==1"
|
|
|
- :class="{'font-color-green':item.direction==1,'font-color-red':item.direction==2}">
|
|
|
- 0.00
|
|
|
+ :class="{'font-color-green':+item.profit>=0,'font-color-red':+item.profit<0}">
|
|
|
+ {{+item.profit}}
|
|
|
</text>
|
|
|
</view>
|
|
|
<view @click="clearorder(item)" v-if="ddType==0" class="usdtListButtom">
|
|
|
@@ -256,16 +256,14 @@
|
|
|
营收
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="itemlist flex" @click="changeData(ls)" v-for="ls in listOBj">
|
|
|
+ <view class="itemlist flex" @click="changeData(ls)" v-for="ls in listOBj">
|
|
|
<view class="type name">
|
|
|
{{ls.name}}
|
|
|
</view>
|
|
|
- <view class="type money"
|
|
|
- :class="{'font-color-green':ls.bool,'font-color-red':!ls.bool}">
|
|
|
+ <view class="type money" :class="{'font-color-green':ls.bool,'font-color-red':!ls.bool}">
|
|
|
{{ls.last}}
|
|
|
</view>
|
|
|
- <view class="type bfb"
|
|
|
- :class="{'font-color-green':ls.bool,'font-color-red':!ls.bool}">
|
|
|
+ <view class="type bfb" :class="{'font-color-green':ls.bool,'font-color-red':!ls.bool}">
|
|
|
{{ls.dcf}}
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -274,7 +272,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { mapState } from 'vuex';
|
|
|
+ import {
|
|
|
+ mapState
|
|
|
+ } from 'vuex';
|
|
|
import {
|
|
|
levertadeLaverorder,
|
|
|
closeorder,
|
|
|
@@ -332,9 +332,9 @@
|
|
|
// 止盈价格
|
|
|
zyMoney: 0,
|
|
|
// 保證金
|
|
|
- bzjMoney:0,
|
|
|
+ bzjMoney: 0,
|
|
|
// 手續費
|
|
|
- sxfMoney:0,
|
|
|
+ sxfMoney: 0,
|
|
|
ddType: 1, //1委托订单2持仓订单3成交订单
|
|
|
loadData: [{
|
|
|
state: 1,
|
|
|
@@ -353,7 +353,9 @@
|
|
|
limit: 10 //每次信息条数
|
|
|
}
|
|
|
],
|
|
|
- setTimeoutObj:'',
|
|
|
+ setTimeoutObj: '',
|
|
|
+ // 是否提交做多請求
|
|
|
+ upDataLoding: false,
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -361,7 +363,7 @@
|
|
|
this.ggBs = newValue;
|
|
|
this.bond();
|
|
|
},
|
|
|
- payNum(newValue, oldValue){
|
|
|
+ payNum(newValue, oldValue) {
|
|
|
this.payNum = newValue;
|
|
|
this.bond();
|
|
|
}
|
|
|
@@ -369,12 +371,12 @@
|
|
|
filters: {
|
|
|
actionMoney: function(value) {
|
|
|
let num = 0;
|
|
|
- if(+value>10000000){
|
|
|
- num = (+(value/10000000).toFixed(2))+'千萬'
|
|
|
- }else if(+value>10000){
|
|
|
- num = (+(value/10000).toFixed(2))+'萬'
|
|
|
+ if (+value > 10000000) {
|
|
|
+ num = (+(value / 10000000).toFixed(2)) + '千萬'
|
|
|
+ } else if (+value > 10000) {
|
|
|
+ num = (+(value / 10000).toFixed(2)) + '萬'
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return num;
|
|
|
}
|
|
|
},
|
|
|
@@ -389,7 +391,7 @@
|
|
|
onHide() {
|
|
|
this.closeScoket()
|
|
|
clearInterval(this.setTimeoutObj)
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
this.levertadeLaverorder();
|
|
|
@@ -402,37 +404,82 @@
|
|
|
},
|
|
|
methods: {
|
|
|
// 提交訂單
|
|
|
- UpOrderHandle(){
|
|
|
- UpOrderHandle()
|
|
|
+ UpOrderHandle() {
|
|
|
+ const that = this;
|
|
|
+ if (this.upDataLoding) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.showLoading({
|
|
|
+ title: '提交中',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ this.upDataLoding = true;
|
|
|
+ that.bond().then(() => {
|
|
|
+ UpOrderHandle({
|
|
|
+ direction: that.typeIndex,
|
|
|
+ type: that.jyType,
|
|
|
+ symbol: that.listOBj[that.actionList].name,
|
|
|
+ mprice: that.jyType == 2 ? that.listOBj[that.actionList].last : that.xzMoney,
|
|
|
+ ggan: that.ggBs,
|
|
|
+ num: that.payNum,
|
|
|
+ upbondmoney: that.bzjMoney,
|
|
|
+ fee: that.sxfMoney,
|
|
|
+ zyprice: that.zyMoney,
|
|
|
+ zsprice: that.zsMoney,
|
|
|
+ }).then((e) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.upDataLoding = false;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '掛單成功',
|
|
|
+ showCancel: false,
|
|
|
+ });
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.upDataLoding = false;
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.upDataLoding = false;
|
|
|
+ })
|
|
|
},
|
|
|
// 修改当前选中的数据对象
|
|
|
changeData(item) {
|
|
|
- console.log(item,'qh');
|
|
|
+ console.log(item, 'qh');
|
|
|
this.actionList = item.instId;
|
|
|
this.alertShow = false;
|
|
|
},
|
|
|
// 獲取保證金
|
|
|
- bond(){
|
|
|
- bond({
|
|
|
- name:this.actionList.split('-')[0],
|
|
|
- 'num':this.payNum,
|
|
|
- 'gann':this.ggBs
|
|
|
- }).then((e)=>{
|
|
|
- this.sxfMoney = e.data.fee
|
|
|
- this.bzjMoney = e.data.bong? e.data.bong:0
|
|
|
- console.log(e)
|
|
|
- }).catch(()=>{
|
|
|
- console.log(e)
|
|
|
+ bond() {
|
|
|
+ const taht = this
|
|
|
+ return new Promise((resolve, rejact) => {
|
|
|
+ bond({
|
|
|
+ name: taht.actionList.split('-')[0],
|
|
|
+ 'num': taht.payNum,
|
|
|
+ 'gann': taht.ggBs
|
|
|
+ }).then((e) => {
|
|
|
+ taht.sxfMoney = e.data.fee
|
|
|
+ taht.bzjMoney = e.data.bong ? e.data.bong : 0
|
|
|
+ console.log(e)
|
|
|
+ resolve()
|
|
|
+ }).catch(() => {
|
|
|
+ rejact()
|
|
|
+ console.log(e)
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
//循環獲取數據
|
|
|
- initListData(){
|
|
|
- this.setTimeoutObj = setInterval(()=>{
|
|
|
+ initListData() {
|
|
|
+ this.setTimeoutObj = setInterval(() => {
|
|
|
this.levertadeLaverorder();
|
|
|
- },2000)
|
|
|
+ }, 2000)
|
|
|
},
|
|
|
// 獲取幣種列表
|
|
|
geLevertade() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '數據加載中...',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
const that = this;
|
|
|
geLevertade().then((e) => {
|
|
|
that.spList = e.list;
|
|
|
@@ -444,12 +491,9 @@
|
|
|
// 开始请求长连接
|
|
|
onScoket() {
|
|
|
const that = this;
|
|
|
- uni.showLoading({
|
|
|
- title: '數據加載中...',
|
|
|
- mask: true
|
|
|
- });
|
|
|
that.scoket = scoketNew("wss://wsaws.okx.com:8443/ws/v5/public");
|
|
|
that.scoket.scoketOpen().then((res) => {
|
|
|
+ uni.hideLoading()
|
|
|
const requestList = that.spList.map((e) => {
|
|
|
return {
|
|
|
"channel": "tickers",
|
|
|
@@ -473,7 +517,7 @@
|
|
|
item.last = +item.last;
|
|
|
item.sodUtc0 = +item.sodUtc0;
|
|
|
// 保存收益情况
|
|
|
- item.bool = item.last - item.sodUtc0>0?true:false;
|
|
|
+ item.bool = item.last - item.sodUtc0 > 0 ? true : false;
|
|
|
// 算出收益率
|
|
|
item.dcf = (+((item.last - item.sodUtc0) / item.sodUtc0 * 100).toFixed(
|
|
|
2)) + '%'
|
|
|
@@ -720,9 +764,11 @@
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
border: 1px solid $border-color-light;
|
|
|
- .buttomZd{
|
|
|
+
|
|
|
+ .buttomZd {
|
|
|
font-size: $font-sm;
|
|
|
}
|
|
|
+
|
|
|
.input {
|
|
|
font-size: $font-sm;
|
|
|
flex-grow: 1;
|
|
|
@@ -782,7 +828,8 @@
|
|
|
.list {
|
|
|
font-size: 20rpx;
|
|
|
padding: 10rpx 0;
|
|
|
- .li{
|
|
|
+
|
|
|
+ .li {
|
|
|
width: 20%;
|
|
|
}
|
|
|
}
|