Browse Source

新增股票

master
liaoxinyu 3 weeks ago
parent
commit
88f97c892a
  1. 5
      src/api/market.js
  2. 2
      src/assets/scss/base/_common.scss
  3. 30
      src/assets/scss/theme/_dark.scss
  4. 2
      src/i18n/de.json
  5. 2
      src/i18n/en.json
  6. 2
      src/i18n/fra.json
  7. 2
      src/i18n/it.json
  8. 2
      src/i18n/jp.json
  9. 2
      src/i18n/kor.json
  10. 2
      src/i18n/pt.json
  11. 2
      src/i18n/spa.json
  12. 2
      src/i18n/tr.json
  13. 2
      src/i18n/tw.json
  14. 13
      src/views/exchangeStock/book-trades.vue
  15. 47
      src/views/exchangeStock/index.vue
  16. 158
      src/views/exchangeStock/make-deal.vue
  17. 20
      src/views/exchangeStock/order-list.vue

5
src/api/market.js

@ -63,7 +63,10 @@ class Market {
static getstockCoinInfo(params) {
return server.get(`/stock/getCoinInfo`,{ params });
}
// 是否显示颜色
static getstocktradingOpen(params) {
return server.get(`/stock/tradingOpen`,{ params });
}
}
export default Market;

2
src/assets/scss/base/_common.scss

@ -151,7 +151,7 @@
}
.table td,
.table th {
border-top: 1px solid #4e4e5d;
// border-top: 1px solid #4e4e5d;
}
.input-group-text {

30
src/assets/scss/theme/_dark.scss

@ -192,8 +192,8 @@
}
#dark .market-trade {
border: 1px solid #2a2e39;
background: #131722;
// border: 1px solid #2a2e39;
// background: #131722;
}
#dark .market-trade .nav .nav-item .nav-link.active {
@ -745,3 +745,29 @@
background-color: #161c3c;
// border: 1px solid #202951;
}
#dark .exchange-history .nav{
background: #121212;
}
#dark .market-order{
border: 1px solid #404040;
}
#dark .ob-heading {
border: 1px solid #333;
box-shadow: 0 0 5px #555;
}
#dark .Tab_sell1{
color: #ffffff;
}
#dark .Tab_buy1{
color: #ffffff;
}
#dark .input-group-text{
border: 1px solid #404040;
background-color: #121212;
}
#dark .form-control{
background-color: #121212;
}
#dark .market-trade p{
color: #e7e7e7;
}

2
src/i18n/de.json

@ -1133,7 +1133,7 @@
"hh15": "Nachrichten",
"hh16": "Entdecken",
"hh17": "Jetzt mit dem Mining beginnen",
"hh18": "Registrieren Sie sich jetzt bei Bonds, um die aktuellsten Nachrichten zu erhalten und sofort mit dem Mining zu starten.",
"hh18": "Registrieren Sie sich jetzt bei Muzkcoin, um die aktuellsten Nachrichten zu erhalten und sofort mit dem Mining zu starten.",
"hh19": "E-Mail-Adresse eingeben",
"hh20": "Abonnieren",
"hh21": "Alle anzeigen",

2
src/i18n/en.json

@ -1236,7 +1236,7 @@
"hh15": "News",
"hh16": "Explore",
"hh17": "Start mining now",
"hh18": "Join now with Bonds to get the latest news and start mining now",
"hh18": "Join now with Muzkcoin to get the latest news and start mining now",
"hh19": "Enter your email",
"hh20": "Subscribe",
"hh21": "See All",

2
src/i18n/fra.json

@ -1133,7 +1133,7 @@
"hh15": "Actualités",
"hh16": "Explorer",
"hh17": "Commencez le minage dès maintenant",
"hh18": "Rejoignez Bonds dès maintenant pour recevoir les dernières actualités et commencer le minage sans attendre.",
"hh18": "Rejoignez Muzkcoin dès maintenant pour recevoir les dernières actualités et commencer le minage sans attendre.",
"hh19": "Saisissez votre e-mail",
"hh20": "S'abonner",
"hh21": "Tout voir",

2
src/i18n/it.json

@ -1132,7 +1132,7 @@
"hh15": "Notizie",
"hh16": "Esplora",
"hh17": "Inizia il mining ora",
"hh18": "Iscriviti ora con Bonds per ricevere le ultime notizie e iniziare subito il mining",
"hh18": "Iscriviti ora con Muzkcoin per ricevere le ultime notizie e iniziare subito il mining",
"hh19": "Inserisci la tua email",
"hh20": "Iscriviti",
"hh21": "Vedi tutto",

