plantList.vue 4.1 KB

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