use-goods-list.vue 3.0 KB

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