GuessYouLike.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="guess">
  3. <view
  4. class="head-item"
  5. @click="goDetail('/pages/tabtar/goodsType', 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 { ref, onMounted } from "vue";
  58. import { usePageData } from "@/hooks/usePageData.ts";
  59. const props = defineProps({
  60. skeletonShow: {
  61. type: Boolean,
  62. default: false
  63. },
  64. bgImage: {
  65. type: String,
  66. default: ''
  67. },
  68. });
  69. const emit = defineEmits(['goDetail', 'goProductDetails']);
  70. const status = ref("more");
  71. const goodsList = ref([]);
  72. const goDetail = (url, isNeedLogin, tabShow) => {
  73. emit('goDetail', url, isNeedLogin, tabShow);
  74. };
  75. const goProductDetails = (url) => {
  76. emit('goProductDetails', url);
  77. };
  78. // 列表查询数据
  79. // const { RowsList, LoadStatus, initData } = usePageData();
  80. // /**猜你喜欢 */
  81. // const guessLike = () => {
  82. // keyWord.value = uni.getStorageSync("history")
  83. // ? uni.getStorageSync("history").join(",")
  84. // : "";
  85. // uni.$uv.$http
  86. // .get(
  87. // `/goods/smart`,
  88. // {
  89. // page: page.value,
  90. // limit: 6,
  91. // keywords: keyWord.value,
  92. // },
  93. // false
  94. // )
  95. // .then((res) => {
  96. // if (res && res.code == 200) {
  97. // goodsList.value =
  98. // page.value == 1
  99. // ? res.page.list
  100. // : goodsList.value.concat(res.page.list);
  101. // if (res.page.totalPage <= res.page.currPage) {
  102. // status.value = "noMore";
  103. // } else {
  104. // status.value = "more";
  105. // }
  106. // skeletonShow.value = false;
  107. // }
  108. // });
  109. // };
  110. onMounted(() => {
  111. // initData();
  112. });
  113. </script>
  114. <style scoped lang="scss">
  115. .guess {
  116. background-color: #dcffd5;
  117. box-sizing: border-box;
  118. border-radius: 10rpx;
  119. overflow: hidden;
  120. .guess-item {
  121. display: flex;
  122. flex-wrap: wrap;
  123. justify-content: space-between;
  124. padding: 20rpx 30rpx;
  125. .item {
  126. margin-bottom: 36rpx;
  127. background-color: #ffffff;
  128. overflow: hidden;
  129. display: flex;
  130. flex-direction: column;
  131. image {
  132. width: 336rpx;
  133. height: 336rpx;
  134. border-radius: 18rpx 18rpx 0 0;
  135. }
  136. .name {
  137. margin: 14rpx 20rpx 6rpx 20rpx;
  138. width: 296rpx;
  139. overflow: hidden;
  140. text-overflow: ellipsis;
  141. display: -webkit-box;
  142. -webkit-line-clamp: 2;
  143. -webkit-box-orient: vertical;
  144. word-wrap: break-word;
  145. word-break: break-all;
  146. white-space: normal !important;
  147. }
  148. .number {
  149. display: flex;
  150. align-items: flex-end;
  151. margin: 8rpx 20rpx 0 20rpx;
  152. .number-red {
  153. color: #fa6138;
  154. font-size: 36rpx;
  155. font-weight: 700;
  156. }
  157. .number-grey {
  158. color: #999999;
  159. font-size: 22rpx;
  160. font-weight: 400;
  161. text-decoration: line-through;
  162. margin-left: 16rpx;
  163. padding-bottom: 4rpx;
  164. }
  165. }
  166. }
  167. }
  168. }
  169. .head-item {
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. padding: 27rpx 30rpx;
  174. box-sizing: border-box;
  175. overflow: hidden;
  176. background-size: 100% 100%;
  177. background-repeat: no-repeat;
  178. .top-left {
  179. .top-left-title {
  180. font-size: 36rpx;
  181. font-family: PingFang SC, PingFang SC-Bold;
  182. font-weight: 700;
  183. }
  184. .top-left-tip {
  185. font-size: 24rpx;
  186. font-family: PingFang SC, PingFang SC-Regular;
  187. font-weight: 400;
  188. margin-top: 5rpx;
  189. }
  190. }
  191. .top-right {
  192. width: 165rpx;
  193. height: 67rpx;
  194. line-height: 67rpx;
  195. background: #ffffff;
  196. border-radius: 34rpx;
  197. box-sizing: border-box;
  198. font-size: 24rpx;
  199. font-family: PingFang SC, PingFang SC-Regular;
  200. font-weight: 400;
  201. text-align: center;
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. }
  206. }
  207. </style>