details.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="cleared-details-container">
  3. <scroll-view class="scroll-con" scroll-y :scroll-top="scrollTop" @scrolltolower="onreachBottom">
  4. <!-- 列表数据 -->
  5. <view class="cell-item-con">
  6. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  7. <view class="cell-item-c">
  8. <view class="cell-item-info">
  9. <view class="cell-item-info-network">{{item.stationName}}</view>
  10. <view class="cell-item-info-weight">清运总重量:<text>{{item.totalWeight}}kg</text></view>
  11. </view>
  12. </view>
  13. <u-grid :col="3" :hover-class="none">
  14. <u-grid-item>
  15. <view class="cell-item-main">
  16. <text class="cell-item-number blue">{{item.clothes}}</text>
  17. <text class="cell-item-unit">个</text>
  18. </view>
  19. <view class="cell-item-exp">废旧衣物</view>
  20. </u-grid-item>
  21. <u-grid-item>
  22. <view class="cell-item-main">
  23. <text class="cell-item-number green">{{item.paper}}</text>
  24. <text class="cell-item-unit">个</text>
  25. </view>
  26. <view class="cell-item-exp">废旧纸张</view>
  27. </u-grid-item>
  28. <u-grid-item>
  29. <view class="cell-item-main">
  30. <text class="cell-item-number red">{{item.plastic}}</text>
  31. <text class="cell-item-unit">kg</text>
  32. </view>
  33. <view class="cell-item-exp">废旧塑料</view>
  34. </u-grid-item>
  35. <u-grid-item>
  36. <view class="cell-item-main">
  37. <text class="cell-item-number yellow">{{item.metal}}</text>
  38. <text class="cell-item-unit">kg</text>
  39. </view>
  40. <view class="cell-item-exp">废旧金属</view>
  41. </u-grid-item>
  42. <u-grid-item>
  43. <view class="cell-item-main">
  44. <text class="cell-item-number yellow">{{item.plaMet}}</text>
  45. <text class="cell-item-unit">kg</text>
  46. </view>
  47. <view class="cell-item-exp">废旧金属/塑料</view>
  48. </u-grid-item>
  49. <u-grid-item>
  50. <view class="cell-item-main">
  51. <text class="cell-item-number yellow">{{item.glass}}</text>
  52. <text class="cell-item-unit">kg</text>
  53. </view>
  54. <view class="cell-item-exp">废旧玻璃</view>
  55. </u-grid-item>
  56. <u-grid-item>
  57. <view class="cell-item-main">
  58. <text class="cell-item-number yellow">{{item.recycling}}</text>
  59. <text class="cell-item-unit">kg</text>
  60. </view>
  61. <view class="cell-item-exp">可回收物</view>
  62. </u-grid-item>
  63. </u-grid>
  64. </view>
  65. </view>
  66. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  67. <view class="loadmore" v-if="listdata.length!=0">
  68. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  69. </view>
  70. </scroll-view>
  71. </view>
  72. </template>
  73. <script>
  74. import { getAlreadyCleanDetails } from '@/api/cleared.js'
  75. export default{
  76. data(){
  77. return{
  78. listdata: [],
  79. pageNo: 1, // 当前页码
  80. pageSize: 10, // 每页条数
  81. total: 0, // 数据总条数
  82. noDataText: '暂无数据', // 列表请求状态提示语
  83. status: 'loadmore', // 加载中状态
  84. scrollTop: 0, // 滚动条位置
  85. }
  86. },
  87. onShow() {
  88. this.refresh()
  89. },
  90. methods: {
  91. // 获取查询参数 刷新列表
  92. refresh(){
  93. this.listdata = []
  94. this.total = 0
  95. this.searchHandle(1)
  96. },
  97. // 搜索查询
  98. searchHandle (pageNo) {
  99. this.status = "loading"
  100. pageNo ? this.pageNo = pageNo : null
  101. getAlreadyCleanDetails({
  102. pageNo: this.pageNo,
  103. pageSize: this.pageSize,
  104. }).then(res => {
  105. if (res.status == 200) {
  106. if(this.pageNo>1){
  107. this.listdata = this.listdata.concat(res.data.list || [])
  108. }else{
  109. this.listdata = res.data.list || []
  110. this.scrollTop = 0
  111. }
  112. this.total = res.data.count || 0
  113. this.noDataText = '暂无数据'
  114. } else {
  115. this.noDataText = res.message
  116. this.listdata = []
  117. this.total = 0
  118. }
  119. this.status = "loadmore"
  120. })
  121. },
  122. // scroll-view到底部加载更多
  123. onreachBottom() {
  124. if(this.listdata.length!=0 && this.listdata.length < this.total){
  125. this.pageNo++
  126. this.searchHandle()
  127. }else{
  128. uni.showToast({ title: '已经到底了', icon: 'none' })
  129. this.status = "nomore"
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .cleared-details-container{
  137. width: 100%;
  138. // 列表
  139. .scroll-con{
  140. overflow: auto;
  141. height: 100vh;
  142. }
  143. .cell-item-con{
  144. .cell-item{
  145. margin: $uni-spacing-col-base $uni-spacing-row-base;
  146. background-color: #fff;
  147. border-radius: $uni-border-radius-base;
  148. color: $uni-text-color;
  149. font-size: $uni-font-size-base;
  150. box-shadow: 3rpx 3rpx 5rpx #eee;
  151. .cell-item-c{
  152. padding: $uni-spacing-col-base $uni-spacing-row-base;
  153. .cell-item-info{
  154. .cell-item-info-network{
  155. word-break: break-all;
  156. margin-bottom: 10rpx;
  157. }
  158. .cell-item-info-weight{
  159. font-size: 26rpx;
  160. text{
  161. font-weight: bold;
  162. }
  163. }
  164. }
  165. }
  166. .cell-item-main{
  167. margin-bottom: 10rpx;
  168. .cell-item-number{
  169. margin-right: 5rpx;
  170. }
  171. .cell-item-unit{
  172. font-size: 26rpx;
  173. }
  174. .blue {
  175. color: #1890FF;
  176. }
  177. .green {
  178. color: #16b50e;
  179. }
  180. .red {
  181. color: red;
  182. }
  183. .yellow {
  184. color: #ff9900;
  185. }
  186. }
  187. }
  188. }
  189. .nodata{
  190. padding-top: 400rpx;
  191. }
  192. }
  193. </style>