vinRecord.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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" @click="toChoosePart(item)">
  8. <view v-if="userInfo&&userInfo.sysUserFlag == '1'">
  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 v-if="userInfo&&userInfo.sysUserFlag == '1'">{{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. computed: {
  47. hasShelf(){
  48. return this.$store.state.vuex_storeShelf
  49. },
  50. userInfo(){
  51. return this.$store.state.vuex_userInfo
  52. }
  53. },
  54. methods: {
  55. pageInit(){
  56. this.total = 0
  57. this.pageNo = 1
  58. this.getRow()
  59. },
  60. // 查询列表
  61. getRow (pageNo) {
  62. let _this = this
  63. if (pageNo) {
  64. this.pageNo = pageNo
  65. }
  66. // 查询条件
  67. let params = {
  68. // beginDate: moment().subtract('days', 6).format('YYYY-MM-DD 00:00:00'),
  69. // endDate: moment(moment().valueOf()).format('YYYY-MM-DD 23:59:59'),
  70. pageNo: this.pageNo,
  71. pageSize: this.pageSize,
  72. identifyType: this.userInfo ? this.userInfo.identifyType : ''
  73. }
  74. this.status = "loading"
  75. getScanVinLogList(params).then(res => {
  76. if (res.code == 200 || res.status == 204 || res.status == 200) {
  77. const retList = res.data.list.filter(item => item.vinCode)
  78. if(_this.pageNo>1){
  79. _this.list = _this.list.concat(retList || [])
  80. }else{
  81. _this.list = retList || []
  82. }
  83. _this.total = res.data.count || 0
  84. } else {
  85. _this.list = []
  86. _this.total = 0
  87. _this.noDataText = '暂无数据'
  88. }
  89. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  90. })
  91. },
  92. // scroll-view到底部加载更多
  93. onreachBottom() {
  94. if(this.list.length < this.total){
  95. this.pageNo += 1
  96. this.getRow()
  97. }else{
  98. this.status = "nomore"
  99. }
  100. },
  101. toChoosePart(item){
  102. item.text = item.modelInfo
  103. uni.navigateTo({
  104. url: "/pagesA/digitalShelf/choosePart?vinNumber="+item.vinCode+"&carList="+encodeURIComponent(JSON.stringify(item))
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="less">
  111. .vinRecord{
  112. width: 100%;
  113. height: 100vh;
  114. background: #f8f8f8;
  115. .des{
  116. text-align: center;
  117. color: #999;
  118. font-size: 12px;
  119. padding: 20rpx 15rpx;
  120. }
  121. .list-box{
  122. flex-grow: 1;
  123. overflow: auto;
  124. }
  125. .list-item{
  126. margin: 20rpx 30rpx;
  127. border:2rpx solid #f8f8f8;
  128. box-shadow: 2rpx 2rpx 6rpx #eee;
  129. border-radius: 20rpx;
  130. padding: 20rpx 15rpx;
  131. background: #ffffff;
  132. > view{
  133. padding: 0 10rpx;
  134. &:last-child{
  135. flex-grow: 1;
  136. >view{
  137. padding: 10rpx 0;
  138. }
  139. }
  140. }
  141. .time-text{
  142. font-size: 10px;
  143. color: #999;
  144. }
  145. &:first-child{
  146. margin-top: 10rpx;
  147. }
  148. &:active{
  149. opacity: 0.6;
  150. transform:scale(0.9);
  151. }
  152. }
  153. }
  154. </style>