orderList.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="my-order">
  4. <view class="header bg-color">
  5. <view class="picTxt acea-row row-between-wrapper">
  6. <view class="text">
  7. <view class="name">{{$t(`服务信息`)}}</view>
  8. <view>{{$t(`消费订单`)}}:{{ orderData.sun_order_count || 0 }}
  9. {{$t(`总消费`)}}:{{$t(`¥`)}}{{ orderData.sun_order_amount || 0 }}
  10. </view>
  11. </view>
  12. <view class="pictrue">
  13. <image src="../static/orderTime.png"></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="nav acea-row row-around">
  18. <view class="item" :class="orderStatus ==-1 ? 'on' : ''" @click="statusClick(-1)">
  19. <view>{{$t(`全部`)}}</view>
  20. <view class="num">{{ orderData.sun_order_count || 0 }}</view>
  21. </view>
  22. <view class="item" :class="orderStatus == 0 ? 'on' : ''" @click="statusClick(0)">
  23. <view>{{$t(`待支付`)}}</view>
  24. <view class="num">{{ orderData.unpaid_count || 0 }}</view>
  25. </view>
  26. <view class="item" :class="orderStatus == 1 ? 'on' : ''" @click="statusClick(1)">
  27. <view>{{$t(`进行中`)}}</view>
  28. <view class="num">{{ orderData.progress_count || 0 }}</view>
  29. </view>
  30. <view class="item" :class="orderStatus == 2 ? 'on' : ''" @click="statusClick(2)">
  31. <view>{{$t(`已完成`)}}</view>
  32. <view class="num ">{{ orderData.finish_count || 0 }}</view>
  33. </view>
  34. <view class="item" :class="orderStatus == 3 ? 'on' : ''" @click="statusClick(3)">
  35. <view>{{$t(`已释放`)}}</view>
  36. <view class="num">{{ orderData.unbinding_count || 0 }}</view>
  37. </view>
  38. </view>
  39. <view class="list">
  40. <view class="item" v-for="(item, index) in orderList" :key="index">
  41. <view @click="goOrderDetails(item.order_id)">
  42. <view class="title acea-row row-between-wrapper">
  43. <view class="acea-row row-middle">
  44. <view>{{ item.add_time }}</view>
  45. </view>
  46. <view v-if="item.status == 0" class="font-color">待支付</view>
  47. <view v-else-if="item.status == 1" class="font-color">进行中</view>
  48. <view v-else-if="item.status == 2 " class="font-color">
  49. 已完成
  50. </view>
  51. <view v-else-if="item.status == 3 " class="font-color">
  52. 待释放
  53. </view>
  54. </view>
  55. <view class="item-info acea-row row-between row-top">
  56. <view class="pictrue">
  57. <easy-loadimage mode="widthFix" :image-src="item.rent.image"></easy-loadimage>
  58. </view>
  59. <view class="text">
  60. <text class="name line2">{{ item.rent.title }}</text>
  61. <view class="money">
  62. <block v-if="item.car_lease==1">
  63. <view class="return">
  64. 以租代购
  65. </view>
  66. <view class="lowe">
  67. 剩余{{item.several_months-item.months}}月
  68. </view>
  69. </block>
  70. <view v-if="item.car_lease==0" class="return">
  71. 月付
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="bottom acea-row row-right row-middle">
  78. <view class="totalPrice">
  79. <text class="money">每月{{$t(`¥`)}}{{ item.pay_price }}</text>
  80. </view>
  81. <view class="bnt cancelBnt" v-if="item.binding_state == 0 &&item.status == 1"
  82. @click="onCartBind(item)">
  83. 绑定车辆</view>
  84. <view class="bnt cancelBnt" v-if="item.status == 0"
  85. @click="goPay(item.pay_price, item.order_id)">
  86. <text>{{$t(`立即付款`)}}</text>
  87. </view>
  88. <view class="bnt cancelBnt" v-if="item.status == 1&&item.months!=item.several_months"
  89. @click="goPay(item.pay_price, item.order_id)">
  90. <text >{{$t(`续费`)}}</text>
  91. </view>
  92. <!-- <view @click="navDetail(item)" class="bnt gredBnt" v-if="item.status >0">
  93. 明细
  94. </view> -->
  95. </view>
  96. </view>
  97. </view>
  98. <view class="loadingicon acea-row row-center-wrapper font-color-white" v-if="orderList.length > 0">
  99. <text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
  100. {{ loadTitle }}
  101. </view>
  102. <view v-if="orderList.length == 0">
  103. <emptyPage v-if="!loading" :title="$t(`暂无订单`)"></emptyPage>
  104. <view class="loadingicon acea-row row-center-wrapper">
  105. <text class="loading iconfont icon-jiazai font-color-white" :hidden="loading == false"></text>
  106. </view>
  107. </view>
  108. </view>
  109. <!-- #ifndef MP -->
  110. <home></home>
  111. <!-- #endif -->
  112. <payment :payMode="payMode" :pay_close="pay_close" @onChangeFun="onChangeFun" :order_id="pay_order_id"
  113. :isCall="true" :totalPrice="totalPrice"></payment>
  114. </view>
  115. </template>
  116. <script>
  117. import {
  118. getUserInfo
  119. } from '@/api/user.js';
  120. import {
  121. getRentOrderData,
  122. getRentOrder,
  123. postRentPay,
  124. // rentSetcar
  125. } from '@/api/rent.js';
  126. import home from '@/components/home';
  127. import payment from '@/components/payment';
  128. import {
  129. toLogin
  130. } from '@/libs/login.js';
  131. import {
  132. mapGetters
  133. } from 'vuex';
  134. import emptyPage from '@/components/emptyPage.vue';
  135. import colors from '@/mixins/color.js';
  136. export default {
  137. components: {
  138. payment,
  139. home,
  140. emptyPage,
  141. },
  142. mixins: [colors],
  143. data() {
  144. return {
  145. loading: false, //是否加载中
  146. loadend: false, //是否加载完毕
  147. loadTitle: this.$t(`加载更多`), //提示语
  148. orderList: [], //订单数组
  149. orderData: {}, //订单详细统计
  150. orderStatus: -1, //订单状态
  151. page: 1,
  152. limit: 20,
  153. payMode: [{
  154. name: this.$t(`微信支付`),
  155. icon: 'icon-weixinzhifu',
  156. value: 'weixin',
  157. title: this.$t(`使用微信快捷支付`),
  158. payStatus: true
  159. },
  160. {
  161. name: this.$t(`支付宝支付`),
  162. icon: 'icon-zhifubao',
  163. value: 'alipay',
  164. title: this.$t(`使用支付宝支付`),
  165. payStatus: true
  166. },
  167. {
  168. name: this.$t(`余额支付`),
  169. icon: 'icon-yuezhifu',
  170. value: 'yue',
  171. title: this.$t(`可用余额`),
  172. number: 0,
  173. payStatus: true
  174. },
  175. ],
  176. pay_close: false,
  177. pay_order_id: '',
  178. totalPrice: '0',
  179. // 保存当前订单数据
  180. actionOrder: {},
  181. payLoding:false,//判断是否支付中
  182. };
  183. },
  184. computed: mapGetters(['isLogin']),
  185. onShow() {
  186. if (this.isLogin) {
  187. this.page = 1;
  188. this.orderList = []
  189. this.loadend = false;
  190. this.onLoadFun();
  191. this.getRentOrder();
  192. } else {
  193. toLogin();
  194. }
  195. },
  196. methods: {
  197. navDetail(item) {
  198. uni.navigateTo({
  199. url: './orderDetail?id='+item.order_id,
  200. });
  201. },
  202. onLoadFun() {
  203. this.getRentOrderData();
  204. this.getUserInfo();
  205. },
  206. /**
  207. * 事件回调
  208. *
  209. */
  210. onChangeFun: function(e) {
  211. console.log(e, '2333');
  212. let opt = e;
  213. let action = opt.action || null;
  214. let value = opt.value != undefined ? opt.value : null;
  215. action && this[action] && this[action](value);
  216. },
  217. /**
  218. * 获取用户信息
  219. *
  220. */
  221. getUserInfo: function() {
  222. let that = this;
  223. getUserInfo().then(res => {
  224. that.payMode[2].number = res.data.now_money;
  225. that.$set(that, 'payMode', that.payMode);
  226. });
  227. },
  228. /**
  229. * 关闭支付组件
  230. *
  231. */
  232. payClose: function() {
  233. this.pay_close = false;
  234. },
  235. /**
  236. * 生命周期函数--监听页面加载
  237. */
  238. onLoad: function(options) {
  239. if (options.status) this.orderStatus = options.status;
  240. },
  241. /**
  242. * 获取订单统计数据
  243. *
  244. */
  245. getRentOrderData: function() {
  246. let that = this;
  247. getRentOrderData().then(res => {
  248. res.data.progress_count += res.data.not_binding_count;
  249. that.$set(that, 'orderData', res.data);
  250. that.payMode.map(item => {
  251. if (item.value == 'weixin') {
  252. item.payStatus = res.data.pay_weixin_open ? true : false;
  253. }
  254. if (item.value == 'alipay') {
  255. item.payStatus = res.data.ali_pay_status ? true : false;
  256. }
  257. if (item.value == 'yue') {
  258. item.payStatus = res.data.yue_pay_status == 1 ? true : false;
  259. }
  260. if (item.value == 'friend') {
  261. item.payStatus = res.data.friend_pay_status == 1 ? true : false;
  262. }
  263. });
  264. //#ifdef MP
  265. this.payMode[1].payStatus = false;
  266. //#endif
  267. });
  268. },
  269. onCartBind(item) {
  270. const that = this;
  271. uni.navigateTo({
  272. url: './onBindCar?id=' + item.order_id,
  273. });
  274. return
  275. // // #ifndef H5
  276. // uni.showModal({
  277. // title: '提示',
  278. // content: '请选择绑定方式',
  279. // showCancel: false,
  280. // cancelText: '扫码',
  281. // confirmText: '手填',
  282. // success: res => {
  283. // if (res.confirm) {
  284. // that.bindImport(item.id)
  285. // }
  286. // if (res.cancel) {
  287. // that.bindQr(item.id)
  288. // }
  289. // },
  290. // fail: () => {},
  291. // complete: () => {}
  292. // });
  293. // // #endif
  294. // // #ifdef H5
  295. // that.bindImport(item.id)
  296. // // #endif
  297. },
  298. // 手输
  299. // bindImport(id) {
  300. // const that = this;
  301. // uni.showModal({
  302. // title: '绑定车辆',
  303. // placeholderText: '请输入车辆编号',
  304. // editable: true,
  305. // cancelText: '取消',
  306. // confirmText: '确定',
  307. // success: res => {
  308. // if (res.confirm) {
  309. // if (res.content) {
  310. // that.rentSetcar(res.content, id)
  311. // } else {
  312. // uni.showToast({
  313. // title: '请输入车辆编号',
  314. // icon: 'error'
  315. // })
  316. // that.bindImport(id)
  317. // }
  318. // }
  319. // },
  320. // fail: () => {},
  321. // complete: () => {}
  322. // });
  323. // },
  324. // 扫码绑定
  325. // bindQr(id) {
  326. // uni.scanCode({
  327. // onlyFromCamera: true,
  328. // scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
  329. // success(res) {
  330. // that.rentSetcar(res.result, id)
  331. // }
  332. // })
  333. // },
  334. // 提交绑定
  335. // rentSetcar(content, id) {
  336. // rentSetcar({
  337. // id,
  338. // machine_no: content
  339. // }).then((res) => {
  340. // }).catch((res) => {
  341. // console.log(res);
  342. // })
  343. // },
  344. /**
  345. * 打开支付组件
  346. *
  347. */
  348. goPay: function(pay_price, order_id) {
  349. this.$set(this, 'pay_close', true);
  350. this.$set(this, 'pay_order_id', order_id);
  351. this.$set(this, 'totalPrice', pay_price);
  352. },
  353. // 支付方式
  354. payCheck(value) {
  355. const that = this;
  356. if(that.payLoding){
  357. return
  358. }
  359. that.payLoding = true;
  360. postRentPay({
  361. 'order_id': that.pay_order_id,
  362. 'pay_type': value,
  363. // 'quitUrt': that.storeInfo.cooperate_id,
  364. // #ifdef MP
  365. from: 'routine',
  366. // #endif
  367. // #ifdef H5
  368. from: that.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
  369. // #endif
  370. // #ifdef APP-PLUS
  371. from: 'app'
  372. // #endif
  373. }).then((res) => {
  374. let status = res.data.status,
  375. orderId = res.data.result.order_id,
  376. jsConfig = res.data.result.jsConfig,
  377. goPages = '/pages/rent/carpay/paySuccess?order_id=' + orderId + '&msg=' + res.msg +'&type=3' + '&totalPrice=' + that.totalPrice,friendPay = '/pages/users/payment_on_behalf/index?order_id=' + orderId + '&spread=' +that.$store.state.app.uid
  378. switch (status) {
  379. case 'ORDER_EXIST':
  380. case 'EXTEND_ORDER':
  381. uni.hideLoading();
  382. return that.$util.Tips({
  383. title: res.msg
  384. }, {
  385. tab: 5,
  386. url: goPages
  387. });
  388. case 'ALLINPAY_PAY':
  389. uni.hideLoading();
  390. // #ifdef MP
  391. this.initIn = true
  392. wx.openEmbeddedMiniProgram({
  393. appId: 'wxef277996acc166c3',
  394. extraData: {
  395. cusid: jsConfig.cusid,
  396. appid: jsConfig.appid,
  397. version: jsConfig.version,
  398. trxamt: jsConfig.trxamt,
  399. reqsn: jsConfig.reqsn,
  400. notify_url: jsConfig.notify_url,
  401. body: jsConfig.body,
  402. remark: jsConfig.remark,
  403. validtime: jsConfig.validtime,
  404. randomstr: jsConfig.randomstr,
  405. paytype: jsConfig.paytype,
  406. sign: jsConfig.sign,
  407. signtype: jsConfig.signtype
  408. }
  409. })
  410. this.jumpData = {
  411. orderId: res.data.result.orderId,
  412. msg: res.msg,
  413. }
  414. // #endif
  415. // #ifdef APP-PLUS
  416. plus.runtime.openURL(jsConfig.payinfo);
  417. setTimeout(e => {
  418. uni.reLaunch({
  419. url: goPages
  420. })
  421. }, 1000)
  422. // #endif
  423. // #ifdef H5
  424. this.formpost(res.data.result.pay_url, jsConfig)
  425. // #endif
  426. break;
  427. case 'PAY_ERROR':
  428. uni.hideLoading();
  429. return that.$util.Tips({
  430. title: res.msg
  431. }, {
  432. tab: 5,
  433. url: goPages
  434. });
  435. break;
  436. case 'SUCCESS':
  437. uni.hideLoading();
  438. if ((that.BargainId || that.combinationId || that.pinkId || that.seckillId || that.discountId) && that.payType != 'friend')
  439. return that.$util.Tips({
  440. title: res.msg,
  441. icon: 'success'
  442. }, {
  443. tab: 4,
  444. url: goPages
  445. });
  446. return that.$util.Tips({
  447. title: res.msg,
  448. icon: 'success'
  449. }, {
  450. tab: 4,
  451. url: that.payType == 'friend' ? friendPay : goPages
  452. });
  453. break;
  454. case 'WECHAT_PAY':
  455. that.toPay = true;
  456. // #ifdef MP
  457. /* that.toPay = true; */
  458. let mp_pay_name = ''
  459. if (uni.requestOrderPayment) {
  460. mp_pay_name = 'requestOrderPayment'
  461. } else {
  462. mp_pay_name = 'requestPayment'
  463. }
  464. uni[mp_pay_name]({
  465. timeStamp: jsConfig.timestamp,
  466. nonceStr: jsConfig.nonceStr,
  467. package: jsConfig.package,
  468. signType: jsConfig.signType,
  469. paySign: jsConfig.paySign,
  470. success: function(res) {
  471. uni.hideLoading();
  472. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId || that.discountId)
  473. return that.$util.Tips({
  474. title: that.$t(`支付成功`),
  475. icon: 'success'
  476. }, {
  477. tab: 4,
  478. url: goPages
  479. });
  480. return that.$util.Tips({
  481. title: that.$t(`支付成功`),
  482. icon: 'success'
  483. }, {
  484. tab: 5,
  485. url: goPages
  486. });
  487. },
  488. fail: function(e) {
  489. uni.hideLoading();
  490. return that.$util.Tips({
  491. title: that.$t(`取消支付`)
  492. }, {
  493. tab: 5,
  494. url: goPages + '&status=2'
  495. });
  496. },
  497. complete: function(e) {
  498. uni.hideLoading();
  499. //关闭当前页面跳转至订单状态
  500. if (res.errMsg == 'requestPayment:cancel' || e.errMsg =='requestOrderPayment:cancel') return
  501. that.$util
  502. .Tips({
  503. title: that.$t(`取消支付`)
  504. }, {
  505. tab: 5,
  506. url: goPages + '&status=2'
  507. });
  508. },
  509. })
  510. // #endif
  511. // #ifdef H5
  512. this.$wechat.pay(res.data.result.jsConfig).then(res => {
  513. return that.$util.Tips({
  514. title: that.$t(`支付成功`),
  515. icon: 'success'
  516. }, {
  517. tab: 5,
  518. url: goPages
  519. });
  520. }).catch(res => {
  521. if (!this.$wechat.isWeixin()) {
  522. uni.redirectTo({
  523. url: goPages + '&msg=' + that.$t(`支付失败`) + '&status=2'
  524. // '&msg=支付失败&status=2'
  525. })
  526. }
  527. if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
  528. title: that.$t(`取消支付`)
  529. }, {
  530. tab: 5,
  531. url: goPages + '&status=2'
  532. });
  533. })
  534. // #endif
  535. // #ifdef APP-PLUS
  536. uni.requestPayment({
  537. provider: 'wxpay',
  538. orderInfo: jsConfig,
  539. success: (e) => {
  540. let url = goPages;
  541. uni.showToast({
  542. title: that.$t(`支付成功`)
  543. })
  544. setTimeout(res => {
  545. uni.redirectTo({
  546. url: url
  547. })
  548. }, 2000)
  549. },
  550. fail: (e) => {
  551. let url = '/pages/rent/carpay/paySuccess?order_id=' +orderId +'&msg=' + that.$t(`支付失败`);
  552. uni.showModal({
  553. content: that.$t(`支付失败`),
  554. showCancel: false,
  555. success: function(res) {
  556. if (res.confirm) {
  557. uni.redirectTo({
  558. url: url
  559. })
  560. } else if (res.cancel) {}
  561. }
  562. })
  563. },
  564. complete: () => {
  565. uni.hideLoading();
  566. },
  567. });
  568. // #endif
  569. break;
  570. case 'PAY_DEFICIENCY':
  571. uni.hideLoading();
  572. //余额不足
  573. return that.$util.Tips({
  574. title: res.msg
  575. }, {
  576. tab: 5,
  577. url: goPages + '&status=1'
  578. });
  579. break;
  580. case "WECHAT_H5_PAY":
  581. uni.hideLoading();
  582. that.$util.Tips({
  583. title: that.$t(`订单创建成功`)
  584. }, {
  585. tab: 4,
  586. url: goPages + '&status=0'
  587. });
  588. setTimeout(() => {
  589. location.href = res.data.result.jsConfig.mweb_url;
  590. }, 2000);
  591. break;
  592. case 'ALIPAY_PAY':
  593. //#ifdef H5
  594. if (this.from === 'weixin') {
  595. uni.redirectTo({
  596. url: `/pages/users/alipay_invoke/index?id=${orderId}&pay_key=${res.data.result.pay_key}`
  597. });
  598. } else {
  599. uni.hideLoading();
  600. that.formContent = res.data.result.jsConfig;
  601. that.$nextTick(() => {
  602. document.getElementById('alipaysubmit').submit();
  603. })
  604. }
  605. //#endif
  606. // #ifdef MP
  607. uni.navigateTo({
  608. url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
  609. });
  610. // #endif
  611. // #ifdef APP-PLUS
  612. uni.requestPayment({
  613. provider: 'alipay',
  614. orderInfo: jsConfig,
  615. success: (e) => {
  616. uni.showToast({
  617. title: that.$t(`支付成功`)
  618. })
  619. let url = '/pages/rent/carpay/paySuccess?order_id=' +orderId +'&msg=' + that.$t(`支付成功`);
  620. setTimeout(res => {
  621. uni.redirectTo({
  622. url: url
  623. })
  624. }, 2000)
  625. },
  626. fail: (e) => {
  627. let url = '/pages/rent/carpay/paySuccess?order_id=' + orderId +'&msg=' + that.$t(`支付失败`);
  628. uni.showModal({
  629. content: that.$t(`支付失败`),
  630. showCancel: false,
  631. success: function(res) {
  632. if (res.confirm) {
  633. uni.redirectTo({
  634. url: url
  635. })
  636. } else if (res.cancel) {}
  637. }
  638. })
  639. },
  640. complete: () => {
  641. uni.hideLoading();
  642. },
  643. });
  644. // #endif
  645. break;
  646. }
  647. that.payLoding = false;
  648. }).catch((res) => {
  649. console.log(res);
  650. that.payLoding = false;
  651. })
  652. },
  653. /**
  654. * 支付成功回调
  655. *
  656. */
  657. pay_complete: function() {
  658. this.loadend = false;
  659. this.page = 1;
  660. this.$set(this, 'orderList', []);
  661. this.pay_close = false;
  662. uni.navigateTo({
  663. url: '/pages/rent/carpay/paySuccess?order_id=' + this.pay_order_id +'&msg=' + this.$t(`支付成功`) + '&type=3&totalPrice=' + this.totalPrice
  664. })
  665. this.pay_order_id = '';
  666. this.getRentOrderData();
  667. this.getRentOrder();
  668. },
  669. /**
  670. * 支付失败回调
  671. *
  672. */
  673. pay_fail: function() {
  674. this.pay_close = false;
  675. this.pay_order_id = '';
  676. },
  677. /**
  678. * 去订单详情
  679. */
  680. goOrderDetails: function(order_id) {
  681. let that = this;
  682. if (!order_id) {
  683. return that.$util.Tips({
  684. title: that.$t(`缺少订单号无法查看订单详情`)
  685. })
  686. };
  687. uni.navigateTo({
  688. url: './orderDetail?id=' + order_id
  689. });
  690. },
  691. /**
  692. * 切换类型
  693. */
  694. statusClick: function(status) {
  695. if (status == this.orderStatus) return;
  696. this.orderStatus = status;
  697. this.loadend = false;
  698. this.page = 1;
  699. this.$set(this, 'orderList', []);
  700. this.getRentOrder();
  701. },
  702. /**
  703. * 获取订单列表
  704. */
  705. getRentOrder: function() {
  706. let that = this;
  707. if (that.loadend) return;
  708. if (that.loading) return;
  709. that.loading = true;
  710. that.loadTitle = that.$t(`加载更多`);
  711. getRentOrder({
  712. status: that.orderStatus,
  713. page: that.page,
  714. limit: that.limit
  715. })
  716. .then(res => {
  717. let list = res.data.list || [];
  718. let loadend = list.length < that.limit;
  719. that.orderList = that.$util.SplitArray(list, that.orderList);
  720. that.$set(that, 'orderList', that.orderList);
  721. that.loadend = loadend;
  722. that.loading = false;
  723. that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
  724. that.page = that.page + 1;
  725. })
  726. .catch(err => {
  727. that.loading = false;
  728. that.loadTitle = that.$t(`加载更多`);
  729. });
  730. },
  731. },
  732. onReachBottom: function() {
  733. this.getRentOrder();
  734. },
  735. // 滚动监听
  736. onPageScroll(e) {
  737. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  738. uni.$emit('scroll');
  739. },
  740. };
  741. </script>
  742. <style scoped lang="scss">
  743. .my-order {
  744. background-color: var(--view-theme);
  745. min-height: 100vh;
  746. .header {
  747. height: 260rpx;
  748. padding: 0 30rpx;
  749. .picTxt {
  750. height: 190rpx;
  751. .text {
  752. color: rgba(255, 255, 255, 0.8);
  753. font-size: 26rpx;
  754. font-family: 'Guildford Pro';
  755. .name {
  756. font-size: 34rpx;
  757. font-weight: bold;
  758. color: #fff;
  759. margin-bottom: 20rpx;
  760. }
  761. }
  762. .pictrue {
  763. width: 122rpx;
  764. height: 109rpx;
  765. image {
  766. width: 100%;
  767. height: 100%;
  768. }
  769. }
  770. }
  771. }
  772. .nav {
  773. background-color: var(--view-theme-16);
  774. width: 690rpx;
  775. height: 140rpx;
  776. border-radius: 6rpx;
  777. margin: -73rpx auto 0 auto;
  778. .item {
  779. text-align: center;
  780. font-size: 26rpx;
  781. color: #fff;
  782. width: 3rem;
  783. padding: 27rpx 0;
  784. border-bottom: 5rpx solid transparent;
  785. &.on {
  786. /* #ifdef H5 || MP */
  787. font-weight: bold;
  788. /* #endif */
  789. /* #ifdef APP-PLUS */
  790. color: #000;
  791. /* #endif */
  792. border-color: var(--view-priceColor);
  793. }
  794. }
  795. .num {
  796. margin-top: 18rpx;
  797. }
  798. }
  799. .list {
  800. width: 690rpx;
  801. margin: 14rpx auto 0 auto;
  802. .item {
  803. background-color: var(--view-theme-16);
  804. border-radius: 6rpx;
  805. margin-bottom: 14rpx;
  806. .title {
  807. height: 84rpx;
  808. padding: 0 30rpx;
  809. border-bottom: 2rpx solid var(--view-theme);
  810. font-size: 28rpx;
  811. color: #FFF;
  812. .sign {
  813. font-size: 24rpx;
  814. padding: 0 7rpx;
  815. height: 36rpx;
  816. margin-right: 15rpx;
  817. }
  818. }
  819. .item-info {
  820. padding: 0 30rpx;
  821. margin-top: 22rpx;
  822. .pictrue {
  823. width: 120rpx;
  824. height: 120rpx;
  825. background-color: #FFF;
  826. /deep/,
  827. /deep/image,
  828. /deep/.easy-loadimage,
  829. /deep/uni-image {
  830. width: 120rpx;
  831. height: 120rpx;
  832. border-radius: 6rpx;
  833. }
  834. image {
  835. width: 100%;
  836. height: 100%;
  837. border-radius: 6rpx;
  838. }
  839. }
  840. .text {
  841. width: 486rpx;
  842. font-size: 28rpx;
  843. color: #999;
  844. margin-top: 6rpx;
  845. // display: flex;
  846. line-height: 39rpx;
  847. .name {
  848. // width: 306rpx;
  849. color: #FFF;
  850. height: 78rpx;
  851. }
  852. .money {
  853. text-align: left;
  854. flex: 1;
  855. display: flex;
  856. .return {
  857. font-size: 24rpx;
  858. background-color: var(--view-priceColor);
  859. color: var(--view-theme);
  860. border-radius: 50rpx;
  861. padding: 0 20rpx;
  862. margin-right: 10rpx;
  863. }
  864. .lowe{
  865. color: #FFF;
  866. }
  867. }
  868. }
  869. }
  870. .totalPrice {
  871. font-size: 26rpx;
  872. color: #282828;
  873. text-align: left;
  874. flex-grow: 1;
  875. .money {
  876. font-size: 28rpx;
  877. font-weight: bold;
  878. color: var(--view-priceColor);
  879. }
  880. }
  881. .bottom {
  882. height: 107rpx;
  883. padding: 0 30rpx;
  884. .bnt {
  885. width: 170rpx;
  886. height: 50rpx;
  887. text-align: center;
  888. line-height: 50rpx;
  889. color: #fff;
  890. border-radius: 50rpx;
  891. font-size: 27rpx;
  892. &.cancelBnt {
  893. color: var(--view-theme);
  894. background-color: var(--view-priceColor);
  895. }
  896. &.gredBnt{
  897. color: #999;
  898. background-color: #FFF;
  899. // border: 1px solid var(--view-priceColor);
  900. }
  901. &~.bnt {
  902. margin-left: 17rpx;
  903. }
  904. }
  905. }
  906. }
  907. }
  908. }
  909. .noCart {
  910. margin-top: 171rpx;
  911. padding-top: 0.1rpx;
  912. .pictrue {
  913. width: 414rpx;
  914. height: 336rpx;
  915. margin: 78rpx auto 56rpx auto;
  916. image {
  917. width: 100%;
  918. height: 100%;
  919. }
  920. }
  921. }
  922. </style>