goods-coupon-section.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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" :key="item.couponId" v-if="index < 2">
  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. white-space: nowrap;
  43. overflow: hidden;
  44. text-overflow: clip;
  45. .tag {
  46. display: inline-block;
  47. height: 30rpx;
  48. padding: 0 8rpx;
  49. margin-right: 8rpx;
  50. background: #fff3f7;
  51. border: 1rpx solid #ff457b;
  52. border-radius: 4rpx;
  53. vertical-align: middle;
  54. .coupon-label {
  55. font-size: 22rpx;
  56. max-width: 236rpx;
  57. overflow: hidden;
  58. text-overflow: ellipsis;
  59. white-space: nowrap;
  60. color: #ff457b;
  61. &::before {
  62. content: '券 |';
  63. margin: 0 6rpx;
  64. margin-left: 0;
  65. }
  66. }
  67. &:first-child {
  68. margin-left: 0;
  69. }
  70. }
  71. .ellipsis {
  72. font-size: 24rpx;
  73. color: #ff457b;
  74. }
  75. }
  76. .more {
  77. font-size: 24rpx;
  78. color: #ff457b;
  79. }
  80. }
  81. }
  82. </style>