| | |
| | | </div> |
| | | </section> |
| | | <div class="mainBackground rounded-view" key="y"> |
| | | <PerpetualOpen class="pl-30 pr-30" :key="keyIndex + 'c'" :selectIndex="selectIndex" :symbol="symbol" |
| | | <PerpetualOpen class="pl-30 pr-30" :key="symbol" :selectIndex="selectIndex" :symbol="symbol" |
| | | :green-data="bids" :red-data="asks" :price="price" :init-open="initOpen" :init-close="initClose" |
| | | :init-futrue="initFutrue" @ordered="onOrdered" @changeValueBack="changeValueBack"> |
| | | </PerpetualOpen> |
| | |
| | | import PerpetualOpen from '@/components/Transform/perpetual-open/index.vue' |
| | | import PerpetualOrder from '@/components/Transform/perpetual-order/index.vue' |
| | | |
| | | import { _getDeepData, _initOpen, _initClose, _futrueOrderInit, _contractApplyOrderList, contractOrder, _futrueOrderList } from "@/service/trade.api"; |
| | | import { _getDeepData, _initOpen, _initClose, _futrueOrderInit, _contractApplyOrderList, contractOrder, _futrueOrderList, _getKline } from "@/service/trade.api"; |
| | | import { _getBalance } from '@/service/user.api' |
| | | import { _getHomeList } from '@/service/home.api' |
| | | import { Popup, Swipe, SwipeItem } from 'vant'; |
| | |
| | | }), |
| | | }, |
| | | watch: { |
| | | // '$route.params.symbol': { |
| | | // immediate: true, |
| | | // handler(newVal) { |
| | | // if (newVal) { |
| | | // this.symbol = newVal |
| | | // this.onUpdate(newVal) // 重新初始化数据 |
| | | // } |
| | | // } |
| | | // }, |
| | | selectIndex(val) { |
| | | showLength = 7 |
| | | }, |
| | |
| | | // this.balance = money |
| | | }) |
| | | }, |
| | | |
| | | methods: { |
| | | ...mapActions('home', [SET_COIN_LIST]), |
| | | onUpdate(symbol) { // 更新 |
| | | debugger |
| | | this.currentType = 'long' |
| | | this.symbol = symbol |
| | | this.closeSocket() |
| | | // this.clearTimer() |
| | | |
| | | this.symbol = symbol |
| | | this.init(symbol) |
| | | }, |
| | | changeCurrentType(type) { |
| | |
| | | if (type === 'open' || type === 'long' || type === 'short' || !type) { |
| | | let initFunTimer = null; |
| | | let initFun = () => { |
| | | _initOpen({ symbol: symbol }).then(data => { |
| | | console.log(data, '22222222') |
| | | _getKline(symbol, '1min').then(data => { |
| | | this.initOpen = data |
| | | clearTimeout(initFunTimer) |
| | | initFunTimer = null |
| | | }).catch(err => { |
| | | }).catch(err => { |
| | | initFunTimer = setTimeout(() => { |
| | | initFun() |
| | | }, 3000); |
| | | }) |
| | | // _initOpen({ symbol: symbol }).then(data => { |
| | | // console.log(data, '22222222') |
| | | // this.initOpen = data |
| | | // clearTimeout(initFunTimer) |
| | | // initFunTimer = null |
| | | // }).catch(err => { |
| | | // initFunTimer = setTimeout(() => { |
| | | // initFun() |
| | | // }, 3000); |
| | | // }) |
| | | } |
| | | initFun() |
| | | } |
| | |
| | | symbol: symbol, |
| | | type: 'orders', |
| | | page_no: 1, |
| | | symbolType: 'cryptos' |
| | | // symbolType: 'cryptos' |
| | | } |
| | | if (this.userInfo.token) { |
| | | contractOrder(obj).then(data => { |
| | |
| | | }, |
| | | fetchFutrueHoldList(symbol) { // 交割持仓 |
| | | if (this.userInfo.token) { |
| | | _futrueOrderList(symbol, 'orders', 1, 'cryptos').then(data => { |
| | | _futrueOrderList(symbol, 'orders', 1).then(data => { |
| | | // this.futrueHold = data |
| | | this.futrueHold = data.sort(this.sortData); |
| | | }) |
| | | this.timer = setInterval(() => { |
| | | _futrueOrderList(symbol, 'orders', 1, 'cryptos').then(data => { |
| | | _futrueOrderList(symbol, 'orders', 1).then(data => { |
| | | // if (typeof this.timer === 'string') { |
| | | // this.timer = null |
| | | // return |
| | |
| | | } |
| | | }, |
| | | fetchFutrueHistory(symbol) { // 交割历史持仓 |
| | | _futrueOrderList(symbol, 'hisorders', 1, 'cryptos').then(data => { |
| | | _futrueOrderList(symbol, 'hisorders', 1 ).then(data => { |
| | | this.futrueHistroy = data |
| | | // this.clearTimeout() |
| | | }) |
| | | }, |
| | | init(symbol) { // 初始化页面 |
| | | // 在清理一遍 |
| | | this.closeSocket() |
| | | this.clearTimer() |
| | | |
| | | this.symbol = symbol |
| | | this.fetchQoutes(symbol) |
| | | this.fetchDeepData(symbol) |