vinRecord.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="vinRecord flex flex_column">
  3. <view class="des">仅可查看最近7天的VIN查询记录</view>
  4. <swiper class="list-box">
  5. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
  6. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  7. <view class="list-item flex align_center justify_between" v-for="item in list" :key="item.id">
  8. <view>
  9. <u-image shape="circle" :src="item.icon||'@/static/def_imgs.png'" width='90' height="90"></u-image>
  10. </view>
  11. <view>
  12. <view class="flex align_center justify_between">
  13. <text class="vin-text">{{item.vinCode}}</text>
  14. <text class="time-text">{{item.createDate}}</text>
  15. </view>
  16. <view>{{item.modelInfo}}</view>
  17. </view>
  18. </view>
  19. <view style="padding: 20upx;">
  20. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  21. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  22. </view>
  23. </scroll-view>
  24. </swiper-item>
  25. </swiper>
  26. </view>
  27. </template>
  28. <script>
  29. import { getScanVinLogList }from '@/api/car.js'
  30. import moment from 'moment'
  31. export default {
  32. data() {
  33. return {
  34. status: 'loading',
  35. noDataText: '暂无数据',
  36. // 查询条件
  37. pageNo: 1,
  38. pageSize: 10,
  39. list: [],
  40. total: 0,
  41. }
  42. },
  43. onLoad() {
  44. this.pageInit()
  45. },
  46. methods: {
  47. pageInit(){
  48. this.total = 0
  49. this.pageNo = 1
  50. this.getRow()
  51. },
  52. // 查询列表
  53. getRow (pageNo) {
  54. let _this = this
  55. if (pageNo) {
  56. this.pageNo = pageNo
  57. }
  58. // 状态条件
  59. const state = ['WAIT','FINISH','CLOSE']
  60. let params = {
  61. beginDate: moment().subtract('days', 6).format('YYYY-MM-DD 00:00:00'),
  62. endDate: moment(moment().valueOf()).format('YYYY-MM-DD 23:59:59'),
  63. pageNo: this.pageNo,
  64. pageSize: this.pageSize,
  65. billState: state[this.swiperCurrent]
  66. }
  67. this.status = "loading"
  68. getScanVinLogList(params).then(res => {
  69. if (res.code == 200 || res.status == 204 || res.status == 200) {
  70. const retList = res.data.list.filter(item => item.vinCode)
  71. if(_this.pageNo>1){
  72. _this.list = _this.list.concat(retList || [])
  73. }else{
  74. _this.list = retList || []
  75. }
  76. _this.total = res.data.count || 0
  77. } else {
  78. _this.list = []
  79. _this.total = 0
  80. _this.noDataText = res.message
  81. }
  82. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  83. })
  84. },
  85. // scroll-view到底部加载更多
  86. onreachBottom() {
  87. if(this.list.length < this.total){
  88. this.pageNo += 1
  89. this.getRow()
  90. }else{
  91. this.status = "nomore"
  92. }
  93. },
  94. }
  95. }
  96. </script>
  97. <style lang="less">
  98. .vinRecord{
  99. width: 100%;
  100. height: 100vh;
  101. background: #f8f8f8;
  102. .des{
  103. text-align: center;
  104. color: #999;
  105. font-size: 12px;
  106. padding: 20rpx 15rpx;
  107. }
  108. .list-box{
  109. flex-grow: 1;
  110. overflow: auto;
  111. }
  112. .list-item{
  113. margin: 20rpx 30rpx;
  114. border:2rpx solid #f8f8f8;
  115. box-shadow: 2rpx 2rpx 6rpx #eee;
  116. border-radius: 20rpx;
  117. padding: 20rpx 15rpx;
  118. background: #ffffff;
  119. > view{
  120. padding: 0 10rpx;
  121. &:last-child{
  122. flex-grow: 1;
  123. >view{
  124. padding: 10rpx 0;
  125. }
  126. }
  127. }
  128. .time-text{
  129. font-size: 10px;
  130. color: #999;
  131. }
  132. &:first-child{
  133. margin-top: 10rpx;
  134. }
  135. &:active{
  136. opacity: 0.6;
  137. transform:scale(0.9);
  138. }
  139. }
  140. }
  141. </style>