orderList.vue 24 KB

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