index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="cleared-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" @tap="goPage(item)">
  7. <view class="cell-item-c">
  8. <view class="cell-item-date">{{item.cleanDate}}</view>
  9. <view class="cell-item-orderNum">
  10. <u-icon name="arrow-right" :size="28" color="#999"></u-icon>
  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.stationNum}}</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.boxNum}}</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.totalWeight}}</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>
  36. </view>
  37. </view>
  38. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  39. <view class="loadmore" v-if="listdata.length!=0">
  40. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  41. </view>
  42. </scroll-view>
  43. </view>
  44. </template>
  45. <script>
  46. import { getAlreadyCleanList } from '@/api/cleared.js'
  47. export default {
  48. data() {
  49. return {
  50. listdata: [],
  51. pageNo: 1, // 当前页码
  52. pageSize: 10, // 每页条数
  53. total: 0, // 数据总条数
  54. noDataText: '暂无数据', // 列表请求状态提示语
  55. status: 'loadmore', // 加载中状态
  56. scrollTop: 0, // 滚动条位置
  57. }
  58. },
  59. onShow() {
  60. this.refresh()
  61. },
  62. methods:{
  63. // 获取查询参数 刷新列表
  64. refresh(){
  65. this.listdata = []
  66. this.total = 0
  67. this.searchHandle(1)
  68. },
  69. // 搜索查询
  70. searchHandle (pageNo) {
  71. this.status = "loading"
  72. pageNo ? this.pageNo = pageNo : null
  73. getAlreadyCleanList({
  74. pageNo: this.pageNo,
  75. pageSize: this.pageSize,
  76. }).then(res => {
  77. if (res.status == 200) {
  78. if(this.pageNo>1){
  79. this.listdata = this.listdata.concat(res.data.list || [])
  80. }else{
  81. this.listdata = res.data.list || []
  82. this.scrollTop = 0
  83. }
  84. this.total = res.data.count || 0
  85. this.noDataText = '暂无数据'
  86. } else {
  87. this.noDataText = res.message
  88. this.listdata = []
  89. this.total = 0
  90. }
  91. this.status = "loadmore"
  92. })
  93. },
  94. // 查看详情
  95. goPage(row){
  96. uni.navigateTo({
  97. url: '/pages/cleared/details'
  98. })
  99. },
  100. // scroll-view到底部加载更多
  101. onreachBottom() {
  102. if(this.listdata.length!=0 && this.listdata.length < this.total){
  103. this.pageNo++
  104. this.searchHandle()
  105. }else{
  106. uni.showToast({ title: '已经到底了', icon: 'none' })
  107. this.status = "nomore"
  108. }
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss">
  114. page{
  115. height: 100%;
  116. }
  117. .cleared-container {
  118. width: 100%;
  119. height: 100%;
  120. display: flex;
  121. flex-direction: column;
  122. // 列表
  123. .scroll-con{
  124. flex: 1;
  125. overflow: auto;
  126. }
  127. // 列表样式
  128. .cell-item-con{
  129. .cell-item{
  130. margin: $uni-spacing-col-base $uni-spacing-row-base;
  131. background-color: #fff;
  132. border-radius: $uni-border-radius-base;
  133. color: $uni-text-color;
  134. font-size: $uni-font-size-base;
  135. box-shadow: 3rpx 3rpx 5rpx #eee;
  136. .cell-item-c{
  137. display: flex;
  138. justify-content: space-between;
  139. padding: 24rpx $uni-spacing-row-base;
  140. .cell-item-date{
  141. color: $uni-text-color-grey;
  142. }
  143. }
  144. .cell-item-main{
  145. display: inline-block;
  146. margin-bottom: 10rpx;
  147. .cell-item-number{
  148. margin-right: 5rpx;
  149. }
  150. .cell-item-unit{
  151. font-size: 26rpx;
  152. }
  153. .blue {
  154. color: #1890FF;
  155. }
  156. .green {
  157. color: #16b50e;
  158. }
  159. .red {
  160. color: red;
  161. }
  162. }
  163. }
  164. }
  165. .nodata{
  166. padding-top: 400rpx;
  167. }
  168. }
  169. </style>