ATFHoteRecommed.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view v-if="productList.length" class="hotTemplate">
  3. <view class="evaluateIcon flex-items">
  4. <tui-icon
  5. name="bag-fill" :size="32" unit="upx"
  6. color="#fc7901" margin="0 20upx 0 0"
  7. ></tui-icon>
  8. <text>热门推荐</text>
  9. </view>
  10. <view class="recommendList">
  11. <view
  12. v-for="(item, index) in productList" class="itemBox"
  13. @click="goodsDateils(item.shopId, item.productId, item.skuId)"
  14. >
  15. <view class="itemImg">
  16. <image :src="item.image" class="pic-img default-img"></image>
  17. </view>
  18. <view class="itemTit">{{ item.productName }}</view>
  19. <view class="flex-items shopNameBox">
  20. <view class="shopName">{{ item.shopName }}</view>
  21. <view class="paymentNum">{{ item.users }}人付款</view>
  22. </view>
  23. <view class="itemPrice">
  24. <view class="price">¥{{ item.price }}</view>
  25. <view class="originalPrice">¥{{ item.originalPrice }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import { getRandomSortProductApi } from '../../api/anotherTFInterface'
  33. export default {
  34. data() {
  35. return {
  36. listQuery: {
  37. page: 1,
  38. pageSize: 5
  39. },
  40. productList: []
  41. }
  42. },
  43. created() {
  44. this.GetremenList()
  45. },
  46. methods: {
  47. // 获取列表数据
  48. GetremenList() {
  49. this.listQuery.timestamp = new Date().getTime()
  50. getRandomSortProductApi(this.listQuery).then((res) => {
  51. uni.stopPullDownRefresh()
  52. if (res.code == 200) {
  53. this.productList = res.data.list
  54. } else {
  55. uni.showToast({
  56. title: res.message,
  57. icon: 'none'
  58. })
  59. }
  60. })
  61. },
  62. // 商品详情
  63. goodsDateils(shopId, productId, skuId) {
  64. uni.navigateTo({
  65. url: '/another-tf/another-serve/goodsDetails/index?shopId=' + shopId + '&productId=' + productId + '&skuId=' +
  66. skuId
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .hotTemplate {
  74. padding: 1rpx 0 50rpx 0;
  75. background: #efefef;
  76. .evaluateIcon {
  77. margin: 30rpx 0 20rpx 0;
  78. justify-content: center;
  79. }
  80. .recommendList {
  81. display: flex;
  82. flex-wrap: wrap;
  83. .itemBox {
  84. width: 47%;
  85. margin: 16rpx 1% 16rpx 2%;
  86. background: #FFFFFF;
  87. .itemImg {
  88. width: 100%;
  89. height: 314rpx;
  90. image {
  91. width: 100%;
  92. height: 100%;
  93. }
  94. }
  95. .itemTit {
  96. padding: 0 20rpx;
  97. height: 40rpx;
  98. width: 100%;
  99. overflow: hidden;
  100. white-space: nowrap;
  101. text-overflow: ellipsis;
  102. }
  103. .shopNameBox {
  104. padding: 0 20rpx;
  105. height: 40rpx;
  106. justify-content: space-between;
  107. margin-top: 20rpx;
  108. .shopName {
  109. color: #FFEBC4;
  110. font-size: 20rpx;
  111. width: 140rpx;
  112. height: 40rpx;
  113. line-height: 40rpx;
  114. border-radius: 0 20rpx 20rpx 0;
  115. background: #333333;
  116. padding-left: 10rpx;
  117. overflow: hidden;
  118. white-space: nowrap;
  119. text-overflow: ellipsis;
  120. }
  121. .paymentNum {
  122. border: 2rpx solid #E4E5E6;
  123. color: #C5AA7B;
  124. font-size: 20rpx;
  125. padding: 5rpx;
  126. }
  127. }
  128. .itemPrice {
  129. display: flex;
  130. align-items: center;
  131. padding: 0 20rpx 10rpx 20rpx;
  132. margin-top: 20rpx;
  133. .price {
  134. font-size: 40rpx;
  135. color: #C83732;
  136. margin-right: 10rpx;
  137. }
  138. .originalPrice {
  139. color: #CCCCCC;
  140. font-size: 24rpx;
  141. text-decoration: line-through;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. </style>