微信

index.vue 6.0KB

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