goods-coupon-section.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="goods-coupon-section" v-if="couponList">
  3. <view class="section" @click="$emit('click')">
  4. <view class="label">优惠券:</view>
  5. <view class="coupon-tags">
  6. <template v-for="(item, index) in couponList">
  7. <view class="tag" v-if="index < 2" :key="item.couponId">
  8. <view class="coupon-label" v-text="item.couponTitle"></view>
  9. </view>
  10. </template>
  11. <text class="ellipsis" v-if="couponList.length > 2">...</text>
  12. </view>
  13. <view class="iconfont icon-chakangengduo more"></view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'goods-coupon-section',
  20. props: {
  21. couponList: {
  22. type: [Object, Array],
  23. default: null
  24. }
  25. }
  26. }
  27. </script>
  28. <style lang="scss" scoped>
  29. .goods-coupon-section {
  30. padding: 24rpx;
  31. background-color: #fff;
  32. .section {
  33. @extend .cm-flex-between;
  34. font-size: 24rpx;
  35. .label {
  36. color: #666;
  37. }
  38. .coupon-tags {
  39. flex: 1;
  40. text-align: right;
  41. margin-right: 24rpx;
  42. .tag {
  43. display: inline-block;
  44. height: 30rpx;
  45. padding: 0 8rpx;
  46. margin-right: 8rpx;
  47. background: #fff3f7;
  48. border: 1rpx solid #ff457b;
  49. border-radius: 4rpx;
  50. vertical-align: middle;
  51. .coupon-label {
  52. font-size: 22rpx;
  53. max-width: 236rpx;
  54. overflow: hidden;
  55. text-overflow: ellipsis;
  56. white-space: nowrap;
  57. color: #ff457b;
  58. &::before {
  59. content: '券 |';
  60. margin: 0 6rpx;
  61. margin-left: 0;
  62. }
  63. }
  64. &:first-child {
  65. margin-left: 0;
  66. }
  67. }
  68. .ellipsis {
  69. font-size: 24rpx;
  70. color: #ff457b;
  71. }
  72. }
  73. .more {
  74. font-size: 24rpx;
  75. color: #ff457b;
  76. }
  77. }
  78. }
  79. </style>