coupon-desc-entry.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="coupon-desc-entry">
  3. <view
  4. class="entry-item"
  5. :class="'entry' + item.id"
  6. v-for="item in entryList"
  7. :key="item.id"
  8. @click="$emit('click', item)"
  9. >
  10. <view class="text" v-text="item.name"></view>
  11. <view class="control">点击查看</view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'coupon-desc-entry',
  18. props: {
  19. couponTipStr: {
  20. type: String,
  21. default: ''
  22. }
  23. },
  24. computed: {
  25. entryList() {
  26. const result = [
  27. {
  28. id: 1,
  29. name: '好友邀请券福利'
  30. },
  31. {
  32. id: 2,
  33. name: '好友消费券福利'
  34. },
  35. {
  36. id: 3,
  37. name: '分享券福利'
  38. }
  39. ]
  40. return result.filter(item => this.couponTipStr.indexOf(item.id.toString()) > -1)
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. $bg-entry-1: url('https://static.caimei365.com/app/mini-hehe/icon/bg-coupon-desc-entry-01.png');
  47. $bg-entry-2: url('https://static.caimei365.com/app/mini-hehe/icon/bg-coupon-desc-entry-02.png');
  48. $bg-entry-3: url('https://static.caimei365.com/app/mini-hehe/icon/bg-coupon-desc-entry-03.png');
  49. $width: 702rpx;
  50. $height: 136rpx;
  51. .coupon-desc-entry {
  52. padding: 0 24rpx;
  53. .entry-item {
  54. @extend .cm-flex-center;
  55. flex-direction: column;
  56. align-items: flex-start;
  57. box-sizing: border-box;
  58. padding-left: 32rpx;
  59. width: $width;
  60. height: $height;
  61. margin: 24rpx 0;
  62. background-position: center;
  63. background-repeat: no-repeat;
  64. background-size: $width $height;
  65. &.entry1 {
  66. background-image: $bg-entry-1;
  67. .text {
  68. color: #ee6531;
  69. }
  70. }
  71. &.entry2 {
  72. background-image: $bg-entry-2;
  73. .text {
  74. color: #4197ef;
  75. }
  76. }
  77. &.entry3 {
  78. background-image: $bg-entry-3;
  79. .text {
  80. color: #ff445e;
  81. }
  82. }
  83. .text {
  84. margin-bottom: 10rpx;
  85. font-size: 46rpx;
  86. font-weight: bold;
  87. }
  88. .control {
  89. @extend .cm-flex-center;
  90. width: 160rpx;
  91. height: 40rpx;
  92. background: linear-gradient(90deg, #ff903b 0%, #fc2744 100%);
  93. border-radius: 20rpx;
  94. font-size: 24rpx;
  95. color: #fff;
  96. &::after {
  97. content: '';
  98. display: block;
  99. margin-left: 12rpx;
  100. width: 0;
  101. height: 0;
  102. border-style: solid;
  103. border-width: 10rpx 0 10rpx 16rpx;
  104. border-color: transparent transparent transparent #fff;
  105. }
  106. }
  107. }
  108. }
  109. </style>