GuessYouLike.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="guess">
  3. <view
  4. class="head-item"
  5. @click="goDetail('/pages/goodsType/index', false, true)"
  6. :style="{ backgroundImage: `url(${bgImage || ''})` }"
  7. >
  8. <view class="top-left">
  9. <view class="top-left-title">猜你喜欢</view>
  10. <view class="top-left-tip">精选好物推荐</view>
  11. </view>
  12. <view class="top-right" style="color: #75c27a">
  13. 查看更多
  14. <!-- <text class="iconfont u-font24">&#xe6c7;</text> -->
  15. <uv-icon name="arrow-right" size="24rpx" color="#75c27a"></uv-icon>
  16. </view>
  17. </view>
  18. <view
  19. class="guess-item"
  20. v-if="(goodsList && goodsList.length > 0) || skeletonShow"
  21. >
  22. <view
  23. class="item u-skeleton-fillet"
  24. @click="
  25. goProductDetails('/pages/shop/goodsDetails?id=' + item.productId)
  26. "
  27. v-for="(item, index) in goodsList.length > 0 ? goodsList : 10"
  28. :key="index"
  29. >
  30. <image
  31. v-if="item && item.cover"
  32. :src="`${item.cover}?x-oss-process=style/w_350`"
  33. mode="aspectFill"
  34. ></image>
  35. <view style="padding-bottom: 40rpx">
  36. <view class="name" style="flex: 1">{{
  37. item.title || "加载中"
  38. }}</view>
  39. <view class="number">
  40. <view class="number-red">
  41. <rich-text
  42. :nodes="$mUtil.priceBigSmall(item.min_sale_price)"
  43. ></rich-text>
  44. </view>
  45. <view class="number-grey"
  46. >¥{{ item.max_market_price || "加载中" }}</view
  47. >
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <noData v-else :config="{ top: 1, content: '暂无商品~' }"></noData>
  53. <loadMore v-if="goodsList.length > 0" :status="status"></loadMore>
  54. </view>
  55. </template>
  56. <script setup>
  57. import { getCurrentInstance } from "vue";
  58. const { proxy } = getCurrentInstance();
  59. const $mUtil = proxy.$mUtil;
  60. const props = defineProps({
  61. goodsList: {
  62. type: Array,
  63. default: () => []
  64. },
  65. skeletonShow: {
  66. type: Boolean,
  67. default: false
  68. },
  69. bgImage: {
  70. type: String,
  71. default: ''
  72. },
  73. status: {
  74. type: String,
  75. default: 'more'
  76. }
  77. });
  78. const emit = defineEmits(['goDetail', 'goProductDetails']);
  79. const goDetail = (url, isNeedLogin, tabShow) => {
  80. emit('goDetail', url, isNeedLogin, tabShow);
  81. };
  82. const goProductDetails = (url) => {
  83. emit('goProductDetails', url);
  84. };
  85. </script>
  86. <style scoped lang="scss">
  87. .guess {
  88. background-color: #dcffd5;
  89. box-sizing: border-box;
  90. border-radius: 10rpx;
  91. overflow: hidden;
  92. .guess-item {
  93. display: flex;
  94. flex-wrap: wrap;
  95. justify-content: space-between;
  96. padding: 20rpx 30rpx;
  97. .item {
  98. margin-bottom: 36rpx;
  99. background-color: #ffffff;
  100. overflow: hidden;
  101. display: flex;
  102. flex-direction: column;
  103. image {
  104. width: 336rpx;
  105. height: 336rpx;
  106. border-radius: 18rpx 18rpx 0 0;
  107. }
  108. .name {
  109. margin: 14rpx 20rpx 6rpx 20rpx;
  110. width: 296rpx;
  111. overflow: hidden;
  112. text-overflow: ellipsis;
  113. display: -webkit-box;
  114. -webkit-line-clamp: 2;
  115. -webkit-box-orient: vertical;
  116. word-wrap: break-word;
  117. word-break: break-all;
  118. white-space: normal !important;
  119. }
  120. .number {
  121. display: flex;
  122. align-items: flex-end;
  123. margin: 8rpx 20rpx 0 20rpx;
  124. .number-red {
  125. color: #00bf5a;
  126. font-size: 36rpx;
  127. font-weight: 700;
  128. }
  129. .number-grey {
  130. color: #999999;
  131. font-size: 22rpx;
  132. font-weight: 400;
  133. text-decoration: line-through;
  134. margin-left: 16rpx;
  135. padding-bottom: 4rpx;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. .head-item {
  142. display: flex;
  143. align-items: center;
  144. justify-content: space-between;
  145. padding: 27rpx 30rpx;
  146. box-sizing: border-box;
  147. overflow: hidden;
  148. background-size: 100% 100%;
  149. background-repeat: no-repeat;
  150. .top-left {
  151. .top-left-title {
  152. font-size: 36rpx;
  153. font-family: PingFang SC, PingFang SC-Bold;
  154. font-weight: 700;
  155. }
  156. .top-left-tip {
  157. font-size: 24rpx;
  158. font-family: PingFang SC, PingFang SC-Regular;
  159. font-weight: 400;
  160. margin-top: 5rpx;
  161. }
  162. }
  163. .top-right {
  164. width: 165rpx;
  165. height: 67rpx;
  166. line-height: 67rpx;
  167. background: #ffffff;
  168. border-radius: 34rpx;
  169. box-sizing: border-box;
  170. font-size: 24rpx;
  171. font-family: PingFang SC, PingFang SC-Regular;
  172. font-weight: 400;
  173. text-align: center;
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. }
  178. }
  179. </style>