app-sup-vip.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view v-if="is_show" class="vip-price dir-left-nowrap" :style="{'margin': `${margin}`}">
  3. <view class="item vip-left">
  4. <image class="vip-icon" src="/static/image/icon/S-VIP.png"></image>
  5. </view>
  6. <view class="item vip-right">{{discount == 0 ? '免费' : discount +'折' }}</view>
  7. </view>
  8. </template>
  9. <script>
  10. import {mapState} from 'vuex';
  11. export default {
  12. name: "app-sup-vip",
  13. props: {
  14. discount: {
  15. type: String,
  16. default() {
  17. return null;
  18. }
  19. },
  20. is_vip_card_user: {
  21. type: Number,
  22. default() {
  23. return 0;
  24. }
  25. },
  26. margin: {
  27. type: String,
  28. default() {
  29. return '0';
  30. }
  31. }
  32. },
  33. data() {
  34. return {
  35. is_show: false,
  36. }
  37. },
  38. created() {
  39. let that = this;
  40. if(that.is_vip_card_user == 1) {
  41. if(that.mall.setting.is_show_super_vip == '1'){
  42. that.is_show = true;
  43. }else {
  44. that.is_show = false;
  45. }
  46. }else {
  47. if(that.mall.setting.is_show_normal_vip == '1'){
  48. that.is_show = true;
  49. }else {
  50. that.is_show = false;
  51. }
  52. }
  53. },
  54. computed: {
  55. ...mapState({
  56. mall: state => state.mallConfig.mall,
  57. userInfo: state => state.user.info,
  58. })
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .vip-price {
  64. width: #{148upx};
  65. height: #{27upx};
  66. .item {
  67. height: #{27upx};
  68. width: 50%;
  69. }
  70. .vip-left {
  71. border-top-left-radius: #{13upx};
  72. border-bottom-left-radius: #{13upx};
  73. background-color: #4e4040;
  74. position: relative;
  75. }
  76. .vip-right {
  77. border-top-right-radius: #{13upx};
  78. border-bottom-right-radius: #{13upx};
  79. background: linear-gradient(45deg, #edc9a8, #fdebde);
  80. font-size: #{22upx};
  81. line-height: #{27upx};
  82. text-align: center;
  83. color: #4e4040;
  84. }
  85. .vip-icon {
  86. width: #{51upx};
  87. height: #{14upx};
  88. position:absolute;
  89. top: 50%;
  90. left: 50%;
  91. transform: translate(-50%, -50%);
  92. }
  93. }
  94. </style>