index.vue 3.2 KB

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