@ -89,6 +89,7 @@ function omitTo(val, scale) {
if (val.toString().indexOf(".") > -1) {
// 提取实体集和精度值
let [entity, precisionVal] = val.toString().split(".");
entity = entity.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
if (precisionVal.length > scale) {
// trunc() 方法会将数字的小数部分去掉,只保留整数部分。
@ -122,7 +123,10 @@ function omitTo(val, scale) {
}
// 检测整型值
} else ret = val + '.' + '0'.repeat(scale);
} else {
val = val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
ret = val + '.' + '0'.repeat(scale);
// 去除末尾可能产生的多余的.
if (ret.toString().endsWith('.')) ret = ret.slice(0, -1);
@ -14,11 +14,11 @@
<div class="">
<div class="d-flex p-3 justify-content-between">
<div>{{$t('contract.a2')}}(USDT)</div>
<div>{{ accountInfo.account_equity || "--" }}</div>
<div>{{ price1(accountInfo.account_equity) || "--" }}</div>
</div>
<div>{{$t('contract.a3')}}(USDT)</div>
<div>{{(accountInfo.usable_balance).toFixed(2)}}</div>
<div>{{price1((accountInfo.usable_balance).toFixed(2))}}</div>
<!-- <div class="d-flex p-3 justify-content-between">
<div>{{$t('contract.a4')}}(USDT)</div>
@ -36,7 +36,7 @@
<div>{{$t('contract.a7')}}
<!-- (USDT) -->
<div class="decreace">{{ accountInfo.riskRate || "0%" }}</div>
<div class="decreace">{{ price1(accountInfo.riskRate) || "0%" }}</div>
<!-- <div class="d-flex p-3 justify-content-between" v-if="false">
<div>{{$t('contract.a8')}}(USDT)</div>
@ -68,7 +68,14 @@ export default {
console.log(this.accountInfo)
},
methods:{
price1(item){
if (item) {
let price = item;
let parts = price.split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(",");
};
</script>
@ -122,7 +122,7 @@
<div class="d-flex justify-content-between mb-4">
<div>{{ $t("contract.a3") }}:</div>
<div>
{{ accountInfo.usable_balance }} USDT
{{ price1(accountInfo.usable_balance) }} USDT
<i
class="el-icon-sort"
@click="$router.push('/wallet/assets/exchange')"
@ -152,7 +152,7 @@
<!-- <span class="fn-12"> ({{ $t("contract.e6") }}) </span> -->
</button>
<div class="text-left">
{{ $t("contract.e7") }} {{ maxNum }}
{{ $t("contract.e7") }} {{ price1(maxNum) }}
<!-- {{ $t("contract.e2") }} -->
@ -167,7 +167,7 @@
<!-- <div class="text-center"> -->
<div class="text-right">
@ -345,6 +345,14 @@ export default {
methods: {
let price = item.toString();
// 获取合约账户信息
contractAccount(boo) {
if (!this.isLogin) return;
@ -52,7 +52,7 @@
@click="$emit('selectprice', item.price)"
>
<div class="d-flex">
<div class="w-8/24 decreace">{{ item.price}}</div>
<div class="w-8/24 decreace">{{ price1(item.price)}}</div>
<div class="w-7/24">{{ omitTo(item.amount, 2) }}</div>
<div class="w-7/24 text-right">{{ item.total }}</div>
@ -69,7 +69,7 @@
<div class="w-10/24">
<div class="name text-secondary fn-12">{{ $t("contract.g3") }}</div>
<div class="num fn-20 increace">
{{ newPriceObj.price }}
{{ price1(newPriceObj.price) }}
<div class="w-14/24 text-right">
@ -84,7 +84,7 @@
<div class="w-8/24 increace">{{ item.price }}</div>
<div class="w-8/24 increace">{{ price1(item.price) }}</div>
@ -204,6 +204,14 @@ export default {
parseTime: date.parseTime,
omitTo: math.omitTo,
getMarketInfo() {
let data = {
symbol: this.symbol
@ -48,8 +48,8 @@
<td>{{ item.side == 1 ? $t("contract.i4") : $t("contract.i5") }}</td>
<!-- <td>{{ item.avail_position }}</td>
<td>{{ item.freeze_position }}</td> -->
<td>{{ item.avg_price * 1 }}</td>
<td>{{ item.realtimePrice }}</td>
<td>{{ price1(item.avg_price * 1) }}</td>
<td>{{ price1(item.realtimePrice) }}</td>
<td>{{ item.flatPrice }}</td>
<td :class="item.unRealProfit>0?'increace':item.unRealProfit<0?'decreace':''">{{ (parseFloat(item.unRealProfit)).toFixed(2) }}</td>
<td>{{ item.profitRate }}</td>
@ -503,6 +503,14 @@ export default {
watch: {},
created() {},
tooltip($ev) {
return Math.round($ev) + "%";
@ -81,7 +81,7 @@
increace: activeContract.increase >= 0
}"
<span class="current">{{ activeContract.price }}$</span>
<span class="current">{{ price1(activeContract.price) }}$</span>
<span class="zf">{{ activeContract.increaseStr }}</span>
@ -92,7 +92,7 @@
24h {{ $t("contract.h7") }}
{{ activeContract.high }}
{{ price1(activeContract.high) }}
<div class="item px-2">
@ -100,7 +100,7 @@
24h {{ $t("contract.h8") }}
{{ activeContract.low }}
{{ price1(activeContract.low) }}
@ -110,7 +110,7 @@
(USDT)
{{ activeContract.vol }}
{{ price1(activeContract.vol) }}
@ -284,6 +284,14 @@ export default {
}, 2000)
ispopover1(item){
this.activeSymbol=item;
this.$refs.popover.showPopper = false;
@ -180,9 +180,9 @@
<!-- Available -->
<p>
{{ $t('exchange.amount') }}
<span> {{toBalance}} {{pair.to}}</span><br />
<span> {{price1(toBalance)}} {{pair.to}}</span><br />
{{ $t('exchange.balance') }}
<span> {{fromBalance}} {{pair.from}}</span>
<span> {{price1(fromBalance)}} {{pair.from}}</span>
</p>
<button class="btn buy" @click="handleBuyOrder">{{ $t("common.buy") }} {{pair.to}}</button>
@ -260,9 +260,9 @@
{{$t('exchange.amount')}}
<span> {{toBalance}} {{pair.to}} </span><br />
<span> {{price1(toBalance)}} {{pair.to}} </span><br />
<button class="btn sell" @click="handleSellOrder">{{ $t("common.sell") }} {{pair.to}}</button>
@ -419,6 +419,14 @@ export default {
getCoinInfo(){
// console.log(this.symbol.indexOf('usdt')!=-1)
if(this.symbol.indexOf('usdt')!=-1){
@ -49,9 +49,9 @@
{{ coin.coin_name == 'fav' ? item.pair_name : item.coin_name + '/' + coin.coin_name}}
</td>
<td class="w-33 text-right">
{{ coin.coin_name == 'fav' ? item.close : item.price}}
{{ price1(coin.coin_name == 'fav' ? item.close : item.price)}}
<td class="w-33 text-right" :class="item.increaseStr.startsWith('-') ? 'red' : 'green'">
<td class="w-33 text-right" :class="getItemClass(item)">
{{ item.increaseStr }}
</tr>
@ -144,6 +144,14 @@ export default {
/*
* 询问用户是否登录
@ -206,6 +214,13 @@ export default {
this.favList.marketInfoList = res||[];
})
.catch((err) => {});
getItemClass(item) {
if (item && item.increaseStr && item.increaseStr.startsWith('-')) {
return 'red';
return 'green';