choosePayment.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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. this.alipayEnv = getEnvIsAlipay();
  265. // 打开弹出层
  266. this.payWayPop = true;
  267. // 计算订单金额
  268. this.orderMoney = details.payAmount.toFixed(2);
  269. // 如果是单个停车订单,且是路边停车,且不是月卡支付,则显示优惠券
  270. if (numType === 'single' && orderType === 'parking' && !this.isMonthPay) {
  271. this.isShowCoupon = true;
  272. this.isCancelCoupon = true;
  273. this.getCouponList(details.id);
  274. }
  275. },
  276. /**
  277. * 获取优惠券列表
  278. * @date 2023-02-17
  279. * @param {any} orderId
  280. * @returns {any}
  281. */
  282. getCouponList(orderId) {
  283. this.$u.api.getCouponByOrderIdApi({ orderId }).then((res) => {
  284. this.couponPopup.couponList = res?.data ?? [];
  285. });
  286. },
  287. /**
  288. * 选中支付类型
  289. * @date 2023-02-17
  290. * @param {any} {detail}
  291. * @returns {any}
  292. */
  293. payRadioChange({ detail }) {
  294. this.radioCurrent = detail.value;
  295. },
  296. /**
  297. * 选中优惠券
  298. * @date 2023-02-17
  299. * @returns {any}
  300. */
  301. chooseCoupon() {
  302. this.couponPopup.show = true;
  303. },
  304. /**
  305. * 贵阳银行支付
  306. * @param {Array} orderList 需要支付的订单号组成的数组
  307. * @param {String} deviceNo 设备编号(只有车位锁部分有)
  308. * */
  309. async gyBankPay() {
  310. const { curOrderList, deviceNo, jumpUrl, payeeName, payeeId, pursueType, sanPay } = this;
  311. const params = {
  312. orderList: curOrderList,
  313. deviceNo,
  314. jumpUrl,
  315. payeeId,
  316. payeeName,
  317. pursueType,
  318. vehicleNo,
  319. sanPay
  320. };
  321. const apiCall = this.exportFlag ? this.$u.api.quickPayExportApi : this.$u.api.payGzbank;
  322. try {
  323. const res = await apiCall({ ...params });
  324. if (res.data.needPay) {
  325. location.href = res?.data?.url;
  326. } else {
  327. this.showToast('无需支付', 'info');
  328. setTimeout(() => {
  329. location.reload();
  330. }, 1000);
  331. }
  332. } catch (err) {
  333. // this.showToast(err.msg, 'error');
  334. }
  335. },
  336. /**
  337. * @description: 贵阳银行包月支付
  338. * @return {*}
  339. */
  340. async gyBankMonthPay() {
  341. try {
  342. const params = {
  343. monthId: this.monthId,
  344. jumpUrl: this.jumpUrl
  345. };
  346. const { code, data } = await this.$u.api.monthPay({ ...params });
  347. if (code === 200) {
  348. location.href = data?.url;
  349. }
  350. } catch (error) {
  351. this.showToast(error?.msg ?? '无法调起支付', 'error');
  352. }
  353. },
  354. /**
  355. * 聚合支付
  356. * */
  357. juhePay() {
  358. this.getWXPayByJava(this.curOrderList, this.deviceNo);
  359. },
  360. /**
  361. * @description: 聚合包月支付
  362. * @return {*}
  363. */
  364. async juheMonthPay() {
  365. try {
  366. const { monthId, jumpUrl } = this;
  367. const { code, data } = await this.$u.api.monthlyWxPay({ monthId, jumpUrl });
  368. if (code === 200) {
  369. localStorage.setItem('jumpUrl', this.jumpUrl);
  370. location.href = data?.qrCodeUrl;
  371. }
  372. } catch (error) {
  373. this.showToast(error?.msg ?? '拉起支付失败!', 'error');
  374. }
  375. },
  376. /**
  377. * 微信支付
  378. */
  379. async wechatPay() {
  380. const { curOrderList, vuex_wxinfo, deviceNo, payeeId, payeeName, vehicleNo, sanPay, couponPopup } = this;
  381. const params = {
  382. orderList: curOrderList,
  383. openid: vuex_wxinfo?.openId,
  384. deviceNo,
  385. payeeId,
  386. payeeName,
  387. vehicleNo,
  388. sanPay,
  389. couponMemberId: couponPopup?.radioCurrent
  390. };
  391. const apiCall = this.exportFlag ? this.$u.api.parkingWechatPayApi : this.$u.api.wechatPayApi;
  392. try {
  393. const { code, data } = await apiCall({ ...params });
  394. if (code === 200) {
  395. if (data.needPay) {
  396. $wxPay.weixinPay(data.wx).then((r) => {
  397. const messageMap = {
  398. 0: '成功',
  399. 1: '已取消支付',
  400. 2: '支付失败,请检查!'
  401. };
  402. switch (Number(r.code)) {
  403. case 0: // 成功
  404. //#ifdef H5
  405. location.reload();
  406. //#endif
  407. break;
  408. case 1: // 取消
  409. if (this.isCancelCoupon) {
  410. this.cancelCoupon(messageMap[r.code]);
  411. } else {
  412. this.showToast(messageMap[r.code], 'info');
  413. }
  414. break;
  415. case 2: // 支付失败
  416. this.showToast(messageMap[r.code], 'error');
  417. break;
  418. }
  419. });
  420. } else {
  421. this.showToast('无需支付', 'info');
  422. setTimeout(() => {
  423. this.jumpUrl ? (location.href = `${this.jumpUrl}`) : location.reload();
  424. }, 1000);
  425. }
  426. }
  427. } catch (error) {}
  428. },
  429. /**
  430. * @description: 取消优惠券
  431. * @param {*} msg
  432. * @return {*}
  433. */
  434. async cancelCoupon(msg) {
  435. try {
  436. const { code } = await this.$u.api.updateCouponStatusApi({ orderList: this.curOrderList });
  437. if (code === 200) {
  438. this.showToast(msg, 'info');
  439. location.reload();
  440. }
  441. } catch (error) {}
  442. },
  443. /**
  444. * @description: 微信包月支付
  445. * @return {*}
  446. */
  447. async wechatMonthPay() {
  448. const { code, data } = await this.$u.api.wechatMonthlyPayapi({ monthId: this.monthId, openid: this.vuex_wxinfo.openId });
  449. if (code === 200) {
  450. $wxPay.weixinPay(data?.wx).then((res) => {
  451. this.handleMonthlyPay.call(this, res);
  452. });
  453. }
  454. },
  455. /**
  456. * @description: 微信包月支付响应处理
  457. * @param {*} response
  458. * @return {*}
  459. */
  460. handleMonthlyPay(response) {
  461. const messageMap = {
  462. 0: { title: '成功', jumpUrl: this.jumpUrl },
  463. 1: { title: '已取消支付' },
  464. 2: { title: '支付失败,请检查!', type: 'error' }
  465. };
  466. const message = messageMap[Number(response.code)];
  467. this.showToast(message.title, message.type || 'info');
  468. if (message.jumpUrl) {
  469. location.href = message.jumpUrl;
  470. }
  471. },
  472. /**
  473. * 直接通过后台获取贵阳银行微信支付地址
  474. * @param {Array} list 需要支付的订单组合数组
  475. * @param {Number} deviceNo 设备编号(在停车锁部分需要)
  476. * */
  477. async getWXPayByJava(orderList, deviceNo) {
  478. const params = {
  479. orderList,
  480. openid: this.vuex_wxinfo.openId,
  481. jumpUrl: this.jumpUrl,
  482. deviceNo: deviceNo || null,
  483. payeeId: this.payeeId,
  484. payeeName: this.payeeName,
  485. pursueType: this.pursueType,
  486. vehicleNo: this.vehicleNo,
  487. sanPay: this.sanPay
  488. };
  489. const apiCall = this.exportFlag ? this.$u.api.polyPayExportApi : this.$u.api.ordinaryWxPay;
  490. try {
  491. const { code, data } = await apiCall({ ...params });
  492. if (code === 200) {
  493. if (data.needPay) {
  494. localStorage.setItem('jumpUrl', this.jumpUrl);
  495. location.href = data.qrCodeUrl;
  496. } else {
  497. this.showToast('无需支付', 'info');
  498. setTimeout(() => {
  499. uni.hideLoading();
  500. location.href = this.jumpUrl;
  501. }, 1000);
  502. }
  503. }
  504. } catch (error) {
  505. // this.showToast(`无法调起${this.alipayEnv ? '支付宝' : this.wxEnv ? '微信' : '聚合'}支付!`, 'error');
  506. }
  507. },
  508. /**
  509. * 支付弹框支付触发
  510. * @date 2023-02-17
  511. * @returns {any}
  512. */
  513. modalClose() {
  514. Object.assign(this, {
  515. payWayPop: false,
  516. wxEnv: true,
  517. alipayEnv: true,
  518. radioCurrent: '',
  519. orderMoney: '',
  520. isShowCoupon: false,
  521. isCancelCoupon: false,
  522. couponPopup: {
  523. show: false,
  524. couponList: [],
  525. radioCurrent: '',
  526. background: {
  527. backgroundColor: '#008CFF'
  528. },
  529. currentCoupon: {}
  530. }
  531. });
  532. this.$emit('closePaymentMethod');
  533. },
  534. /**
  535. * 关闭优惠券弹框
  536. * @date 2023-02-17
  537. * @returns {any}
  538. */
  539. customBack() {
  540. this.couponPopup.show = false;
  541. },
  542. /**
  543. * 优惠券单选触发
  544. * @date 2023-02-17
  545. * @param {any} val
  546. * @returns {any}
  547. */
  548. couponRadioChange(val) {
  549. // this.couponPopup.radioCurrent = val.detail.value;
  550. // this.couponPopup.currentCoupon = this.couponPopup.couponList.find((item) => item.id === this.couponPopup.radioCurrent);
  551. },
  552. couponItemClick(item) {
  553. this.couponPopup.radioCurrent = item.id === this.couponPopup.radioCurrent ? '' : item.id;
  554. },
  555. /**
  556. * 优惠券确认
  557. * @date 2023-02-17
  558. * @returns {any}
  559. */
  560. confimCoupon() {
  561. this.couponPopup.currentCoupon = this.couponPopup.radioCurrent
  562. ? this.couponPopup.couponList.find((item) => item.id === this.couponPopup.radioCurrent)
  563. : {};
  564. this.couponPopup.show = false;
  565. },
  566. /**
  567. * 立即支付
  568. * @date 2023-02-17
  569. * @returns {any}
  570. */
  571. immediatePayment() {
  572. if (this.isIndoor) {
  573. const relationObj = {
  574. weixin: 'wechat',
  575. gzyh: 'quick',
  576. juhe: 'poly'
  577. };
  578. this.indoorPayment(relationObj[this.radioCurrent]);
  579. } else {
  580. switch (this.radioCurrent) {
  581. case 'weixin': // 微信支付
  582. this.isMonthPay ? this.wechatMonthPay() : this.wechatPay();
  583. break;
  584. case 'gzyh': // 贵州银行支付或快捷支付
  585. this.isMonthPay ? this.gyBankMonthPay() : this.gyBankPay();
  586. break;
  587. case 'juhe': // 聚合支付
  588. this.isMonthPay ? this.juheMonthPay() : this.juhePay();
  589. break;
  590. }
  591. }
  592. },
  593. /**
  594. * @description: 室内支付
  595. * @param {*} payMode
  596. * @return {*}
  597. */
  598. async indoorPayment(payMode) {
  599. const { curOrderList, couponPopup, vuex_wxinfo, jumpUrl } = this;
  600. const params = {
  601. orderList: curOrderList,
  602. payMode,
  603. couponMemberId: couponPopup?.radioCurrent,
  604. openid: vuex_wxinfo?.openId,
  605. sanPay: true,
  606. jumpUrl
  607. };
  608. const { code, data } = await this.$u.api.indoorPaymentApi({ ...params });
  609. if (code === 200) {
  610. if (data?.needPay) {
  611. switch (payMode) {
  612. case 'wechat': // 微信支付
  613. $wxPay.weixinPay(data?.wechat?.wx).then((r) => {
  614. const messageMap = {
  615. 0: '成功',
  616. 1: '已取消支付',
  617. 2: '支付失败,请检查!'
  618. };
  619. switch (Number(r.code)) {
  620. case 0: // 成功
  621. //#ifdef H5
  622. this.jumpUrl ? (location.href = `${this.jumpUrl}&polyOrderId=${data.polyOrderId}`) : location.reload();
  623. //#endif
  624. break;
  625. case 1: // 取消
  626. if (this.isCancelCoupon) {
  627. this.cancelCoupon(messageMap[r.code]);
  628. } else {
  629. this.showToast(messageMap[r.code], 'info');
  630. }
  631. break;
  632. case 2: // 支付失败
  633. this.showToast(messageMap[r.code], 'error');
  634. break;
  635. }
  636. });
  637. break;
  638. case 'quick': // 快捷支付
  639. location.href = data?.quick?.url;
  640. break;
  641. case 'poly':
  642. localStorage.setItem('jumpUrl', this.jumpUrl);
  643. location.href = data?.poly?.qrCodeUrl;
  644. break;
  645. }
  646. } else {
  647. this.showToast('无需支付', 'info');
  648. setTimeout(() => {
  649. this.jumpUrl ? (location.href = `${this.jumpUrl}&polyOrderId=${data.polyOrderId}`) : location.reload();
  650. }, 1000);
  651. }
  652. }
  653. },
  654. /**
  655. * 计算剩余时间
  656. * @date 2022-02-17
  657. * @param {any} datetime
  658. * @returns {any}
  659. */
  660. calcValidity(startTime, endTime) {
  661. let endTimeStr = new Date(endTime).valueOf(),
  662. nowTimeStr = new Date(startTime).valueOf() < Date.now() ? Date.now() : new Date(startTime).valueOf(),
  663. remainTimeStr = endTimeStr - nowTimeStr,
  664. day = Math.floor(remainTimeStr / (1000 * 3600 * 24)),
  665. dayOver = remainTimeStr % (1000 * 3600 * 24),
  666. hours = Math.floor(dayOver / (3600 * 1000)),
  667. hourOver = dayOver % (3600 * 1000),
  668. minutes = Math.floor(hourOver / (60 * 1000));
  669. return `${day}天${hours}小时${minutes}分`;
  670. },
  671. getDifference(a, b) {
  672. return a > b ? a - b : 0;
  673. },
  674. /**
  675. * @description: 显示报错信息
  676. * @param {*} title
  677. * @param {*} type
  678. * @return {*}
  679. */
  680. showToast(title, type = 'error') {
  681. this.$refs.uToast.show({ title, type });
  682. }
  683. }
  684. };
  685. </script>
  686. <style lang="scss" scoped>
  687. @import './choosePayment.scss';
  688. </style>