historySpend.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 class="bottom">
  17. <view v-if="item.EvaluateState == 0" @click.stop="goAppraise(item)" class="ping">评价</view>
  18. <view v-else @click.stop="goAppraiseDetail(item)" class="kan">查看评价</view>
  19. </view>
  20. </view>
  21. <!-- 上拉 加载更多 -->
  22. <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
  23. <!-- 无数据空白页 -->
  24. <nodata v-if="itemData.length==0"></nodata>
  25. </view>
  26. </template>
  27. <script>
  28. import nodata from '../../components/nodata/nodata.vue'
  29. export default {
  30. components: {
  31. nodata,
  32. },
  33. data() {
  34. return {
  35. page: 1,
  36. itemData: [],
  37. noMoreShow: false,
  38. }
  39. },
  40. onLoad() {
  41. this.page = 1
  42. this.myOrderCoupon()
  43. },
  44. methods: {
  45. goAppraiseDetail(item) {
  46. uni.navigateTo({
  47. url: 'myAppraiseDetail?sheetId=' + item.id
  48. })
  49. },
  50. goAppraise(item){
  51. uni.navigateTo({
  52. url: 'appraise?sheetID=' + item.id + '&shopID=' + item.shopID
  53. })
  54. },
  55. goDetail(id) {
  56. uni.navigateTo({
  57. url: 'historyDetail?id=' + id
  58. })
  59. },
  60. myOrderCoupon() {
  61. uni.showLoading({
  62. title: '加载中'
  63. })
  64. this.$http('openweiXinCardInfoController/queryConsumptionList', {
  65. // page: this.page,
  66. // limit: 10,
  67. }, 'POST').then(res => {
  68. uni.hideLoading();
  69. // var list = res.data.Items
  70. var list = res.data
  71. // 处理 undefined和null转为空白字符串
  72. // list.forEach((item, index) => {
  73. // for (const key in item) {
  74. // item[key] = this.$praseStrEmpty(item[key])
  75. // }
  76. // })
  77. if (this.page == 1) {
  78. this.itemData = list
  79. } else {
  80. this.itemData = this.itemData.concat(list)
  81. }
  82. if (list.length < 10) {
  83. this.noMoreShow = true
  84. } else {
  85. this.noMoreShow = false
  86. }
  87. })
  88. },
  89. },
  90. // 下拉刷新
  91. onPullDownRefresh() {
  92. this.page = 1
  93. this.myOrderCoupon()
  94. setTimeout(function() {
  95. uni.stopPullDownRefresh();
  96. }, 1000);
  97. },
  98. // 上拉加载更多
  99. onReachBottom() {
  100. // this.page++;
  101. this.myOrderCoupon()
  102. },
  103. }
  104. </script>
  105. <style>
  106. .box {
  107. min-height: 100vh;
  108. background-color: #F4F5F7;
  109. padding-top: 20rpx;
  110. }
  111. .itemHistory {
  112. margin: 0rpx 24rpx 20rpx;
  113. padding: 20rpx;
  114. background-color: #FFFFFF;
  115. border-radius: 10rpx;
  116. }
  117. .time {
  118. font-size: 24rpx;
  119. color: #999999;
  120. }
  121. .carPlate {
  122. margin: 20rpx 0rpx 15rpx;
  123. display: flex;
  124. align-items: center;
  125. justify-content: flex-start;
  126. }
  127. .plate {
  128. font-size: 30rpx;
  129. color: #3C3C3C;
  130. font-weight: bold;
  131. margin-right: 20rpx;
  132. }
  133. .mileage {
  134. font-size: 24rpx;
  135. color: #F19D01;
  136. padding: 0rpx 10rpx;
  137. border: 1rpx solid #F19D01;
  138. border-radius: 4rpx;
  139. height: 36rpx;
  140. }
  141. .itemN {
  142. margin-top: 15rpx;
  143. display: flex;
  144. /* 隐藏文字显示 ...不换行 */
  145. overflow: hidden;
  146. text-overflow: ellipsis;
  147. white-space: nowrap;
  148. }
  149. .shopName{
  150. color: #666666;
  151. font-size: 24rpx;
  152. margin-top: 15rpx;
  153. /* 隐藏文字显示 ...不换行 */
  154. overflow: hidden;
  155. text-overflow: ellipsis;
  156. white-space: nowrap;
  157. }
  158. .itemContent {
  159. color: #666666;
  160. font-size: 24rpx;
  161. }
  162. .bottom{
  163. padding-top: 20rpx;
  164. border-top: 1rpx solid #EEEEEE;
  165. margin-top: 20rpx;
  166. display: flex;
  167. justify-content: flex-end;
  168. }
  169. .ping{
  170. text-align: center;
  171. color: #FF4F00;
  172. width: 150rpx;
  173. height: 56rpx;
  174. line-height: 56rpx;
  175. border-radius: 36rpx;
  176. border: 2rpx solid #FF4F00;
  177. }
  178. .kan{
  179. text-align: center;
  180. color: #3C3C3C;
  181. width: 150rpx;
  182. height: 56rpx;
  183. line-height: 56rpx;
  184. border-radius: 36rpx;
  185. border: 2rpx solid #DDDDDD;
  186. }
  187. .noMore {
  188. text-align: center;
  189. line-height: 50rpx;
  190. color: #999999;
  191. font-size: 28rpx;
  192. }
  193. </style>