vinRecord.vue 3.9 KB

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