| | |
| | | import { useUserStore } from "@/store/user"; |
| | | const userStore = useUserStore(); |
| | | const quotesStore = useQuotesStore() |
| | | let timer = null // 底部持仓等的公用定时器 |
| | | let timer1 = null |
| | | |
| | | var showLength = 7 |
| | | export default { |
| | |
| | | initTimer: null, |
| | | keyIndex: 0, |
| | | timeout: null, |
| | | timer: null, // 底部持仓等的公用定时器 |
| | | timer1: null, |
| | | balance: 0, |
| | | symbol: '', |
| | | price: '', |
| | |
| | | } |
| | | }, |
| | | async created() { |
| | | |
| | | if (this.$route.query.type) { |
| | | this.type = this.$route.query.type |
| | | } |
| | | this.symbol = this.$route.params.symbol |
| | | |
| | | await this.SET_COIN_LIST(this.type) |
| | | // _getBalance().then(data => { // 获取用户余额 |
| | | // this.$store.commit('user/SET_USERINFO', { balance: data.money }) |
| | |
| | | this.getBalance() |
| | | this.timerMoeny = setInterval(() => { |
| | | this.getBalance() |
| | | }, 5000) |
| | | }, 3000) |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | symbolType: 'cryptos' |
| | | } |
| | | contractOrder(obj).then(data => { |
| | | |
| | | this.orderHold = data |
| | | }) |
| | | this[this.curTab](this.symbol) |
| | |
| | | if (this.selectIndex / 1 === 1) { |
| | | this.curTab = 'fetchOrderListHold' |
| | | this.animated2 = true |
| | | timer1 = setTimeout(() => { |
| | | this.timer1 = setTimeout(() => { |
| | | this.animated2 = false |
| | | clearTimeout(timer1) |
| | | }, 5000) |
| | | clearTimeout(this.timer1) |
| | | }, 1000) |
| | | } else { |
| | | this.animated1 = true |
| | | timer1 = setTimeout(() => { |
| | | this.timer1 = setTimeout(() => { |
| | | this.animated1 = false |
| | | clearTimeout(timer1) |
| | | }, 5000) |
| | | clearTimeout(this.timer1) |
| | | }, 1000) |
| | | } |
| | | this[this.curTab](this.symbol) |
| | | }, |
| | |
| | | }).catch(err => { |
| | | this.initFunTimer1 = setTimeout(() => { |
| | | initFun() |
| | | }, 5000); |
| | | }, 1000); |
| | | }) |
| | | } |
| | | initFun() |
| | |
| | | }).catch(err => { |
| | | this.initFunTimer2 = setTimeout(() => { |
| | | initFun() |
| | | }, 5000); |
| | | }, 1000); |
| | | }) |
| | | } |
| | | this.initFunTimer2 = setTimeout(() => { |
| | |
| | | this.orderCur = data |
| | | }) |
| | | this.clearTimer() |
| | | timer = setInterval(() => { |
| | | this.timer = setInterval(() => { |
| | | _contractApplyOrderList({ |
| | | symbol, |
| | | type: 'orders', |
| | | page_no: 1 |
| | | }).then(data => { |
| | | // if (typeof timer === 'string') { |
| | | // timer = null |
| | | // if (typeof this.timer === 'string') { |
| | | // this.timer = null |
| | | // return |
| | | // } |
| | | this.orderCur = data |
| | | }) |
| | | }, 5000) |
| | | }, 1000) |
| | | } |
| | | }, |
| | | fetchOrderListHold(symbol) { // 当前持仓 |
| | | let obj = { |
| | | symbol: this.symbol, |
| | | symbol: symbol, |
| | | type: 'orders', |
| | | page_no: 1, |
| | | symbolType: 'cryptos' |
| | |
| | | // this.orderHold = data |
| | | this.orderHold = data.sort(this.sortData); |
| | | }) |
| | | timer = setInterval(() => { |
| | | this.timer = setInterval(() => { |
| | | contractOrder(obj).then(data => { |
| | | // if (typeof timer === 'string') { |
| | | // timer = null |
| | | // if (typeof this.timer === 'string') { |
| | | // this.timer = null |
| | | // return |
| | | // } |
| | | // this.orderHold = data |
| | | this.orderHold = data.sort(this.sortData); |
| | | }) |
| | | }, 5000) |
| | | }, 1000) |
| | | } |
| | | }, |
| | | fetchFutrueHoldList(symbol) { // 交割持仓 |
| | |
| | | // this.futrueHold = data |
| | | this.futrueHold = data.sort(this.sortData); |
| | | }) |
| | | timer = setInterval(() => { |
| | | this.timer = setInterval(() => { |
| | | _futrueOrderList(symbol, 'orders', 1, 'cryptos').then(data => { |
| | | // if (typeof timer === 'string') { |
| | | // timer = null |
| | | // if (typeof this.timer === 'string') { |
| | | // this.timer = null |
| | | // return |
| | | // } |
| | | // this.futrueHold = data |
| | | this.futrueHold = data.sort(this.sortData); |
| | | }) |
| | | }, 5000) |
| | | }, 1000) |
| | | } |
| | | }, |
| | | fetchFutrueHistory(symbol) { // 交割历史持仓 |
| | |
| | | clearTimeout(this.initFunTimer2) |
| | | this.initFunTimer2 = null |
| | | } |
| | | clearInterval(timer) |
| | | clearInterval(this.timer) |
| | | // if (isNeed) { |
| | | // timer = '' |
| | | // this.timer = '' |
| | | // return |
| | | // } |
| | | timer = null |
| | | this.timer = null |
| | | }, |
| | | changeCurrentType(type) { |
| | | this.currentType = type |