deliveryRecord.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  7. <text class="cell-item-date">{{item.time}}</text>
  8. <view class="cell-item-main">
  9. <u-image width="150rpx" height="150rpx" :src="item.pic" class="cell-item-pic"></u-image>
  10. <view class="cell-item-r">
  11. <view class="cell-item-head">
  12. <view class="cell-item-val"><text class="cell-item-num">{{item.rubbishWeight}}</text>克</view>
  13. <u-tag :text="item.goldNum + '乐豆'" mode="light" type="warning" size="mini" class="cell-item-price" />
  14. </view>
  15. <text class="cell-item-des">{{item.stationName}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  21. <view class="loadmore">
  22. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  23. </view>
  24. </scroll-view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. getDeliveryLogList
  30. } from '@/api/deliveryRecord.js'
  31. export default {
  32. data() {
  33. return {
  34. listdata: [
  35. // { tit: '255', time: '2020-11-4 10:11', pic: '', price: '38', label: '撒健康的国家啥都给交撒旦教撒健康的国家啥都给交撒旦撒健给交撒旦教' },
  36. // { tit: '255', time: '2020-11-4 10:11', pic: '', price: '38', label: '撒健康的国家啥旦教' },
  37. ],
  38. pageNo: 1, // 当前页码
  39. pageSize: 10, // 每页条数
  40. total: 0, // 数据总条数
  41. noDataText: '暂无数据', // 列表请求状态提示语
  42. status: 'loadmore', // 加载中状态
  43. }
  44. },
  45. onShow() {
  46. this.searchHandle(1)
  47. },
  48. onLoad() {
  49. },
  50. methods:{
  51. // 搜索查询
  52. searchHandle (pageNo,suppName) {
  53. this.status = "loading"
  54. pageNo ? this.pageNo = pageNo : null
  55. getDeliveryLogList({
  56. pageNo: this.pageNo,
  57. pageSize: this.pageSize,
  58. // queryWord: this.queryValue
  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. this.listdata.length == 0 && this.queryValue != '' ? this.noDataText = '没有搜索到相关结果' : this.noDataText = '暂无数据'
  68. } else {
  69. this.noDataText = res.message
  70. this.listdata = []
  71. this.total = 0
  72. }
  73. this.status = "loadmore"
  74. })
  75. },
  76. // scroll-view到底部加载更多
  77. onreachBottom() {
  78. if(this.listdata.length < this.total){
  79. this.pageNo += 1
  80. this.searchHandle()
  81. }else{
  82. uni.showToast({ title: '已经到底了', icon: 'none' })
  83. this.status = "nomore"
  84. }
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="less">
  90. .deliveryRecord-container{
  91. width: 100%;
  92. // 列表
  93. .scroll-con{
  94. height: 100%;
  95. overflow: auto;
  96. }
  97. // 列表样式
  98. .cell-item-con{
  99. .cell-item{
  100. background-color: #fff;
  101. color: #606266;
  102. padding: 16rpx 32rpx 22rpx;
  103. border-bottom: 1rpx solid #e6e6e6;
  104. .cell-item-date{
  105. display: block;
  106. color: #909399;
  107. font-size: 26rpx;
  108. }
  109. .cell-item-main{
  110. display: flex;
  111. justify-content: space-around;
  112. align-items: center;
  113. padding-top: 14rpx;
  114. .cell-item-pic{
  115. flex-shrink: 0;
  116. margin-right: 20rpx;
  117. }
  118. .cell-item-r{
  119. flex-grow: 1;
  120. .cell-item-head{
  121. display: flex;
  122. justify-content: space-between;
  123. align-items: center;
  124. padding: 5rpx 0 15rpx;
  125. .cell-item-val{
  126. font-size: 32rpx;
  127. .cell-item-num{
  128. display: inline-block;
  129. margin-right: 6rpx;
  130. }
  131. }
  132. }
  133. .cell-item-des{
  134. color: #909399;
  135. font-size: 26rpx;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. </style>