index.vue 3.7 KB

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