choosePayment.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. <template>
  2. <view>
  3. <u-modal
  4. v-model="payWayPop"
  5. :title-style="{ color: '#1E1E1E', fontSize: '34rpx' }"
  6. title="选择支付方式"
  7. width="600rpx"
  8. :show-confirm-button="false"
  9. :show-cancel-button="false"
  10. :mask-close-able="true"
  11. @input="modalClose"
  12. >
  13. <view class="pay-content">
  14. <view class="pay-list">
  15. <radio-group @change="payRadioChange">
  16. <!-- #ifdef H5 || MP-WEIXIN -->
  17. <view class="pay-list-item" v-if="wxEnv">
  18. <view class="pay-list-item-image">
  19. <image class="image" src="/static/img/wechat-icon-new.png" mode="aspectFit" />
  20. <view>微信支付</view>
  21. </view>
  22. <view class="radioBox">
  23. <radio color="#2DCF8C" value="weixin" :checked="'weixin' === radioCurrent" />
  24. </view>
  25. </view>
  26. <!-- #endif -->
  27. <template v-if="alipayEnv">
  28. <view class="pay-list-item">
  29. <view class="pay-list-item-image">
  30. <image class="image" src="/static/img/alipay-icon-new.png" mode="aspectFit" />
  31. <view>支付宝支付<text>随机立减最高10元</text></view>
  32. </view>
  33. <view class="radioBox">
  34. <radio color="#2DCF8C" value="juhe" :checked="'juhe' === radioCurrent" />
  35. </view>
  36. </view>
  37. </template>
  38. <view class="pay-list-item">
  39. <view class="pay-list-item-image">
  40. <image class="image" src="/static/img/gy-icon-new.png" mode="aspectFit" />
  41. <view>贵州银行</view>
  42. </view>
  43. <view class="radioBox">
  44. <radio color="#2DCF8C" value="gzyh" :checked="'gzyh' === radioCurrent" />
  45. </view>
  46. </view>
  47. <template v-if="!alipayEnv">
  48. <view class="pay-list-item">
  49. <view class="pay-list-item-image">
  50. <image class="image" src="/static/img/juhe-icon-new.png" mode="aspectFit" />
  51. <view>聚合支付</view>
  52. </view>
  53. <view class="radioBox">
  54. <radio color="#2DCF8C" value="juhe" :checked="'juhe' === radioCurrent" />
  55. </view>
  56. </view>
  57. </template>
  58. </radio-group>
  59. </view>
  60. <view class="pay-coupon" v-if="radioCurrent === 'weixin' && isShowCoupon">
  61. <u-cell-group :border="false">
  62. <u-cell-item
  63. icon=""
  64. title="优惠券"
  65. :value="couponPopup.currentCoupon.couponName || (couponPopup.couponList.length ? '暂未选择优惠券' : '无可用优惠券')"
  66. :border-bottom="false"
  67. @click="chooseCoupon"
  68. ></u-cell-item>
  69. </u-cell-group>
  70. </view>
  71. <view class="pay-money">
  72. <text class="discount-money" v-if="couponPopup.currentCoupon.couponContent && radioCurrent === 'weixin'"
  73. >¥ {{ getDifference(orderMoney, couponPopup.currentCoupon.couponContent).toFixed(2) }}</text
  74. >
  75. <text class="original-money" :class="couponPopup.currentCoupon.couponContent && radioCurrent === 'weixin' && 'original-discount-money'"
  76. >¥ {{ orderMoney }}</text
  77. >
  78. </view>
  79. <view class="pay-btn">
  80. <u-button type="primary" shape="circle" :disabled="!radioCurrent" @tap="$u.debounce(immediatePayment, 1500, true)">立即支付</u-button>
  81. </view>
  82. </view>
  83. </u-modal>
  84. <!-- 选择优惠券弹框 -->
  85. <u-popup v-model="couponPopup.show" mode="top" length="100%">
  86. <view class="coupon-popup">
  87. <u-navbar
  88. back-text=""
  89. title="我的优惠券"
  90. :background="couponPopup.background"
  91. title-color="#fff"
  92. back-icon-color="#fff"
  93. :custom-back="customBack"
  94. />
  95. <view class="coupon-popup-list">
  96. <template v-if="couponPopup.couponList.length">
  97. <radio-group @change="couponRadioChange">
  98. <view class="coupon-popup-list-item" v-for="(item, index) in couponPopup.couponList" :key="index">
  99. <view class="coupon-popup-list-item-top">
  100. <view class="coupon-popup-list-item-top-left">
  101. <view class="cplitl-left">
  102. <view>
  103. <text>¥</text>
  104. <text>{{ item.couponContent }}</text>
  105. </view>
  106. <view class="cplitl-left-bottom">{{ Number(item.threshold) > 0 ? `停车时长满${item.threshold}分钟` : '无门槛' }}</view>
  107. </view>
  108. <view class="cplitl-right">
  109. <view>{{ item.couponName }}</view>
  110. <view>有限期:剩余{{ calcValidity(item.startTime, item.endTime) }}</view>
  111. </view>
  112. </view>
  113. <view class="coupon-popup-list-item-top-right">
  114. <radio color="#FF6D6D" :value="item.id" :checked="item.id === couponPopup.radioCurrent" @click="couponItemClick(item)" />
  115. </view>
  116. </view>
  117. <view class="coupon-popup-list-item-bottom">
  118. 适用停车点:
  119. <template v-if="item.parkList">
  120. <template v-if="item.parkList.length > 1"> 适用多个停车点 </template>
  121. <template v-else> 仅限{{ item.parkList.map((item) => item.parkName).join('、') }} </template>
  122. <template v-if="item.parkList && item.parkList.length > 1">
  123. <view class="cplib-point">
  124. <u-read-more
  125. text-indent="0"
  126. show-height="0"
  127. :toggle="true"
  128. :shadow-style="{ backgroundImage: 'none' }"
  129. fontSize="20rpx"
  130. close-text="展开所有停车点"
  131. >
  132. <view class="cplib-point-content">{{ item.parkList.map((item) => item.parkName).join('、') }}</view>
  133. </u-read-more>
  134. </view>
  135. </template>
  136. </template>
  137. </view>
  138. </view>
  139. </radio-group>
  140. </template>
  141. <template v-else>
  142. <u-empty text="没有适合的优惠券" mode="coupon" margin-top="300"></u-empty>
  143. </template>
  144. </view>
  145. <view class="coupon-popup-btn">
  146. <u-button type="primary" shape="circle" @click="confimCoupon">确 定</u-button>
  147. </view>
  148. </view>
  149. </u-popup>
  150. <u-toast ref="uToast" />
  151. </view>
  152. </template>
  153. <script>
  154. import { getEnvIsWx, getEnvIsAlipay } from '@/utils/judgEnvironment.js';
  155. import $wxPay from '@/utils/wxPay.js';
  156. export default {
  157. props: {
  158. // 订单数组
  159. curOrderList: {
  160. type: Array,
  161. default: null
  162. },
  163. // 设备编号
  164. deviceNo: {
  165. type: String,
  166. default: null
  167. },
  168. // 地磁支付需要字段
  169. payeeId: {
  170. type: String,
  171. default: undefined
  172. },
  173. // 地磁支付需要字段
  174. payeeName: {
  175. type: String,
  176. default: undefined
  177. },
  178. // 扫码支付需要字段
  179. sanPay: {
  180. type: Boolean,
  181. default: false
  182. },
  183. // 追缴类型
  184. pursueType: {
  185. type: String,
  186. default: undefined
  187. },
  188. // 车牌号
  189. vehicleNo: {
  190. type: String,
  191. default: undefined
  192. },
  193. // 跳转页面
  194. jumpUrl: {
  195. type: String,
  196. default: null
  197. },
  198. // 出口扫码 接口不一样
  199. exportFlag: {
  200. type: Boolean,
  201. default: false
  202. },
  203. // 区分包月支付
  204. isMonthPay: {
  205. type: Boolean,
  206. default: false
  207. },
  208. // 包月id
  209. monthId: {
  210. type: String,
  211. default: null
  212. },
  213. // 室内扫码
  214. isIndoor: {
  215. type: Boolean,
  216. default: false
  217. }
  218. },
  219. data() {
  220. return {
  221. // 支付弹框显示
  222. payWayPop: false,
  223. // 是否微信环境
  224. wxEnv: true,
  225. // 支付宝环境
  226. alipayEnv: true,
  227. // 支付方式选择
  228. radioCurrent: '',
  229. // 订单金额
  230. orderMoney: '',
  231. // 显示优惠券选项
  232. isShowCoupon: false,
  233. // 是否取消优惠券标识
  234. isCancelCoupon: false,
  235. // 选择优惠券弹框
  236. couponPopup: {
  237. // 弹框标识
  238. show: false,
  239. // 优惠券列表
  240. couponList: [],
  241. // 优惠券选中项value
  242. radioCurrent: '',
  243. // navbar背景
  244. background: {
  245. backgroundColor: '#008CFF'
  246. },
  247. // 优惠券选中项
  248. currentCoupon: {}
  249. }
  250. };
  251. },
  252. methods: {
  253. /**
  254. * 打开弹框触发
  255. * @date 2023-02-17
  256. * @param {any} details
  257. * @param {any} numType single 单笔订单 multiple 多比订单 用于区分多笔订单不能使用优惠券
  258. * @param {any} orderType road 路段订单 parking 停车场订单 用于区分路段订单不使用优惠券
  259. * @returns {any}
  260. */
  261. openPopup(details, numType = 'single', orderType = 'road') {
  262. // 获取环境信息
  263. this.wxEnv = getEnvIsWx();
  264. // 判断支付宝环境
  265. this.alipayEnv = getEnvIsAlipay();
  266. // 打开弹出层
  267. this.payWayPop = true;
  268. // 计算订单金额
  269. this.orderMoney = details.payAmount.toFixed(2);
  270. // 如果是单个停车订单,且是路边停车,且不是月卡支付,则显示优惠券
  271. if (numType === 'single' && orderType === 'parking' && !this.isMonthPay) {
  272. this.isShowCoupon = true;
  273. this.isCancelCoupon = true;
  274. this.getCouponList(details.id);
  275. }
  276. },
  277. /**
  278. * 获取优惠券列表
  279. * @date 2023-02-17
  280. * @param {any} orderId
  281. * @returns {any}
  282. */
  283. getCouponList(orderId) {
  284. this.$u.api.getCouponByOrderIdApi({ orderId }).then((res) => {
  285. this.couponPopup.couponList = res?.data ?? [];
  286. });
  287. },
  288. /**
  289. * 选中支付类型
  290. * @date 2023-02-17
  291. * @param {any} {detail}
  292. * @returns {any}
  293. */
  294. payRadioChange({ detail }) {
  295. this.radioCurrent = detail.value;
  296. },
  297. /**
  298. * 选中优惠券
  299. * @date 2023-02-17
  300. * @returns {any}
  301. */
  302. chooseCoupon() {
  303. this.couponPopup.show = true;
  304. },
  305. /**
  306. * 贵阳银行支付
  307. * @param {Array} orderList 需要支付的订单号组成的数组
  308. * @param {String} deviceNo 设备编号(只有车位锁部分有)
  309. * */
  310. async gyBankPay() {
  311. const { curOrderList, deviceNo, jumpUrl, payeeName, payeeId, pursueType, sanPay } = this;
  312. const params = {
  313. orderList: curOrderList,
  314. deviceNo,
  315. jumpUrl,
  316. payeeId,
  317. payeeName,
  318. pursueType,
  319. vehicleNo,
  320. sanPay
  321. };
  322. const apiCall = this.exportFlag ? this.$u.api.quickPayExportApi : this.$u.api.payGzbank;
  323. try {
  324. const res = await apiCall({ ...params });
  325. if (res.data.needPay) {
  326. location.href = res?.data?.url;
  327. } else {
  328. this.showToast('无需支付', 'info');
  329. setTimeout(() => {
  330. location.reload();
  331. }, 1000);
  332. }
  333. } catch (err) {
  334. // this.showToast(err.msg, 'error');
  335. }
  336. },
  337. /**
  338. * @description: 贵阳银行包月支付
  339. * @return {*}
  340. */
  341. async gyBankMonthPay() {
  342. try {
  343. const params = {
  344. monthId: this.monthId,
  345. jumpUrl: this.jumpUrl
  346. };
  347. const { code, data } = await this.$u.api.monthPay({ ...params });
  348. if (code === 200) {
  349. location.href = data?.url;
  350. }
  351. } catch (error) {
  352. this.showToast(error?.msg ?? '无法调起支付', 'error');
  353. }
  354. },
  355. /**
  356. * 聚合支付
  357. * */
  358. juhePay() {
  359. this.getWXPayByJava(this.curOrderList, this.deviceNo);
  360. },
  361. /**
  362. * @description: 聚合包月支付
  363. * @return {*}
  364. */
  365. async juheMonthPay() {
  366. try {
  367. const { monthId, jumpUrl } = this;
  368. const { code, data } = await this.$u.api.monthlyWxPay({ monthId, jumpUrl });
  369. if (code === 200) {
  370. localStorage.setItem('jumpUrl', this.jumpUrl);
  371. location.href = data?.qrCodeUrl;
  372. }
  373. } catch (error) {
  374. this.showToast(error?.msg ?? '拉起支付失败!', 'error');
  375. }
  376. },
  377. /**
  378. * 微信支付
  379. */
  380. async wechatPay() {
  381. const { curOrderList, vuex_wxinfo, deviceNo, payeeId, payeeName, vehicleNo, sanPay, couponPopup } = this;
  382. const params = {
  383. orderList: curOrderList,
  384. openid: vuex_wxinfo?.openId,
  385. deviceNo,
  386. payeeId,
  387. payeeName,
  388. vehicleNo,
  389. sanPay,
  390. couponMemberId: couponPopup?.radioCurrent
  391. };
  392. const apiCall = this.exportFlag ? this.$u.api.parkingWechatPayApi : this.$u.api.wechatPayApi;
  393. try {
  394. const { code, data } = await apiCall({ ...params });
  395. if (code === 200) {
  396. if (data.needPay) {
  397. $wxPay.weixinPay(data.wx).then((r) => {
  398. const messageMap = {
  399. 0: '成功',
  400. 1: '已取消支付',
  401. 2: '支付失败,请检查!'
  402. };
  403. switch (Number(r.code)) {
  404. case 0: // 成功
  405. //#ifdef H5
  406. location.reload();
  407. //#endif
  408. break;
  409. case 1: // 取消
  410. if (this.isCancelCoupon) {
  411. this.cancelCoupon(messageMap[r.code]);
  412. } else {
  413. this.showToast(messageMap[r.code], 'info');
  414. }
  415. break;
  416. case 2: // 支付失败
  417. this.showToast(messageMap[r.code], 'error');
  418. break;
  419. }
  420. });
  421. } else {
  422. this.showToast('无需支付', 'info');
  423. setTimeout(() => {
  424. this.jumpUrl ? (location.href = `${this.jumpUrl}`) : location.reload();
  425. }, 1000);
  426. }
  427. }
  428. } catch (error) {}
  429. },
  430. /**
  431. * @description: 取消优惠券
  432. * @param {*} msg
  433. * @return {*}
  434. */
  435. async cancelCoupon(msg) {
  436. try {
  437. const { code } = await this.$u.api.updateCouponStatusApi({ orderList: this.curOrderList });
  438. if (code === 200) {
  439. this.showToast(msg, 'info');
  440. location.reload();
  441. }
  442. } catch (error) {}
  443. },
  444. /**
  445. * @description: 微信包月支付
  446. * @return {*}
  447. */
  448. async wechatMonthPay() {
  449. const { code, data } = await this.$u.api.wechatMonthlyPayapi({ monthId: this.monthId, openid: this.vuex_wxinfo.openId });
  450. if (code === 200) {
  451. $wxPay.weixinPay(data?.wx).then((res) => {
  452. this.handleMonthlyPay.call(this, res);
  453. });
  454. }
  455. },
  456. /**
  457. * @description: 微信包月支付响应处理
  458. * @param {*} response
  459. * @return {*}
  460. */
  461. handleMonthlyPay(response) {
  462. const messageMap = {
  463. 0: { title: '成功', jumpUrl: this.jumpUrl },
  464. 1: { title: '已取消支付' },
  465. 2: { title: '支付失败,请检查!', type: 'error' }
  466. };
  467. const message = messageMap[Number(response.code)];
  468. this.showToast(message.title, message.type || 'info');
  469. if (message.jumpUrl) {
  470. location.href = message.jumpUrl;
  471. }
  472. },
  473. /**
  474. * 直接通过后台获取贵阳银行微信支付地址
  475. * @param {Array} list 需要支付的订单组合数组
  476. * @param {Number} deviceNo 设备编号(在停车锁部分需要)
  477. * */
  478. async getWXPayByJava(orderList, deviceNo) {
  479. const params = {
  480. orderList,
  481. openid: this.vuex_wxinfo.openId,
  482. jumpUrl: this.jumpUrl,
  483. deviceNo: deviceNo || null,
  484. payeeId: this.payeeId,
  485. payeeName: this.payeeName,
  486. pursueType: this.pursueType,
  487. vehicleNo: this.vehicleNo,
  488. sanPay: this.sanPay
  489. };
  490. const apiCall = this.exportFlag ? this.$u.api.polyPayExportApi : this.$u.api.ordinaryWxPay;
  491. try {
  492. const { code, data } = await apiCall({ ...params });
  493. if (code === 200) {
  494. if (data.needPay) {
  495. localStorage.setItem('jumpUrl', this.jumpUrl);
  496. location.href = data.qrCodeUrl;
  497. } else {
  498. this.showToast('无需支付', 'info');
  499. setTimeout(() => {
  500. uni.hideLoading();
  501. location.href = this.jumpUrl;
  502. }, 1000);
  503. }
  504. }
  505. } catch (error) {
  506. // this.showToast(`无法调起${this.alipayEnv ? '支付宝' : this.wxEnv ? '微信' : '聚合'}支付!`, 'error');
  507. }
  508. },
  509. /**
  510. * 支付弹框支付触发
  511. * @date 2023-02-17
  512. * @returns {any}
  513. */
  514. modalClose() {
  515. Object.assign(this, {
  516. payWayPop: false,
  517. wxEnv: true,
  518. alipayEnv: true,
  519. radioCurrent: '',
  520. orderMoney: '',
  521. isShowCoupon: false,
  522. isCancelCoupon: false,
  523. couponPopup: {
  524. show: false,
  525. couponList: [],
  526. radioCurrent: '',
  527. background: {
  528. backgroundColor: '#008CFF'
  529. },
  530. currentCoupon: {}
  531. }
  532. });
  533. this.$emit('closePaymentMethod');
  534. },
  535. /**
  536. * 关闭优惠券弹框
  537. * @date 2023-02-17
  538. * @returns {any}
  539. */
  540. customBack() {
  541. this.couponPopup.show = false;
  542. },
  543. /**
  544. * 优惠券单选触发
  545. * @date 2023-02-17
  546. * @param {any} val
  547. * @returns {any}
  548. */
  549. couponRadioChange(val) {
  550. // this.couponPopup.radioCurrent = val.detail.value;
  551. // this.couponPopup.currentCoupon = this.couponPopup.couponList.find((item) => item.id === this.couponPopup.radioCurrent);
  552. },
  553. couponItemClick(item) {
  554. this.couponPopup.radioCurrent = item.id === this.couponPopup.radioCurrent ? '' : item.id;
  555. },
  556. /**
  557. * 优惠券确认
  558. * @date 2023-02-17
  559. * @returns {any}
  560. */
  561. confimCoupon() {
  562. this.couponPopup.currentCoupon = this.couponPopup.radioCurrent
  563. ? this.couponPopup.couponList.find((item) => item.id === this.couponPopup.radioCurrent)
  564. : {};
  565. this.couponPopup.show = false;
  566. },
  567. /**
  568. * 立即支付
  569. * @date 2023-02-17
  570. * @returns {any}
  571. */
  572. immediatePayment() {
  573. if (this.isIndoor) {
  574. const relationObj = {
  575. weixin: 'wechat',
  576. gzyh: 'quick',
  577. juhe: 'poly'
  578. };
  579. this.indoorPayment(relationObj[this.radioCurrent]);
  580. } else {
  581. switch (this.radioCurrent) {
  582. case 'weixin': // 微信支付
  583. this.isMonthPay ? this.wechatMonthPay() : this.wechatPay();
  584. break;
  585. case 'gzyh': // 贵州银行支付或快捷支付
  586. this.isMonthPay ? this.gyBankMonthPay() : this.gyBankPay();
  587. break;
  588. case 'juhe': // 聚合支付
  589. this.isMonthPay ? this.juheMonthPay() : this.juhePay();
  590. break;
  591. }
  592. }
  593. },
  594. /**
  595. * @description: 室内支付
  596. * @param {*} payMode
  597. * @return {*}
  598. */
  599. async indoorPayment(payMode) {
  600. const { curOrderList, couponPopup, vuex_wxinfo, jumpUrl } = this;
  601. const params = {
  602. orderList: curOrderList,
  603. payMode,
  604. couponMemberId: couponPopup?.radioCurrent,
  605. openid: vuex_wxinfo?.openId,
  606. sanPay: true,
  607. jumpUrl
  608. };
  609. const { code, data } = await this.$u.api.indoorPaymentApi({ ...params });
  610. if (code === 200) {
  611. if (data?.needPay) {
  612. switch (payMode) {
  613. case 'wechat': // 微信支付
  614. $wxPay.weixinPay(data?.wechat?.wx).then((r) => {
  615. const messageMap = {
  616. 0: '成功',
  617. 1: '已取消支付',
  618. 2: '支付失败,请检查!'
  619. };
  620. switch (Number(r.code)) {
  621. case 0: // 成功
  622. //#ifdef H5
  623. this.jumpUrl ? (location.href = `${this.jumpUrl}&polyOrderId=${data.polyOrderId}`) : location.reload();
  624. //#endif
  625. break;
  626. case 1: // 取消
  627. if (this.isCancelCoupon) {
  628. this.cancelCoupon(messageMap[r.code]);
  629. } else {
  630. this.showToast(messageMap[r.code], 'info');
  631. }
  632. break;
  633. case 2: // 支付失败
  634. this.showToast(messageMap[r.code], 'error');
  635. break;
  636. }
  637. });
  638. break;
  639. case 'quick': // 快捷支付
  640. location.href = data?.quick?.url;
  641. break;
  642. case 'poly':
  643. localStorage.setItem('jumpUrl', this.jumpUrl);
  644. location.href = data?.poly?.qrCodeUrl;
  645. break;
  646. }
  647. } else {
  648. this.showToast('无需支付', 'info');
  649. setTimeout(() => {
  650. this.jumpUrl ? (location.href = `${this.jumpUrl}&polyOrderId=${data.polyOrderId}`) : location.reload();
  651. }, 1000);
  652. }
  653. }
  654. },
  655. /**
  656. * 计算剩余时间
  657. * @date 2022-02-17
  658. * @param {any} datetime
  659. * @returns {any}
  660. */
  661. calcValidity(startTime, endTime) {
  662. let endTimeStr = new Date(endTime).valueOf(),
  663. nowTimeStr = new Date(startTime).valueOf() < Date.now() ? Date.now() : new Date(startTime).valueOf(),
  664. remainTimeStr = endTimeStr - nowTimeStr,
  665. day = Math.floor(remainTimeStr / (1000 * 3600 * 24)),
  666. dayOver = remainTimeStr % (1000 * 3600 * 24),
  667. hours = Math.floor(dayOver / (3600 * 1000)),
  668. hourOver = dayOver % (3600 * 1000),
  669. minutes = Math.floor(hourOver / (60 * 1000));
  670. return `${day}天${hours}小时${minutes}分`;
  671. },
  672. getDifference(a, b) {
  673. return a > b ? a - b : 0;
  674. },
  675. /**
  676. * @description: 显示报错信息
  677. * @param {*} title
  678. * @param {*} type
  679. * @return {*}
  680. */
  681. showToast(title, type = 'error') {
  682. this.$refs.uToast.show({ title, type });
  683. }
  684. }
  685. };
  686. </script>
  687. <style lang="scss" scoped>
  688. @import './choosePayment.scss';
  689. </style>