2
src/i18n/jp.json

@ -1131,7 +1131,7 @@
"hh15": "ニュース",
"hh16": "探索する",
"hh17": "今すぐマイニングを開始",
"hh18": "Bondsに今すぐ登録して、最新ニュースを受け取り、マイニングを始めましょう。",
"hh18": "Muzkcoinに今すぐ登録して、最新ニュースを受け取り、マイニングを始めましょう。",
"hh19": "メールアドレスを入力",
"hh20": "購読する",
"hh21": "すべて見る",

2
src/i18n/kor.json

@ -1131,7 +1131,7 @@
"hh15": "뉴스",
"hh16": "둘러보기",
"hh17": "지금 채굴 시작하기",
"hh18": "Bonds에 지금 가입하고 최신 뉴스를 받아보며 채굴을 시작하세요",
"hh18": "Muzkcoin에 지금 가입하고 최신 뉴스를 받아보며 채굴을 시작하세요",
"hh19": "이메일 주소 입력",
"hh20": "구독하기",
"hh21": "전체 보기",

2
src/i18n/pt.json

@ -1132,7 +1132,7 @@
"hh15": "Notícias",
"hh16": "Explorar",
"hh17": "Comece a minerar agora",
"hh18": "Cadastre-se agora na Bonds para receber as últimas notícias e começar a minerar imediatamente",
"hh18": "Cadastre-se agora na Muzkcoin para receber as últimas notícias e começar a minerar imediatamente",
"hh19": "Insira seu e-mail",
"hh20": "Assinar",
"hh21": "Ver Tudo",

2
src/i18n/spa.json

@ -1132,7 +1132,7 @@
"hh15": "Noticias",
"hh16": "Explorar",
"hh17": "Empieza a minar ahora",
"hh18": "Únete ahora con Bonds para recibir las últimas noticias y empezar a minar de inmediato.",
"hh18": "Únete ahora con Muzkcoin para recibir las últimas noticias y empezar a minar de inmediato.",
"hh19": "Introduce tu correo electrónico",
"hh20": "Suscribirse",
"hh21": "Ver todo",

2
src/i18n/tr.json

@ -1132,7 +1132,7 @@
"hh15": "Haberler",
"hh16": "Keşfet",
"hh17": "Hemen madenciliğe başla",
"hh18": "En son haberleri almak ve hemen madenciliğe başlamak için Bonds'a şimdi katılın",
"hh18": "En son haberleri almak ve hemen madenciliğe başlamak için Muzkcoin'a şimdi katılın",
"hh19": "E-posta adresinizi girin",
"hh20": "Abone Ol",
"hh21": "Tümünü Gör",

2
src/i18n/tw.json

@ -1166,7 +1166,7 @@
"hh15": "新聞資訊",
"hh16": "探索",
"hh17": "立即開始挖礦",
"hh18": "立即加入 Bonds,取得最新資訊並開始挖礦",
"hh18": "立即加入 Muzkcoin,取得最新資訊並開始挖礦",
"hh19": "輸入您的電子郵件",
"hh20": "訂閱",
"hh21": "全部",

13
src/views/exchangeStock/book-trades.vue

