homePaidVip.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="home-paid-vip" v-if="isShowPaidVip">
  3. <commonWrapper :config="dataConfig">
  4. <view class="vip-container" :style="[containerStyle]">
  5. <view class="left-content">
  6. <image
  7. :src="imgUrl"
  8. class="vip-icon"
  9. v-if="imgUrl"
  10. mode="heightFix"
  11. ></image>
  12. <view class="text-content" :style="{ color: tipsTextColor }">
  13. {{ $t(`开通SVIP会员预计省`) }}
  14. <text :style="{ color: moneyTextColor }">{{ diff }}</text>
  15. {{ $t(`元`) }}
  16. </view>
  17. </view>
  18. <view class="right-content">
  19. <navigator
  20. url="/pages/annex/vip_paid/index"
  21. hover-class="none"
  22. class="open-btn"
  23. :style="[btnStyle]"
  24. >
  25. {{ rightBntText }}
  26. <text class="iconfont icon-jiantou"></text>
  27. </navigator>
  28. </view>
  29. </view>
  30. </commonWrapper>
  31. </view>
  32. </template>
  33. <script>
  34. import commonWrapper from "./commonWrapper.vue";
  35. import { mapGetters } from "vuex";
  36. export default {
  37. name: "homePaidVip",
  38. components: {
  39. commonWrapper,
  40. },
  41. props: {
  42. dataConfig: {
  43. type: Object,
  44. default: () => ({}),
  45. },
  46. productData: {
  47. type: Object,
  48. default: () => ({}),
  49. },
  50. priceData: {
  51. type: Object,
  52. default: () => ({}),
  53. },
  54. isShowPaidVip: {
  55. type: Boolean,
  56. default: false,
  57. },
  58. },
  59. computed: {
  60. ...mapGetters(["isLogin", "userInfo"]),
  61. diff() {
  62. let price =
  63. Number(this.priceData.price) || Number(this.productData.price) || 0;
  64. let vip_price =
  65. Number(this.priceData.vip_price) ||
  66. Number(this.productData.vip_price) ||
  67. 0;
  68. let val = (price - vip_price).toFixed(2);
  69. return val > 0 ? val : "0.00";
  70. },
  71. containerStyle() {
  72. return {};
  73. },
  74. imgUrl() {
  75. return this.dataConfig.imgConfig ? this.dataConfig.imgConfig.url : "";
  76. },
  77. rightBntText() {
  78. return this.dataConfig.rightBntConfig
  79. ? this.dataConfig.rightBntConfig.value
  80. : this.$t("立即开通");
  81. },
  82. isCustomTone() {
  83. return (
  84. this.dataConfig.toneConfig && this.dataConfig.toneConfig.tabVal === 1
  85. );
  86. },
  87. tipsTextColor() {
  88. return this.isCustomTone && this.dataConfig.tipsColor
  89. ? this.dataConfig.tipsColor.color[0].item
  90. : "#333333";
  91. },
  92. moneyTextColor() {
  93. return this.isCustomTone && this.dataConfig.moneyColor
  94. ? this.dataConfig.moneyColor.color[0].item
  95. : "#F62C2C";
  96. },
  97. btnStyle() {
  98. return {
  99. color:
  100. this.isCustomTone && this.dataConfig.btnColor
  101. ? this.dataConfig.btnColor.color[0].item
  102. : "#FF6B00",
  103. fontSize:
  104. (this.dataConfig.btnConfig ? this.dataConfig.btnConfig.val : 13) * 2 +
  105. "rpx",
  106. };
  107. },
  108. },
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. .home-paid-vip {
  113. .vip-container {
  114. display: flex;
  115. justify-content: space-between;
  116. align-items: center;
  117. .left-content {
  118. display: flex;
  119. align-items: center;
  120. .vip-icon {
  121. width: 36rpx; // Default size from admin component info
  122. height: 36rpx;
  123. margin-right: 16rpx;
  124. }
  125. .text-content {
  126. font-size: 26rpx;
  127. font-weight: 400;
  128. }
  129. }
  130. .right-content {
  131. .open-btn {
  132. display: flex;
  133. align-items: center;
  134. font-weight: 500;
  135. .iconfont {
  136. font-size: 24rpx;
  137. margin-left: 4rpx;
  138. }
  139. }
  140. }
  141. }
  142. }
  143. </style>