index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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.substr(0,10) }}</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 || 0}}</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 || 0}}</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/1000).toFixed(3) || 0 }}</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. uni.showLoading({
  72. mask: true,
  73. title: '加载中'
  74. })
  75. this.status = "loading"
  76. pageNo ? this.pageNo = pageNo : null
  77. getAlreadyCleanList({
  78. pageNo: this.pageNo,
  79. pageSize: this.pageSize,
  80. }).then(res => {
  81. uni.hideLoading()
  82. if (res.status == 200) {
  83. if(this.pageNo>1){
  84. this.listdata = this.listdata.concat(res.data.list || [])
  85. }else{
  86. this.listdata = res.data.list || []
  87. this.scrollTop = 0
  88. }
  89. this.total = res.data.count || 0
  90. this.noDataText = '暂无数据'
  91. } else {
  92. this.noDataText = res.message
  93. this.listdata = []
  94. this.total = 0
  95. }
  96. this.status = "loadmore"
  97. })
  98. },
  99. // 查看详情
  100. goPage(row){
  101. uni.navigateTo({
  102. url: '/pages/cleared/details?createDate='+row.cleanDate
  103. })
  104. },
  105. // scroll-view到底部加载更多
  106. onreachBottom() {
  107. if(this.listdata.length!=0 && this.listdata.length < this.total){
  108. this.pageNo++
  109. this.searchHandle()
  110. }else{
  111. uni.showToast({ title: '已经到底了', icon: 'none' })
  112. this.status = "nomore"
  113. }
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss">
  119. page{
  120. height: 100%;
  121. }
  122. .cleared-container {
  123. width: 100%;
  124. height: 100%;
  125. display: flex;
  126. flex-direction: column;
  127. // 列表
  128. .scroll-con{
  129. flex: 1;
  130. overflow: auto;
  131. }
  132. // 列表样式
  133. .cell-item-con{
  134. .cell-item{
  135. margin: $uni-spacing-col-base $uni-spacing-row-base;
  136. background-color: #fff;
  137. border-radius: $uni-border-radius-base;
  138. color: $uni-text-color;
  139. font-size: $uni-font-size-base;
  140. box-shadow: 3rpx 3rpx 5rpx #eee;
  141. .cell-item-c{
  142. display: flex;
  143. justify-content: space-between;
  144. padding: 24rpx $uni-spacing-row-base;
  145. .cell-item-date{
  146. color: $uni-text-color-grey;
  147. }
  148. }
  149. .cell-item-main{
  150. display: inline-block;
  151. margin-bottom: 10rpx;
  152. .cell-item-number{
  153. margin-right: 5rpx;
  154. }
  155. .cell-item-unit{
  156. font-size: 26rpx;
  157. }
  158. .blue {
  159. color: #1890FF;
  160. }
  161. .green {
  162. color: #16b50e;
  163. }
  164. .red {
  165. color: red;
  166. }
  167. }
  168. }
  169. }
  170. .nodata{
  171. padding-top: 400rpx;
  172. }
  173. }
  174. </style>