historySpend.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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">
  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="">
  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. if (this.itemData.length != 0) {
  74. this.itemData.forEach((item, index) => {
  75. if (item.pickNum <= 0) {
  76. this.allHave = false
  77. }
  78. })
  79. }
  80. })
  81. },
  82. },
  83. // 下拉刷新
  84. onPullDownRefresh() {
  85. this.page = 1
  86. this.myOrderCoupon()
  87. setTimeout(function() {
  88. uni.stopPullDownRefresh();
  89. }, 1000);
  90. },
  91. // 上拉加载更多
  92. onReachBottom() {
  93. // this.page++;
  94. this.myOrderCoupon()
  95. },
  96. }
  97. </script>
  98. <style>
  99. .box {
  100. min-height: 100vh;
  101. background-color: #F4F5F7;
  102. padding-top: 20rpx;
  103. }
  104. .itemHistory {
  105. margin: 0rpx 24rpx 20rpx;
  106. padding: 20rpx;
  107. background-color: #FFFFFF;
  108. border-radius: 10rpx;
  109. }
  110. .time {
  111. font-size: 24rpx;
  112. color: #999999;
  113. }
  114. .carPlate {
  115. margin: 20rpx 0rpx 15rpx;
  116. display: flex;
  117. align-items: center;
  118. justify-content: flex-start;
  119. }
  120. .plate {
  121. font-size: 30rpx;
  122. color: #3C3C3C;
  123. font-weight: bold;
  124. margin-right: 20rpx;
  125. }
  126. .mileage {
  127. font-size: 24rpx;
  128. color: #F19D01;
  129. padding: 0rpx 10rpx;
  130. border: 1rpx solid #F19D01;
  131. border-radius: 4rpx;
  132. height: 36rpx;
  133. }
  134. .itemN {
  135. display: flex;
  136. }
  137. .shopName,
  138. .itemContent {
  139. color: #666666;
  140. font-size: 24rpx;
  141. margin: 15rpx 0rpx;
  142. /* 隐藏文字显示 ...不换行 */
  143. overflow: hidden;
  144. text-overflow: ellipsis;
  145. white-space: nowrap;
  146. }
  147. .noMore {
  148. text-align: center;
  149. line-height: 50rpx;
  150. color: #999999;
  151. font-size: 28rpx;
  152. }
  153. </style>