details.vue 6.0 KB

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