details.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. createDate: '' // 时间
  86. }
  87. },
  88. onLoad(options) {
  89. this.createDate = options.createDate
  90. },
  91. onShow() {
  92. this.refresh()
  93. },
  94. methods: {
  95. // 获取查询参数 刷新列表
  96. refresh(){
  97. this.listdata = []
  98. this.total = 0
  99. this.searchHandle(1)
  100. },
  101. // 搜索查询
  102. searchHandle (pageNo) {
  103. uni.showLoading({
  104. mask: true,
  105. title: '加载中'
  106. })
  107. this.status = "loading"
  108. pageNo ? this.pageNo = pageNo : null
  109. getAlreadyCleanDetails({
  110. pageNo: this.pageNo,
  111. pageSize: this.pageSize,
  112. createDate: this.createDate
  113. }).then(res => {
  114. uni.hideLoading()
  115. if (res.status == 200) {
  116. if(this.pageNo>1){
  117. this.listdata = this.listdata.concat(res.data.list || [])
  118. }else{
  119. this.listdata = res.data.list || []
  120. this.scrollTop = 0
  121. }
  122. this.total = res.data.count || 0
  123. this.noDataText = '暂无数据'
  124. } else {
  125. this.noDataText = res.message
  126. this.listdata = []
  127. this.total = 0
  128. }
  129. this.status = "loadmore"
  130. })
  131. },
  132. // scroll-view到底部加载更多
  133. onreachBottom() {
  134. if(this.listdata.length!=0 && this.listdata.length < this.total){
  135. this.pageNo++
  136. this.searchHandle()
  137. }else{
  138. uni.showToast({ title: '已经到底了', icon: 'none' })
  139. this.status = "nomore"
  140. }
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .cleared-details-container{
  147. width: 100%;
  148. // 列表
  149. .scroll-con{
  150. overflow: auto;
  151. height: 100vh;
  152. }
  153. .cell-item-con{
  154. .cell-item{
  155. margin: $uni-spacing-col-base $uni-spacing-row-base;
  156. background-color: #fff;
  157. border-radius: $uni-border-radius-base;
  158. color: $uni-text-color;
  159. font-size: $uni-font-size-base;
  160. box-shadow: 3rpx 3rpx 5rpx #eee;
  161. .cell-item-c{
  162. padding: $uni-spacing-col-base $uni-spacing-row-base;
  163. .cell-item-info{
  164. .cell-item-info-network{
  165. word-break: break-all;
  166. margin-bottom: 10rpx;
  167. }
  168. .cell-item-info-weight{
  169. font-size: 26rpx;
  170. text{
  171. font-weight: bold;
  172. }
  173. }
  174. }
  175. }
  176. .cell-item-main{
  177. margin-bottom: 10rpx;
  178. .cell-item-number{
  179. margin-right: 5rpx;
  180. }
  181. .cell-item-unit{
  182. font-size: 26rpx;
  183. }
  184. .blue {
  185. color: #1890FF;
  186. }
  187. .green {
  188. color: #16b50e;
  189. }
  190. .red {
  191. color: red;
  192. }
  193. .yellow {
  194. color: #ff9900;
  195. }
  196. }
  197. }
  198. }
  199. .nodata{
  200. padding-top: 400rpx;
  201. }
  202. }
  203. </style>