index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <!-- 搭配购 -->
  3. <view class="discounts">
  4. <view class="title">
  5. <text>搭配购</text>
  6. <span class="iconfont icon-xiangyou"></span>
  7. </view>
  8. <view class="discounts-list">
  9. <view class="discounts-box" v-for="item in discountsData" :key="item.id">
  10. <image class="discounts-img" :src="item.image" mode="aspectFill"></image>
  11. <view class="discounts-msg">
  12. <text class="discounts-title line1">{{item.title}}</text>
  13. <!-- #ifdef H5 || APP-PLUS -->
  14. <slot name="center" :item="item"></slot>
  15. <!-- #endif -->
  16. <!-- #ifdef MP -->
  17. <slot name="center{{item.id}}"></slot>
  18. <!-- #endif -->
  19. <view class="discounts-attr line2">
  20. <text class="" v-for="(attr,index) in item.products" :key="index">
  21. <text v-if="index > 0">+</text>
  22. <text>
  23. {{attr.title.substring(0,5)}}
  24. </text>
  25. </text>
  26. </view>
  27. <text class="discounts-kc">库存:{{item.is_limit ? item.limit_num : '充足'}}</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. }
  38. },
  39. props: {
  40. discountsData: {
  41. type: Array,
  42. default:()=>[]
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .discounts {
  49. background-color: #fff;
  50. margin: 0 20rpx;
  51. border-radius: 12rpx;
  52. .title {
  53. display: flex;
  54. justify-content: space-between;
  55. border-bottom: 1px solid #EEEEEE;
  56. padding: 24rpx 20rpx;
  57. margin-top: 20rpx;
  58. color: #333;
  59. .iconfont {
  60. font-size: 14px;
  61. color: #7a7a7a;
  62. }
  63. }
  64. .discounts-list {
  65. display: flex;
  66. align-items: center;
  67. width: 100%;
  68. overflow-x: scroll;
  69. .discounts-box {
  70. display: flex;
  71. align-items: center;
  72. padding: 24rpx;
  73. .discounts-img {
  74. width: 180rpx;
  75. height: 180rpx;
  76. border-radius: 8rpx;
  77. margin-right: 24rpx;
  78. }
  79. .discounts-msg {
  80. display: flex;
  81. flex-direction: column;
  82. justify-content: space-around;
  83. color: #333333;
  84. height: 164rpx;
  85. .discounts-title {
  86. font-size: 28rpx;
  87. font-weight: bold;
  88. width: 450rpx;
  89. span{
  90. width: 100%;
  91. }
  92. }
  93. .discounts-attr {
  94. // display: flex;
  95. flex-wrap: wrap;
  96. width: 450rpx;
  97. max-height: 398rpx;
  98. font-size: 20rpx;
  99. // overflow: hidden;
  100. }
  101. .discounts-kc {
  102. color: var(--view-theme);
  103. font-size: 20rpx;
  104. }
  105. }
  106. }
  107. }
  108. }
  109. </style>