carList.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="my-order">
  4. <view class="nav acea-row row-around">
  5. <view class="item" :class="onAll ==-1 ? 'on' : ''" @click="statusClick(-1)">
  6. <view>{{$t(`全部`)}}</view>
  7. </view>
  8. <view class="item" :class="available == 0 ? 'on' : ''" @click="statusClick(0)">
  9. <view>{{$t(`欠费`)}}</view>
  10. </view>
  11. <view class="item" :class="available == 1 ? 'on' : ''" @click="statusClick(1)">
  12. <view>{{$t(`正常`)}}</view>
  13. </view>
  14. <view class="item" :class="binding == 0 ? 'on' : ''" @click="statusClick(2)">
  15. <view>{{$t(`未绑定`)}}</view>
  16. </view>
  17. <view class="item" :class="binding == 1 ? 'on' : ''" @click="statusClick(3)">
  18. <view>{{$t(`已绑定`)}}</view>
  19. </view>
  20. </view>
  21. <view class='search acea-row row-between-wrapper'>
  22. <view class='input acea-row row-between-wrapper'>
  23. <text class='iconfont icon-sousuo'></text>
  24. <input type='text' v-model='searchKey' @confirm="inputConfirm" focus :placeholder='$t(`姓名/手机号/车辆编号`)'
  25. placeholder-class='placeholder' @input="setValue"></input>
  26. </view>
  27. <view class='bnt' @tap='searchBut'>{{$t(`搜索`)}}</view>
  28. </view>
  29. <view class="list">
  30. <view class="item" v-for="(item,ind) in orderList">
  31. <view class="acea-row">
  32. <image class="img" src="../static/cart.png" mode="scaleToFill"></image>
  33. <view class="title line2">
  34. {{item.machine_name}}
  35. </view>
  36. </view>
  37. <view class="machine ">
  38. <view class="acea-row row-between">
  39. <view class="it">
  40. 当前位置:{{item.address?item.address:'未定位'}}
  41. </view>
  42. <view class="status">
  43. 电量:{{item.residue}}%
  44. </view>
  45. </view>
  46. </view>
  47. <view class="machine acea-row row-between-wrapper">
  48. <view class="acea-row row-left">
  49. <view class="it">
  50. 编号:
  51. </view>
  52. <view class="code">
  53. {{item.machine_no}}
  54. </view>
  55. </view>
  56. <view class="acea-row row-rightss" v-if="item.plate_number">
  57. <view class="it">
  58. 车牌号:
  59. </view>
  60. <view class="code">
  61. {{item.plate_number}}
  62. </view>
  63. </view>
  64. <view class="acea-row row-rightss" v-if="item.plate_number">
  65. <view class="font-color-blue" v-if="item.relevance_id">
  66. 已绑定
  67. </view>
  68. <view class="font-color-white" v-if="!item.relevance_id">
  69. 未绑定
  70. </view>
  71. </view>
  72. </view>
  73. <view v-if="item.is_available==0" class="text_red tip ">
  74. 欠费
  75. </view>
  76. <!-- <view v-if="item.is_available==1" class="text_blue tip">
  77. 正常
  78. </view> -->
  79. <view v-if="item.is_available==1" class="text_greed tip">
  80. 正常
  81. </view>
  82. </view>
  83. </view>
  84. <view class="loadingicon acea-row row-center-wrapper font-color-white" v-if="orderList.length > 0">
  85. <text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
  86. {{ loadTitle }}
  87. </view>
  88. <view v-if="orderList.length == 0">
  89. <emptyPage v-if="!loading" :title="$t(`暂无订单`)"></emptyPage>
  90. <view class="loadingicon acea-row row-center-wrapper">
  91. <text class="loading iconfont icon-jiazai font-color-white" :hidden="loading == false"></text>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- #ifndef MP -->
  96. <home></home>
  97. <!-- #endif -->
  98. </view>
  99. </template>
  100. <script>
  101. import {
  102. postStoreCarCode,
  103. } from '@/api/rent.js';
  104. import home from '@/components/home';
  105. import {
  106. toLogin
  107. } from '@/libs/login.js';
  108. import {
  109. mapGetters
  110. } from 'vuex';
  111. import emptyPage from '@/components/emptyPage.vue';
  112. import colors from '@/mixins/color.js';
  113. export default {
  114. components: {
  115. home,
  116. emptyPage,
  117. },
  118. mixins: [colors],
  119. data() {
  120. return {
  121. searchKey: '',
  122. onAll: -1, //是否全部
  123. available: -1, //是否欠费
  124. binding: -1, //是否绑定车辆
  125. loading: false, //是否加载中
  126. loadend: false, //是否加载完毕
  127. loadTitle: this.$t(`加载更多`), //提示语
  128. orderList: [], //订单数组
  129. orderData: {}, //订单详细统计
  130. page: 1,
  131. limit: 20,
  132. pay_close: false,
  133. pay_order_id: '',
  134. totalPrice: '0',
  135. // 保存当前订单数据
  136. actionOrder: {},
  137. payLoding: false, //判断是否支付中
  138. };
  139. },
  140. computed: mapGetters(['isLogin']),
  141. onShow() {
  142. if (this.isLogin) {
  143. this.page = 1;
  144. this.orderList = []
  145. this.loadend = false;
  146. this.getRentOrder();
  147. } else {
  148. toLogin();
  149. }
  150. },
  151. methods: {
  152. // 回车查询
  153. inputConfirm: function(event) {
  154. if (event.detail.value) {
  155. uni.hideKeyboard();
  156. this.searchBut(event.detail.value);
  157. }
  158. },
  159. // 查询
  160. searchBut() {
  161. this.loadend = false;
  162. this.page = 1;
  163. this.orderList = [];
  164. uni.showLoading({
  165. title: this.$t(`正在搜索中`)
  166. });
  167. this.getRentOrder();
  168. uni.hideLoading();
  169. },
  170. // 设置查询值
  171. setValue: function(event) {
  172. this.$set(this, 'searchKey', event.detail.value);
  173. },
  174. /**
  175. * 切换类型
  176. */
  177. statusClick: function(status) {
  178. if (status == 2 || status == 3) {
  179. if ((status == 2 && this.binding == 0) || (status == 3 && this.binding == 1)) {
  180. return;
  181. }
  182. if (status == 2) {
  183. this.binding = 0;
  184. } else
  185. if (status == 3) {
  186. this.binding = 1;
  187. }
  188. }
  189. if (status == 0 || status == 1) {
  190. if (status == this.available) {
  191. return;
  192. }
  193. this.available = status;
  194. }
  195. if (status == -1) {
  196. if (status == this.onAll) {
  197. return;
  198. } else {
  199. this.onAll = status;
  200. this.binding = -1;
  201. this.available = -1;
  202. }
  203. } else {
  204. this.onAll = 1;
  205. }
  206. this.loadend = false;
  207. this.page = 1;
  208. this.$set(this, 'orderList', []);
  209. this.getRentOrder();
  210. },
  211. /**
  212. * 获取订单列表
  213. */
  214. getRentOrder: function() {
  215. let that = this;
  216. if (that.loadend) return;
  217. if (that.loading) return;
  218. that.loading = true;
  219. that.loadTitle = that.$t(`加载更多`);
  220. postStoreCarCode({
  221. is_available: that.available,
  222. binding: that.binding,
  223. page: that.page,
  224. limit: that.limit,
  225. key: that.searchKey
  226. })
  227. .then(res => {
  228. let list = res.data || [];
  229. let loadend = list.length < that.limit;
  230. that.orderList = that.$util.SplitArray(list, that.orderList);
  231. that.$set(that, 'orderList', that.orderList);
  232. that.loadend = loadend;
  233. that.loading = false;
  234. that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
  235. that.page = that.page + 1;
  236. })
  237. .catch(err => {
  238. that.loading = false;
  239. that.loadTitle = that.$t(`加载更多`);
  240. });
  241. },
  242. },
  243. onReachBottom: function() {
  244. this.getRentOrder();
  245. },
  246. // 滚动监听
  247. onPageScroll(e) {
  248. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  249. uni.$emit('scroll');
  250. },
  251. };
  252. </script>
  253. <style scoped lang="scss">
  254. .list {
  255. padding: 30rpx;
  256. padding-top: 206rpx;
  257. .item {
  258. position: relative;
  259. background-color: var(--view-theme-16);
  260. padding: 30rpx;
  261. border-radius: 10rpx;
  262. margin-bottom: 20rpx;
  263. overflow: hidden;
  264. .title {
  265. font-weight: bold;
  266. font-size: $uni-font-size-lg;
  267. color: #fff;
  268. padding-left: 10rpx;
  269. }
  270. .machine {
  271. font-size: $uni-font-size-sm;
  272. color: #999999;
  273. margin-top: 20rpx;
  274. .code {
  275. color: var(--view-priceColor);
  276. background-color: rgba(#75EFFA, 0.2);
  277. padding: 5rpx 10rpx;
  278. border-radius: 10rpx;
  279. }
  280. }
  281. .img {
  282. width: 40rpx;
  283. height: 40rpx;
  284. }
  285. .tip {
  286. position: absolute;
  287. top: 0;
  288. right: 0;
  289. padding: 5rpx 20rpx;
  290. font-size: 20rpx;
  291. border-bottom-left-radius: 10rpx;
  292. &.text_greed {
  293. color: #49D8A8;
  294. background-color: rgba(#49D8A8, 0.2);
  295. }
  296. &.text_red {
  297. color: rgba(254, 92, 45, 1);
  298. background-color: rgba(rgba(254, 92, 45, 1), 0.2);
  299. }
  300. &.text_blue {
  301. color: #1db0fc;
  302. background-color: rgba(#1db0fc, 0.2);
  303. }
  304. }
  305. }
  306. }
  307. .my-order {
  308. background-color: var(--view-theme);
  309. min-height: 100vh;
  310. .search {
  311. position: fixed;
  312. top: 80rpx;
  313. left: 0rpx;
  314. z-index: 999;
  315. padding-top: 30rpx;
  316. padding-bottom: 30rpx;
  317. padding-left: 30rpx;
  318. background-color: var(--view-theme);
  319. .bnt {
  320. width: 120rpx;
  321. text-align: center;
  322. height: 66rpx;
  323. line-height: 66rpx;
  324. font-size: 30rpx;
  325. color: #FFFFFF;
  326. }
  327. .input {
  328. width: 598rpx;
  329. background-color: #f7f7f7;
  330. border-radius: 33rpx;
  331. padding: 0 35rpx;
  332. box-sizing: border-box;
  333. height: 66rpx;
  334. input {
  335. width: 472rpx;
  336. font-size: 28rpx;
  337. }
  338. .placeholder {
  339. color: #999;
  340. }
  341. .iconfont {
  342. color: #555;
  343. font-size: 35rpx;
  344. }
  345. }
  346. }
  347. .header {
  348. height: 260rpx;
  349. padding: 0 30rpx;
  350. .picTxt {
  351. height: 190rpx;
  352. .text {
  353. color: rgba(255, 255, 255, 0.8);
  354. font-size: 26rpx;
  355. font-family: 'Guildford Pro';
  356. .name {
  357. font-size: 34rpx;
  358. font-weight: bold;
  359. color: #fff;
  360. margin-bottom: 20rpx;
  361. }
  362. }
  363. .pictrue {
  364. width: 122rpx;
  365. height: 109rpx;
  366. image {
  367. width: 100%;
  368. height: 100%;
  369. }
  370. }
  371. }
  372. }
  373. .nav {
  374. background-color: var(--view-theme-16);
  375. width: 690rpx;
  376. height: 90rpx;
  377. border-radius: 6rpx;
  378. margin: 0 auto 0 auto;
  379. position: fixed;
  380. top: 0;
  381. left: 0;
  382. right: 0;
  383. z-index: 9999;
  384. .item {
  385. text-align: center;
  386. font-size: 26rpx;
  387. color: #fff;
  388. width: 3rem;
  389. padding: 27rpx 0;
  390. border-bottom: 5rpx solid transparent;
  391. &.on {
  392. /* #ifdef H5 || MP */
  393. font-weight: bold;
  394. /* #endif */
  395. /* #ifdef APP-PLUS */
  396. color: #000;
  397. /* #endif */
  398. border-color: var(--view-priceColor);
  399. }
  400. }
  401. }
  402. }
  403. .noCart {
  404. margin-top: 171rpx;
  405. padding-top: 0.1rpx;
  406. .pictrue {
  407. width: 414rpx;
  408. height: 336rpx;
  409. margin: 78rpx auto 56rpx auto;
  410. image {
  411. width: 100%;
  412. height: 100%;
  413. }
  414. }
  415. }
  416. </style>