index.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <template>
  2. <div class="payment">
  3. <!-- 选择支付方式 -->
  4. <template v-if="step === 1">
  5. <div class="moneyInfo">
  6. <div class="tips">You Neet to Pay</div>
  7. <div class="money" v-if="salePlans">
  8. <FontZoom width="320">
  9. <template v-if="salePlans && salePlans.currencyCode && salePlans.currencyCode !== 'USD'">
  10. <img class="icon" :src="salePlans.currencyInfo.iconPath" /><span class="info"> {{ salePlans.price }} {{ salePlans.currencyInfo.tokenSymbol }} (${{salePlans.usdPrice}})</span>
  11. </template>
  12. <template v-else>
  13. <span class="info usd">${{salePlans.usdPrice}}</span>
  14. </template>
  15. </FontZoom>
  16. </div>
  17. </div>
  18. <div class="payList">
  19. <div class="detail" v-if="salePlans && salePlans.currencyCode && salePlans.currencyCode !== 'USD'">
  20. <div class="title">Crypto Wallet</div>
  21. <div class="item denet" @click="deNetPay">
  22. <div>
  23. <img src="../../static/payment/icon_wallet.png" />
  24. <span>DeNet Pay</span>
  25. </div>
  26. <div class="wallet">
  27. Balance:{{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}
  28. </div>
  29. </div>
  30. <div class="item" @click="maskPay">
  31. <a class="maskLink" :href="maskUrlLink"></a>
  32. <img src="../../static/payment/icon_meta_mask.png" />
  33. <span>MetaMask</span>
  34. </div>
  35. </div>
  36. <div class="detail" v-if="salePlans && salePlans.currencyCode && salePlans.currencyCode === 'USD'">
  37. <div class="title">Credit/Debit Card</div>
  38. <div class="item denet" @click="deNetPay">
  39. <div>
  40. <img src="../../static/payment/icon_wallet.png" />
  41. <span>DeNet Pay</span>
  42. </div>
  43. <div class="wallet">
  44. Balance:{{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}
  45. </div>
  46. </div>
  47. <div class="item" @click="achPay">
  48. <img src="../../static/payment/icon_master_card.png" />
  49. <span>MasterCard</span>
  50. </div>
  51. <div class="item" @click="achPay">
  52. <img src="../../static/payment/icon_visa.png" />
  53. <span>VISA</span>
  54. </div>
  55. </div>
  56. <div class="detail">
  57. <div class="title">Redemption Code</div>
  58. <div class="item" @click="showRedeem">
  59. <img src="../../static/payment/icon_enter_code.png" />
  60. <span>Enter Code</span>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <!-- 余额足够 -->
  66. <template v-else-if="step === 2">
  67. <div class="balanceTop">
  68. <img class="balance" src="../../static/img/icon_balance.svg" />
  69. <div class="text">Balance</div>
  70. <div class="money">
  71. <FontZoom width="320">
  72. <img class="icon" :src="currencyInfoData.iconPath" /> <span class="font">{{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}</span>
  73. </FontZoom>
  74. </div>
  75. <template v-if="waitRefresh">
  76. <div class="waitFont">It may take some time to credit the funds into your account.</div>
  77. <div
  78. @click="checkWaitInfo"
  79. class="waitBtn">
  80. <img :class="{ 'icon-refresh-rotate': refreshRotate }" src="../../static/img/icon_refresh.svg" />
  81. </div>
  82. </template>
  83. </div>
  84. <div class="balanceBot">
  85. <div class="l">
  86. <div class="neet">You Neet to Pay</div>
  87. <div class="money">
  88. <FontZoom width="190">
  89. <span class="text">{{salePlans.price}} {{ salePlans.currencyInfo.tokenSymbol }}</span>
  90. </FontZoom>
  91. </div>
  92. </div>
  93. <div>
  94. <div
  95. class="btn"
  96. :class="{ disabled: (Number(currencyInfoData.balance) < Number(salePlans.price)) || payDisabled }"
  97. @click="pay">
  98. Pay Now
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <!-- 余额不足 -->
  104. <template v-else-if="step === 3">
  105. <template v-if="salePlans && salePlans.currencyCode && salePlans.currencyCode !== 'USD'">
  106. <div class="balanceInfo">
  107. <div class="top">
  108. <div class="item title">
  109. <img src="../../static/img/icon_deposit.png" />
  110. <span>Deposit to Buy</span>
  111. </div>
  112. <div class="item column">
  113. <div class="l">Deposit</div>
  114. <div class="r">
  115. <FontZoom width="260">
  116. <img :src="currencyInfoData.iconPath" />
  117. <span>{{ salePlans.price - currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}</span>
  118. </FontZoom>
  119. </div>
  120. </div>
  121. <div class="item column">
  122. <div class="l">Network</div>
  123. <div class="r">
  124. <FontZoom width="260">
  125. <img :src="currencyInfoData.chainInfo.iconPath" />
  126. <span>{{ currencyInfoData.chainInfo.chainName }}</span>
  127. </FontZoom>
  128. </div>
  129. </div>
  130. <div class="address">
  131. <div class="title">Address</div>
  132. <QrCode :tokenChain="currencyInfoData.tokenChain" :rechargeAddress="rechargeAddress"></QrCode>
  133. </div>
  134. <div class="notice">
  135. <div class="icon"><img src="../../static/img/icon_warning.svg" /></div>
  136. <div class="text">Make sure you also selected <Br/><strong>{{ currencyInfoData.chainInfo.chainName }}</strong> <br/>as the Network on the platform where you are withdrawing funds for this deposiit. Otherwise, you'll lose your assets.</div>
  137. </div>
  138. </div>
  139. <div class="line"></div>
  140. <div class="balance">
  141. <div class="icon">
  142. <img src="../../static/img/icon_balance_blue.svg" />
  143. </div>
  144. <div class="text">
  145. <FontZoom width="260">
  146. <span>Balance: {{ currencyInfoData.balance }} {{ currencyInfoData.tokenSymbol }}</span>
  147. </FontZoom>
  148. </div>
  149. <div
  150. class="refresh"
  151. @click="checkCurrencyInfo">
  152. <img :class="{ 'icon-refresh-rotate': refreshRotate }" src="../../static/img/icon_refresh.svg" />
  153. </div>
  154. </div>
  155. </div>
  156. <div class="balanceBot">
  157. <div class="l">
  158. <div class="neet">You Neet to Pay</div>
  159. <div class="money">
  160. <FontZoom width="190">
  161. <span class="text">{{salePlans.price}} {{ salePlans.currencyInfo.tokenSymbol }}</span>
  162. </FontZoom>
  163. </div>
  164. </div>
  165. <div>
  166. <div
  167. class="btn"
  168. :class="{ disabled: (Number(currencyInfoData.balance) < Number(salePlans.price)) || payDisabled }"
  169. @click="payToken">
  170. Pay Now
  171. </div>
  172. </div>
  173. </div>
  174. </template>
  175. <template v-if="salePlans && salePlans.currencyCode && salePlans.currencyCode === 'USD'">
  176. <div class="balanceInfo">
  177. <div class="top">
  178. <div class="item usd">
  179. <div class="l">Payment amount</div>
  180. <div class="r fontPayment">${{ usdAmountData.orderAmountValue }}</div>
  181. </div>
  182. <div class="item usd">
  183. <div class="l">Balance</div>
  184. <div class="r font">${{ usdAmountData.balance }}</div>
  185. </div>
  186. <div class="item usd" v-if="Number(usdAmountData.rechargeAmountValue) > 0">
  187. <div class="l">{{ usdAmountData.feeDesc }}</div>
  188. <div class="r font">${{ usdAmountData.feeAmountValue }}</div>
  189. </div>
  190. <div class="item usd" v-if="Number(usdAmountData.rechargeAmountValue) > 0">
  191. <div class="l">Deposit Amount</div>
  192. <div class="r fontDeposit">${{ usdAmountData.rechargeAmountValue }}</div>
  193. </div>
  194. <div class="deposit" @click="achPay(false)">Deposit</div>
  195. </div>
  196. <div class="line"></div>
  197. <div class="balance">
  198. <div class="icon">
  199. <img src="../../static/img/icon_balance_blue.svg" />
  200. </div>
  201. <div class="text">Balance: ${{currencyInfoData.balance}}</div>
  202. <div
  203. class="refresh"
  204. @click="checkUsdCurrencyInfo">
  205. <img :class="{ 'icon-refresh-rotate': refreshRotate }" src="../../static/img/icon_refresh.svg" />
  206. </div>
  207. </div>
  208. </div>
  209. <div class="balanceBot">
  210. <div class="l">
  211. <div class="neet">You Neet to Pay</div>
  212. <div class="money">
  213. <FontZoom width="190">
  214. <span class="text">{{ usdAmountData.rechargeAmountValue > 0 ? usdAmountData.rechargeAmountValue : usdAmountData.orderAmountValue }} {{ salePlans.currencyInfo.tokenSymbol }}</span>
  215. </FontZoom>
  216. </div>
  217. </div>
  218. <div>
  219. <div
  220. class="btn"
  221. :class="{ disabled: (usdAmountData.rechargeAmountValue > 0) || payDisabled }"
  222. @click="payUSD">
  223. Pay Now
  224. </div>
  225. </div>
  226. </div>
  227. </template>
  228. </template>
  229. <!-- 成功支付 -->
  230. <template v-else-if="step === 4">
  231. <div class="payInfo">
  232. <div class="picShow" v-if="buyData">
  233. <div class="tip">Wow, NFT in the Mystery box is</div>
  234. <img class="pic" :src="buyData.imagePath" />
  235. <div class="name">{{buyData.nftItemName}}</div>
  236. </div>
  237. </div>
  238. <div class="payBtn">
  239. <button class="btn" @click="goNext">Done</button>
  240. </div>
  241. </template>
  242. <!-- loading -->
  243. <div class="loading" v-if="loading">
  244. <van-loading color="#1D9BF0"></van-loading>
  245. </div>
  246. <div class="loadingBg" v-if="loading"></div>
  247. <!-- redeem -->
  248. <van-popup
  249. round
  250. v-model="redeemLayer"
  251. position="bottom">
  252. <div class="redeem">
  253. <div class="tips">Enter Redemption Code</div>
  254. <div class="footer">
  255. <div class="input">
  256. <input
  257. type="text"
  258. ref="input"
  259. v-model="redeemStr"
  260. @input="textInput"
  261. @blur="textBlur"
  262. @focus="textFocus"
  263. @keydown.enter="redeemPayment" />
  264. </div>
  265. <button
  266. class="enter"
  267. :class="{ disabled: !redeemNext }"
  268. @click="redeemPayment">
  269. Redeem
  270. </button>
  271. </div>
  272. </div>
  273. </van-popup>
  274. </div>
  275. </template>
  276. <script>
  277. import FontZoom from '../../components/FontZoom.vue';
  278. import QrCode from '../../components/qrcode.vue';
  279. import { postRequest } from '../../http/index';
  280. import { maskUrl } from '../../utils/help';
  281. import { Dialog, Toast } from 'vant';
  282. import Api from '../../http/api';
  283. export default {
  284. name: 'payment',
  285. data() {
  286. return {
  287. step: 1, // 1: 支付方式列表 2: 余额支付 3: 充值支付 4: 支付完成
  288. loading: true,
  289. salePlans: null,
  290. rechargeAddress: '',
  291. redeemStr: '',
  292. redeemNext: false,
  293. redeemLayer: false,
  294. buyData: {},
  295. payDisabled: false,
  296. waitRefresh: false,
  297. refreshRotate: false,
  298. currencyInfoData: {},
  299. currencyTimer: 0,
  300. achTimer: 0,
  301. maskUrlLink: ``,
  302. usdAmountData: {},
  303. }
  304. },
  305. head() {
  306. return {
  307. title: 'Buy NFT Mystery Box',
  308. }
  309. },
  310. components: {
  311. QrCode,
  312. FontZoom,
  313. },
  314. mounted() {
  315. this.saleInfo()
  316. },
  317. beforeDestroy() {
  318. clearTimeout(this.currencyTimer);
  319. },
  320. methods : {
  321. saleInfo () {
  322. postRequest(Api.getNftMysteryBoxSaleInfo, {
  323. params: {
  324. nftProjectId: this.$route.query.nftProjectId
  325. }
  326. }).then(res => {
  327. let { code, data } = res;
  328. if (code === 0) {
  329. this.salePlans = data.salePlans[0];
  330. this.getCurrencyInfoByCode();
  331. // 获取充值地址
  332. if (this.rechargeAddress === '') {
  333. this.getAddress()
  334. }
  335. }
  336. }).finally(() => {
  337. this.loading = false;
  338. })
  339. },
  340. getCurrencyInfoByCode() {
  341. postRequest(Api.getCurrencyInfoByCode, {
  342. params: {
  343. currencyCode: this.salePlans.currencyCode
  344. }
  345. }).then(res => {
  346. let { code, data } = res;
  347. if (code === 0) {
  348. this.currencyInfoData = data;
  349. }
  350. })
  351. // 计算金额
  352. if (this.salePlans.currencyCode === 'USD') {
  353. // this.salePlans.price
  354. postRequest(Api.calcRechargePayAmount, {
  355. params: {
  356. currencyCode: this.salePlans.currencyCode,
  357. orderAmountValue: this.salePlans.price,
  358. payChannel: 'ach'
  359. }
  360. }).then(res => {
  361. let { code, data } = res;
  362. if (code === 0) {
  363. this.usdAmountData = data;
  364. }
  365. })
  366. }
  367. },
  368. getTokenRechargeRecord() {
  369. postRequest(Api.syncChainTokenRechargeRecord, {
  370. params: {
  371. currencyCode: this.salePlans.currencyCode
  372. }
  373. }).then(res => {
  374. let { code, data } = res;
  375. if (code === 0) {
  376. if (data.length > 0) {
  377. let currencyInfo = data[0];
  378. if (currencyInfo.currencyCode == this.currencyInfoData.currencyCode) {
  379. this.currencyInfoData.balance = currencyInfo.balance;
  380. }
  381. } else {
  382. this.currencyInfoData.balance = 0
  383. }
  384. }
  385. })
  386. },
  387. currencyInfoTimer() {
  388. clearTimeout(this.currencyTimer);
  389. this.currencyTimer = setTimeout(() => {
  390. this.currencyInfoTimer()
  391. this.getCurrencyInfoByCode()
  392. }, 10000);
  393. },
  394. checkUsdCurrencyInfo() {
  395. if (!this.refreshRotate) {
  396. this.refreshRotate = true;
  397. this.getCurrencyInfoByCode()
  398. setTimeout(() => {
  399. this.refreshRotate = false;
  400. }, 1000)
  401. }
  402. },
  403. checkCurrencyInfo() {
  404. if (!this.refreshRotate) {
  405. this.refreshRotate = true;
  406. this.getTokenRechargeRecord()
  407. setTimeout(() => {
  408. this.refreshRotate = false;
  409. }, 1000)
  410. }
  411. },
  412. checkWaitInfo() {
  413. if (!this.refreshRotate) {
  414. this.refreshRotate = true;
  415. if (this.salePlans.currencyCode === 'USD') {
  416. this.getCurrencyInfoByCode()
  417. } else {
  418. this.getTokenRechargeRecord()
  419. }
  420. setTimeout(() => {
  421. this.refreshRotate = false;
  422. }, 1000)
  423. }
  424. },
  425. showRedeem() {
  426. this.redeemStr = '';
  427. this.redeemLayer = true;
  428. this.$nextTick(() => {
  429. this.$refs.input.focus();
  430. })
  431. },
  432. textInput(e) {
  433. let len = 16
  434. let str = this.redeemStr.replace(/[^a-zA-Z0-9]/g, '')
  435. str = str.toUpperCase();
  436. str = str.slice(0, len);
  437. // set
  438. this.redeemStr = str;
  439. this.redeemNext = str !== '' && str.length === len;
  440. },
  441. textBlur(e) {
  442. let isiOS = !!window.navigator.userAgent.match(/\(i\[^;]+;( U;)? CPU.+Mac OS X/)
  443. if (isiOS) {
  444. setTimeout(() => {
  445. const scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0
  446. window.scrollTo(0, Math.max(scrollHeight - 1, 0))
  447. }, 100)
  448. }
  449. },
  450. textFocus(e) {
  451. let isiOS = !!window.navigator.userAgent.match(/\(i\[^;]+;( U;)? CPU.+Mac OS X/)
  452. if (isiOS) {
  453. setTimeout(() => {
  454. const scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0
  455. window.scrollTo(0, Math.max(scrollHeight - 1, 0))
  456. }, 100)
  457. }
  458. },
  459. redeemPayment() {
  460. if (!this.redeemNext) return;
  461. let params = {
  462. redeemCode: this.redeemStr,
  463. nftProjectId: this.$route.query.nftProjectId,
  464. }
  465. this.redeemNext = false;
  466. postRequest(Api.redeemNft, {
  467. params
  468. }).then(res => {
  469. let { code, data } = res;
  470. if (code === 0) {
  471. this.redeemLayer = false;
  472. if (data.length > 0) {
  473. this.buyData = data[0];
  474. }
  475. // 购买成功
  476. this.step = 4;
  477. } else {
  478. this.payError(code)
  479. }
  480. }).finally(() => {
  481. this.redeemNext = true;
  482. })
  483. },
  484. getAddress() {
  485. postRequest(Api.getTokenRechargeAddress, {
  486. params: {
  487. tokenChain: this.salePlans.currencyInfo?.tokenChain
  488. }
  489. }).then(res => {
  490. let { code, data } = res;
  491. if (code === 0) {
  492. this.rechargeAddress = data.rechargeAddress
  493. this.maskUrlToLink()
  494. }
  495. })
  496. },
  497. maskUrlToLink() {
  498. // MetaMask Link
  499. let url;
  500. if (this.salePlans.currencyInfo?.contractAddress) {
  501. // 代币
  502. url = maskUrl({
  503. target_address: this.salePlans.currencyInfo.contractAddress,
  504. parameters: {
  505. address: this.rechargeAddress,
  506. uint256: `${Number(this.salePlans.price) - Number(this.currencyInfoData.balance)}e${this.salePlans.currencyInfo?.decimalLength || 18}`
  507. }
  508. }, false)
  509. } else {
  510. // 主币
  511. url = maskUrl({
  512. target_address: this.rechargeAddress,
  513. parameters: {
  514. value: `${Number(this.salePlans.price) - Number(this.currencyInfoData.balance)}e${this.salePlans.currencyInfo?.decimalLength || 18}`
  515. }
  516. })
  517. }
  518. this.maskUrlLink = url;
  519. },
  520. goNext() {
  521. this.$router.push({
  522. path: `/nft/${this.$route.query.nftProjectId}/${this.$route.query.account}/show`,
  523. })
  524. },
  525. pay() {
  526. if (this.payDisabled || Number(this.currencyInfoData.balance) < Number(this.salePlans.price)) return;
  527. this.payDisabled = true;
  528. postRequest(Api.payNftMysteryBoxWithBalance, {
  529. params: {
  530. nftProjectId: this.$route.query.nftProjectId,
  531. salePlanId: this.salePlans.salePlanId,
  532. }
  533. }).then(res => {
  534. let { code, data } = res;
  535. if (code == 0) {
  536. if (data && data.buyItems.length > 0) {
  537. this.buyData = data.buyItems[0];
  538. }
  539. // 购买成功
  540. this.step = 4;
  541. } else {
  542. this.payError(code)
  543. }
  544. }).finally(() => {
  545. this.payDisabled = false;
  546. })
  547. },
  548. payUSD() {
  549. if (this.usdAmountData.rechargeAmountValue <= 0) {
  550. this.pay()
  551. }
  552. },
  553. payToken() {
  554. if (Number(this.currencyInfoData.balance) >= Number(this.salePlans.price)) {
  555. this.pay()
  556. }
  557. },
  558. payError(code) {
  559. let msg;
  560. switch (code.toString()) {
  561. case '5001':
  562. msg = 'nft project not exist'
  563. break;
  564. case '5002':
  565. msg = 'nft project not available'
  566. break
  567. case '5101':
  568. msg = 'nft sale plan not exist'
  569. break
  570. case '5102':
  571. msg = 'nft sold out'
  572. break
  573. case '5103':
  574. msg = 'Purchase limit reached'
  575. break
  576. case '5104':
  577. case '5105':
  578. case '5106':
  579. msg = 'Invalid redemption code'
  580. break;
  581. default:
  582. msg = 'Invalid redemption code, please try again'
  583. break;
  584. }
  585. // Dialog
  586. Dialog({
  587. message: msg,
  588. confirmButtonText: 'OK',
  589. confirmButtonColor: '#1D9BF0',
  590. });
  591. },
  592. deNetPay() {
  593. if (!this.salePlans) return;
  594. if (Number(this.salePlans.price) > Number(this.currencyInfoData.balance)) {
  595. // 余额不够
  596. this.step = 3;
  597. this.currencyInfoTimer();
  598. } else {
  599. // 余额足够
  600. this.step = 2;
  601. }
  602. },
  603. maskPay() {
  604. this.step = 2;
  605. this.waitRefresh = true;
  606. this.currencyInfoTimer();
  607. Dialog({
  608. message: `Was the pament successful?`,
  609. showCancelButton: true,
  610. confirmButtonText: 'YES',
  611. confirmButtonColor: '#1D9BF0',
  612. cancelButtonText: 'NO',
  613. cancelButtonColor: '#1D9BF0',
  614. }).then(() => {
  615. this.checkWaitInfo()
  616. }).catch(() => {
  617. this.checkWaitInfo()
  618. });
  619. },
  620. achPay(modifyStep = true) {
  621. if (modifyStep) {
  622. this.step = 2;
  623. }
  624. this.waitRefresh = true;
  625. this.currencyInfoTimer();
  626. Dialog({
  627. message: `Was the pament successful?`,
  628. showCancelButton: true,
  629. confirmButtonText: 'YES',
  630. confirmButtonColor: '#1D9BF0',
  631. cancelButtonText: 'NO',
  632. cancelButtonColor: '#1D9BF0',
  633. }).then(() => {
  634. this.checkWaitInfo()
  635. }).catch(() => {
  636. this.checkWaitInfo()
  637. });
  638. this.$nextTick(() => {
  639. let win = window.open();
  640. win.opener = null;
  641. win.location.href = `${location.protocol}//${location.host}/payment_ach/${this.usdAmountData.rechargeAmountValue}`;
  642. this.achTimer = setInterval(() => {
  643. console.log('pay')
  644. if (win && win.closed) {
  645. console.log('done')
  646. clearInterval(this.achTimer);
  647. }
  648. }, 500);
  649. })
  650. },
  651. }
  652. }
  653. </script>
  654. <style lang="scss">
  655. html,
  656. body,
  657. #__nuxt,
  658. #__layout {
  659. width: 100%;
  660. height: 100%;
  661. padding: 0;
  662. margin: 0;
  663. overflow: hidden;
  664. }
  665. .payment {
  666. width: 100%;
  667. height: 100%;
  668. }
  669. .moneyInfo {
  670. display: flex;
  671. align-items: center;
  672. justify-content: center;
  673. flex-direction: column;
  674. height: 90px;
  675. border-bottom: solid 8px rgba($color: #f5f5f5, $alpha: .6);
  676. .tips {
  677. font-size: 12px;
  678. font-weight: 500;
  679. }
  680. .money {
  681. display: flex;
  682. align-items: center;
  683. justify-content: center;
  684. margin-top: 10px;
  685. .icon {
  686. overflow: hidden;
  687. width: 26px;
  688. height: 26px;
  689. border-radius: 50%;
  690. margin-right: 10px;
  691. vertical-align: middle;
  692. background-color: #f5f5f5;
  693. }
  694. .info {
  695. color: #000;
  696. font-size: 20px;
  697. font-weight: 700;
  698. &.usd {
  699. margin-top: -5px;
  700. }
  701. }
  702. }
  703. }
  704. .payList {
  705. overflow-y: auto;
  706. height: calc(100% - 90px);
  707. .detail {
  708. padding: 18px 16px;
  709. .title {
  710. color: #ADADAD;
  711. height: 26px;
  712. font-size: 12px;
  713. font-weight: 500;
  714. }
  715. .item {
  716. position: relative;
  717. display: flex;
  718. align-items: center;
  719. justify-content: center;
  720. font-weight: 500;
  721. font-size: 16px;
  722. height: 50px;
  723. margin-bottom: 14px;
  724. border-radius: 100px;
  725. border: 1px solid #ECECEC;
  726. &:last-child {
  727. margin-bottom: 0;
  728. }
  729. img {
  730. width: 24px;
  731. height: 24px;
  732. margin-right: 4px;
  733. }
  734. &.denet {
  735. flex-direction: column;
  736. img {
  737. margin-top: -6px;
  738. }
  739. }
  740. .wallet {
  741. width: 100%;
  742. overflow: hidden;
  743. color: #ADADAD;
  744. font-size: 11px;
  745. text-align: center;
  746. margin-top: -2px;
  747. }
  748. .maskLink {
  749. position: absolute;
  750. z-index: 10;
  751. width: 100%;
  752. height: 100%;
  753. }
  754. }
  755. }
  756. }
  757. .loading {
  758. position: absolute;
  759. z-index: 3;
  760. display: flex;
  761. align-items: center;
  762. justify-content: center;
  763. top: 0;
  764. left: 0;
  765. width: 100%;
  766. height: 100%;
  767. }
  768. .loadingBg {
  769. position: absolute;
  770. z-index: 2;
  771. top: 0;
  772. left: 0;
  773. width: 100%;
  774. height: 100%;
  775. background-color: rgba($color: #000, $alpha: .1);
  776. }
  777. .redeem {
  778. padding: 18px 16px 38px;
  779. .tips {
  780. height: 31px;
  781. font-size: 15px;
  782. font-weight: 500;
  783. }
  784. .footer {
  785. display: flex;
  786. justify-content: space-between;
  787. .input {
  788. display: flex;
  789. align-items: center;
  790. justify-content: center;
  791. width: calc(100% - 93px);
  792. height: 45px;
  793. border-radius: 5px;
  794. border: 1px solid #E0E0E0;
  795. input {
  796. width: 94%;
  797. border: 0;
  798. outline: 0;
  799. }
  800. }
  801. .enter {
  802. width: 83px;
  803. height: 45px;
  804. border: 0;
  805. color: #ffffff;
  806. font-size: 17px;
  807. font-weight: 500;
  808. border-radius: 5px;
  809. background: #1D9BF0;
  810. &.disabled {
  811. background: #DEDEDE;
  812. }
  813. }
  814. }
  815. }
  816. .payInfo {
  817. width: 100%;
  818. height: calc(100% - 88px);
  819. .picShow {
  820. padding: 54px 48px;
  821. .tip {
  822. height: 44px;
  823. font-size: 18px;
  824. font-weight: 600;
  825. text-align: center;
  826. }
  827. .pic {
  828. width: 280px;
  829. height: 280px;
  830. border-radius: 3px;
  831. margin-bottom: 20px;
  832. }
  833. .name {
  834. font-size: 18px;
  835. font-weight: 600;
  836. line-height: 21px;
  837. text-align: center;
  838. }
  839. }
  840. }
  841. .payBtn {
  842. padding: 0 16px 38px;
  843. .btn {
  844. width: 100%;
  845. height: 50px;
  846. color: #FFFFFF;
  847. font-size: 18px;
  848. font-weight: 700;
  849. border-radius: 50px;
  850. background: #1D9BF0;
  851. }
  852. }
  853. .balanceTop {
  854. display: flex;
  855. align-items: center;
  856. justify-content: center;
  857. flex-direction: column;
  858. height: calc(100% - 100px);
  859. background-color: #f5f5f5;
  860. .balance {
  861. width: 66px;
  862. height: 66px;
  863. margin-bottom: 6px;
  864. }
  865. .text {
  866. font-size: 15px;
  867. font-weight: 500;
  868. line-height: 18px;
  869. color: #9D9D9D;
  870. }
  871. .money {
  872. font-size: 22px;
  873. font-weight: 700;
  874. line-height: 26px;
  875. margin-top: 6px;
  876. .icon {
  877. width: 22px;
  878. height: 22px;
  879. margin-right: 6px;
  880. }
  881. .font {
  882. color: #000;
  883. }
  884. }
  885. }
  886. .balanceInfo {
  887. overflow-y: auto;
  888. height: calc(100% - 100px);
  889. background-color: #f5f5f5;
  890. .top {
  891. padding: 0 16px 17px 16px;
  892. background-color: #ffffff;
  893. .item {
  894. display: flex;
  895. align-items: center;
  896. height: 54px;
  897. border-bottom: solid 1px #F2F2F2;
  898. &.title {
  899. font-size: 16px;
  900. font-weight: 600;
  901. line-height: 19px;
  902. img {
  903. width: 26px;
  904. height: 26px;
  905. margin-right: 6px;
  906. }
  907. }
  908. &.column {
  909. color: rgba($color: #5E5E5E, $alpha: .7);
  910. font-size: 14px;
  911. font-weight: 400;
  912. .l {
  913. width: 70px;
  914. }
  915. .r {
  916. img {
  917. width: 21px;
  918. height: 21px;
  919. margin-right: 4px;
  920. }
  921. span {
  922. color: rgba($color: #5E5E5E, $alpha: .7);
  923. }
  924. }
  925. }
  926. &.usd {
  927. font-size: 14px;
  928. font-weight: 500;
  929. justify-content: space-between;
  930. .fontPayment {
  931. font-size: 18px;
  932. font-weight: 600;
  933. }
  934. .font {
  935. color: #9A9A9A;
  936. font-size: 16px;
  937. font-weight: 500;
  938. }
  939. .fontDeposit {
  940. color: #1D9BF0;
  941. font-size: 18px;
  942. font-weight: 600;
  943. }
  944. }
  945. }
  946. .deposit {
  947. display: flex;
  948. align-items: center;
  949. justify-content: center;
  950. height: 54px;
  951. color: #ffffff;
  952. font-weight: 600;
  953. font-size: 18px;
  954. margin-top: 16px;
  955. border-radius: 54px;
  956. background: #1D9BF0;
  957. }
  958. .address {
  959. color: rgba($color: #5E5E5E, $alpha: .7);
  960. .title {
  961. height: 42px;
  962. font-size: 14px;
  963. font-weight: 400;
  964. line-height: 42px;
  965. }
  966. }
  967. .notice {
  968. display: flex;
  969. justify-content: space-between;
  970. padding: 10px;
  971. margin-top: 12px;
  972. border-radius: 8px;
  973. background: #F9F6EE;
  974. .icon {
  975. width: 20px;
  976. margin-right: 10px;
  977. img {
  978. width: 20px;
  979. height: 20px;
  980. }
  981. }
  982. .text {
  983. flex: 1;
  984. color: rgba($color: #5E5E5E, $alpha: .7);
  985. font-size: 14px;
  986. font-weight: 400;
  987. line-height: 19px;
  988. word-break: break-all;
  989. strong {
  990. color: #FF0000;
  991. font-weight: bold;
  992. }
  993. }
  994. }
  995. }
  996. .line {
  997. height: 8px;
  998. }
  999. .balance {
  1000. display: flex;
  1001. align-items: center;
  1002. padding: 0 16px;
  1003. height: 54px;
  1004. background-color: #ffffff;
  1005. .icon {
  1006. width: 24px;
  1007. margin-right: 6px;
  1008. img {
  1009. width: 24px;
  1010. }
  1011. }
  1012. .text {
  1013. flex: 1;
  1014. font-size: 14px;
  1015. font-weight: 500;
  1016. line-height: 17px;
  1017. span {
  1018. color: #000;
  1019. margin-right: auto;
  1020. }
  1021. }
  1022. .refresh {
  1023. width: 24px;
  1024. height: 24px;
  1025. img {
  1026. width: 24px;
  1027. transform-origin: center center;
  1028. }
  1029. }
  1030. }
  1031. }
  1032. .balanceBot {
  1033. display: flex;
  1034. justify-content: space-between;
  1035. width: 100%;
  1036. padding: 17px 16px 38px;
  1037. border-top: solid 1px #ECECEC;
  1038. .l {
  1039. display: flex;
  1040. flex-direction: column;
  1041. justify-content: center;
  1042. }
  1043. .neet {
  1044. font-size: 12px;
  1045. font-weight: 500;
  1046. line-height: 14px;
  1047. }
  1048. .money {
  1049. height: 22px;
  1050. line-height: 22px;
  1051. font-size: 18px;
  1052. font-weight: 700;
  1053. margin-top: 4px;
  1054. .text {
  1055. color: #000;
  1056. margin-right: auto;
  1057. }
  1058. }
  1059. .btn {
  1060. display: flex;
  1061. align-items: center;
  1062. justify-content: center;
  1063. width: 140px;
  1064. height: 46px;
  1065. color: #ffffff;
  1066. font-size: 18px;
  1067. font-weight: 700;
  1068. line-height: 21px;
  1069. border-radius: 46px;
  1070. background: #1D9BF0;
  1071. &.disabled {
  1072. background: #D2D2D2;
  1073. }
  1074. }
  1075. }
  1076. .waitFont {
  1077. margin-top: 16px;
  1078. padding: 0 20px;
  1079. font-size: 14px;
  1080. font-weight: 500;
  1081. line-height: 17px;
  1082. text-align: center;
  1083. }
  1084. .waitBtn {
  1085. display: flex;
  1086. align-items: center;
  1087. justify-content: center;
  1088. width: 50px;
  1089. height: 50px;
  1090. margin: 50px auto 0;
  1091. border-radius: 50%;
  1092. background-color: #ffffff;
  1093. img {
  1094. width: 24px;
  1095. height: 24px;
  1096. }
  1097. }
  1098. .icon-refresh-rotate {
  1099. transform: rotate(360deg);
  1100. transition-duration: 1s;
  1101. }
  1102. </style>