order.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="index">
  3. <view class="nav">
  4. <text class="t2" :class="{ t1: map.status == 'all' }" @tap="setMap('status', 'all')">全部</text>
  5. <text class="t2" :class="{ t1: map.status == 2 }" @tap="setMap('status', 2)">进行中</text>
  6. <text class="t2" :class="{ t1: map.status == 3 }" @tap="setMap('status', 3)">待支付</text>
  7. <text class="t2" :class="{ t1: map.status == 99 }" @tap="setMap('status', 99)">已完成</text>
  8. </view>
  9. <view class="center">
  10. <view class="orders" v-if="order.total > 0" v-for="(v, i) in order.data" :key="i" @tap="navigateTo('/pages/myDriving/drivingDetails?order_id=' + v.id)">
  11. <view class="top">
  12. <view class="input">
  13. <text class="icon gray">&#xe77c;</text>
  14. <text class="time">{{ v.createtime | date }}</text>
  15. </view>
  16. <text class="more icon gray">{{ v.status_text }}&#xe60f;</text>
  17. </view>
  18. <view class="left">
  19. <view class="input">
  20. <text class="icon green">&#xe608;</text>
  21. <text class="address">{{ v.start }}</text>
  22. </view>
  23. <view class="input">
  24. <text class="icon orange">&#xe608;</text>
  25. <text class="address">{{ v.end }}</text>
  26. </view>
  27. </view>
  28. <view class="right">¥{{ v.price }}元</view>
  29. </view>
  30. </view>
  31. <view class="bottom">
  32. <view class="item" @tap="navigateTo('/pages/myDriving/myDriving')">
  33. <text class="icon">&#xe606;</text>
  34. 首页
  35. </view>
  36. <view class="item active" @tap="navigateTo('/pages/myDriving/order')">
  37. <text class="icon">&#xe616;</text>
  38. 订单
  39. </view>
  40. <view class="item " @tap="navigateTo('/pages/myDriving/withdraw')">
  41. <text class="icon">&#xe61c;</text>
  42. 提现
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import helper from '../../common/helper.js';
  49. import api from '../../common/api.js';
  50. export default {
  51. data() {
  52. return {
  53. map: {
  54. status: 'all',
  55. page: 1,
  56. type: 'driver'
  57. },
  58. order: {}
  59. };
  60. },
  61. filters: {
  62. date: value => {
  63. let date = new Date(value * 1000);
  64. let h = date.getHours();
  65. let m = date.getMinutes();
  66. return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m);
  67. }
  68. },
  69. onShow() {
  70. this.getList();
  71. },
  72. methods: {
  73. async getList() {
  74. let res = await api.getOrderList(this.map);
  75. this.order = res.data;
  76. uni.stopPullDownRefresh();
  77. },
  78. onPullDownRefresh() {
  79. this.map.page = 1;
  80. this.getList();
  81. },
  82. onReachBottom() {
  83. if (this.info.last_page > this.info.current_page) {
  84. this.getList();
  85. }
  86. },
  87. navigateTo(url) {
  88. uni.navigateTo({
  89. url: url
  90. });
  91. },
  92. setMap(key, value) {
  93. this.map[key] = value;
  94. this.map.page = 1;
  95. this.getList();
  96. }
  97. }
  98. };
  99. </script>
  100. <style lang="scss" scoped>
  101. page,
  102. .index {
  103. height: 100%;
  104. background-color: #fbfbfb;
  105. }
  106. .center {
  107. padding: 30upx;
  108. }
  109. .center1 {
  110. padding: 30upx;
  111. }
  112. .nav {
  113. display: flex;
  114. padding: 20upx;
  115. font-size: 28upx;
  116. background-color: #ffffff;
  117. .t1 {
  118. width: 48%;
  119. text-align: center;
  120. color: #32c45e;
  121. }
  122. .t2 {
  123. width: 48%;
  124. text-align: center;
  125. }
  126. .icon {
  127. font-size: 30upx;
  128. }
  129. }
  130. .orders {
  131. margin-bottom: 30upx;
  132. display: flex;
  133. padding: 20upx 20upx;
  134. border-radius: 10upx;
  135. box-shadow: 1px 1px 1px 1px #eaeaea;
  136. align-items: center;
  137. flex-wrap: wrap;
  138. align-items: center;
  139. justify-content: center;
  140. background-color: #ffffff;
  141. .icon {
  142. font-size: 48upx;
  143. }
  144. .top {
  145. width: 100%;
  146. display: flex;
  147. align-items: center;
  148. justify-content: space-between;
  149. font-size: 24upx;
  150. .input {
  151. display: flex;
  152. align-items: center;
  153. color: #999999;
  154. }
  155. .more {
  156. font-size: 28upx;
  157. }
  158. }
  159. .left {
  160. width: 80%;
  161. .input {
  162. width: 100%;
  163. padding: 6upx 0;
  164. display: flex;
  165. align-items: center;
  166. .time {
  167. width: 70%;
  168. font-size: 25upx;
  169. color: #979797;
  170. }
  171. .address {
  172. width: 70%;
  173. font-size: 26upx;
  174. }
  175. }
  176. }
  177. .right {
  178. width: 20%;
  179. font-size: 26upx;
  180. color: #e51c23;
  181. button {
  182. width: 60%;
  183. background-color: #32c45e;
  184. margin-top: 20upx;
  185. border-radius: 50upx;
  186. padding: 0 10upx;
  187. font-size: 22upx;
  188. }
  189. }
  190. }
  191. .bottom {
  192. background-color: #ffffff;
  193. position: absolute;
  194. width: 100%;
  195. bottom: 0;
  196. height: 120upx;
  197. display: flex;
  198. align-items: center;
  199. justify-content: space-around;
  200. .item {
  201. display: flex;
  202. flex-direction: column;
  203. width: 33.33%;
  204. align-items: center;
  205. font-size: 24upx;
  206. .icon {
  207. font-size: 56upx;
  208. color: #999999;
  209. }
  210. }
  211. }
  212. .active {
  213. color: #32c45e !important;
  214. .icon {
  215. color: #32c45e !important;
  216. }
  217. }
  218. </style>