10.10综合交易所原始源码_移动端
1
李凌
2 days ago dce10d37ad35efe8ed1d39d6e5fcf7e4904381df
src/views/trade/components/OptionsContract.vue
@@ -43,7 +43,7 @@
          <div class="line"></div>
          <PerpetualOrder class="pl-8 pr-8" :key="keyIndex + 'b'" :symbol="symbol" :order-cur="orderCur"
            :order-hold="orderHold" :topIndex="selectIndex" :futrue-hold="futrueHold" :futrue-histroy="futrueHistroy"
            @tab="onTab" @recall="onRecall" />
            :perpetual-histroy="perpetualHistroy" :symbol-type="type" @tab="onTab" @recall="onRecall" />
        </div>
      </div>
@@ -85,8 +85,8 @@
              <div class="px-2 ml-12 py-2 flex items-center textColor1 text-28" @click="onDeliveryTab('history')"
                :class="deliveryPositionTab === 'history' ? 'active-line' : ''">{{ $t('历史仓位') }}</div>
            </div>
            <img src="@/assets/image/public/record.png" alt="record-img" class="w-16 h-9 pr-8 record-img"
              @click="goDeliveryHistory" />
            <!-- <img src="@/assets/image/public/record.png" alt="record-img" class="w-16 h-9 pr-8 record-img"
              @click="goDeliveryHistory" /> -->
          </div>
          <template v-if="deliveryPositionTab === 'hold'">
            <futrue-hold-list :price="price" :list-data="futrueHold" />
@@ -216,6 +216,7 @@
      bids: initDepthArr(),
      orderCur: [],
      orderHold: [],
      perpetualHistroy: [],
      futrueHold: [],
      futrueHistroy: [],
      curTab: 'fetchOrderListHold',
@@ -290,6 +291,8 @@
    symbol(val) {
      if (val && val !== this._lastSymbol) {
        this._lastSymbol = val
        this.futrueHold = []
        this.futrueHistroy = []
        this.closeSocket()
        this.init(val)
      }
@@ -456,6 +459,7 @@
    },
    fetchOrderListCur(symbol) {
      if (!this.userInfo || !this.userInfo.token) return
      symbol = ''
      const params = { symbol, type: 'orders', page_no: 1 }
      _contractApplyOrderList(params).then(data => { this.orderCur = data || [] })
      this.clearTimer()
@@ -465,6 +469,8 @@
    },
    fetchOrderListHold(symbol) {
      if (!this.userInfo || !this.userInfo.token) return
      symbol = ''
      const symbolType = this.type || 'cryptos'
      const obj = { symbol, type: 'orders', page_no: 1, symbolType }
      contractOrder(obj).then(data => {
@@ -480,20 +486,30 @@
    fetchFutrueHoldList(symbol) {
      if (!this.userInfo || !this.userInfo.token) return
      const symbolType = this.type || 'cryptos'
      _futrueOrderList(symbol, 'orders', 1, symbolType).then(data => {
      const querySymbol = symbol || this.symbol || ''
      _futrueOrderList(querySymbol, 'orders', 1, symbolType).then(data => {
        this.futrueHold = (data || []).sort(this.sortData)
      })
      this.clearTimer()
      this.timer = setInterval(() => {
        _futrueOrderList(symbol, 'orders', 1, symbolType).then(data => {
        _futrueOrderList(querySymbol, 'orders', 1, symbolType).then(data => {
          this.futrueHold = (data || []).sort(this.sortData)
        })
      }, 1000)
    },
    fetchFutrueHistory(symbol) {
      const symbolType = this.type || 'cryptos'
      _futrueOrderList(symbol, 'hisorders', 1, symbolType).then(data => {
      const querySymbol = symbol || this.symbol || ''
      _futrueOrderList(querySymbol, 'hisorders', 1, symbolType).then(data => {
        this.futrueHistroy = data || []
      })
    },
    fetchPerpetualHistory(symbol) {
      if (!this.userInfo || !this.userInfo.token) return
      symbol = ''
      const symbolType = this.type || 'cryptos'
      contractOrder({ symbol, type: 'hisorders', page_no: 1, symbolType }).then(data => {
        this.perpetualHistroy = data || []
      })
    },
    init(symbol) {
@@ -502,10 +518,22 @@
      this.fetchDeepData(symbol)
      this.initParam(symbol)
      this.clearTimer()
      if ((this.selectIndex ?? 1) === 2) {
        if (this.deliveryPositionTab === 'history') {
          this.curTab = 'fetchFutrueHistory'
          this.fetchFutrueHistory(symbol)
        } else {
          this.curTab = 'fetchFutrueHoldList'
          this.fetchFutrueHoldList(symbol)
        }
        return
      }
      if (this.curTab === 'fetchOrderListHold') {
        this.fetchOrderListHold(symbol)
      } else if (typeof this[this.curTab] === 'function') {
        this[this.curTab](symbol)
      } else {
        this.fetchFutrueHoldList(symbol)
        this.fetchOrderListHold(symbol)
      }
    },
    closeSocket() {