app-vip-card.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view v-if="vip_card.permission == 1" :style="[{'background-color': `${vip_card.setting.form.background}`,'height': `${vip_card.setting.form.top_bottom_padding*2 + 120 + 'rpx'}`,'padding': `${vip_card.setting.form.top_bottom_padding + 'rpx 0'}`}]">
  3. <view v-if="!userInfo.is_vip_card_user" class="app-vip-card cross-center dir-left-nowrap" :style="[{'background-image': 'url(' + `${vip_card.setting.form.buy_bg != 'statics/img/app/vip_card/buy_bg.png' ? vip_card.setting.form.buy_bg : svipImg.buy_bg}` + ')','background-color': `${background}`,'margin-top': `${top}`}]">
  4. <image class="app-vip-logo" :src="svipImg.logo"></image>
  5. <view>
  6. <view class="buy-big-text" :style="[{'color': `${vip_card.setting.form.buy_big_color}`}]">{{vip_card.setting.form.buy_big}}</view>
  7. <view class="buy-small-text" :style="[{'color': `${vip_card.setting.form.buy_small_color}`}]">{{vip_card.setting.form.buy_small}}</view>
  8. </view>
  9. <view @click="toSvip" class="app-vip-btn" :style="[{'color': `${vip_card.setting.form.buy_btn_color}`,'background':`${vip_card.setting.form.buy_btn_bg_color}`}]">{{vip_card.setting.form.buy_btn_text}}</view>
  10. </view>
  11. <view v-else-if="userInfo.is_vip_card_user" class="app-vip-card cross-center dir-left-nowrap" :style="[{'background-image': 'url(' + `${vip_card.setting.form.renew_bg != 'statics/img/app/vip_card/buy_bg.png' ? vip_card.setting.form.renew_bg : svipImg.buy_bg}` + ')','background-color': `${background}`,'margin-top': `${top}`}]">
  12. <image class="app-vip-logo" :src="svipImg.logo"></image>
  13. <view>
  14. <view class="buy-big-text" :style="[{'color': `${vip_card.setting.form.renew_text_color}`}]">{{vip_card.setting.form.renew_text}}</view>
  15. </view>
  16. <view @click="toSvip" class="app-vip-btn app-renew-btn cross-center main-center" :style="[{'background':`${vip_card.setting.form.renew_btn_bg_color}`}]">
  17. <text>详情</text>
  18. <image class="right-icon" src="/static/image/icon/right.png"></image>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {mapState} from 'vuex';
  25. export default {
  26. name: 'app-vip-card',
  27. props: {
  28. background: {
  29. type: String,
  30. default() {
  31. return `#f7f7f7`;
  32. }
  33. },
  34. top: {
  35. type: String,
  36. default() {
  37. return `20rpx`;
  38. }
  39. },
  40. value: Object
  41. },
  42. computed: {
  43. ...mapState({
  44. theme: state => state.mallConfig.theme,
  45. userInfo: state => state.user.info,
  46. vip_card: state => state.mallConfig.plugin.vip_card,
  47. svipImg: state => state.mallConfig.__wxapp_img.vip_card
  48. }),
  49. },
  50. watch: {
  51. value: {
  52. handler(data) {
  53. if (data) {
  54. this.vip_card.setting.form = this.value;
  55. }
  56. },
  57. immediate: true,
  58. }
  59. },
  60. created() {
  61. // let that = this;
  62. // that.$request({
  63. // url: that.$api.index.config,
  64. // }).then(response=>{
  65. // that.$hideLoading();
  66. // if(response.code == 0) {
  67. // that.vip_card = response.data.plugin.vip_card;
  68. // that.svipImg = response.data.__wxapp_img.vip_card;
  69. // if(that.value) {
  70. // that.vip_card.setting.form = that.value;
  71. // }
  72. // }
  73. // })
  74. },
  75. methods: {
  76. toSvip() {
  77. uni.navigateTo({
  78. url: '/plugins/vip_card/index/index'
  79. });
  80. },
  81. },
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .app-vip-card {
  86. height: #{120rpx};
  87. width: 100%;
  88. padding: 0 #{24rpx};
  89. border-radius: #{15rpx};
  90. position: relative;
  91. background-size:#{702rpx} #{120rpx};
  92. background-repeat:no-repeat;
  93. background-position: center bottom;
  94. .app-vip-logo {
  95. height: #{54rpx};
  96. width: #{60rpx};
  97. margin: 0 #{30rpx} 0 #{25rpx};
  98. }
  99. .buy-big-text {
  100. font-size: #{28rpx};
  101. margin-bottom: #{4rpx};
  102. }
  103. .buy-small-text {
  104. font-size: #{22rpx};
  105. }
  106. .app-vip-btn {
  107. position: absolute;
  108. right: #{45rpx};
  109. top: #{36rpx};
  110. font-size: #{25rpx};
  111. width: #{140rpx};
  112. height: #{48rpx};
  113. line-height: #{48rpx};
  114. text-align: center;
  115. border-radius: #{24rpx};
  116. background: -webkit-linear-gradient(left, #fbdec7, #f3bf95);
  117. background: -o-linear-gradient(left, #fbdec7, #f3bf95);
  118. background: linear-gradient(to right, #fbdec7, #f3bf95);
  119. }
  120. .app-vip-btn.app-renew-btn {
  121. width: #{89rpx};
  122. height: #{35rpx};
  123. line-height: #{35rpx};
  124. border-radius: #{18rpx};
  125. top: #{42.5rpx};
  126. .right-icon {
  127. height: #{22rpx};
  128. width: #{12rpx};
  129. margin-left: #{8rpx};
  130. }
  131. }
  132. }
  133. </style>