historySpend.vue 3.6 KB

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