carList.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="my-order">
  4. <view class="list">
  5. <view class="item" v-for="(item,ind) in orderList">
  6. <view class="acea-row">
  7. <view class="title line2">
  8. {{item.add_time}}
  9. </view>
  10. </view>
  11. <view class="machine ">
  12. <view class="acea-row row-between">
  13. <view class="it">
  14. 出价:{{item.price}}
  15. </view>
  16. <view class="status">
  17. 分红:{{item.dividend_price}}
  18. </view>
  19. <view class="status">
  20. 已分红:{{item.paid_dividend}}
  21. </view>
  22. </view>
  23. </view>
  24. <view class="machine acea-row row-between-wrapper">
  25. <view class="acea-row row-left">
  26. <view class="it">
  27. 编号:
  28. </view>
  29. <view class="code">
  30. {{item.machine_no}}
  31. </view>
  32. </view>
  33. <view class="acea-row row-rightss" v-if="item.plate_number">
  34. <view class="it">
  35. 车牌号:
  36. </view>
  37. <view class="code">
  38. {{item.plate_number}}
  39. </view>
  40. </view>
  41. <view class="acea-row row-rightss">
  42. <view class="font-color-blue" v-if="item.store_binding==1">
  43. 已绑定
  44. </view>
  45. <view class="font-color-white" v-else>
  46. 未绑定
  47. </view>
  48. </view>
  49. </view>
  50. <view v-if="item.status==0" class="text_red tip ">
  51. 待租
  52. </view>
  53. <view v-if="item.status==1" class="text_blue tip">
  54. 进行中
  55. </view>
  56. <view v-if="item.status==1" class="text_greed tip">
  57. 完成
  58. </view>
  59. </view>
  60. </view>
  61. <view class="loadingicon acea-row row-center-wrapper font-color-white" v-if="orderList.length > 0">
  62. <text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
  63. {{ loadTitle }}
  64. </view>
  65. <view v-if="orderList.length == 0">
  66. <emptyPage v-if="!loading" :title="$t(`暂无订单`)"></emptyPage>
  67. <view class="loadingicon acea-row row-center-wrapper">
  68. <text class="loading iconfont icon-jiazai font-color-white" :hidden="loading == false"></text>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- #ifndef MP -->
  73. <home></home>
  74. <!-- #endif -->
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. postSponsorCar,
  80. } from '@/api/rent.js';
  81. import home from '@/components/home';
  82. import {
  83. toLogin
  84. } from '@/libs/login.js';
  85. import {
  86. mapGetters
  87. } from 'vuex';
  88. import emptyPage from '@/components/emptyPage.vue';
  89. import colors from '@/mixins/color.js';
  90. export default {
  91. components: {
  92. home,
  93. emptyPage,
  94. },
  95. mixins: [colors],
  96. data() {
  97. return {
  98. searchKey: '',
  99. onAll: -1, //是否全部
  100. available: -1, //是否欠费
  101. binding: -1, //是否绑定车辆
  102. loading: false, //是否加载中
  103. loadend: false, //是否加载完毕
  104. loadTitle: this.$t(`加载更多`), //提示语
  105. orderList: [], //订单数组
  106. orderData: {}, //订单详细统计
  107. page: 1,
  108. limit: 20,
  109. pay_close: false,
  110. pay_order_id: '',
  111. totalPrice: '0',
  112. // 保存当前订单数据
  113. actionOrder: {},
  114. payLoding: false, //判断是否支付中
  115. };
  116. },
  117. computed: mapGetters(['isLogin']),
  118. onShow() {
  119. if (this.isLogin) {
  120. this.page = 1;
  121. this.orderList = []
  122. this.loadend = false;
  123. this.getRentOrder();
  124. } else {
  125. toLogin();
  126. }
  127. },
  128. methods: {
  129. // 回车查询
  130. inputConfirm: function(event) {
  131. if (event.detail.value) {
  132. uni.hideKeyboard();
  133. this.searchBut(event.detail.value);
  134. }
  135. },
  136. // 查询
  137. searchBut() {
  138. this.loadend = false;
  139. this.page = 1;
  140. this.orderList = [];
  141. uni.showLoading({
  142. title: this.$t(`正在搜索中`)
  143. });
  144. this.getRentOrder();
  145. uni.hideLoading();
  146. },
  147. // 设置查询值
  148. setValue: function(event) {
  149. this.$set(this, 'searchKey', event.detail.value);
  150. },
  151. /**
  152. * 切换类型
  153. */
  154. statusClick: function(status) {
  155. if (status == 2 || status == 3) {
  156. if ((status == 2 && this.binding == 0) || (status == 3 && this.binding == 1)) {
  157. return;
  158. }
  159. if (status == 2) {
  160. this.binding = 0;
  161. } else
  162. if (status == 3) {
  163. this.binding = 1;
  164. }
  165. }
  166. if (status == 0 || status == 1) {
  167. if (status == this.available) {
  168. return;
  169. }
  170. this.available = status;
  171. }
  172. if (status == -1) {
  173. if (status == this.onAll) {
  174. return;
  175. } else {
  176. this.onAll = status;
  177. this.binding = -1;
  178. this.available = -1;
  179. }
  180. } else {
  181. this.onAll = 1;
  182. }
  183. this.loadend = false;
  184. this.page = 1;
  185. this.$set(this, 'orderList', []);
  186. this.getRentOrder();
  187. },
  188. /**
  189. * 获取订单列表
  190. */
  191. getRentOrder: function() {
  192. let that = this;
  193. if (that.loadend) return;
  194. if (that.loading) return;
  195. that.loading = true;
  196. that.loadTitle = that.$t(`加载更多`);
  197. postSponsorCar({
  198. is_available: that.available,
  199. binding: that.binding,
  200. page: that.page,
  201. limit: that.limit,
  202. key: that.searchKey
  203. })
  204. .then(res => {
  205. let list = res.data.list || [];
  206. let loadend = list.length < that.limit;
  207. that.orderList = that.$util.SplitArray(list, that.orderList);
  208. that.$set(that, 'orderList', that.orderList);
  209. that.loadend = loadend;
  210. that.loading = false;
  211. that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
  212. that.page = that.page + 1;
  213. })
  214. .catch(err => {
  215. that.loading = false;
  216. that.loadTitle = that.$t(`加载更多`);
  217. });
  218. },
  219. },
  220. onReachBottom: function() {
  221. this.getRentOrder();
  222. },
  223. // 滚动监听
  224. onPageScroll(e) {
  225. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  226. uni.$emit('scroll');
  227. },
  228. };
  229. </script>
  230. <style scoped lang="scss">
  231. .list {
  232. padding: 30rpx;
  233. .item {
  234. position: relative;
  235. background-color: var(--view-theme-16);
  236. padding: 30rpx;
  237. border-radius: 10rpx;
  238. margin-bottom: 20rpx;
  239. overflow: hidden;
  240. .title {
  241. font-weight: bold;
  242. font-size: $uni-font-size-base;
  243. color: #fff;
  244. }
  245. .machine {
  246. font-size: $uni-font-size-sm;
  247. color: #999999;
  248. margin-top: 20rpx;
  249. .code {
  250. color: var(--view-priceColor);
  251. background-color: rgba(#75EFFA, 0.2);
  252. padding: 5rpx 10rpx;
  253. border-radius: 10rpx;
  254. }
  255. }
  256. .img {
  257. width: 40rpx;
  258. height: 40rpx;
  259. }
  260. .tip {
  261. position: absolute;
  262. top: 0;
  263. right: 0;
  264. padding: 5rpx 20rpx;
  265. font-size: 20rpx;
  266. border-bottom-left-radius: 10rpx;
  267. &.text_greed {
  268. color: #49D8A8;
  269. background-color: rgba(#49D8A8, 0.2);
  270. }
  271. &.text_red {
  272. color: rgba(254, 92, 45, 1);
  273. background-color: rgba(rgba(254, 92, 45, 1), 0.2);
  274. }
  275. &.text_blue {
  276. color: #1db0fc;
  277. background-color: rgba(#1db0fc, 0.2);
  278. }
  279. }
  280. }
  281. }
  282. .my-order {
  283. background-color: var(--view-theme);
  284. min-height: 100vh;
  285. }
  286. </style>