index.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view
  3. class="user-identity-btn"
  4. >
  5. <template v-if="isVip">
  6. <!--会员-->
  7. <identity-type :price="vipPrice" :is-vip="true" :checked="true" />
  8. <!--普通用户-->
  9. <identity-type :price="normalPrice" />
  10. </template>
  11. <template v-else>
  12. <!--普通用户-->
  13. <identity-type :price="normalPrice" :is-normal="true" :checked="true" />
  14. <!--会员-->
  15. <identity-type :price="vipPrice" />
  16. <view class="open-card" @click="handleOpen">
  17. 开通福卡会员,立享福卡特权
  18. </view>
  19. </template>
  20. </view>
  21. </template>
  22. <script>/**
  23. * 购买弹窗 显示会员身份
  24. */
  25. import { mapState } from 'vuex'
  26. import IdentityType from './IdentityType'
  27. export default {
  28. name: 'UserIdentityBtn',
  29. components: { IdentityType },
  30. props: {
  31. vipPrice: {
  32. type: Number,
  33. default: 0
  34. },
  35. normalPrice: {
  36. type: Number,
  37. default: 0
  38. }
  39. },
  40. data() {
  41. return {
  42. }
  43. },
  44. computed: {
  45. ...mapState({
  46. userInfo: state => state.user.info
  47. }),
  48. isVip() {
  49. return this.userInfo.is_vip
  50. }
  51. },
  52. methods: {
  53. handleOpen() {
  54. uni.navigateTo({
  55. url: '/pages/index/index'
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .user-identity-btn {
  63. .open-card{
  64. text-align: center;
  65. text-decoration: underline;
  66. margin: 20rpx 0;
  67. }
  68. }
  69. </style>