-goods-recommend.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="recommend-box" >
  3. <h4 class="goods-recommend-title">宝贝推荐</h4>
  4. <view class="like-goods-list">
  5. <view class="like-goods-list">
  6. <view
  7. class="like-goods-item"
  8. @click="clickGoods(item)"
  9. v-for="(item, index) in res"
  10. :key="index"
  11. >
  12. <u-image
  13. :fade="true"
  14. duration="450"
  15. :lazy-load="true"
  16. :src="item.thumbnail"
  17. width="330rpx"
  18. height="330rpx"
  19. class="like-goods-uimage"
  20. >
  21. <u-loading slot="loading"></u-loading>
  22. </u-image>
  23. <view style="background-color: #ffffff; width: 100%">
  24. <view class="name">{{ item.goodsName }}</view>
  25. <view class="price-sales">
  26. <div class="item-price" v-if="item.price != undefined">
  27. <span>{{ formatPrice(item.price)[0] }}</span>
  28. .{{formatPrice(item.price)[1]}}
  29. <!-- <text v-if="item.point != undefined">+{{ item.point }}积分</text> -->
  30. </div>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. props: ["res"],
  41. methods: {
  42. // 点击店铺推荐
  43. clickGoods(val) {
  44. uni.navigateTo({
  45. url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`
  46. });
  47. },
  48. // 格式化金钱 1999 --> [1999,00]
  49. formatPrice(val) {
  50. if (typeof val == "undefined") {
  51. return val;
  52. }
  53. return val.toFixed(2).split(".");
  54. }
  55. }
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. @import "../mp-goods.scss";
  60. @import "../product.scss";
  61. .goods_recomm {
  62. padding: 12px 0 20rpx 20rpx;
  63. color: #000;
  64. font-size: 30rpx;
  65. font-weight: 400;
  66. margin-bottom: 28rpx;
  67. }
  68. .like-goods-uimage {
  69. /deep/ .u-image {
  70. height: 350rpx !important;
  71. }
  72. width: 100%;
  73. }
  74. .recommend-box {
  75. background-color: #ffffff;
  76. width: 100%;
  77. padding-bottom: 120rpx;
  78. .title {
  79. width: 120rpx;
  80. height: 42rpx;
  81. font-size: 30rpx;
  82. font-weight: 700;
  83. text-align: left;
  84. color: #333333;
  85. margin-left: 20rpx;
  86. }
  87. }
  88. .like-goods-list {
  89. display: flex;
  90. width: 100%;
  91. flex-wrap: wrap;
  92. }
  93. .like-goods-item {
  94. padding: 0 !important;
  95. width: 48%;
  96. margin: 0 1% 10rpx 1%;
  97. background: #f7f7f7;
  98. border-radius: 12rpx;
  99. overflow: hidden;
  100. /deep/ .u-image {
  101. width: 100%;
  102. }
  103. }
  104. .like-goods-list {
  105. // background-color: #f8f8f8;
  106. width: 100%;
  107. margin-bottom: 100rpx;
  108. .name {
  109. padding: 14rpx 8rpx 0 8rpx;
  110. color: #333;
  111. font-size: 24rpx;
  112. display: -webkit-box;
  113. overflow: hidden;
  114. -webkit-box-orient: vertical;
  115. -webkit-line-clamp: 2;
  116. background: #f7f7f7;
  117. height: 80rpx;
  118. }
  119. .price-sales {
  120. padding: 8rpx;
  121. background: #f7f7f7;
  122. display: flex;
  123. justify-content: space-between;
  124. align-items: center;
  125. .item-price {
  126. overflow: hidden;
  127. text-overflow: ellipsis;
  128. white-space: nowrap;
  129. font-size: 26rpx;
  130. text-align: left;
  131. color: $jd-color;
  132. line-height: 23px;
  133. font-weight: bold;
  134. > span {
  135. font-size: 32rpx;
  136. }
  137. }
  138. .sales {
  139. line-height: 23px;
  140. font-size: 22rpx;
  141. text-align: left;
  142. letter-spacing: 0;
  143. color: #cccccc;
  144. // padding-right: 10rpx;
  145. }
  146. }
  147. }
  148. </style>