123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <transition name="msgbox-fade">
- <div class="popup-wrap" v-if="visible">
- <div class="popup-modal"></div>
- <div class="popup-box">
- <div class="popup-hd">
- <div class="popup-hd-title"><em>{{$t('vip.title')}}</em></div>
- <span class="popup-close" @click="visible = false"></span>
- </div>
- <div class="popup-bd">
- <div class="vip-wrap">
- <div class="vip-hd">
- <div class="level-current">
- <i :class="`icon-level${vipLevel}`" v-if="vipLevel !== null"></i>
- </div>
- <div class="level-progress">
- <div class="level-comming">
- <p>{{$t('vip.text1')}} {{needMore}} EOS {{$t('vip.text2')}}</p>
- <i :class="`icon-level${vipLevel + 1}`" v-if="vipLevel !== null"></i>
- </div>
- <div class="progress-wrap">
- <div class="progress-bar" :style="{ width: progress}"></div>
- </div>
- </div>
- <div class="level-next">
- <i :class="`icon-level${vipLevel + 1}`" v-if="vipLevel !== null"></i>
- </div>
- </div>
- <div class="vip-bd">
- <p class="vip-introtips">
- {{$t('vip.intro')}}<br />
- {{$t('vip.tips')}}
- </p>
- <table class="vip-level">
- <thead>
- <tr>
- <th>{{$t('vip.tab1')}}</th>
- <th>{{$t('vip.tab2')}}(EOS)</th>
- <th>{{$t('vip.tab3')}}(EOS)</th>
- <th>{{$t('vip.tab4')}}(GT)</th>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(item, index) in vipList" :key="index">
- <td class="t1"><i :class="`icon-level${index + 1}`"></i></td>
- <td class="t2"><span>{{item.need}}</span></td>
- <td class="t3"><span>{{item.return}}</span></td>
- <td class="t4"><span>{{item.airdrop}}</span></td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </transition>
- </template>
- <script>
- import API from '@/api/'
- import NP from 'number-precision'
- import $store from '@/store/index'
- export default {
- name: 'vipPopup',
- data () {
- return {
- vipLevel: null,
- nextVipNeed: '',
- needMore: '',
- progress: 0,
- vipList: []
- }
- },
- async created () {
- while (this.vipList.length < 10) {
- this.vipList.push({})
- }
- await $store.dispatch('doScatterLogin')
- this.$showLoading()
- API.user.getVipInfo({}).then(({ data }) => {
- this.$hideLoading()
- if (data.code === 0) {
- data.data.vip_list.forEach(n => {
- n.return = NP.times(n.return, 100) + '%'
- })
- this.vipList = data.data.vip_list
- this.needMore = data.data.need_more
- this.nextVipNeed = data.data.next_vip_need
- this.vipLevel = data.data.vip_level
- this.progress = (this.nextVipNeed - this.needMore) / this.nextVipNeed * 100 + '%'
- }
- }).catch(() => {
- this.$hideLoading()
- })
- }
- }
- </script>
- <style lang="scss">
- @import "./style.scss";
- </style>
|