goods-coupon-section.vue 2.0 KB

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