微信

index.vue 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="mainPage">
  3. <div>
  4. <div class="userTop_view">
  5. <div class="gradient_bg"></div>
  6. <div class="zIndex_bg"></div>
  7. <div class="userAvatar_Border">
  8. <div class="userAvatar">
  9. <img :src="headimgurl" alt width="100%" height="100%">
  10. </div>
  11. </div>
  12. <div class="uesr-info">
  13. <div class="user-name">{{user.Name}}</div>
  14. <div class="mobile" v-if="user.Phone">{{user.Phone}}</div>
  15. <div class="mobile" v-else @click="bindMobile">绑定手机号</div>
  16. </div>
  17. </div>
  18. <div class="vip-privilege flex-h">
  19. <div class="flex-item privilege-item" @click="toCoupons">
  20. <div class="img-box">
  21. <img src="../../../../common/icon/userCenter-icon-1.png" width="100%" height="100%" alt>
  22. </div>
  23. <span>优惠券</span>
  24. <span>{{Nums.couponnum || 0}}张未使用</span>
  25. </div>
  26. <div class="flex-item privilege-item" @click="toCard">
  27. <div class="img-box">
  28. <img src="../../../../common/icon/userCenter-icon-2.png" width="100%" height="100%" alt>
  29. </div>
  30. <span>卡券</span>
  31. <span>0张未使用</span>
  32. </div>
  33. <div class="flex-item privilege-item" @click="toVipDetail">
  34. <i class="iconfont icon-01" @click.stop="toVip"></i>
  35. <div class="img-box">
  36. <img src="../../../../common/icon/userCenter-icon-3.png" width="100%" height="100%" alt>
  37. </div>
  38. <span>VIP卡</span>
  39. <span>
  40. ¥{{Nums.vipbalance}}
  41. <i class="iconfont icon-jiantou-right" style="font-size: 0.1rem;"></i>
  42. </span>
  43. </div>
  44. </div>
  45. <div class="userCenter-menu">
  46. <div class="menu-item flex-h" @click="toLessonOrder">
  47. <span>我的课程</span>
  48. <i class="iconfont icon-jiantou-right"></i>
  49. </div>
  50. <div class="menu-item flex-h" @click="toGoodsOrder">
  51. <span>商品订单</span>
  52. <i class="iconfont icon-jiantou-right"></i>
  53. </div>
  54. <div class="menu-item flex-h" @click="toBodyCheck">
  55. <span>体检报告</span>
  56. <i class="iconfont icon-jiantou-right"></i>
  57. </div>
  58. <div class="menu-item flex-h" @click="toLuckdraw">
  59. <span>抽奖记录</span>
  60. <i class="iconfont icon-jiantou-right"></i>
  61. </div>
  62. <div class="menu-item flex-h" @click="toActiveList">
  63. <span>活动记录</span>
  64. <i class="iconfont icon-jiantou-right"></i>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import { mapState, createNamespacedHelpers } from 'vuex'
  72. const { mapActions: actions } = createNamespacedHelpers('userCenter')
  73. export default {
  74. name: '',
  75. data () {
  76. return {
  77. user: {}
  78. }
  79. },
  80. computed: {
  81. ...mapState({
  82. userInfo: x => x.userCenter.userInfo,
  83. org: x => x.app.orgId,
  84. Nums: x => x.userCenter.Nums
  85. })
  86. },
  87. components: {
  88. },
  89. mounted () {
  90. this.getUserInfo({ org: this.org }).then(() => {
  91. this.user = this.userInfo.customer
  92. if (this.user.AccountInfo) {
  93. this.AccountInfo = JSON.parse(this.user.AccountInfo)
  94. }
  95. this.headimgurl = this.user.Headimgurl
  96. })
  97. this.getNum()
  98. },
  99. methods: {
  100. ...actions(['getUserInfo', 'getNum']),
  101. toLessonOrder () {
  102. this.$router.push({ name: 'lessonOrder' })
  103. },
  104. toVip () {
  105. this.$router.push({ name: 'vip' })
  106. },
  107. toVipDetail () {
  108. this.$router.push({ name: 'vipDetail' })
  109. },
  110. toCard () {
  111. this.$router.push({ name: 'card' })
  112. },
  113. toCoupons () {
  114. this.$router.push({ name: 'coupons' })
  115. },
  116. bindMobile () {
  117. this.$router.push({ name: 'bindMobile' })
  118. },
  119. toGoodsOrder () {
  120. this.$router.push({ name: 'orderList', query: { from: 'c' } })
  121. },
  122. toBodyCheck () {
  123. var url = window.location.pathname
  124. window.location.href = url.replace('user.html', 'bodyCheck.html') + '#/'
  125. },
  126. toLuckdraw () {
  127. // ^参数约定为97
  128. let userid = this.userInfo.customer.CustomerId
  129. let num = Math.floor(Math.random() * 10 + 1) * 100 + Math.floor(Math.random() * 10 + 1) * 10 + Math.floor(Math.random() * 10 + 1)
  130. num = num >= 1000 ? 999 : num
  131. userid = `${userid}${num}`
  132. window.location.href = `${window.location.origin}/game/luckdraw/#/lotteryList?from=${userid}`
  133. },
  134. toActiveList(){
  135. this.$router.push({ name: 'activeList' })
  136. }
  137. }
  138. }
  139. </script>
  140. <!-- Add "scoped" attribute to limit CSS to this component only -->
  141. <style lang="scss" scoped>
  142. @import 'page.scss';
  143. </style>