10.10综合交易所原始源码_移动端
1
admin
2026-01-06 03043192ddf00f9a36b7454799a9152cd1b50a0b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<template>
  <!-- U本位合约历史 -->
  <div id="cryptos">
    <div class="perpetualHistory px-2 text-28">
      <assets-head :title="$t('U本位合约历史')" :backFunc="() => {
        if ($route.query.goback) {
          $router.push({
            path: '/cryptos/funds',
            query: {
              tab: 2,
              index: 0, // 0: 查看理财订单 1: 矿机
              type: 'cryptos'
            }
          })
        } else {
          //$router.push(`/cryptos/perpetualContract/${symbol}?selectIndex=1`)
          if (this.$route.query?.from === 'trade') {
            this.$router.push('/trade/index?tabActive=1')
          } else {
            $router.go(-1)
          }
        }
      }" />
      <div>
        <van-tabs ref="tabs" v-model:active="type" swipeable @change="onChange" sticky>
          <van-tab :title="item.title" v-for="item in selectData" :key="item.title" :name="item.type">
            <div class="all-select flex justify-end text-28" v-if="symbol">
              <div class="select-box flex" @click.stop="isAll = !isAll">
                <div class="flex-1 text-28">
                  {{ CurrencyType == 'indices' ? symbolETF : symbol == 'all' ? $t('全部') : symbol.toUpperCase() }}
                </div>
                <van-icon name="arrow-down" />
                <div class="select-data" v-if="isAll">
                  <div class="select-item" @click.stop="selectItem(item2)" v-for="(item2, index) in currencyList"
                    :key="index">{{ CurrencyType == 'indices' ? item2.name : item2.symbol == 'all' ?
                      $t('全部') : item2.symbol.toUpperCase() }}
                  </div>
                </div>
              </div>
            </div>
            <template v-if="type === 'orders'">
              <van-list v-model:loading="loading" :loading-text="$t('加载中...')" :finished="finished"
                :finished-text="dataList.orders.length ? $t('已经全部加载完毕') : ''" @load="onLoad" :offset="30" class="px-5">
                <PerpetualEntrustList v-if="type === 'orders'" :list-data="dataList.orders" @recall="recall">
                </PerpetualEntrustList>
                <div class="flex flex-col justify-center pt-12 pb-5 items-center"
                  v-if="!dataList.orders.length && !loading">
                  <img src="@/assets/image/assets-center/no-data.png" alt="" class="w-24 h-24 no-data-img" />
                  <p class="text-grey mt-5">{{ $t('暂无记录') }}</p>
                </div>
              </van-list>
            </template>
 
            <template v-if="type === 'hisorders'">
              <van-list v-model:loading="loading" :loading-text="$t('加载中...')" :finished="finished"
                :finished-text="dataList.hisorders.length ? $t('已经全部加载完毕') : ''" @load="onLoad" :offset="30" class="px-5">
                <PerpetualHistoryPosition :list-data="dataList.hisorders"></PerpetualHistoryPosition>
                <div class="flex flex-col justify-center pt-12 pb-5 items-center"
                  v-if="!dataList.hisorders.length && !loading">
                  <img src="@/assets/image/assets-center/no-data.png" alt="" class="w-24 h-24 no-data-img" />
                  <p class="text-grey mt-5">{{ $t('暂无记录') }}</p>
                </div>
              </van-list>
            </template>
          </van-tab>
        </van-tabs>
      </div>
    </div>
  </div>
</template>
 
