myOrder.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="wrapper">
  3. <view v-for="(order, oIndex) in list" :key="oIndex" class="orderCard" @click="handleClick(order)">
  4. <view class="bottom address">
  5. <text class="left">订单编号 {{ order.startChargeSeq }}</text>
  6. <text class="right">{{ order.statusText}}</text>
  7. </view>
  8. <view class="divider"></view>
  9. <view class="title">{{ order.stationName }}</view>
  10. <view class="address">充电方式:扫码充电</view>
  11. <view class="address">
  12. 下单时间:{{
  13. order.startTm
  14. }}
  15. </view>
  16. <view class="bottom">
  17. <view class="left price">
  18. <text class="unit">¥</text>
  19. <text>{{ order.realMoney | unitPrice }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <u-empty style="margin-top:20%;" text="还没有订单" v-if="list.length == 0"></u-empty>
  24. <uni-load-more :status="loadStatus"></uni-load-more>
  25. </div>
  26. </template>
  27. <script>
  28. import { getOrderList } from "@/api/order";
  29. export default {
  30. data() {
  31. return {
  32. keyword: "",
  33. params: {
  34. pageNum: 1,
  35. pageSize: 10,
  36. isOnlyCharing: 0,
  37. },
  38. list: [], // 订单列表
  39. statusOptions: {
  40. 1: '启动中',
  41. 2: '充电中',
  42. 3: '停止中',
  43. 4: '已完成',
  44. 5: '未知',
  45. 8: '异常订单',
  46. 20: '已完成',
  47. },
  48. loadStatus: 'more',
  49. total: 10
  50. };
  51. },
  52. onReachBottom() {
  53. if(this.list.length < this.total){
  54. this.params.pageNum++;
  55. this.init();
  56. }
  57. },
  58. onPullDownRefresh() {
  59. this.params.pageNum = 1
  60. this.list = []
  61. this.init();
  62. },
  63. mounted() {
  64. this.init();
  65. },
  66. methods: {
  67. handleClick(item) {
  68. if (item.status >= 4) {
  69. uni.navigateTo({
  70. url: `/pages/mine/order/detail?id=${item.startChargeSeq}`
  71. });
  72. }
  73. else {
  74. uni.navigateTo({
  75. url: `/pages/station/charge/charging?id=${item.connectorId}`
  76. })
  77. }
  78. },
  79. search() {
  80. this.list = [];
  81. this.init();
  82. },
  83. async init() {
  84. uni.stopPullDownRefresh()
  85. let res = await getOrderList(this.params);
  86. if (res.data.code == 200) {
  87. let data = res.data.rows;
  88. this.total = res.data.total
  89. data.forEach(item => {
  90. item.statusText = this.statusOptions[item.status]
  91. });
  92. this.list.push(...data);
  93. if(this.list.length >= res.data.total){
  94. this.loadStatus = 'noMore'
  95. }
  96. }
  97. },
  98. },
  99. };
  100. </script>
  101. <style lang="scss" scoped>
  102. .wrapper {
  103. padding: 0 30rpx 30rpx;
  104. }
  105. .orderCard {
  106. background: url(/static/order/order-list-bg.png) right 20rpx bottom no-repeat;
  107. background-size: auto 50%;
  108. border-radius: 20rpx;
  109. box-shadow: 0px 0px 2px 1px #b7b7b740;
  110. margin: 30rpx 0;
  111. padding: 20rpx;
  112. text-align: left;
  113. line-height: 1.5;
  114. .title {
  115. font-size: 28rpx;
  116. font-weight: 500;
  117. margin-bottom: 20rpx;
  118. position: relative;
  119. &::before {
  120. background-color: #0974C5;
  121. content: "";
  122. position: absolute;
  123. border-radius: 3rpx;
  124. left: -20rpx;
  125. top: 46%;
  126. -webkit-transform: translateY(-50%);
  127. transform: translateY(-50%);
  128. width: 3px;
  129. height: 15px;
  130. }
  131. }
  132. .address {
  133. font-size: 24rpx;
  134. color: #707070;
  135. margin-bottom: 10rpx;
  136. }
  137. .unit {
  138. font-size: 20rpx;
  139. }
  140. .price {
  141. font-size: 32rpx;
  142. line-height: 1;
  143. font-weight: 500;
  144. margin-right: 10rpx;
  145. color: $main-color;
  146. }
  147. .bottom {
  148. display: flex;
  149. justify-content: space-between;
  150. }
  151. }
  152. </style>