| | |
| | | v-for="(item,index) in typelist" :key="index">{{item}}</div> |
| | | </div> |
| | | <div v-if="typeindex==0"> |
| | | <!-- <trade-head :backFunc="() => $router.push('/')" :symbol="symbol" :newname="newname" :price="price" :range="range" |
| | | :isTrade="true" @update-coin="onUpdate" @data="quote = $event" /> --> |
| | | <trade-head :backFunc="() => $router.push('/')" :symbol="symbol" :newname="newname" :price="price" :range="range" |
| | | :isTrade="true" @update-coin="onUpdate" @data="quote = $event" /> |
| | | |
| | | <div class="trade-buy-sell flex justify-between px-30 py-30"> |
| | | <keep-alive> |
| | | <trade-deep-data :selectValue="selectValue" @getList="getList" :showType="showType" :symbol="symbol" |
| | | v-if="symbol" :price="price" class="w-290 mr-30" /> |
| | | </keep-alive> |
| | | <trade-order-area :key="newzuj" :symbol="symbol" :init-open="initOpena" :newname="newname" :init-close="initClose" |
| | | :price="price" @ordered="onOrdereda" /> |
| | | <trade-order-area :symbol="symbol" :init-open="initOpena" :newname="newname" :init-close="initClose" :price="price" |
| | | @ordered="onOrdereda" /> |
| | | </div> |
| | | |
| | | <div class="list-data"> |
| | |
| | | range: "", |
| | | stop_price_profit: "", |
| | | stop_price_loss: "", |
| | | newzuj:0, |
| | | initClose: {}, |
| | | asks: initArr, // 卖单 |
| | | bids: initArr, // 买单 |
| | |
| | | timeout: null, |
| | | timer: null, // 底部持仓等的公用定时器 |
| | | timer2: null, // 交割合约底部持仓等的公用定时器 |
| | | symbol: "", |
| | | price: "", |
| | | range: "", |
| | | initOpena: {}, |
| | |
| | | } |
| | | _getBalance().then((data) => { |
| | | // 获取用户余额 |
| | | this.$store.commit("user/SET_USERINFO", { |
| | | balance: data.money |
| | | }); |
| | | this.$store.commit("user/SET_USERINFO", { balance: data.money }); |
| | | // const { money } = data |
| | | // this.balance = money |
| | | }); |
| | |
| | | this.curTab = "fetchOrderListHold"; |
| | | } |
| | | this.symbol = symbol; |
| | | // if(this.symbol == 'ORBITAL'){ |
| | | // this.symbol = 'mother' |
| | | // } |
| | | if (this.typeindex == 0) { |
| | | this.inita(symbol); |
| | | } else { |
| | | this.init(symbol); |
| | | } |
| | | // this.handleQoutes() |
| | | }, |
| | | methods: { |
| | | ...mapActions("home", [SET_COIN_LIST]), |
| | |
| | | if (e == 0) { |
| | | this.initParama(this.symbol) |
| | | } else { |
| | | // this.symbol = 'wld' |
| | | this.symbol = 'wld' |
| | | this.initParam(this.symbol) |
| | | } |
| | | this.$forceUpdate() |
| | |
| | | this[this.curTab](this.symbol); |
| | | }, |
| | | getCoinPrce(val) { |
| | | |
| | | _getHomeList(val).then((res) => { |
| | | this.coinPrice = res[0].close; |
| | | }); |
| | |
| | | _getHomeList(symbol).then((data) => { |
| | | // 获取行情 |
| | | this.handleQoutes(data); |
| | | // this.startQuoteSocket(); // socket |
| | | this.startQuoteSocket(); // socket |
| | | if (this.typeindex == 0) { |
| | | this.startQuoteSocketa(); // socket |
| | | } else { |
| | |
| | | }, |
| | | fetchDeepData(symbol) { |
| | | console.log("sd"); |
| | | this.newzuj += 1 |
| | | _getDeepData(symbol).then((data) => { |
| | | // 获取深度 |
| | | console.log(data); |
| | |
| | | return; |
| | | } |
| | | this.deepData = data; |
| | | const { |
| | | asks, |
| | | bids |
| | | } = data; |
| | | const { asks, bids } = data; |
| | | this.asks = asks.sort((a, b) => a.price - b.price).slice(0, showLength); |
| | | this.bids = bids.sort((a, b) => a.price - b.price).slice(-showLength); |
| | | }, |
| | |
| | | }; |
| | | |
| | | this.socket.onmessage = (evt) => { |
| | | const { |
| | | data |
| | | } = evt; |
| | | const { |
| | | code, |
| | | data: _data |
| | | } = JSON.parse(data); |
| | | const { data } = evt; |
| | | const { code, data: _data } = JSON.parse(data); |
| | | if (code / 1 === 0) { |
| | | this.handleDeep(_data); |
| | | } |
| | |
| | | //console.log('开仓数据') |
| | | Axios.tradeBuyToken({}).then((res) => { |
| | | this.initOpena = res.data; |
| | | console.log(this.initOpena.volume, res.data.volume, type,111111); |
| | | console.log(this.initOpen.volume, res.data.volume, type); |
| | | }); |
| | | } |
| | | if (type === "close" || !type) { |
| | |
| | | if (type === "open" || type === "long" || type === "short" || !type) { |
| | | let initFunTimer = null; |
| | | let initFun = () => { |
| | | |
| | | _initOpen(symbol.toLowerCase()) |
| | | _initOpen(symbol) |
| | | .then((data) => { |
| | | this.initOpen = data; |
| | | clearTimeout(initFunTimer); |
| | |
| | | this.initParam(symbol); // 'open' |
| | | } |
| | | this.clearTimer(); |
| | | // this.getCoinPrce(symbol); |
| | | this.getCoinPrce(symbol); |
| | | }, |
| | | closeSocketa() { |
| | | this.socket && this.socket.close(); |
| | |
| | | // socket.send('hello') |
| | | // } |
| | | this.sockets.quotes.onmessage = (evt) => { |
| | | const { |
| | | data |
| | | } = evt; |
| | | const { |
| | | code, |
| | | data: _data |
| | | } = JSON.parse(data); |
| | | const { data } = evt; |
| | | const { code, data: _data } = JSON.parse(data); |
| | | if (code / 1 === 0) { |
| | | this.handleQoutes(_data); |
| | | } |
| | |
| | | // vm.inita(symbol); |
| | | // }); |
| | | // }else{ |
| | | // next((vm) => { |
| | | // vm.symbol = symbol; |
| | | // vm.inita(symbol); |
| | | // }); |
| | | next((vm) => { |
| | | vm.symbol = symbol; |
| | | vm.init(symbol); |
| | |
| | | } |
| | | }, |
| | | activated() { |
| | | this.currentType = this.$route.query.currentType ? |
| | | this.$route.query.currentType : |
| | | "long"; |
| | | this.currentType = this.$route.query.currentType |
| | | ? this.$route.query.currentType |
| | | : "long"; |
| | | }, |
| | | deactivated() { |
| | | if (this.typeindex == 0) { |
| | |
| | | width: 100%; |
| | | } |
| | | |
| | | .my-swipe .van-swipe-item {} |
| | | .my-swipe .van-swipe-item { |
| | | } |
| | | |
| | | .line { |
| | | height: 13px; |