deliveryRecord.vue 4.0 KB

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