vip.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <transition name="msgbox-fade">
  3. <div class="popup-wrap" v-if="visible">
  4. <div class="popup-modal"></div>
  5. <div class="popup-box">
  6. <div class="popup-hd">
  7. <div class="popup-hd-title"><em>{{$t('vip.title')}}</em></div>
  8. <span class="popup-close" @click="visible = false"></span>
  9. </div>
  10. <div class="popup-bd">
  11. <div class="vip-wrap">
  12. <div class="vip-hd">
  13. <div class="level-current">
  14. <i :class="`icon-level${vipLevel}`" v-if="vipLevel !== null"></i>
  15. </div>
  16. <div class="level-progress">
  17. <div class="level-comming">
  18. <p>{{$t('vip.text1')}} {{needMore}} EOS {{$t('vip.text2')}}</p>
  19. <i :class="`icon-level${vipLevel + 1}`" v-if="vipLevel !== null"></i>
  20. </div>
  21. <div class="progress-wrap">
  22. <div class="progress-bar" :style="{ width: progress}"></div>
  23. </div>
  24. </div>
  25. <div class="level-next">
  26. <i :class="`icon-level${vipLevel + 1}`" v-if="vipLevel !== null"></i>
  27. </div>
  28. </div>
  29. <div class="vip-bd">
  30. <p class="vip-introtips">
  31. {{$t('vip.intro')}}<br />
  32. {{$t('vip.tips')}}
  33. </p>
  34. <table class="vip-level">
  35. <thead>
  36. <tr>
  37. <th>{{$t('vip.tab1')}}</th>
  38. <th>{{$t('vip.tab2')}}(EOS)</th>
  39. <th>{{$t('vip.tab3')}}(EOS)</th>
  40. <th>{{$t('vip.tab4')}}(GT)</th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. <tr v-for="(item, index) in vipList" :key="index">
  45. <td class="t1"><i :class="`icon-level${index + 1}`"></i></td>
  46. <td class="t2"><span>{{item.need}}</span></td>
  47. <td class="t3"><span>{{item.return}}</span></td>
  48. <td class="t4"><span>{{item.airdrop}}</span></td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </transition>
  58. </template>
  59. <script>
  60. import API from '@/api/'
  61. import NP from 'number-precision'
  62. import $store from '@/store/index'
  63. export default {
  64. name: 'vipPopup',
  65. data () {
  66. return {
  67. vipLevel: null,
  68. nextVipNeed: '',
  69. needMore: '',
  70. progress: 0,
  71. vipList: []
  72. }
  73. },
  74. async created () {
  75. while (this.vipList.length < 10) {
  76. this.vipList.push({})
  77. }
  78. await $store.dispatch('doScatterLogin')
  79. this.$showLoading()
  80. API.user.getVipInfo({}).then(({ data }) => {
  81. this.$hideLoading()
  82. if (data.code === 0) {
  83. data.data.vip_list.forEach(n => {
  84. n.return = NP.times(n.return, 100) + '%'
  85. })
  86. this.vipList = data.data.vip_list
  87. this.needMore = data.data.need_more
  88. this.nextVipNeed = data.data.next_vip_need
  89. this.vipLevel = data.data.vip_level
  90. this.progress = (this.nextVipNeed - this.needMore) / this.nextVipNeed * 100 + '%'
  91. }
  92. }).catch(() => {
  93. this.$hideLoading()
  94. })
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. @import "./style.scss";
  100. </style>