@ -19,12 +19,12 @@
<tbody class="sell-orders" v-if="symbol!='gitpusdt'">
<div class="order-item" v-for="item in sellList" :key="item.id">
<el-progress class="progress" type="line" :stroke-width="39" :percentage="getValue(item.amount)" :show-text="false" color="rgba(216,43,43,0.15)">
<el-progress class="progress" type="line" :stroke-width="39" :percentage="getValue(item.amount)" :show-text="false" color="rgba(216,43,43,0.15)" define-back-color="#121212">
</el-progress>
<!-- 卖单 使用弹性盒子倒序排列 -->
<tr style="display:block;" class="tb-cells" @click.stop="handleOrder(item.price)">
<td class="w-33 red" title="pick this price to sell">{{ item.price|omitTo(priceDecimals) }}</td>
<td class="w-33 text-right">{{ item.amount|omitTo(qtyDecimals) }}</td>
<td class="w-33 text-center">{{ item.amount|omitTo(qtyDecimals) }}</td>
<td class="w-33 text-right">{{ item.price|multiple(item.amount, priceDecimals) }}</td>
</tr>
</div>
@ -61,12 +61,12 @@
<tbody class="buy-orders" :style="[{'height':symbol!='gitpusdt'?'':'470px!important'}]">
<!-- 买单 反序数值 -->
<div class="order-item" v-for="item in reversed" :key="item.id">
<el-progress class="progress" type="line" :stroke-width="39" :percentage="getValue(item.amount)" :show-text="false" color="rgba(37, 188, 103, 0.15)">
<el-progress class="progress" type="line" :stroke-width="39" :percentage="getValue(item.amount)" :show-text="false" color="rgba(37, 188, 103, 0.15)" define-back-color="#121212">
</el-progress>
<!-- 卖单 使用弹性盒子倒序排列 -->
<tr style="display:block;" class="tb-cells" @click.stop="handleOrder(item.price)">
<td class="w-33 green" title="pick this price to buy">{{ item.price|omitTo(priceDecimals) }}</td>
<td class="w-33 text-right">{{ item.amount|omitTo(qtyDecimals) }}</td>
<td class="w-33 text-center">{{ item.amount|omitTo(qtyDecimals) }}</td>
<td class="w-33 text-right">{{ item.price|multiple(item.amount, priceDecimals) }}</td>
</tr>
</div>
@ -310,6 +310,7 @@ export default {
left: 0;
top: 0;
height: 100%;
width: 100%;
z-index: 100;
cursor: pointer;
@ -381,8 +382,8 @@ export default {
</style>
<style lang="scss" scoped>
.ob-heading {
border: 1px solid #333;
box-shadow: 0 0 5px #555;
border: 1px solid #dadada;
box-shadow: 0 0 5px #dadada;
}
.textcolor{
color: #007bff;

47
src/views/exchangeStock/index.vue

@ -39,7 +39,7 @@
</div>
</div> -->
<div class="contract-page">
<div class="coin-change d-flex align-items-center py-2 pl-4 heading justify-content-between">
<div class="coin-change d-flex align-items-center py-2 pl-4 heading justify-content-between bg-plain">
<div class="d-flex align-items-center">
<div class="coin d-flex align-items-center">
<el-popover
@ -60,9 +60,9 @@
style="max-height:300px;overflow:auto;"
>
<template v-for="parent in marketList">
<!-- <div class="px-3 text-primary" :key="parent.coin_name">
{{ parent.coin_name }}
</div> -->
<div class="px-3 text-primary" :key="parent.coin_name">
<!-- {{ parent.coin_name }} -->
</div>
<table class="table" :key="parent.coin_name + 1">
<thead>
<tr class="text-secondary">
@ -75,17 +75,27 @@
</thead>
<tbody>
<!-- @click="symbol = item.symbol" -->
<tr v-for="item in parent.marketInfoList" :key="item.symbol"
:class="{ active: item.symbol == symbol }" @click="ispopover1(item.symbol)">
<tr
v-for="item in parent.marketInfoList"
:key="item.symbol"
:class="{ active: item.symbol == symbol }"
@click="ispopover1(item.symbol)"
>
<td class="w-10/24">
<!-- {{ item.symbol }}/{{ parent.coin_name }} -->
{{ item.coin_name }}
</td>
<td class="w-7/24 " :class="item.increase < 0 ? 'decreace' : 'increace'">
<td
class="w-7/24 "
:class="item.increase < 0 ? 'decreace' : 'increace'"
>
{{item.price}}
<!-- item.symbol == symbol ? price1 : -->
</td>
<td class="w-7/24" :class="item.increase < 0 ? 'decreace' : 'increace'">
<td
class="w-7/24"
:class="item.increase < 0 ? 'decreace' : 'increace'"
>
{{ item.increaseStr }}
</td>
</tr>
@ -481,8 +491,11 @@
Exchange.getstockUserBalance(this.marketInfo.pair_name).then(data => {
// this.fromBalance = data[this.pair.from.toUpperCase()].usable_balance;
// this.toBalance = data[this.pair.to.toUpperCase()].usable_balance;
console.log(data[this.activeContract.coin_name].usable_balance,'111');
this.fromBalance = data[this.pair.from.toUpperCase()].usable_balance;
this.toBalance = data[this.pair.to.toUpperCase()].usable_balance;
this.toBalance = data[this.activeContract.coin_name].usable_balance;
}).catch(err => {
@ -494,6 +507,9 @@
//
update() {
this.getBalance();
setTimeout(()=>{
this.getBalance();
},2000)
this.getOrders();
this.getCurrencyExCny();
},
@ -507,6 +523,10 @@
})
},
getOrders() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
if (this.currentTab == "opens") { //
@ -678,6 +698,9 @@
Market.getstockMarketList().then(data => {
this.marketList = data;
// if (!this.symbol) { // symbol
// this.symbol = _.nth(data).marketInfoList[0].symbol;
// }
}).catch(err => {});
// this.update();
},
@ -692,7 +715,7 @@
</script>
<style>
/* .el-popover{
background-color: #121212;
} */
.el-popover{
/* background-color: #121212; */
}
</style>

158
src/views/exchangeStock/make-deal.vue

@ -62,7 +62,7 @@
<!-- <stock-kline :symbol="symbol" :socket="socket" :priceDecimals="priceDecimals"></stock-kline> -->
<!-- 交易处理 -->
<div class="market-trade" style="background-color: transparent;border: 0px;">
<div class="market-trade ">
<h4 style="text-align: center;">{{$t('nav.c12')}}</h4>
<div class="d-flex" style="margin: 14px;justify-content: space-around;border: 1px solid #b9b9b9;border-radius: 40px;">
<div :class="Tab_buysell == 1?'Tab_buy':'Tab_buy1'" @click="Tab_buysell=1">{{$t('order.buy')}}</div>
@ -191,7 +191,8 @@
{{ $t('exchange.balance') }}
<span> {{fromBalance}} {{pair.from}}</span>
</p>
<button class="btn buy" @click="handleBuyOrder">{{ $t("common.buy") }} {{pair.to}}</button>
<button class="btn buy" @click="handleBuyOrder" v-if="tradingOpenshow==true">{{ $t("common.buy") }} {{pair.to}}</button>
<button class="btn colorless" @click="handleBuyOrder" v-if="tradingOpenshow==false">{{ $t("common.buy") }} {{pair.to}}</button>
</div>
<!-- Sell Order -->
@ -237,7 +238,8 @@
<el-popover popper-class='popover-tips' placement="top-start" trigger="manual" v-model="visibles.sell.limitAmount">
<span class="content">
<i class="el-icon-warning-outline"></i>
{{ msgList.sell[2] }}
<!-- {{ msgList.sell[2] }} -->
{{ msgList.sell[4] }}
</span>
<div class="input-group" slot="reference">
<input type="number" v-model="sellorder.amount" class="form-control" min=0 :placeholder="$t('exchange.enter-amount')">
@ -272,7 +274,8 @@
{{ $t('exchange.balance') }}
<span> {{fromBalance}} {{pair.from}}</span>
</p>
<button class="btn sell" @click="handleSellOrder">{{ $t("common.sell") }} {{pair.to}}</button>
<button class="btn sell" @click="handleSellOrder" v-if="tradingOpenshow==true">{{ $t("common.sell") }} {{pair.to}}</button>
<button class="btn colorless" @click="handleSellOrder" v-if="tradingOpenshow==false">{{ $t("common.sell") }} {{pair.to}}</button>
</div>
</div>
</div>
@ -299,6 +302,11 @@ export default {
cacheTotal: 0, //
cachePrice: null, //
timeoutId: null,
intervalId: null,
tradingOpenshow:false,
timer: null,
//
visibles: {
"buy": {
@ -375,8 +383,9 @@ export default {
if (!this.isMarket) {
this.buyorder.amount = Math.division(val, this.buyorder.entrust_price);
} else { //
this.cacheTotal = val;
this.buyorder.amount = this.cacheTotal
// this.cacheTotal = val;
// this.buyorder.amount = this.cacheTotal
this.buyorder.amount = Math.division(val, this.buyorder.entrust_price,6);
}
}
},
@ -453,6 +462,91 @@ export default {
});
},
tradingOpen(){
Market.getstocktradingOpen().then(res => {
// console.log(res);
this.tradingOpenshow = res
}).catch(err => {});
},
//
startSchedule() {
// const now = new Date();
// const minutes = now.getMinutes();
// const seconds = now.getSeconds();
// const milliseconds = now.getMilliseconds();
// let msUntilNextTime = 0; //
// // 00 30
// if (minutes < 30) {
// // 0~29 30
// msUntilNextTime = (30 - minutes) * 60000 - seconds * 1000 - milliseconds;
// } else {
// // 30~59 00 (60)
// msUntilNextTime = (60 - minutes) * 60000 - seconds * 1000 - milliseconds;
// }
// console.log(` ${Math.round(msUntilNextTime / 1000)} `);
// // 1. setTimeout
// this.timeoutId = setTimeout(() => {
// // /
// this.tradingOpen();
// // 2. setInterval 30
// const THIRTY_MINUTES_MS = 30 * 60 * 1000;
// this.intervalId = setInterval(() => {
// this.tradingOpen();
// }, THIRTY_MINUTES_MS);
// }, msUntilNextTime);
this.timer = setInterval(() => {
const now = new Date();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
let remainingSeconds = 0;
// 1. 0000 3000
if (minutes % 30 === 0 && seconds === 0) {
remainingSeconds = 0;
console.log(`距离下次刷新还有 ${remainingSeconds} 秒,正在执行刷新...`);
//
this.tradingOpen();
}
// 2.
else {
if (minutes < 30) {
// 0~29 30
remainingSeconds = (30 - minutes) * 60 - seconds;
} else {
// 30~59 60 ()
remainingSeconds = (60 - minutes) * 60 - seconds;
}
//
// console.log(` ${remainingSeconds} `);
}
}, 1000);
},
//
// clearSchedule() {
// if (this.timeoutId) {
// clearTimeout(this.timeoutId);
// this.timeoutId = null;
// }
// if (this.intervalId) {
// clearInterval(this.intervalId);
// this.intervalId = null;
// }
// },
renderBuyAmount(val, index) {
// console.Info(val)
// console.Info(this.buyorder)
@ -645,10 +739,12 @@ export default {
if (this.empty(order.amount)) {
flag = false;
this.visibles[orderType].marketAmount = true;
this.visibles[orderType].limitAmount = true;
this.msgList[orderType][4] = this.$t('nav.a6');
} else if (order.amount < this.minQty) {
flag = false;
this.visibles[orderType].marketAmount = true;
this.visibles[orderType].limitAmount = true;
this.msgList[orderType][4] = this.$t('nav.a7')+` ${this.minQty}`;
}
}
@ -717,9 +813,18 @@ export default {
created() {
this.getCoinInfo()
this.tradingOpen()
this.startSchedule();
this.reset();
},
beforeDestroy() {
// this.clearSchedule();
if (this.timer) {
clearInterval(this.timer);
}
},
}
</script>
@ -785,7 +890,7 @@ export default {
.Tab_buy1{
width: 50%;
height: 40px;
color: #000;
color: #000000;
line-height: 40px;
text-align: center;
border-radius: 40px;
@ -802,23 +907,32 @@ export default {
.Tab_sell1{
width: 50%;
height: 40px;
// color: #ffffff;
color: #000000;
line-height: 40px;
text-align: center;
border-radius: 40px;
}
// .market-trade input{
// border: 1px solid #404040;
// }
// .input-group-text{
// border: 1px solid #404040;
// background-color: #121212;
// }
// .form-control{
// background-color: #121212;
// }
// .market-trade p{
// color: #e7e7e7;
// }
.market-trade input{
border: 1px solid #e7e7e7;
}
.input-group-text{
border: 1px solid #e7e7e7;
background-color: #fff;
}
.form-control{
background-color: #fff;
}
.market-trade p{
color: #767676;
}
.colorless{
background: #999999;
color: #fff;
text-transform: uppercase;
padding: 10px;
margin-top: 30px;
width: 100%;
box-shadow: 0px 0px 15px 0px rgba(199, 199, 199, 0.7);
}
</style>

20
src/views/exchangeStock/order-list.vue

@ -1,5 +1,5 @@
<template>
<div class="col-md-12" style="padding: 0px 10px;">
<div class="col-md-12">
<div class="exchange-history order-history market-order mt15 bg-plain">
<ul class="nav nav-pills" role="tablist">
<li class="nav-item" @click="toggle('stockholdPosition')">
@ -101,9 +101,9 @@
<td>{{item.usable_balance}}</td>
<td>{{item.realtimePrice}}</td>
<td>{{item.cost_price}}</td>
<td>{{item.dayProfit}}</td>
<td>{{item.unRealProfit}}</td>
<td>{{item.profitRate}}</td>
<td :class="item.dayProfit>0?'increace':item.dayProfit<0?'decreace':''">{{item.dayProfit}}</td>
<td :class="item.unRealProfit>0?'increace':item.unRealProfit<0?'decreace':''">{{item.unRealProfit}}</td>
<td :class="item.profitRate>0?'increace':item.profitRate<0?'decreace':''">{{item.profitRate}}</td>
</tr>
</tbody>
</table>
@ -332,15 +332,15 @@
</script>
<style scoped>
/* .market-order{
border: 1px solid #404040;
} */
.market-order{
border: 1px solid #ececec;
}
</style>
<style lang="scss">
.exchange-history {
// .nav {
// background: #121212;
// }
.nav {
background: #ececec;
}
.nav-link.active {
color: #007bff;

Loading…
Cancel
Save