deliveryRecord.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="deliveryRecord-container">
  3. <scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
  4. <!-- 列表数据 -->
  5. <view class="cell-item-con">
  6. <u-gap height="15"></u-gap>
  7. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  8. <text class="cell-item-date">{{item.deliveryTime}}</text>
  9. <view class="cell-item-main">
  10. <u-image mode="scaleToFill" shape="circle" width="80rpx" height="80rpx" :src="`/static/${item.rubbishType}.png`" class="cell-item-pic"></u-image>
  11. <view class="cell-item-r">
  12. <view class="cell-item-head">
  13. <view class="cell-item-val">
  14. <text class="cell-item-num">{{item.rubbishWeight}}</text>克
  15. </view>
  16. <view class="cell-item-ledu">
  17. <text>+{{item.goldNum}}</text>
  18. <u-image mode="scaleToFill" width="34rpx" height="34rpx" src="/static/ledou.png"></u-image>
  19. </view>
  20. </view>
  21. <text class="cell-item-des">{{item.stationName}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  27. <view class="loadmore">
  28. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. getDeliveryLogList
  36. } from '@/api/deliveryRecord.js'
  37. export default {
  38. data() {
  39. return {
  40. listdata: [],
  41. pageNo: 1, // 当前页码
  42. pageSize: 10, // 每页条数
  43. total: 0, // 数据总条数
  44. noDataText: '暂无数据', // 列表请求状态提示语
  45. status: 'loadmore', // 加载中状态
  46. }
  47. },
  48. onShow() {
  49. this.searchHandle(1)
  50. },
  51. methods:{
  52. // 搜索查询
  53. searchHandle (pageNo,suppName) {
  54. this.status = "loading"
  55. pageNo ? this.pageNo = pageNo : null
  56. getDeliveryLogList({
  57. pageNo: this.pageNo,
  58. pageSize: this.pageSize,
  59. }).then(res => {
  60. if (res.status == 200) {
  61. if(this.pageNo>1){
  62. this.listdata = this.listdata.concat(res.data.list || [])
  63. }else{
  64. this.listdata = res.data.list || []
  65. }
  66. this.total = res.data.count || 0
  67. } else {
  68. this.noDataText = res.message
  69. this.listdata = []
  70. this.total = 0
  71. }
  72. this.status = "loadmore"
  73. })
  74. },
  75. // scroll-view到底部加载更多
  76. onreachBottom() {
  77. if(this.listdata.length < this.total){
  78. this.pageNo += 1
  79. this.searchHandle()
  80. }else{
  81. uni.showToast({ title: '已经到底了', icon: 'none' })
  82. this.status = "nomore"
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="less">
  89. .deliveryRecord-container{
  90. width: 100%;
  91. // 列表
  92. .scroll-con{
  93. height: 100%;
  94. overflow: auto;
  95. }
  96. // 列表样式
  97. .cell-item-con{
  98. .cell-item{
  99. background-color: #fff;
  100. color: #606266;
  101. padding: 20rpx 32rpx 22rpx;
  102. border-bottom: 1rpx solid #EEEEEE;
  103. &:last-child{
  104. border:0;
  105. }
  106. .cell-item-date{
  107. display: block;
  108. color: #909399;
  109. font-size: 24rpx;
  110. }
  111. .cell-item-main{
  112. display: flex;
  113. justify-content: space-around;
  114. align-items: center;
  115. padding-top: 14rpx;
  116. .cell-item-pic{
  117. flex-shrink: 0;
  118. margin-right: 20rpx;
  119. }
  120. .cell-item-r{
  121. flex-grow: 1;
  122. .cell-item-head{
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. .cell-item-val{
  127. font-size: 30rpx;
  128. font-weight: bold;
  129. .cell-item-num{
  130. display: inline-block;
  131. margin-right: 6rpx;
  132. }
  133. }
  134. .cell-item-ledu{
  135. display: flex;
  136. justify-content: space-between;
  137. align-items: center;
  138. text{
  139. font-size: 40rpx;
  140. color: #01c9b2;
  141. }
  142. }
  143. }
  144. .cell-item-des{
  145. color: #909399;
  146. font-size: 26rpx;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </style>