historySpend.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="box">
  3. <view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.ID)">
  4. <view class="time">{{item.time}}</view>
  5. <view class="carPlate">
  6. <view class="plate">{{item.PlateNumber}}</view>
  7. <view class="mileage">{{item.CurrentMileage}}km</view>
  8. </view>
  9. <view class="shopName">{{item.ShopName}}</view>
  10. <view class="itemContent" v-show="item.listItems.length != 0" v-for="(v,i) in item.listItems.">{{v.ItemName}},</view>
  11. <view class="itemContent" v-show="item.listParts.length != 0" v-for="(v,i) in item.listParts.">{{v.GoodsName}},</view>
  12. </view>
  13. <!-- 上拉 加载更多 -->
  14. <view class="noMore" v-if="noMoreShow">没有更多数据</view>
  15. <!-- 无数据空白页 -->
  16. <nodata v-if="itemData.length==0"></nodata>
  17. </view>
  18. </template>
  19. <script>
  20. import nodata from '../../components/nodata/nodata.vue'
  21. export default {
  22. components: {
  23. nodata,
  24. },
  25. data() {
  26. return {
  27. page: 1,
  28. itemData: [],
  29. noMoreShow: false,
  30. }
  31. },
  32. onLoad() {
  33. this.page = 1
  34. // this.myOrderCoupon()
  35. },
  36. methods: {
  37. goDetail(id) {
  38. uni.navigateTo({
  39. url: 'historyDetail?id=' + id
  40. })
  41. },
  42. myOrderCoupon() {
  43. uni.showLoading({
  44. title: '加载中'
  45. })
  46. this.$http('worldKeepCar/keepCarMy/listTCouponPage', {
  47. // page: this.page,
  48. // limit: 10,
  49. }, 'GET').then(res => {
  50. uni.hideLoading();
  51. // var list = res.data.Items
  52. var list = res.data
  53. // 处理 undefined和null转为空白字符串
  54. list.forEach((item, index) => {
  55. for (const key in item) {
  56. item[key] = this.$praseStrEmpty(item[key])
  57. }
  58. })
  59. if (this.page == 1) {
  60. this.itemData = list
  61. } else {
  62. this.itemData = this.itemData.concat(list)
  63. }
  64. if (list.length < 10) {
  65. this.noMoreShow = true
  66. } else {
  67. this.noMoreShow = false
  68. }
  69. if (this.itemData.length != 0) {
  70. this.itemData.forEach((item, index) => {
  71. if (item.pickNum <= 0) {
  72. this.allHave = false
  73. }
  74. })
  75. }
  76. })
  77. },
  78. },
  79. // 下拉刷新
  80. onPullDownRefresh() {
  81. this.page = 1
  82. this.myOrderCoupon()
  83. setTimeout(function() {
  84. uni.stopPullDownRefresh();
  85. }, 1000);
  86. },
  87. // 上拉加载更多
  88. onReachBottom() {
  89. // this.page++;
  90. this.myOrderCoupon()
  91. },
  92. }
  93. </script>
  94. <style>
  95. .box {
  96. min-height: 100vh;
  97. background-color: #F4F5F7;
  98. padding-top: 20rpx;
  99. }
  100. .itemHistory {
  101. margin: 0rpx 24rpx 20rpx;
  102. padding: 20rpx;
  103. background-color: #FFFFFF;
  104. border-radius: 10rpx;
  105. }
  106. .time {
  107. font-size: 24rpx;
  108. color: #999999;
  109. }
  110. .carPlate {
  111. margin: 20rpx 0rpx 15rpx;
  112. display: flex;
  113. align-items: center;
  114. justify-content: flex-start;
  115. }
  116. .plate {
  117. font-size: 30rpx;
  118. color: #3C3C3C;
  119. font-weight: bold;
  120. margin-right: 20rpx;
  121. }
  122. .mileage {
  123. font-size: 24rpx;
  124. color: #F19D01;
  125. padding: 0rpx 10rpx;
  126. border: 1rpx solid #F19D01;
  127. border-radius: 4rpx;
  128. height: 36rpx;
  129. }
  130. .shopName,
  131. .itemContent {
  132. color: #666666;
  133. font-size: 24rpx;
  134. margin: 15rpx 0rpx;
  135. /* 隐藏文字显示 ...不换行 */
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. white-space: nowrap;
  139. }
  140. </style>