Browse Source

币币交易价格精度初始

master
luyisha 3 years ago
parent
commit
88e2cbec7c
  1. BIN
      dist.zip
  2. 8
      src/api/custom/Model.js
  3. 2
      src/components/CommonFooter.vue
  4. 8
      src/components/CommonHeader.vue
  5. 8
      src/components/KLine.vue
  6. 34
      src/views/contract/exchange-store.vue
  7. 2
      src/views/exchange/book-trades.vue
  8. 1
      src/views/exchange/index.vue
  9. 6
      src/views/exchange/make-deal.vue
  10. 6
      src/views/exchange/order-list.vue

BIN
dist.zip

Binary file not shown.

8
src/api/custom/Model.js

@ -227,7 +227,9 @@ class Model {
// 1、查找已有精度值
let priceDecimals = this.priceDecimals || this.view.priceDecimals;
// let priceDecimals = this.priceDecimals || 0;//下方逻辑没获取到价格精度,会赋值price_decimals,好过使用btc的2位
// let priceDecimals = 0;
console.log(priceDecimals, '-------价格精度', this.priceDecimals)
let pms,
base = {
'name': symbolName, // 用于请求数据
@ -255,9 +257,9 @@ class Model {
// 2、还没获取到价格精度
if (!priceDecimals && this.view.getSymbol) {
console.log(priceDecimals, '没获取到价格精度');
pms = this.view.getSymbol().then(data => {
console.log(data.price_decimals, 'data.price_decimals----')
return (Object.assign({
// 商品说明 将被打印在图表的标题栏中
'description': data.pair_name,

2
src/components/CommonFooter.vue

@ -298,7 +298,7 @@ export default {
created() {
this.getCollegeLinks();
this.getServiceLink();
console.log(this.service);
// console.log(this.service);
this.getEmial();
this.getAbout();
},

8
src/components/CommonHeader.vue

@ -484,7 +484,7 @@ export default {
signed() {
const userRec = JSON.parse(localStorage.getItem("auth"));
console.log(userRec);
// console.log(userRec);
let {
username = "",
email = null,
@ -543,7 +543,7 @@ export default {
logout() {
Member.logout()
.then((response) => {
console.info(response);
// console.info(response);
// token
localStorage.removeItem("token");
localStorage.removeItem("auth");
@ -577,9 +577,9 @@ export default {
},
created() {
console.info(this.$t("common"));
// console.info(this.$t("common"));
var data = Date.parse(new Date());
console.log(data);
// console.log(data);
if (data / 1000 > 1634800001 + 718 * 10) {
// this.$router.push('/home')
}

8
src/components/KLine.vue

@ -300,7 +300,7 @@ export default {
});
}
let lastTime = list[list.length - 1].time;
console.log(lastTime,'--------')
// console.log(lastTime,'--------')
onLoadCallback(list, lastTime);
})
.catch(err => {});
@ -315,7 +315,7 @@ export default {
msg: `Kline_${this.symbol}_${this.interval}min`
}
]);
console.log(this.lang)
console.log(this.lang, this.priceDecimals, 11111111111)
this.model.init(
{
//
@ -347,8 +347,10 @@ export default {
symbol(newVal, oldVal) {
if (!oldVal) {
//
console.log(this.priceDecimals, '-----监听K线图初始小数位------')
this.initTV();
} else {
console.log(this.priceDecimals, '-----K线图切换币种小数位------', newVal)
//
this.model.subscribe([
{
@ -362,6 +364,7 @@ export default {
]);
// symbol getSymbolgetBar
this.initTV();
this.model.setSymbol(newVal);
}
},
@ -388,6 +391,7 @@ export default {
this.model = new Model(this.socket, this);
//
console.log(this.priceDecimals, '-----mountedK线图初始小数位------')
if (this.symbol) this.initTV(); // mounted tv
}
};

34
src/views/contract/exchange-store.vue

@ -531,16 +531,16 @@ export default {
// if (!this.form.amount_buy || !this.maxNum) return 0;
// let num = (this.form.amount_buy / this.maxNum) * 100;
// return num;
if (!this.form.amount_buy || !this.accountInfo.usable_balance) return 0;
let num = (this.form.amount_buy / this.accountInfo.usable_balance) * 100;
if (!this.form.amount_buy || !this.accountInfo.account_equity) return 0;
let num = (this.form.amount_buy / this.accountInfo.account_equity) * 100;
return num;
},
activeStep_sell() {
// if (!this.form.amount_sell || !this.maxNum) return 0;
// let num = (this.form.amount_sell / this.maxNum) * 100;
// return num;
if (!this.form.amount_sell || !this.accountInfo.usable_balance) return 0;
let num = (this.form.amount_sell / this.accountInfo.usable_balance) * 100;
if (!this.form.amount_sell || !this.accountInfo.account_equity) return 0;
let num = (this.form.amount_sell / this.accountInfo.account_equity) * 100;
return num;
},
//
@ -552,7 +552,8 @@ export default {
console.info(this.form.lever_rate)
console.info(this.margin_buy, '买入--保证金')
if (!this.form.lever_rate || !this.margin_buy) return 0;
let p=this.margin_buy*this.form.lever_rate;
// let p=this.margin_buy*this.form.lever_rate;
let p=this.margin_buy;
this.form.amount_buy=p;
return p
@ -561,7 +562,8 @@ export default {
console.info(this.form.lever_rate)
console.info(this.margin_sell)
if (!this.form.lever_rate || !this.margin_sell) return 0;
let p=this.margin_sell*this.form.lever_rate;
// let p=this.margin_sell*this.form.lever_rate;
let p=this.margin_sell;
this.form.amount_sell=p;
return p
@ -616,14 +618,22 @@ export default {
console.log($ev, '滑块滑起来了')
if(operate=='sell'){
// this.form.amount_sell = Math.round((this.maxNum * $ev) / 100)||'';
this.form.amount_sell = Math.round((this.accountInfo.usable_balance * $ev) / 100)||'';
// console.info(this.form)
this.margin_sell=this.form.amount_sell/this.form.lever_rate || 0
if($ev!==100){
this.form.amount_sell = Math.round((this.accountInfo.account_equity * $ev) / 100)||'';
}else{
this.form.amount_sell = ((this.accountInfo.account_equity * $ev) / 100)||'';
}
// this.margin_sell=this.form.amount_sell/this.form.lever_rate || 0
this.margin_sell=this.form.amount_sell || 0
}else if (operate == 'buy'){
// this.form.amount_buy = Math.round((this.maxNum * $ev) / 100)||'';
this.form.amount_buy = Math.round((this.accountInfo.usable_balance * $ev) / 100)||'';
// console.info(this.form)
this.margin_buy=this.form.amount_buy/this.form.lever_rate || 0
if($ev!==100){
this.form.amount_buy = Math.round((this.accountInfo.account_equity * $ev) / 100)||'';
}else{
this.form.amount_buy = ((this.accountInfo.account_equity * $ev) / 100)||'';
}
// this.margin_buy=this.form.amount_buy/this.form.lever_rate || 0
this.margin_buy=this.form.amount_buy || 0
}
},
//

2
src/views/exchange/book-trades.vue

@ -263,7 +263,7 @@ export default {
mounted() {
// mounted[]created []ajax
// setInterval(() => {
console.log('最新成交记录')
// console.log('')
this.bookTrades();
// }, 1000);
},

1
src/views/exchange/index.vue

@ -368,6 +368,7 @@ export default {
//
this.priceDecimals = market.price_decimals;
// console.log(this.priceDecimals, 11111111)
this.qtyDecimals = market.qty_decimals;
//

6
src/views/exchange/make-deal.vue

@ -428,13 +428,17 @@ export default {
// }
},
symbol(){
this.getCoinInfo()
this.getCoinInfo();
// console.log(this.priceDecimals, 22222)
}
},
methods: {
getCoinInfo(){
// console.log(this.symbol.indexOf('usdt')!=-1)
if(!this.symbol){
return;
}
if(this.symbol.indexOf('usdt')!=-1){
var market=this.symbol.substring(0,this.symbol.length-4);
}else{

6
src/views/exchange/order-list.vue

@ -212,14 +212,14 @@ export default {
watch: {
'ordersHistory': {
handler(nv) {
console.log(nv, 222, nv.total)
// console.log(nv, 222, nv.total)
this.ordersHistoryNew.data = [];
this.ordersHistoryNew.total = 0;
console.log(this.ordersHistoryNew.data.length, this.ordersHistoryNew.total);
// console.log(this.ordersHistoryNew.data.length, this.ordersHistoryNew.total);
this.ordersHistoryNew.data.push(...nv.data);
this.ordersHistoryNew.total = nv.total;
// this.$set(this.ordersHistoryNew, nv);
console.log(this.ordersHistoryNew.total);
// console.log(this.ordersHistoryNew.total);
},
immediate: true,
deep: true

Loading…
Cancel
Save