use-goods-list.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="goods-list margin-top-xs">
  3. <view class="list dflex-b dflex dflex-wrap-w w-full">
  4. <view class="item pos-r bg-main border-radius padding-bottom-sm" v-for="(item, index) in data" :key="index"
  5. @click="Dever.location('source/info?id=' + item.id + '&title=' + item.name)">
  6. <view class="image-wrapper">
  7. <image mode="aspectFill" :lazy-load="true" :src="item.cover"></image>
  8. </view>
  9. <text class="title clamp padding-sm">{{ item.name }}</text>
  10. <view class="padding-left-sm price-area">
  11. <template v-if="item.price && item.price > 0">
  12. <text class="price">{{ item.price_text }}</text>
  13. <text class="m-price" v-if="item.m_price && item.m_price > 0">{{ item.m_price_text }}</text>
  14. </template>
  15. <template v-else>
  16. <text v-if="item.info" class="price-desc">{{ item.info }}</text>
  17. <text v-else class="price free-tag">免费</text>
  18. <text class="m-price" v-if="item.m_price > 0">{{ item.m_price_text }}</text>
  19. </template>
  20. </view>
  21. <view class="padding-left-sm rebate-info">
  22. <view class="rebate-line" v-if="item.rebate && item.rebate.buy && item.rebate.buy.desc">
  23. <text class="icon icon-jifen">🎁</text>
  24. <text class="label">{{ item.rebate.buy.name }}:</text>
  25. <text class="value">{{ item.rebate.buy.desc }}</text>
  26. </view>
  27. <view class="rebate-line" v-if="item.rebate && item.rebate.share && item.rebate.share.desc">
  28. <text class="icon icon-yongjin">💰</text>
  29. <text class="label">{{ item.rebate.share.name }}:</text>
  30. <text class="value">{{ item.rebate.share.desc }}</text>
  31. </view>
  32. </view>
  33. <view class="use-tag pos-a pos-top bg-base"
  34. v-if="item.price > 0 && item.promotion_tag && item.promotion_tag.name">{{ item.promotion_tag.name }}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. props: {
  43. data: {
  44. type: Array,
  45. default: []
  46. },
  47. }
  48. };
  49. </script>
  50. <style>
  51. .yishou {
  52. float: right;
  53. }
  54. .price-area {
  55. min-height: 48rpx;
  56. /* 确保有一致高度 */
  57. display: flex;
  58. align-items: center;
  59. gap: 10rpx;
  60. }
  61. .free-tag {
  62. color: #4caf50;
  63. /* 绿色 */
  64. background-color: #e6f5ea;
  65. padding: 4rpx 10rpx;
  66. border-radius: 6rpx;
  67. font-size: 24rpx;
  68. }
  69. .use-tag {
  70. border-top-left-radius: 5px;
  71. border-bottom-right-radius: 5px;
  72. line-height: 1;
  73. padding: 4px 6px;
  74. font-size: 11px;
  75. }
  76. .price-desc {
  77. font-size: 24rpx;
  78. color: #666;
  79. font-weight: normal;
  80. white-space: nowrap;
  81. /* 不换行 */
  82. overflow: hidden;
  83. /* 超出隐藏 */
  84. text-overflow: ellipsis;
  85. /* 超出显示省略号 */
  86. }
  87. .item {
  88. height: 480rpx;
  89. /* 示例高度,根据实际内容调整 */
  90. box-sizing: border-box;
  91. display: flex;
  92. flex-direction: column;
  93. justify-content: space-between;
  94. }
  95. .rebate-info {
  96. margin-top: 8rpx;
  97. font-size: 24rpx;
  98. color: #555;
  99. }
  100. .rebate-line {
  101. display: flex;
  102. align-items: center;
  103. margin-bottom: 4rpx;
  104. }
  105. .rebate-line .icon {
  106. margin-right: 6rpx;
  107. }
  108. .rebate-line .label {
  109. color: #999;
  110. margin-right: 4rpx;
  111. }
  112. .rebate-line .value {
  113. color: #e64340;
  114. font-weight: bold;
  115. }
  116. .goods-list .list {
  117. padding: 0 1vw 9px;
  118. }
  119. .goods-list .item:nth-child(2n+1) {
  120. margin-right: 1vw;
  121. }
  122. .goods-list .item {
  123. width: 46vw;
  124. overflow: hidden;
  125. margin-top: 2vw;
  126. }
  127. .goods-list .image-wrapper {
  128. width: 100%;
  129. height: 320rpx;
  130. overflow: hidden;
  131. }
  132. .clamp {
  133. overflow: hidden;
  134. text-overflow: ellipsis;
  135. white-space: nowrap;
  136. display: block;
  137. width: 100%;
  138. }
  139. .goods-list .image-wrapper uni-image {
  140. width: 100%;
  141. height: 100%;
  142. opacity: 1;
  143. }
  144. </style>