index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  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" v-if="Number(currencyInfoData.balance) < Number(salePlans.price)"></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">{{ Number(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: (Number(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. let price = Number(this.salePlans.price) > Number(this.currencyInfoData.balance) ? Number(this.salePlans.price) - Number(this.currencyInfoData.balance) : Number(this.salePlans.price)
  501. if (this.salePlans.currencyInfo?.contractAddress) {
  502. // 代币
  503. url = maskUrl({
  504. target_address: this.salePlans.currencyInfo.contractAddress,
  505. parameters: {
  506. address: this.rechargeAddress,
  507. uint256: `${price}e${this.salePlans.currencyInfo?.decimalLength || 18}`
  508. }
  509. }, false)
  510. } else {
  511. // 主币
  512. url = maskUrl({
  513. target_address: this.rechargeAddress,
  514. parameters: {
  515. value: `${price}e${this.salePlans.currencyInfo?.decimalLength || 18}`
  516. }
  517. })
  518. }
  519. this.maskUrlLink = url;
  520. },
  521. goNext() {
  522. this.$router.push({
  523. path: `/nft/${this.$route.query.nftProjectId}/${this.$route.query.account}/show`,
  524. })
  525. },
  526. pay() {
  527. if (this.payDisabled || Number(this.currencyInfoData.balance) < Number(this.salePlans.price)) return;
  528. this.payDisabled = true;
  529. postRequest(Api.payNftMysteryBoxWithBalance, {
  530. params: {
  531. nftProjectId: this.$route.query.nftProjectId,
  532. salePlanId: this.salePlans.salePlanId,
  533. }
  534. }).then(res => {
  535. let { code, data } = res;
  536. if (code == 0) {
  537. if (data && data.buyItems.length > 0) {
  538. this.buyData = data.buyItems[0];
  539. }
  540. // 购买成功
  541. this.step = 4;
  542. } else {
  543. this.payError(code)
  544. }
  545. }).finally(() => {
  546. this.payDisabled = false;
  547. })
  548. },
  549. payUSD() {
  550. if (Number(this.usdAmountData.rechargeAmountValue) <= 0) {
  551. this.pay()
  552. }
  553. },
  554. payToken() {
  555. if (Number(this.currencyInfoData.balance) >= Number(this.salePlans.price)) {
  556. this.pay()
  557. }
  558. },
  559. payError(code) {
  560. let msg;
  561. switch (code.toString()) {
  562. case '5001':
  563. msg = 'nft project not exist'
  564. break;
  565. case '5002':
  566. msg = 'nft project not available'
  567. break
  568. case '5101':
  569. msg = 'nft sale plan not exist'
  570. break
  571. case '5102':
  572. msg = 'nft sold out'
  573. break
  574. case '5103':
  575. msg = 'Purchase limit reached'
  576. break
  577. case '5104':
  578. case '5105':
  579. case '5106':
  580. msg = 'Invalid redemption code'
  581. break;
  582. default:
  583. msg = 'Invalid redemption code, please try again'
  584. break;
  585. }
  586. // Dialog
  587. Dialog({
  588. message: msg,
  589. confirmButtonText: 'OK',
  590. confirmButtonColor: '#1D9BF0',
  591. });
  592. },
  593. deNetPay() {
  594. if (!this.salePlans) return;
  595. let where;
  596. if (this.salePlans.currencyCode === 'USD') {
  597. where = Number(this.usdAmountData.rechargeAmountValue) > 0
  598. } else {
  599. where = Number(this.salePlans.price) > Number(this.currencyInfoData.balance)
  600. }
  601. if (where) {
  602. // 余额不够
  603. this.step = 3;
  604. this.currencyInfoTimer();
  605. } else {
  606. // 余额足够
  607. this.step = 2;
  608. }
  609. },
  610. maskPay() {
  611. if (Number(this.salePlans.price) > Number(this.currencyInfoData.balance)) {
  612. this.step = 2;
  613. this.waitRefresh = true;
  614. this.currencyInfoTimer();
  615. Dialog({
  616. message: `Was the pament successful?`,
  617. showCancelButton: true,
  618. confirmButtonText: 'YES',
  619. confirmButtonColor: '#1D9BF0',
  620. cancelButtonText: 'NO',
  621. cancelButtonColor: '#1D9BF0',
  622. }).then(() => {
  623. this.checkWaitInfo()
  624. }).catch(() => {
  625. this.checkWaitInfo()
  626. });
  627. } else {
  628. this.step = 2;
  629. }
  630. },
  631. achPay(modifyStep = true) {
  632. if (Number(this.usdAmountData.rechargeAmountValue) > 0) {
  633. if (modifyStep) {
  634. this.step = 2;
  635. }
  636. this.waitRefresh = true;
  637. this.currencyInfoTimer();
  638. Dialog({
  639. message: `Was the pament successful?`,
  640. showCancelButton: true,
  641. confirmButtonText: 'YES',
  642. confirmButtonColor: '#1D9BF0',
  643. cancelButtonText: 'NO',
  644. cancelButtonColor: '#1D9BF0',
  645. }).then(() => {
  646. this.checkWaitInfo()
  647. }).catch(() => {
  648. this.checkWaitInfo()
  649. });
  650. this.$nextTick(() => {
  651. let win = window.open();
  652. win.opener = null;
  653. win.location.href = `${location.protocol}//${location.host}/payment_ach/${this.usdAmountData.rechargeAmountValue}`;
  654. this.achTimer = setInterval(() => {
  655. console.log('pay')
  656. if (win && win.closed) {
  657. console.log('done')
  658. clearInterval(this.achTimer);
  659. }
  660. }, 500);
  661. })
  662. } else {
  663. if (modifyStep) {
  664. this.step = 2;
  665. }
  666. }
  667. },
  668. }
  669. }
  670. </script>
  671. <style lang="scss">
  672. html,
  673. body,
  674. #__nuxt,
  675. #__layout {
  676. width: 100%;
  677. height: 100%;
  678. padding: 0;
  679. margin: 0;
  680. overflow: hidden;
  681. }
  682. .payment {
  683. width: 100%;
  684. height: 100%;
  685. }
  686. .moneyInfo {
  687. display: flex;
  688. align-items: center;
  689. justify-content: center;
  690. flex-direction: column;
  691. height: 90px;
  692. border-bottom: solid 8px rgba($color: #f5f5f5, $alpha: .6);
  693. .tips {
  694. font-size: 12px;
  695. font-weight: 500;
  696. }
  697. .money {
  698. display: flex;
  699. align-items: center;
  700. justify-content: center;
  701. margin-top: 10px;
  702. .icon {
  703. overflow: hidden;
  704. width: 26px;
  705. height: 26px;
  706. border-radius: 50%;
  707. margin-right: 10px;
  708. vertical-align: middle;
  709. background-color: #f5f5f5;
  710. }
  711. .info {
  712. color: #000;
  713. font-size: 20px;
  714. font-weight: 700;
  715. &.usd {
  716. margin-top: -5px;
  717. }
  718. }
  719. }
  720. }
  721. .payList {
  722. overflow-y: auto;
  723. height: calc(100% - 90px);
  724. .detail {
  725. padding: 18px 16px;
  726. .title {
  727. color: #ADADAD;
  728. height: 26px;
  729. font-size: 12px;
  730. font-weight: 500;
  731. }
  732. .item {
  733. position: relative;
  734. display: flex;
  735. align-items: center;
  736. justify-content: center;
  737. font-weight: 500;
  738. font-size: 16px;
  739. height: 50px;
  740. margin-bottom: 14px;
  741. border-radius: 100px;
  742. border: 1px solid #ECECEC;
  743. &:last-child {
  744. margin-bottom: 0;
  745. }
  746. img {
  747. width: 24px;
  748. height: 24px;
  749. margin-right: 4px;
  750. }
  751. &.denet {
  752. flex-direction: column;
  753. img {
  754. margin-top: -6px;
  755. }
  756. }
  757. .wallet {
  758. width: 100%;
  759. overflow: hidden;
  760. color: #ADADAD;
  761. font-size: 11px;
  762. text-align: center;
  763. margin-top: -2px;
  764. }
  765. .maskLink {
  766. position: absolute;
  767. z-index: 10;
  768. width: 100%;
  769. height: 100%;
  770. }
  771. }
  772. }
  773. }
  774. .loading {
  775. position: absolute;
  776. z-index: 3;
  777. display: flex;
  778. align-items: center;
  779. justify-content: center;
  780. top: 0;
  781. left: 0;
  782. width: 100%;
  783. height: 100%;
  784. }
  785. .loadingBg {
  786. position: absolute;
  787. z-index: 2;
  788. top: 0;
  789. left: 0;
  790. width: 100%;
  791. height: 100%;
  792. background-color: rgba($color: #000, $alpha: .1);
  793. }
  794. .redeem {
  795. padding: 18px 16px 38px;
  796. .tips {
  797. height: 31px;
  798. font-size: 15px;
  799. font-weight: 500;
  800. }
  801. .footer {
  802. display: flex;
  803. justify-content: space-between;
  804. .input {
  805. display: flex;
  806. align-items: center;
  807. justify-content: center;
  808. width: calc(100% - 93px);
  809. height: 45px;
  810. border-radius: 5px;
  811. border: 1px solid #E0E0E0;
  812. input {
  813. width: 94%;
  814. border: 0;
  815. outline: 0;
  816. }
  817. }
  818. .enter {
  819. width: 83px;
  820. height: 45px;
  821. border: 0;
  822. color: #ffffff;
  823. font-size: 17px;
  824. font-weight: 500;
  825. border-radius: 5px;
  826. background: #1D9BF0;
  827. &.disabled {
  828. background: #DEDEDE;
  829. }
  830. }
  831. }
  832. }
  833. .payInfo {
  834. width: 100%;
  835. height: calc(100% - 88px);
  836. .picShow {
  837. padding: 54px 48px;
  838. .tip {
  839. height: 44px;
  840. font-size: 18px;
  841. font-weight: 600;
  842. text-align: center;
  843. }
  844. .pic {
  845. width: 280px;
  846. height: 280px;
  847. border-radius: 3px;
  848. margin-bottom: 20px;
  849. }
  850. .name {
  851. font-size: 18px;
  852. font-weight: 600;
  853. line-height: 21px;
  854. text-align: center;
  855. }
  856. }
  857. }
  858. .payBtn {
  859. padding: 0 16px 38px;
  860. .btn {
  861. width: 100%;
  862. height: 50px;
  863. color: #FFFFFF;
  864. font-size: 18px;
  865. font-weight: 700;
  866. border-radius: 50px;
  867. background: #1D9BF0;
  868. }
  869. }
  870. .balanceTop {
  871. display: flex;
  872. align-items: center;
  873. justify-content: center;
  874. flex-direction: column;
  875. height: calc(100% - 100px);
  876. background-color: #f5f5f5;
  877. .balance {
  878. width: 66px;
  879. height: 66px;
  880. margin-bottom: 6px;
  881. }
  882. .text {
  883. font-size: 15px;
  884. font-weight: 500;
  885. line-height: 18px;
  886. color: #9D9D9D;
  887. }
  888. .money {
  889. font-size: 22px;
  890. font-weight: 700;
  891. line-height: 26px;
  892. margin-top: 6px;
  893. .icon {
  894. width: 22px;
  895. height: 22px;
  896. margin-right: 6px;
  897. }
  898. .font {
  899. color: #000;
  900. }
  901. }
  902. }
  903. .balanceInfo {
  904. overflow-y: auto;
  905. height: calc(100% - 100px);
  906. background-color: #f5f5f5;
  907. .top {
  908. padding: 0 16px 17px 16px;
  909. background-color: #ffffff;
  910. .item {
  911. display: flex;
  912. align-items: center;
  913. height: 54px;
  914. border-bottom: solid 1px #F2F2F2;
  915. &.title {
  916. font-size: 16px;
  917. font-weight: 600;
  918. line-height: 19px;
  919. img {
  920. width: 26px;
  921. height: 26px;
  922. margin-right: 6px;
  923. }
  924. }
  925. &.column {
  926. color: rgba($color: #5E5E5E, $alpha: .7);
  927. font-size: 14px;
  928. font-weight: 400;
  929. .l {
  930. width: 70px;
  931. }
  932. .r {
  933. img {
  934. width: 21px;
  935. height: 21px;
  936. margin-right: 4px;
  937. }
  938. span {
  939. color: rgba($color: #5E5E5E, $alpha: .7);
  940. }
  941. }
  942. }
  943. &.usd {
  944. font-size: 14px;
  945. font-weight: 500;
  946. justify-content: space-between;
  947. .fontPayment {
  948. font-size: 18px;
  949. font-weight: 600;
  950. }
  951. .font {
  952. color: #9A9A9A;
  953. font-size: 16px;
  954. font-weight: 500;
  955. }
  956. .fontDeposit {
  957. color: #1D9BF0;
  958. font-size: 18px;
  959. font-weight: 600;
  960. }
  961. }
  962. }
  963. .deposit {
  964. display: flex;
  965. align-items: center;
  966. justify-content: center;
  967. height: 54px;
  968. color: #ffffff;
  969. font-weight: 600;
  970. font-size: 18px;
  971. margin-top: 16px;
  972. border-radius: 54px;
  973. background: #1D9BF0;
  974. }
  975. .address {
  976. color: rgba($color: #5E5E5E, $alpha: .7);
  977. .title {
  978. height: 42px;
  979. font-size: 14px;
  980. font-weight: 400;
  981. line-height: 42px;
  982. }
  983. }
  984. .notice {
  985. display: flex;
  986. justify-content: space-between;
  987. padding: 10px;
  988. margin-top: 12px;
  989. border-radius: 8px;
  990. background: #F9F6EE;
  991. .icon {
  992. width: 20px;
  993. margin-right: 10px;
  994. img {
  995. width: 20px;
  996. height: 20px;
  997. }
  998. }
  999. .text {
  1000. flex: 1;
  1001. color: rgba($color: #5E5E5E, $alpha: .7);
  1002. font-size: 14px;
  1003. font-weight: 400;
  1004. line-height: 19px;
  1005. word-break: break-all;
  1006. strong {
  1007. color: #FF0000;
  1008. font-weight: bold;
  1009. }
  1010. }
  1011. }
  1012. }
  1013. .line {
  1014. height: 8px;
  1015. }
  1016. .balance {
  1017. display: flex;
  1018. align-items: center;
  1019. padding: 0 16px;
  1020. height: 54px;
  1021. background-color: #ffffff;
  1022. .icon {
  1023. width: 24px;
  1024. margin-right: 6px;
  1025. img {
  1026. width: 24px;
  1027. }
  1028. }
  1029. .text {
  1030. flex: 1;
  1031. font-size: 14px;
  1032. font-weight: 500;
  1033. line-height: 17px;
  1034. span {
  1035. color: #000;
  1036. margin-right: auto;
  1037. }
  1038. }
  1039. .refresh {
  1040. width: 24px;
  1041. height: 24px;
  1042. img {
  1043. width: 24px;
  1044. transform-origin: center center;
  1045. }
  1046. }
  1047. }
  1048. }
  1049. .balanceBot {
  1050. display: flex;
  1051. justify-content: space-between;
  1052. width: 100%;
  1053. padding: 17px 16px 38px;
  1054. border-top: solid 1px #ECECEC;
  1055. .l {
  1056. display: flex;
  1057. flex-direction: column;
  1058. justify-content: center;
  1059. }
  1060. .neet {
  1061. font-size: 12px;
  1062. font-weight: 500;
  1063. line-height: 14px;
  1064. }
  1065. .money {
  1066. height: 22px;
  1067. line-height: 22px;
  1068. font-size: 18px;
  1069. font-weight: 700;
  1070. margin-top: 4px;
  1071. .text {
  1072. color: #000;
  1073. margin-right: auto;
  1074. }
  1075. }
  1076. .btn {
  1077. display: flex;
  1078. align-items: center;
  1079. justify-content: center;
  1080. width: 140px;
  1081. height: 46px;
  1082. color: #ffffff;
  1083. font-size: 18px;
  1084. font-weight: 700;
  1085. line-height: 21px;
  1086. border-radius: 46px;
  1087. background: #1D9BF0;
  1088. &.disabled {
  1089. background: #D2D2D2;
  1090. }
  1091. }
  1092. }
  1093. .waitFont {
  1094. margin-top: 16px;
  1095. padding: 0 20px;
  1096. font-size: 14px;
  1097. font-weight: 500;
  1098. line-height: 17px;
  1099. text-align: center;
  1100. }
  1101. .waitBtn {
  1102. display: flex;
  1103. align-items: center;
  1104. justify-content: center;
  1105. width: 50px;
  1106. height: 50px;
  1107. margin: 50px auto 0;
  1108. border-radius: 50%;
  1109. background-color: #ffffff;
  1110. img {
  1111. width: 24px;
  1112. height: 24px;
  1113. }
  1114. }
  1115. .icon-refresh-rotate {
  1116. transform: rotate(360deg);
  1117. transition-duration: 1s;
  1118. }
  1119. </style>