plantList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <scroll-view class="container" scroll-y="true" @scrolltolower="handleLoadMore()">
  3. <view class="goods-row" v-for="(item, index) in plantList" :key="index" @click="goToGoodDetail(item)">
  4. <cover-image class="goods-img" :src="item.imgPath"></cover-image>
  5. <view class="goods-info">
  6. <view class="goods-name">{{item.productName}}</view>
  7. <view class="goods-area">面积:{{item.areaSize}}㎡</view>
  8. <view class="goods-number">
  9. <text class="goods-icon">¥</text>
  10. <text class="goods-spec">{{item.bizPrice}}</text>
  11. <text class="goods-price">¥{{item.originalPrice}}</text>
  12. </view>
  13. <view class="goods-date">有效期:{{item.term}}</view>
  14. </view>
  15. <view class="goods-cart">
  16. <view class="more-button">
  17. <view class="iconfont icongengduo"></view>
  18. </view>
  19. </view>
  20. </view>
  21. <u-top-tips ref="uTips"></u-top-tips>
  22. </scroll-view>
  23. </template>
  24. <script>
  25. const NET = require('@/utils/request')
  26. const API = require('@/config/api')
  27. export default {
  28. data() {
  29. return {
  30. pageIndex: 1,
  31. isOver: false,
  32. plantList: [],
  33. }
  34. },
  35. onLoad() {
  36. this.getGoodsList()
  37. },
  38. methods: {
  39. // 懒加载
  40. handleLoadMore() {
  41. if (!this.isOver) {
  42. this.pageIndex++
  43. this.getGoodsList()
  44. }
  45. },
  46. // 获取商品
  47. getGoodsList() {
  48. NET.request(API.getPlantList, {
  49. pageIndex: this.pageIndex,
  50. pageSize: 10,
  51. }, 'GET').then(res => {
  52. this.isOver = res.data.list.length != 10
  53. this.plantList = this.plantList.concat(res.data.list)
  54. }).catch(error => {
  55. this.$refs.uTips.show({
  56. title: '获取共享种植列表失败',
  57. type: 'warning',
  58. })
  59. })
  60. },
  61. // 跳转详情
  62. goToGoodDetail(item){
  63. uni.navigateTo({
  64. url: '/pagesGood/goodDetails?minePlant=true&goodId=' + item.id
  65. });
  66. },
  67. },
  68. }
  69. </script>
  70. <style lang="less" scoped>
  71. page {
  72. width: 100%;
  73. height: 100%;
  74. }
  75. .container {
  76. width: 100%;
  77. height: 100%;
  78. float: left;
  79. background-color: #f7f7f7;
  80. overflow-y: auto;
  81. .goods-row:first-child{
  82. margin-top: 12px;
  83. }
  84. .goods-row {
  85. width: calc(100% - 24px);
  86. height: 104px;
  87. float: left;
  88. padding: 11px 11px 11px 7px;
  89. box-sizing: border-box;
  90. margin: 0 0 12px 12px;
  91. background: #FFFFFF;
  92. box-shadow: 0px 1px 5px 0px rgba(102, 102, 102, 0.43);
  93. border-radius: 15px;
  94. .goods-img {
  95. width: 84px;
  96. height: 84px;
  97. float: left;
  98. }
  99. .goods-info {
  100. width: calc(100% - 108px);
  101. height: 84px;
  102. box-sizing: border-box;
  103. padding-left: 6px;
  104. float: left;
  105. .goods-name {
  106. width: calc(100% + 24px);
  107. height: 20px;
  108. font-size: 16px;
  109. font-family: PingFang SC;
  110. color: #333333;
  111. line-height: 20px;
  112. white-space: nowrap;
  113. text-overflow: ellipsis;
  114. overflow: hidden;
  115. }
  116. .goods-area {
  117. height: 18px;
  118. margin: 6px 0 2px 0;
  119. line-height: 18px;
  120. font-size: 13px;
  121. font-family: PingFang SC;
  122. color: #666666;
  123. }
  124. .goods-number {
  125. height: 18px;
  126. font-family: PingFang SC;
  127. line-height: 18px;
  128. .goods-icon {
  129. font-size: 12px;
  130. color: #52A63A;
  131. }
  132. .goods-spec {
  133. font-size: 15px;
  134. color: #52A63A;
  135. margin-right: 15px;
  136. }
  137. .goods-price {
  138. font-size: 13px;
  139. text-decoration: line-through;
  140. color: #A67954;
  141. }
  142. }
  143. .goods-date {
  144. height: 16px;
  145. margin-top: 4px;
  146. line-height: 16px;
  147. font-size: 13px;
  148. font-family: PingFang SC;
  149. color: #666666;
  150. }
  151. }
  152. .goods-cart {
  153. width: 24px;
  154. height: 84px;
  155. float: left;
  156. .more-button {
  157. width: 24px;
  158. height: 20px;
  159. margin-top: 64px;
  160. .iconfont {
  161. color: #999999;
  162. font-size: 32px;
  163. line-height: 20px;
  164. }
  165. }
  166. }
  167. }
  168. }
  169. </style>