|
|
|
@ -299,7 +299,9 @@ |
|
|
|
:contract="1" |
|
|
|
> |
|
|
|
<!-- 合约页面的买卖列表中间的实时价格 --> |
|
|
|
<view class="fn-lg color-buy">{{newPrice.price}} |
|
|
|
<view class="fn-lg color-buy"> |
|
|
|
{{newPrice.price}} |
|
|
|
<!-- {{activeCoin}} --> |
|
|
|
<!-- <span class="color-buy" v-if="newPrice.price>100">{{omitTo(newPrice.price,2)}}</span> |
|
|
|
<span class="color-buy" v-if="newPrice.price>1&&newPrice.price<100">{{omitTo(newPrice.price,4)}}</span> |
|
|
|
<span class="color-buy" v-if="newPrice.price<1">{{omitTo(newPrice.price,6)}}</span> --> |
|
|
|
@ -815,7 +817,8 @@ export default { |
|
|
|
refreshing:false, |
|
|
|
pingAmount:'', |
|
|
|
imgurl:'', |
|
|
|
bao:0 |
|
|
|
bao:0, |
|
|
|
newPrice1:[] |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -870,6 +873,18 @@ export default { |
|
|
|
return plus.os.name |
|
|
|
// #endif |
|
|
|
}, |
|
|
|
activeCoin() { |
|
|
|
if (!this.newPrice1.length) return {}; |
|
|
|
|
|
|
|
const targetPair = this.newPrice1?.flatMap(parentItem => |
|
|
|
parentItem.marketInfoList || [] |
|
|
|
).find(item => item.pair_name === this.query.symbol); |
|
|
|
let num = targetPair.pair_name === 'BTC/USDT' ? (+targetPair.price).toFixed(1) : (+targetPair.price).toFixed(3); |
|
|
|
this.list.map(item=>{ |
|
|
|
if(item.symbol==targetPair.symbol) item.realtimePrice = num |
|
|
|
}) |
|
|
|
return num; |
|
|
|
}, |
|
|
|
marginCheck(){ |
|
|
|
return parseInt(this.margin); |
|
|
|
} |
|
|
|
@ -1268,6 +1283,7 @@ export default { |
|
|
|
this.buyList = res.data.swapBuyList; |
|
|
|
this.tradeList = res.data.swapTradeList; |
|
|
|
this.newPrice = this.tradeList[0] || {}; |
|
|
|
this.newPrice1 = this.tradeList[0] || {}; |
|
|
|
// console.info(this.newPrice) |
|
|
|
this.form.entrust_price = this.newPrice.price; |
|
|
|
this.linkSocket(data.symbol); |
|
|
|
@ -1423,6 +1439,11 @@ export default { |
|
|
|
cmd: "sub", |
|
|
|
msg: `swapTradeList_${symbol}`, |
|
|
|
}); |
|
|
|
// 订阅最新价格 |
|
|
|
this.ws.send({ |
|
|
|
cmd: "sub", |
|
|
|
msg: `swapMarketList`, |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 取消订阅 |
|
|
|
unLink(symbol) { |
|
|
|
@ -1441,6 +1462,11 @@ export default { |
|
|
|
cmd: "unsub", |
|
|
|
msg: `swapTradeList_${symbol}`, |
|
|
|
}); |
|
|
|
// 取消最新价格 |
|
|
|
this.ws.send({ |
|
|
|
cmd: "unsub", |
|
|
|
msg: `swapMarketList`, |
|
|
|
}); |
|
|
|
}, |
|
|
|
socketMessage() { |
|
|
|
// 节流防抖 |
|
|
|
@ -1474,7 +1500,8 @@ export default { |
|
|
|
this.newPrice = arr[i] |
|
|
|
} |
|
|
|
} |
|
|
|
// console.log(this.newPrice, '----------') |
|
|
|
// this.newPrice1 = JSON.parse(JSON.stringify(data)); |
|
|
|
// console.log(data, '----------') |
|
|
|
break; |
|
|
|
} |
|
|
|
}); |
|
|
|
|