deliveryRecord.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. rubbishType: []
  47. }
  48. },
  49. onShow() {
  50. this.searchHandle(1)
  51. this.rubbishType = this.$store.state.vuex_rubbishType
  52. },
  53. methods:{
  54. // 搜索查询
  55. searchHandle (pageNo,suppName) {
  56. this.status = "loading"
  57. pageNo ? this.pageNo = pageNo : null
  58. getDeliveryLogList({
  59. pageNo: this.pageNo,
  60. pageSize: this.pageSize,
  61. }).then(res => {
  62. if (res.status == 200) {
  63. if(this.pageNo>1){
  64. this.listdata = this.listdata.concat(res.data.list || [])
  65. }else{
  66. this.listdata = res.data.list || []
  67. }
  68. this.total = res.data.count || 0
  69. } else {
  70. this.noDataText = res.message
  71. this.listdata = []
  72. this.total = 0
  73. }
  74. this.status = "loadmore"
  75. })
  76. },
  77. // scroll-view到底部加载更多
  78. onreachBottom() {
  79. if(this.listdata.length < this.total){
  80. this.pageNo += 1
  81. this.searchHandle()
  82. }else{
  83. uni.showToast({ title: '已经到底了', icon: 'none' })
  84. this.status = "nomore"
  85. }
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="less">
  91. .deliveryRecord-container{
  92. width: 100%;
  93. // 列表
  94. .scroll-con{
  95. height: 100%;
  96. overflow: auto;
  97. }
  98. // 列表样式
  99. .cell-item-con{
  100. .cell-item{
  101. background-color: #fff;
  102. color: #606266;
  103. padding: 20rpx 32rpx 22rpx;
  104. border-bottom: 1rpx solid #EEEEEE;
  105. &:last-child{
  106. border:0;
  107. }
  108. .cell-item-date{
  109. display: block;
  110. color: #909399;
  111. font-size: 24rpx;
  112. }
  113. .cell-item-main{
  114. display: flex;
  115. justify-content: space-around;
  116. align-items: center;
  117. padding-top: 14rpx;
  118. .cell-item-pic{
  119. flex-shrink: 0;
  120. margin-right: 20rpx;
  121. }
  122. .cell-item-r{
  123. flex-grow: 1;
  124. .cell-item-head{
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. .cell-item-val{
  129. font-size: 30rpx;
  130. font-weight: bold;
  131. .cell-item-num{
  132. display: inline-block;
  133. margin-right: 6rpx;
  134. }
  135. }
  136. .cell-item-ledu{
  137. display: flex;
  138. justify-content: space-between;
  139. align-items: center;
  140. text{
  141. font-size: 40rpx;
  142. color: #01c9b2;
  143. }
  144. }
  145. }
  146. .cell-item-des{
  147. color: #909399;
  148. font-size: 26rpx;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. }
  155. </style>