<script>
import assetsHead from "@/components/Transform/assets-head/index.vue";
import PerpetualEntrustList from '@/components/Transform/perpetual-entrust-list/index.vue';
import PerpetualHistoryPosition from '@/components/Transform/perpetual-history-position/index.vue';
import { contractOrder, _contractApplyOrderList } from "@/service/trade.api";
import { List, Tab, Tabs } from 'vant';
import { _getCoins } from '@/service/home.api'
import { setSessionStorage, getSessionStorage } from '@/utils/utis'
export default {
  data() {
    return {
      type: "orders",
      dataList: {
        orders: [],
        hisorders: []
      },
      symbol: 'all',
      isAll: false,
      selectData: [
        { title: this.$t('当前委托'), type: 'orders' },
        { title: this.$t('历史仓位'), type: 'hisorders' },
      ],
      loading: false,
      finished: false,
      page: 1,
      currencyList: [],
      symbolETF: '',
      CurrencyType: ''
 
    };
  },
  mounted() {
    if (getSessionStorage('cryptoHistoryType')) {
      this.type = getSessionStorage('cryptoHistoryType')
    }
    //this.symbol = this.$route.query.symbol
    this.CurrencyType = this.$route.query.type
    this.getCoins()
  },
  methods: {
    getCoins() {
      _getCoins({ type: this.$route.query.type }).then((res) => {
        console.log(res)
        this.currencyList = res
        this.currencyList.map((item) => {
          if (item.symbol == this.symbol) {
            this.symbolETF = item.name
          }
        })
        this.currencyList.unshift({
          symbol: 'all'
        })
      })
    },
    onChange(e) {
      this.dataList[e] = []
      this.finished = false
      this.page = 1
      this.type = e
      this.loading = true;
      this.isAll = false
      setSessionStorage('cryptoHistoryType', this.type)
      if (this.loading) {
        this.fetchList(this.symbol)
      }
    },
    onClickLeft() {
      this.$router.go(-1);
    },
    async fetchList(symbol) {
      const _api = this.type === 'orders' ? _contractApplyOrderList : contractOrder
      const type = this.type
      _api({
        symbol: symbol == 'all' ? '' : symbol,
        type,
        page_no: this.page,
        symbolType: this.CurrencyType
      }).then(data => {
        this.dataList[type] = this.dataList[type].concat(data)
        this.loading = false
        if (data.length < 10) {
          this.finished = true
        }
        this.page++
      })
    },
    recall() {
      this.page = 1;
      this.dataList.orders = []
      this.fetchList(this.symbol)
    },
    onLoad() {
      this.dataList.orders = []
      this.fetchList(this.symbol)
    },
    //选择币种
    selectItem(item) {
      this.dataList[this.type] = []
      this.page = 1
      this.symbol = item.symbol
      this.fetchList(this.symbol)
      this.isAll = false
      this.symbolETF = item.name
    }
  },
  components: {
    PerpetualEntrustList,
    PerpetualHistoryPosition,
    assetsHead,
    [List.name]: List,
    [Tabs.name]: Tabs,
    [Tab.name]: Tab
  },
}
 
</script>
<style lang="scss" scoped>
#cryptos {
 
 
  :deep(.van-tabs__nav) {
    background-color: $tab_background;
  }
 
  :deep(.van-tab--active) {
    background: $btn_main;
    border-radius: 5px;
    color: $white !important;
  }
 
  .perpetualHistory {
    width: 100%;
    box-sizing: border-box;
  }
 
  .active-line {
    position: relative;
    padding-bottom: 30px;
    color: $white !important;
  }
 
  .active-line::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    right: 0;
    width: 280px;
    height: 8px;
    background-color: $color_main;
  }
 
  .all-select {
    padding: 30px 0;
    margin-right: 20px;
 
    .select-box {
      height: 70px;
      background: $selectSymbol_background;
      color: $text_color6;
      display: flex;
      align-items: center;
      font-size: 14px;
      padding: 0 20px;
      position: relative;
      border: 1px solid $border_color;
      min-width: 260px;
 
      .select-data {
        position: absolute;
        top: 75px;
        left: 0;
        z-index: 10;
        width: 100%;
        height: 500px;
        overflow-y: auto;
 
        background: $grey_bg;
 
 
        .select-item {
          padding: 20px 20px;
          text-align: center;
 
          border-bottom: 1px solid $border_color;
          font-size: 30px;
        }
      }
    }
  }
}
</style>