app-payment.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. <!-- 全局支付组件 -->
  2. <template>
  3. <view class="app-payment main-center cross-center" :class="showPayment?'show':''">
  4. <view class="modal" v-if="payData">
  5. <view class="title">
  6. <view>支付方式</view>
  7. <view class="cancel" @click="cancel">
  8. <image src="https://shop.9026.com/web/statics/image/mall/static/icon/close.png"></image>
  9. </view>
  10. </view>
  11. <view class="pay-amount">支付金额 ¥{{balance <0 ? setPrice(payData.amount, balance) : payData.amount}} 元</view>
  12. <view class="pay-type-list">
  13. <view v-for="(item, index) in payData.list" @click="checkPayType(index)" :key="index"
  14. class="pay-type-item cross-center">
  15. <view class="box-grow-0">
  16. <image class="pay-type-icon" :src="item.icon"></image>
  17. </view>
  18. <view class="box-grow-1">
  19. <view class="pay-type-name">{{item.name}}</view>
  20. <view class="pay-type-desc" v-if="item.desc">{{item.desc}}</view>
  21. </view>
  22. <view class="box-grow-0">
  23. <view v-if="item.key === 'balance' && item.desc === '账户余额不足'" style="height: 26rpx;width:113rpx"
  24. @click.prevent.stop="navPay">
  25. <image style="height: 100%;width:100%" load-lazy="true"
  26. src="https://shop.9026.com/web/statics/img/mall/static/pay-td.png"></image>
  27. </view>
  28. <app-radio v-else-if="item.checked" :theme="getTheme" v-model="item.checked" type="round">
  29. </app-radio>
  30. </view>
  31. <view class="into-modal main-center cross-center" v-if="printPassword && item.key === 'balance'">
  32. <view class="password-tip" v-if="item.is_pay_password == 0 && !setPassword">
  33. <view class="password-content dir-top-nowrap main-center cross-center">
  34. <view>您的账户尚未设置余额支付密码</view>
  35. <view>是否立即设置?</view>
  36. </view>
  37. <view class="password-btn main-center cross-center">
  38. <view @click="payByBalance">暂不设置</view>
  39. <view class="line"></view>
  40. <view @click="setPassword = !setPassword;password=''" :style="{'color':getTheme.color}">
  41. 确认</view>
  42. </view>
  43. </view>
  44. <view class="password-view" v-else-if="printPassword">
  45. <image class="password-close"
  46. @click="printPassword = false;setPassword = false;verifyPassword = false;"
  47. src="https://shop.9026.com/web/statics/image/mall/static/icon/icon-close.png"></image>
  48. <view class="password-title">请{{verifyPassword ? '确认':'输入'}}余额支付密码</view>
  49. <!-- #ifdef MP-ALIPAY -->
  50. <input type="number" :class="!haveFocus ? 'input' :''" @focus="haveFocus=true"
  51. @input="passwordInput" @blur="haveFocus=false;getFocus=false" v-model="password">
  52. <!-- #endif -->
  53. <!-- #ifdef MP-WEIXIN -->
  54. <input type="number" style="top:0;right: 400%" @input="passwordInput" :focus="getFocus"
  55. @blur="getFocus=false" v-model="password">
  56. <!-- #endif -->
  57. <!-- #ifndef MP-ALIPAY || MP-WEIXIN -->
  58. <input type="number" v-show="getFocus" style="top:0;right: 400%" @input="passwordInput"
  59. :focus="getFocus" @blur="getFocus=false" v-model="password">
  60. <!-- #endif -->
  61. <view @click="getInputFocus" class="passoword-input main-center cross-center">
  62. <view class="password-item main-center cross-center">
  63. <view v-if="password.length > 0" class="password-placeholder"></view>
  64. </view>
  65. <view class="password-item main-center cross-center">
  66. <view v-if="password.length > 1" class="password-placeholder"></view>
  67. </view>
  68. <view class="password-item main-center cross-center">
  69. <view v-if="password.length > 2" class="password-placeholder"></view>
  70. </view>
  71. <view class="password-item main-center cross-center">
  72. <view v-if="password.length > 3" class="password-placeholder"></view>
  73. </view>
  74. <view class="password-item main-center cross-center">
  75. <view v-if="password.length > 4" class="password-placeholder"></view>
  76. </view>
  77. <view class="password-item main-center cross-center">
  78. <view v-if="password.length > 5" class="password-placeholder"></view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="footer">
  86. <!-- #ifdef MP -->
  87. <app-button type="important" :theme="getTheme" @click="confirm" round>提交订单</app-button>
  88. <!-- #endif-->
  89. <!-- #ifdef H5 -->
  90. <app-button type="important" :theme="getTheme" @click.native.stop="confirm" round>提交订单</app-button>
  91. <!-- #endif-->
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import Vue from 'vue';
  98. import {
  99. mapGetters,
  100. mapState
  101. } from 'vuex';
  102. import AppRadio from '@/components/basic-component/app-radio/app-radio';
  103. export default {
  104. name: 'app-payment',
  105. components: {
  106. AppRadio
  107. },
  108. computed: {
  109. ...mapState({
  110. mall: state => state.mallConfig.mall,
  111. userInfo: state => state.user.info,
  112. showPayment: function(state) {
  113. return state.payment.showPayment;
  114. },
  115. payData: state => state.payment.payData,
  116. }),
  117. ...mapGetters('mallConfig', {
  118. getTheme: 'getTheme',
  119. }),
  120. },
  121. data() {
  122. return {
  123. balance: 0, // 余额
  124. is_need_pay_password: 0,
  125. haveFocus: false,
  126. getFocus: false,
  127. printPassword: false,
  128. setPassword: false,
  129. verifyPassword: false,
  130. password: '',
  131. verify_pay_password: '',
  132. pay_password: '',
  133. payPassword: '',
  134. }
  135. },
  136. created() {
  137. this.setPayment();
  138. this.getSetting();
  139. },
  140. destroyed(){
  141. this.$store.commit('payment/showPayment', false);
  142. },
  143. methods: {
  144. getInputFocus() {
  145. this.$nextTick(() => {
  146. this.getFocus = true;
  147. })
  148. },
  149. passwordInput() {
  150. if (this.password.length == 6) {
  151. setTimeout(() => {
  152. if (this.setPassword) {
  153. this.setPayPassword();
  154. } else {
  155. uni.showLoading({
  156. mask: true
  157. });
  158. uni.hideKeyboard();
  159. this.verifyPayPassword();
  160. }
  161. })
  162. }
  163. },
  164. setPayPassword() {
  165. if (this.password.length < 6) {
  166. return false;
  167. }
  168. if (!this.verifyPassword) {
  169. this.pay_password = this.password.toString().substring(0, 6);
  170. this.verifyPassword = true;
  171. this.password = '';
  172. } else {
  173. this.verify_pay_password = this.password.toString().substring(0, 6);;
  174. if (this.pay_password === this.verify_pay_password) {
  175. uni.showLoading({
  176. mask: true
  177. });
  178. let data = {
  179. pay_password: this.pay_password,
  180. verify_pay_password: this.verify_pay_password,
  181. }
  182. this.$request({
  183. url: this.$api.member.set_password,
  184. method: "post",
  185. data: data
  186. }).then(response => {
  187. uni.hideLoading();
  188. if (response.code === 0) {
  189. this.payPassword = this.pay_password;
  190. this.printPassword = false;
  191. this.setPassword = false;
  192. this.verifyPassword = false;
  193. this.password = '';
  194. this.pay_password = '';
  195. this.verify_pay_password = '';
  196. this.$store.commit('payment/showPayment', false);
  197. this.payByBalance();
  198. } else {
  199. this.password = '';
  200. this.pay_password = '';
  201. this.verify_pay_password = '';
  202. uni.showToast({
  203. icon: 'none',
  204. title: response.msg
  205. });
  206. }
  207. });
  208. } else {
  209. this.verifyPassword = false;
  210. this.password = '';
  211. this.pay_password = '';
  212. this.verify_pay_password = '';
  213. uni.showToast({
  214. icon: 'none',
  215. title: '两次输入的密码不一致'
  216. })
  217. }
  218. }
  219. },
  220. navPay() {
  221. this.$store.commit('payment/showPayment', false);
  222. this.$store.state.payment.reject({
  223. errMsg: '5b03b6e009796c698d132908cb635fca',
  224. });
  225. uni.navigateTo({
  226. url: "/pages/balance/recharge"
  227. });
  228. },
  229. // 获取余额接口
  230. getSetting: function() {
  231. if ((this.$store.state.user.accessToken === '' || this.$store.state.user.accessToken === null)) {
  232. return true;
  233. }
  234. const self = this;
  235. self.$request({
  236. url: self.$api.balance.index,
  237. }).then(info => {
  238. if (info.code === 0) {
  239. this.balance = Number(info.data.balance);
  240. }
  241. });
  242. },
  243. setPrice(price, balance) {
  244. price = Number(price)
  245. balance = Math.abs(balance)
  246. return price + balance
  247. },
  248. // 提交订单
  249. setPayment() {
  250. const vm = this;
  251. Vue.use({
  252. install(Vue, options) {
  253. Vue.prototype.$payment = {
  254. pay: vm.pay,
  255. };
  256. },
  257. });
  258. },
  259. pay(id) {
  260. return new Promise((resolve, reject) => {
  261. this.$store.commit('payment/setAll', {
  262. showPayment: false,
  263. payData: null,
  264. payType: null,
  265. id: id,
  266. resolve: resolve,
  267. reject: reject,
  268. });
  269. uni.showLoading({
  270. mask: true,
  271. title: '请求支付...',
  272. });
  273. this.$request({
  274. url: this.$api.payment.get_payments,
  275. data: {
  276. id: id,
  277. }
  278. }).then(response => {
  279. uni.hideLoading();
  280. console.log('debug 1--->', response);
  281. if (response.code === 0) {
  282. console.log('debug payment, set resolve 2,', this.$store.state.payment
  283. .resolve);
  284. return this.showPaymentModal(response.data);
  285. } else {
  286. response.errMsg = response.msg || '';
  287. return this.$store.state.payment.reject(response.msg);
  288. }
  289. }).catch(e => {
  290. uni.hideLoading();
  291. e.errMsg = e.msg || '';
  292. return this.$store.state.payment.reject(e);
  293. });
  294. });
  295. },
  296. showPaymentModal(data) {
  297. console.log('debug 2--->', data);
  298. for (let i in data.list) {
  299. if (typeof data.list[i].checked === 'undefined') {
  300. data.list[i].checked = false;
  301. }
  302. }
  303. this.$store.commit('payment/payData', data);
  304. if (data.amount === 0 || data.amount === 0.00 || data.amount === '0' || data.amount === '0.00') {
  305. this.$store.commit('payment/payType', 'balance');
  306. for (let i in this.$store.state.payment.payData.list) {
  307. if (this.$store.state.payment.payData.list[i].key === 'balance') {
  308. this.$store.state.payment.payData.list[i].checked = true;
  309. } else {
  310. this.$store.state.payment.payData.list[i].checked = false;
  311. }
  312. }
  313. this.confirm();
  314. return;
  315. }
  316. this.$store.commit('payment/showPayment', true);
  317. },
  318. confirm() {
  319. for (let i in this.$store.state.payment.payData.list) {
  320. if (this.$store.state.payment.payData.list[i].checked) {
  321. this.$store.commit('payment/payType', this.$store.state.payment.payData.list[i].key);
  322. }
  323. }
  324. if (!this.$store.state.payment.payType) {
  325. uni.showModal({
  326. title: '提示',
  327. content: '请选择支付方式',
  328. showCancel: false,
  329. });
  330. return;
  331. }
  332. this.$store.commit('payment/showPayment', false);
  333. console.log('payment confirm 2:', this.$store.state.payment.payType);
  334. console.log('debug payment, confirm 2,', this.$store.state.payment.resolve);
  335. return this.getPayData();
  336. },
  337. cancel() {
  338. this.$store.commit('payment/showPayment', false);
  339. return this.$store.state.payment.reject({
  340. errMsg: '支付取消',
  341. });
  342. },
  343. checkPayType(index) {
  344. if (this.$store.state.payment.payData.list[index].disabled || this.$store.state.payment.payData.list[index]
  345. .checked) {
  346. return false;
  347. }
  348. const payData = this.$store.state.payment.payData;
  349. for (let i in payData.list) {
  350. if (i == index) {
  351. payData.list[i].checked = true;
  352. } else {
  353. payData.list[i].checked = false;
  354. }
  355. }
  356. this.$store.commit('payment/payData', payData);
  357. },
  358. getPayData() {
  359. console.log('debug payment, getPayData 1,', this.$store.state.payment.resolve);
  360. uni.showLoading({
  361. mask: true,
  362. title: '请求支付...',
  363. });
  364. let _this = this;
  365. let data = {
  366. id: this.$store.state.payment.id,
  367. pay_type: this.$store.state.payment.payType,
  368. }
  369. // #ifdef H5
  370. this.$storage.setStorageSync('WEB_URL', window.location.href + '&pay_id_weChart=' + data.id +
  371. '&isWechat=true');
  372. if (window.location.hash.indexOf('/pages/balance/recharge') > -1) {
  373. data.url = window.location.href.split('#')[0] + '#/pages/balance/recharge?isPay=ture';
  374. } else {
  375. if (window.location.hash.indexOf('?') > -1) {
  376. data.url = window.location.href + '&isPay=ture'
  377. } else {
  378. data.url = window.location.href + '?isPay=ture'
  379. }
  380. }
  381. data.url += `&isWechat=true&payType=${this.$store.state.payment.payType}`
  382. if (!this.$jwx.isWechat()) {
  383. data.url += '&pay_id_weChart=' + data.id
  384. }
  385. // #endif
  386. this.$request({
  387. url: this.$api.payment.pay_data,
  388. data: data
  389. }).then(response => {
  390. uni.hideLoading();
  391. if (response.code === 0) {
  392. switch (this.$store.state.payment.payType) {
  393. case 'balance':
  394. this.callBranch(response.data);
  395. break;
  396. case 'huodao':
  397. this.callHuodao(response.data);
  398. break;
  399. // #ifdef H5
  400. case 'wechat_h5':
  401. console.log('debug payment, wechat_h5');
  402. this.$jwx.chooseWXPay({
  403. timestamp: response.data.timeStamp,
  404. nonceStr: response.data.nonceStr,
  405. packAge: response.data.package,
  406. signType: response.data.signType,
  407. paySign: response.data.paySign,
  408. webUrl: response.data.mweb_url,
  409. success() {
  410. _this.$store.state.payment.resolve({
  411. errMsg: '支付成功',
  412. });
  413. },
  414. fail(res) {
  415. _this.$store.state.payment.reject({
  416. errMsg: res.msg
  417. });
  418. }
  419. });
  420. uni.showModal({
  421. content: '确定已完成支付?',
  422. confirmText: '确定',
  423. cancelText: '返回支付',
  424. success(res) {
  425. if (res.confirm) {
  426. _this.weChartPay(_this.$store.state.payment.id);
  427. } else if (res.cancel) {
  428. _this.$store.state.payment.reject({
  429. errMsg: '支付取消'
  430. });
  431. }
  432. }
  433. });
  434. break;
  435. case 'alipay_h5':
  436. if (this.$jwx.isWechat()) {
  437. _AP.pay(response.data.url);
  438. } else {
  439. window.location.href = response.data.url;
  440. uni.showModal({
  441. content: '确定已完成支付?',
  442. confirmText: '确定',
  443. cancelText: '返回支付',
  444. success(res) {
  445. if (res.confirm) {
  446. _this.weChartPay(_this.$store.state.payment.id);
  447. // _this.$store.state.payment.resolve({
  448. // errMsg: '支付成功',
  449. // });
  450. } else if (res.cancel) {
  451. _this.$store.state.payment.reject({
  452. errMsg: '支付取消'
  453. });
  454. }
  455. },
  456. fail() {}
  457. });
  458. }
  459. console.log('debug payment, alipay_h5');
  460. break;
  461. // #endif
  462. default:
  463. // #ifdef MP
  464. console.log('debug payment, getPayData 2,', this.$store.state.payment.resolve);
  465. this.callPlatformPayment(response.data);
  466. // #endif
  467. break;
  468. }
  469. } else {
  470. return this.$store.state.payment.reject(response.msg);
  471. }
  472. }).catch(e => {
  473. uni.hideLoading();
  474. e.errMsg = e.msg || '';
  475. return this.$store.state.payment.reject(e);
  476. });
  477. },
  478. callBranch(data) {
  479. let that = this;
  480. if (data.order_amount === 0 || data.order_amount === 0.00 || data.order_amount === '0' || data
  481. .order_amount === '0.00') {
  482. this.payByBalance();
  483. } else {
  484. uni.showModal({
  485. title: '余额支付确认',
  486. content: `账户余额:${data.balance_amount},支付金额:${data.order_amount}`,
  487. success: (e) => {
  488. if (e.confirm) {
  489. for (let item of this.payData.list) {
  490. if (item.key == 'balance') {
  491. if (item.is_open_pay_password == 1) {
  492. this.payPassword = '';
  493. this.is_need_pay_password = item.is_pay_password;
  494. this.password = '';
  495. this.$store.commit('payment/showPayment', true);
  496. this.printPassword = true;
  497. setTimeout(() => {
  498. this.getFocus = true;
  499. }, 800)
  500. } else {
  501. this.payByBalance();
  502. }
  503. break
  504. }
  505. }
  506. } else {
  507. return this.$store.state.payment.reject({
  508. errMsg: '支付取消.',
  509. });
  510. }
  511. }
  512. });
  513. }
  514. },
  515. verifyPayPassword() {
  516. if (this.password.length < 6) {
  517. return false;
  518. }
  519. this.payPassword = this.password.toString().substring(0, 6);
  520. this.$request({
  521. url: this.$api.member.verify_password,
  522. data: {
  523. pay_password: this.payPassword,
  524. },
  525. method: 'post'
  526. }).then(response => {
  527. this.password = '';
  528. uni.hideLoading();
  529. if (response.code === 0) {
  530. this.$store.commit('payment/showPayment', false);
  531. this.payByBalance();
  532. } else {
  533. this.password = '';
  534. this.payPassword = '';
  535. uni.showModal({
  536. title: '提示',
  537. content: response.msg,
  538. showCancel: false
  539. });
  540. }
  541. }).catch(e => {
  542. uni.hideLoading();
  543. e.errMsg = e.msg || '';
  544. return this.$store.state.payment.reject(e);
  545. });
  546. },
  547. payByBalance() {
  548. uni.showLoading({
  549. mask: true,
  550. title: '支付中...',
  551. });
  552. let para = {
  553. id: this.$store.state.payment.id,
  554. pay_password: this.payPassword ? this.payPassword : '',
  555. is_need_pay_password: this.is_need_pay_password
  556. }
  557. this.$request({
  558. url: this.$api.payment.pay_buy_balance,
  559. data: para
  560. }).then(response => {
  561. uni.hideLoading();
  562. if (response.code === 0) {
  563. this.$store.commit('payment/showPayment', false);
  564. return this.$store.state.payment.resolve({
  565. errMsg: '支付成功',
  566. });
  567. } else {
  568. return this.$store.state.payment.reject({
  569. errMsg: response.msg,
  570. });
  571. }
  572. }).catch(e => {
  573. e.errMsg = e.msg || '';
  574. return this.$store.state.payment.reject(e);
  575. });
  576. },
  577. callHuodao() {
  578. uni.showLoading({
  579. mask: true,
  580. title: '提交中...',
  581. });
  582. this.$request({
  583. url: this.$api.payment.pay_buy_huodao,
  584. data: {
  585. id: this.$store.state.payment.id,
  586. },
  587. }).then(response => {
  588. uni.hideLoading();
  589. if (response.code === 0) {
  590. return this.$store.state.payment.resolve({
  591. errMsg: '支付成功',
  592. });
  593. } else {
  594. return this.$store.state.payment.reject({
  595. errMsg: response.msg,
  596. });
  597. }
  598. }).catch(e => {
  599. uni.hideLoading();
  600. e.errMsg = e.msg || '';
  601. return this.$store.state.payment.reject(e);
  602. });
  603. },
  604. // #ifdef MP
  605. callPlatformPayment(data) {
  606. console.log('debug payment, callPlatformPayment 1,', this.$store.state.payment.resolve);
  607. let paymentProvider = null;
  608. // #ifdef MP-WEIXIN
  609. paymentProvider = ['wxpay'];
  610. // #endif
  611. // #ifdef MP-ALIPAY
  612. paymentProvider = ['alipay'];
  613. // #endif
  614. // #ifdef MP-BAIDU
  615. paymentProvider = ['baidu'];
  616. // #endif
  617. // #ifdef MP-TOUTIAO
  618. paymentProvider = ['toutiao'];
  619. // #endif
  620. uni.requestPayment({
  621. provider: paymentProvider,
  622. success: (e) => {
  623. console.log('debug payment, callPlatformPayment 3,', this.$store.state.payment
  624. .resolve);
  625. console.log('success:', e);
  626. // #ifndef MP-ALIPAY
  627. return this.$store.state.payment.resolve(e);
  628. // #endif
  629. // #ifdef MP-ALIPAY
  630. if (e.resultCode === 9000 || e.resultCode === '9000') {
  631. return this.$store.state.payment.resolve(e);
  632. } else {
  633. return this.$store.state.payment.reject({
  634. errMsg: e.memo,
  635. });
  636. }
  637. // #endif
  638. },
  639. fail: (e) => {
  640. const cancelMsgList = [
  641. 'requestPayment:fail cancel',
  642. ];
  643. if (e.errMsg && cancelMsgList.indexOf(e.errMsg) >= 0) {
  644. e.errMsg = '取消支付';
  645. }
  646. console.log('debug payment, callPlatformPayment 4,', this.$store.state.payment
  647. .resolve);
  648. console.log('fail:', e);
  649. return this.$store.state.payment.reject(e);
  650. },
  651. ...data
  652. });
  653. },
  654. // #endif
  655. // #ifdef H5
  656. alipayH5Pay() {},
  657. weChartPay(id) {
  658. this.$request({
  659. url: this.$api.registered.pay,
  660. method: 'get',
  661. data: {
  662. payment_order_union_id: id
  663. }
  664. }).then((res) => {
  665. if (res.code === 0) {
  666. if (res.data.status === 1) {
  667. this.$store.state.payment.resolve({
  668. errMsg: '支付成功',
  669. });
  670. uni.redirectTo({
  671. url: `/pages/order-submit/pay-result?payment_order_union_id=${id}`,
  672. });
  673. } else {
  674. uni.redirectTo({
  675. url: '/pages/order/index/index'
  676. });
  677. }
  678. }
  679. })
  680. }
  681. // #endif
  682. },
  683. }
  684. </script>
  685. <style scoped lang="scss">
  686. $bigPadding: #{50rpx};
  687. $smallPadding: #{25rpx};
  688. $middlePadding: #{30rpx};
  689. $smallFont: #{24rpx};
  690. $lineWidth: #{1rpx};
  691. $modalWidth: #{600rpx};
  692. $iconWidth: #{60rpx};
  693. .app-payment {
  694. background: rgba(0, 0, 0, .5);
  695. position: fixed;
  696. z-index: 2000;
  697. left: 0;
  698. top: 0;
  699. width: 100%;
  700. height: 100%;
  701. visibility: hidden;
  702. opacity: 0;
  703. transition: 150ms;
  704. .modal {
  705. background: #fff;
  706. width: $modalWidth;
  707. border-radius: #{15rpx};
  708. .title {
  709. text-align: center;
  710. padding: $middlePadding;
  711. border-bottom: $lineWidth solid #e2e2e2;
  712. position: relative;
  713. }
  714. .cancel {
  715. position: absolute;
  716. right: 0;
  717. top: 0;
  718. padding: $middlePadding;
  719. image {
  720. width: #{36rpx};
  721. height: #{36rpx};
  722. }
  723. }
  724. .pay-amount {
  725. text-align: center;
  726. padding: $bigPadding;
  727. font-weight: bolder;
  728. }
  729. .pay-type-list {
  730. padding: 0 $bigPadding;
  731. }
  732. .pay-type-item {
  733. border-bottom: $lineWidth solid #e2e2e2;
  734. padding: $smallPadding 0;
  735. .pay-type-icon {
  736. width: $iconWidth;
  737. height: $iconWidth;
  738. margin-right: $smallPadding;
  739. }
  740. .pay-type-desc {
  741. color: #909090;
  742. font-size: $smallFont;
  743. }
  744. }
  745. .pay-type-item:last-child {
  746. border-bottom: none;
  747. }
  748. .footer {
  749. padding: $bigPadding;
  750. }
  751. }
  752. }
  753. .app-payment.show {
  754. visibility: visible;
  755. opacity: 1;
  756. }
  757. .into-modal {
  758. background: rgba(0, 0, 0, .5);
  759. position: fixed;
  760. z-index: 2100;
  761. left: 0;
  762. top: 0;
  763. width: 100%;
  764. height: 100%;
  765. opacity: 1;
  766. transition: 150ms;
  767. .password-tip {
  768. width: #{630rpx};
  769. height: #{340rpx};
  770. position: relative;
  771. border-radius: #{16rpx};
  772. background-color: #fff;
  773. .password-content {
  774. height: #{240rpx};
  775. width: 100%;
  776. color: #353535;
  777. }
  778. .password-btn {
  779. position: absolute;
  780. bottom: 0;
  781. left: 0;
  782. width: 100%;
  783. color: #666666;
  784. height: #{88rpx};
  785. border-top: #{2rpx} solid #e2e2e2;
  786. >view {
  787. width: 50%;
  788. text-align: center;
  789. height: #{88rpx};
  790. line-height: #{88rpx};
  791. }
  792. .line {
  793. width: #{2rpx};
  794. height: #{32rpx};
  795. background-color: #e2e2e2;
  796. }
  797. }
  798. }
  799. .password-view {
  800. position: relative;
  801. width: #{560rpx};
  802. height: #{300rpx};
  803. border-radius: #{16rpx};
  804. background-color: #fff;
  805. margin-top: #{-200rpx};
  806. .password-close {
  807. position: absolute;
  808. top: #{29rpx};
  809. right: #{28rpx};
  810. width: #{30rpx};
  811. height: #{30rpx};
  812. z-index: 2101;
  813. }
  814. .password-title {
  815. height: #{140rpx};
  816. line-height: #{140rpx};
  817. text-align: center;
  818. margin-bottom: #{128rpx};
  819. }
  820. .password-button {
  821. padding: 0 #{60rpx};
  822. position: relative;
  823. z-index: 2101;
  824. }
  825. input {
  826. position: absolute;
  827. top: -300%;
  828. width: #{475rpx};
  829. height: #{78rpx};
  830. margin: 0 auto;
  831. z-index: 9999;
  832. }
  833. .input {
  834. top: #{144rpx};
  835. height: #{70rpx};
  836. left: #{42.5rpx};
  837. color: #fff;
  838. font-size: #{1rpx};
  839. background-color: transparent;
  840. opacity: 0;
  841. }
  842. .passoword-input {
  843. position: absolute;
  844. background-color: #fff;
  845. top: #{140rpx};
  846. left: 0;
  847. width: 100%;
  848. z-index: 2101;
  849. .password-item {
  850. border: #{2rpx} solid #e2e2e2;
  851. margin-left: #{-2rpx};
  852. height: #{78rpx};
  853. width: #{78rpx};
  854. .password-placeholder {
  855. width: #{24rpx};
  856. height: #{24rpx};
  857. border-radius: 50%;
  858. background-color: #353535;
  859. }
  860. }
  861. }
  862. }
  863. }
  864. </style>