index.vue 37 KB

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