give-dialog.vue 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303
  1. <template>
  2. <div class="overlay" v-if="visible">
  3. <div class="content"
  4. :style="{
  5. height: dialogHeight + 'px',
  6. width: showComType != 'preview' ? '600px' : '880px'}">
  7. <div class="pop-mask"
  8. v-show="showCurrencyPop || showCurrencySelect"
  9. @click.stop="showCurrencyPop = false; showCurrencySelect=false"></div>
  10. <!-- 头部 -->
  11. <div class="head">
  12. <div class="left">
  13. <!-- 关闭按钮 -->
  14. <div class="close-btn" @click="close">
  15. <img class="icon-close"
  16. :src="require('@/assets/svg/icon-close.svg')"
  17. v-if="showComType == 'default'"/>
  18. <img class="icon-close"
  19. :src="require('@/assets/svg/icon-back.svg')"
  20. v-else/>
  21. </div>
  22. <!-- 标题 -->
  23. <div class="title">
  24. {{ currentComData[showComType]["title"] }}
  25. </div>
  26. </div>
  27. <div class="right">
  28. <!-- 更多按钮 -->
  29. <img :src="require('@/assets/svg/icon-more-l.svg')"
  30. class="more"
  31. @click="showMoreOption = true">
  32. <div class="area-option"
  33. v-if="showMoreOption"
  34. @click="showMoreOption = false">
  35. <div class="option">
  36. <div class="item" @click="goTransactionsList()">
  37. <img :src="require('@/assets/svg/icon-menu.svg')">
  38. <span>Transaction History</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- 内容 -->
  45. <div class="body">
  46. <img src="@/assets/gif/icon-guide-select.gif"
  47. class="icon-guide-select"
  48. v-if="!currentCurrencyInfo.currencyCode && showComType == 'default'">
  49. <!-- 充值组件 -->
  50. <top-up v-if="showComType == 'topUp'"
  51. :asyncIng="asyncIng"
  52. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  53. @topUpDone="topUpDone"></top-up>
  54. <!-- 表单填写容器 -->
  55. <div class="body-content" v-if="showComType != 'topUp'">
  56. <!-- 货币列表 -->
  57. <div class="currency-pop" v-show="showCurrencyPop">
  58. <currency-list
  59. ref="currencyListDom"
  60. @selectCurrency="selectCurrency"
  61. @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
  62. </div>
  63. <div class="currency-pop-select" v-show="showCurrencySelect">
  64. <currency-select
  65. ref="currencySelectDom"
  66. :list="tempCurrentCurrencyList"
  67. @selectCurrency="selectCurrencyAfter">
  68. </currency-select>
  69. </div>
  70. <div class="left" v-if="showComType != 'preview'">
  71. <div class="gift-pack-wrapper">
  72. <img class="icon"
  73. :src="require('@/assets/svg/icon-gift-pack.svg')"/>
  74. </div>
  75. <div class="bottom">
  76. </div>
  77. </div>
  78. <div class="right"
  79. :class="{'fill-right': showComType == 'preview'}">
  80. <global-tip :type="'2'"></global-tip>
  81. <div class="form-wrapper" v-if="showComType == 'default'">
  82. <img
  83. class="img-mode"
  84. :src="require('@/assets/svg/img-mode.svg')"
  85. />
  86. <!-- 金额、数量 -->
  87. <div class="form-base">
  88. <div class="item currency-select-wrapper">
  89. <div
  90. class="label currency-select"
  91. :class="{'selected': currentCurrencyInfo.currencyCode}"
  92. @click="selectCurrencyPopHandle"
  93. >
  94. <img v-if="currentCurrencyInfo.iconPath"
  95. class="icon"
  96. :src="currentCurrencyInfo.iconPath"
  97. />
  98. <div class="text">
  99. {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Select a reward'}}
  100. </div>
  101. <img
  102. class="arrow"
  103. :src="currentCurrencyInfo.currencyCode ?
  104. require('@/assets/svg/icon-form-arrow-down.svg') : require('@/assets/svg/icon-form-white-arrow-down.svg')
  105. "
  106. />
  107. </div>
  108. <input
  109. v-model="baseFormData.amountValue"
  110. placeholder="0"
  111. autofocus
  112. @input="onAmountInput"
  113. @blur="onAmountBlur"
  114. />
  115. </div>
  116. <div class="item">
  117. <div class="label">
  118. <img
  119. class="icon"
  120. :src="
  121. require('@/assets/svg/icon-winners.svg')
  122. "
  123. />
  124. Winners
  125. </div>
  126. <input
  127. v-model="baseFormData.totalCount"
  128. placeholder="0"
  129. @input="onCountInput"
  130. @blur="onCountBlur"
  131. />
  132. </div>
  133. </div>
  134. <!-- 刷新按钮、充值 -->
  135. <div class="form-base-help" v-show="currentCurrencyInfo.currencyCode">
  136. <div class="currency-operation">
  137. <div class="balance">
  138. <img
  139. :src="
  140. require('@/assets/svg/icon-balance.svg')
  141. "
  142. />
  143. Balance
  144. </div>
  145. <div class="amount">
  146. <a-tooltip :title="currentCurrencyInfo.balance">
  147. {{ getBit(currentCurrencyInfo.balance) }}
  148. </a-tooltip>
  149. <img
  150. :class="{ 'icon-refresh-rotate': refreshRotate }"
  151. @click="updateCurrencyBanlce"
  152. :src="
  153. require('@/assets/svg/icon-form-refresh.svg')
  154. "
  155. />
  156. </div>
  157. <div v-if="currentCurrencyInfo.currencyCode != 'USD'" class="top-up" @click="goTopUp">Deposit</div>
  158. </div>
  159. <div class="msg">
  160. Recommend winners 100~10000
  161. </div>
  162. </div>
  163. <div class="form-label">
  164. <div>
  165. Tasks
  166. </div>
  167. <!-- <div>
  168. <el-dropdown trigger="click">
  169. <img src="@/assets/svg/icon-add-task.svg"
  170. class="icon-add-task"
  171. v-show="formList.some(item => !item.show)">
  172. <template #dropdown>
  173. <el-dropdown-menu>
  174. <div v-for="(item, key) in formList" :key="key"
  175. @click="clickDropdown(item, key)">
  176. <el-dropdown-item style="height: 50px;width: 240px" v-if="!item.show">
  177. <img :src="item.icon" style="width: 20px; height: 20px;margin-right: 12px" />
  178. {{item.label}}
  179. </el-dropdown-item>
  180. </div>
  181. </el-dropdown-menu>
  182. </template>
  183. </el-dropdown>
  184. </div> -->
  185. </div>
  186. <!-- 转推、like、关注 -->
  187. <div class="form-require">
  188. <div
  189. v-for="(item, index) in formList"
  190. :key="index"
  191. >
  192. <div v-if="item.show" class="form-item"
  193. :class="{ 'border-hide': formList.length - 1 == index }">
  194. <div class="item-left">
  195. <div class="label">
  196. <img
  197. class="icon"
  198. :src="item.icon"
  199. />
  200. {{ item.label }}
  201. </div>
  202. <div
  203. class="control"
  204. v-if="item.nodeType == 'textarea'"
  205. >
  206. <follow-input
  207. :isAddSelf="!isBack"
  208. :atUserList="atUserList"
  209. @addUser="addFollowUser"
  210. @setUser="setFollowUser"
  211. @delUser="delFollowUser"
  212. ></follow-input>
  213. </div>
  214. <!-- join discord -->
  215. <div
  216. class="control"
  217. v-if="item.nodeType == 'input'"
  218. >
  219. <div v-if="showDiscordInvitePop"
  220. class="discord-invite-info"
  221. @click="showDiscordInvitePop = false">
  222. <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
  223. <span class="name">{{discordInviteInfo.name}}</span>
  224. </div>
  225. <input v-model="item.text"
  226. placeholder="Enter discord invite link"
  227. class="discord-address"
  228. @input="onIptDiscordAddress($event, index)"
  229. @blur="onBlurDiscordAddress($event, index)" />
  230. </div>
  231. </div>
  232. <div>
  233. <el-switch
  234. v-if="item.type > 3"
  235. v-model="item.checked"
  236. @change="formSwitchChange($event, item, index)"
  237. />
  238. <!-- <img src="@/assets/svg/icon-task-close.svg"
  239. class="icon-task-close"
  240. @click="hideTask(item, index)"> -->
  241. </div>
  242. <!--
  243. v-if="item.type == 2 || item.type == 3 || item.type == 7 || item.type == 8 || item.type == 9"
  244. <img
  245. v-if="item.type == 3"
  246. :src="
  247. require('@/assets/svg/icon-option-checked.svg')
  248. "
  249. /> -->
  250. </div>
  251. </div>
  252. </div>
  253. <!-- 机器人 -->
  254. <!-- <div class="anti-bot-wrapper">
  255. <div class="label">
  256. <img
  257. :src="
  258. require('@/assets/svg/icon-anti-bot.svg')
  259. "
  260. class="icon-bot"
  261. />
  262. Anti Bot
  263. <img
  264. :src="
  265. require('@/assets/svg/icon-beta.svg')
  266. "
  267. class="icon-beta"
  268. />
  269. <img
  270. :src="
  271. require('@/assets/svg/icon-question.svg')
  272. "
  273. class="icon-question"
  274. />
  275. </div>
  276. <el-switch v-model="openAntiBot" />
  277. </div> -->
  278. <!-- 提示 -->
  279. <ul class="tips-wrapper">
  280. <li class="row">
  281. Rewards can only be claimed after the target user completes all tasks you set.
  282. </li>
  283. <li class="row">
  284. Each user can only receive a reward once per task.
  285. </li>
  286. <li class="row">
  287. The reward will expire in 7 days once issued. Please promote it as much as possible within this period. After the experiment, the remaining rewards will be returned to your DeNet Wallet.
  288. </li>
  289. </ul>
  290. <div class="submit-btn-wrapper">
  291. <div class="submit-btn"
  292. :class="{ 'disabled-submit': iptErrMsgTxt != '' && !depositGuide }"
  293. @click="confirm">
  294. <img class="icon-loading"
  295. v-if="submitIng"
  296. :src="require('@/assets/svg/icon-btn-loading.svg')"
  297. />
  298. {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
  299. </div>
  300. </div>
  301. </div>
  302. <!-- 预览 -->
  303. <template v-else-if="showComType == 'preview'">
  304. <div class="preview">
  305. <div
  306. class="card"
  307. :class="{ center: Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) }">
  308. <div class="card-title">
  309. <img
  310. class="img"
  311. v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)"
  312. :src=" require('@/assets/subject/top-01.svg') " />
  313. <div class="font">
  314. Preview: <span>{{installStatus ? 'After' : 'Before' }}</span> DeNet Installed
  315. </div>
  316. </div>
  317. <div class="flash">
  318. <preview-card
  319. :currentCurrencyInfo="currentCurrencyInfo"
  320. :postData="publishRes"
  321. :baseFormData="baseFormData"
  322. :amountFontSize="previewFontSize"
  323. ></preview-card>
  324. </div>
  325. </div>
  326. <!-- 需充值 -->
  327. <div class="card-content" v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)">
  328. <template v-if="currentCurrencyInfo.currencyCode === 'USD'">
  329. <div class="card-title">
  330. <img class="img" :src=" require('@/assets/subject/top-02.svg') " />
  331. <div class="font">Deposit to Send Giveaway</div>
  332. </div>
  333. <div class="card-list">
  334. <div class="item">
  335. <div class="l">Giveaway Amount</div>
  336. <div class="r"></div>
  337. </div>
  338. <div class="item">
  339. <div class="l">Balance</div>
  340. <div class="r"></div>
  341. </div>
  342. <div class="item">
  343. <div class="l">Paypal charges fee ()</div>
  344. <div class="r"></div>
  345. </div>
  346. <div class="item">
  347. <div class="l">Deposit Amount</div>
  348. <div class="r"></div>
  349. </div>
  350. </div>
  351. </template>
  352. <template v-else>
  353. <div class="card-title">
  354. <img class="img" :src=" require('@/assets/subject/top-02.svg') " />
  355. <div class="font">Deposit to Send Giveaway</div>
  356. </div>
  357. <top-up2
  358. :asyncIng="asyncIng"
  359. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  360. @topUpDone="topUpDone">
  361. </top-up2>
  362. <div class="card-title">
  363. <img class="img" :src=" require('@/assets/subject/top-03.svg') " />
  364. <div class="font">Wait for the amount to arrive</div>
  365. </div>
  366. <div class="card-amount">
  367. <img class="icon" src="@/assets/subject/icon-balance.png" />
  368. <div class="con">
  369. <div class="desc">Balance</div>
  370. <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
  371. </div>
  372. <img
  373. class="refresh"
  374. :class="{ 'icon-refresh-rotate': refreshRotate }"
  375. @click="updateCurrencyBanlce"
  376. :src=" require('@/assets/svg/icon-form-refresh.svg') "
  377. />
  378. </div>
  379. </template>
  380. </div>
  381. </div>
  382. </template>
  383. <!-- paypal支付按钮 -->
  384. <div class="payment" v-show="showComType == 'preview'">
  385. <paypal-button
  386. :finalAmountData="finalAmountData"
  387. :payConfig="{
  388. paypalClientId,
  389. feeDesc: payConfig.feeDesc,
  390. paypalHtml,
  391. amount: baseFormData.amountValue,
  392. postId
  393. }"
  394. :currentCurrencyInfo="currentCurrencyInfo"
  395. @payPalFinsh="payPalFinsh"
  396. >
  397. <template v-slot:balance>
  398. <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance)">
  399. <img class="icon" src="@/assets/subject/icon-balance.png" />
  400. <div class="con">
  401. <div class="desc">Balance</div>
  402. <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
  403. </div>
  404. <img
  405. class="refresh"
  406. :class="{ 'icon-refresh-rotate': refreshRotate }"
  407. @click="updateCurrencyBanlce"
  408. :src=" require('@/assets/svg/icon-form-refresh.svg') "
  409. />
  410. </div>
  411. </template>
  412. </paypal-button>
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. <!-- 提示 -->
  419. <message-box
  420. :dialogVisible="showMessageBox"
  421. :title="messageBoxData.title"
  422. :content="messageBoxData.content"
  423. @cancel="messageBoxCancel"
  424. @confirm="messageBoxConfirm"
  425. ></message-box>
  426. </div>
  427. </template>
  428. <script setup>
  429. import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide } from "vue";
  430. import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
  431. import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
  432. import { payCalcFee, getPayConfig } from "@/http/pay";
  433. import { getFrontConfig } from "@/http/account";
  434. import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
  435. import { debounce, getBit } from "@/uilts/help"
  436. import Report from "@/log-center/log"
  437. import { ElMessage, ElLoading, ElDropdown, ElDropdownMenu, ElDropdownItem } from "element-plus";
  438. import "element-plus/es/components/message/style/css";
  439. import {create, all} from "mathjs";
  440. import messageBox from "@/view/components/message-box.vue";
  441. import currencyList from "@/view/components/currency-list.vue";
  442. import currencySelect from "@/view/components/currency-select.vue";
  443. import previewCard from "@/view/iframe/publish/components/preview-card";
  444. import followInput from "@/view/iframe/publish/components/follow-input";
  445. import paypalButton from "@/view/iframe/publish/components/paypal-button";
  446. import topUp from "@/view/iframe/publish/components/top-up.vue";
  447. import topUp2 from "@/view/iframe/publish/components/top-up2.vue";
  448. import GlobalTip from '@/view/components/global-tip.vue'
  449. const config = {
  450. number: 'BigNumber',
  451. }
  452. const math = create(all, config);
  453. //临时货币信息
  454. let tempCurrentCurrencyInfo = ref({});
  455. let tempCurrentCurrencyList = ref([]);
  456. let paypalClientId = ref("");
  457. let payConfig = ref({});
  458. let paypalHtml = ref("");
  459. let installStatus = ref(false);
  460. let timer = ref(null);
  461. provide('installStatus', installStatus)
  462. // 发布后返回的结果
  463. let publishRes = reactive({});
  464. //弹窗是否展示
  465. let visible = ref(false);
  466. //弹窗高度
  467. let dialogHeight = ref(680);
  468. // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
  469. let showComType = ref("default");
  470. let currentComData = {
  471. default: {
  472. title: "Giveaway",
  473. },
  474. preview: {
  475. title: "Giveaway",
  476. },
  477. topUp: {
  478. title: "Deposit",
  479. },
  480. };
  481. // 机器人开关
  482. let openAntiBot = ref(false);
  483. // 是否正在提交
  484. let submitIng = ref(false);
  485. // 艾特关注人列表
  486. let atUserList = ref([]);
  487. // 表单错误提示
  488. let iptErrMsgTxt = ref("Select a reward");
  489. // 是否返回
  490. let isBack = ref(false);
  491. // 展示消息提示
  492. let showMessageBox = ref(false);
  493. // 展示货币列表pop
  494. let showCurrencyPop = ref(false);
  495. let showCurrencySelect = ref(false);
  496. // 展示更多按钮下的选项
  497. let showMoreOption = ref(false);
  498. // 货币列表的dom
  499. let currencyListDom = ref('');
  500. // 刷新按钮旋转
  501. let refreshRotate = ref(false);
  502. // 预览字体大小
  503. let previewFontSize = ref(56);
  504. let postId = ref('');
  505. // 余额是否同步中
  506. let asyncIng = ref(false);
  507. // 提交按钮-充值引导提示
  508. let depositGuide = ref(false);
  509. let messageBoxData = ref({
  510. title: "",
  511. content: "",
  512. });
  513. // 真实支付金额数据
  514. let finalAmountData = ref({
  515. currencyCode: '',
  516. feeAmountValue: 0,
  517. finalAmountValue: 0,
  518. requestAmountValue: 0,
  519. });
  520. // 表单数据
  521. let baseFormData = reactive({
  522. amountCurrencyCode: '',
  523. amountValue: "",
  524. totalCount: "",
  525. });
  526. // 当前选择的货币信息
  527. let currentCurrencyInfo = ref({
  528. currencyCode: "",
  529. currencyName: "",
  530. balance: "",
  531. currencyType: "",
  532. iconPath: "",
  533. minAmount: "",
  534. tokenChain: "",
  535. tokenSymbol: "",
  536. usdEstimateBalance: ""
  537. });
  538. const discordIptErrTxt = 'Discord invite link is wrong';
  539. const discordIptEmptyErrTxt = 'Enter discord invite link';
  540. const discordIptNerverExpiresErrTxt = 'Make sure the Discord link never expires'
  541. let iptErrType = ''; //discord
  542. let formList = reactive([
  543. {
  544. label: "Follow",
  545. icon: require("@/assets/svg/icon-task-twitter.svg"),
  546. nodeType: "textarea",
  547. type: 1,
  548. text: [],
  549. checked: true,
  550. show: true
  551. },
  552. {
  553. label: "Retweet & Like",
  554. icon: require("@/assets/svg/icon-task-twitter.svg"),
  555. nodeType: "div",
  556. type: 3,
  557. checked: true,
  558. show: true
  559. },
  560. {
  561. label: "Like Tweet",
  562. icon: require("@/assets/svg/icon-task-twitter.svg"),
  563. nodeType: "div",
  564. type: 2,
  565. checked: true,
  566. show: false
  567. },
  568. {
  569. label: "Comment and Tag 3 friends",
  570. icon: require("@/assets/svg/icon-task-twitter.svg"),
  571. nodeType: "div",
  572. type: 9,
  573. checked: true,
  574. show: true
  575. },
  576. {
  577. label: "Repost to Facebook",
  578. icon: require("@/assets/svg/icon-task-facebook.svg"),
  579. nodeType: "div",
  580. text: '',
  581. type: 8,
  582. checked: true,
  583. show: true
  584. },
  585. {
  586. label: "Join Discord",
  587. icon: require("@/assets/svg/icon-discord-mini.svg"),
  588. nodeType: "input",
  589. text: '',
  590. type: 7,
  591. checked: true,
  592. show: true
  593. },
  594. ]);
  595. const discordInviteInfo = ref({});
  596. let showDiscordInvitePop = ref(false);
  597. const props = defineProps({
  598. dialogVisible: {
  599. type: Boolean,
  600. default: false,
  601. },
  602. });
  603. watch(
  604. () => props.dialogVisible,
  605. (newVal) => {
  606. console.log("watch", newVal);
  607. visible.value = newVal;
  608. if (newVal) {
  609. Report.reportLog({
  610. pageSource: Report.pageSource.publisherDialog,
  611. businessType: Report.businessType.pageView,
  612. });
  613. getLocalCurrencyInfoByCode();
  614. setTimeout(() => {
  615. setDialogHeight();
  616. }, 300);
  617. // 更新余额
  618. clearInterval(timer.value);
  619. timer.value = setInterval(() => {
  620. getCurrencyInfo({loop: true});
  621. }, 10000)
  622. } else {
  623. clearInterval(timer.value);
  624. }
  625. }
  626. );
  627. const emits = defineEmits(["close", "confirm", "payPalFinsh"]);
  628. const close = () => {
  629. if (showComType.value != "default") {
  630. showComType.value = "default";
  631. calcDomZoom();
  632. isBack.value = true;
  633. } else {
  634. initParams();
  635. emits("close", false);
  636. }
  637. };
  638. /**
  639. * 设置弹窗高度
  640. */
  641. const setDialogHeight = (resize = false) => {
  642. nextTick(() => {
  643. let clientHeight = window.innerHeight;
  644. let gapSafe = 40;
  645. console.log('resize',resize)
  646. if (dialogHeight.value > clientHeight - gapSafe) {
  647. dialogHeight.value = clientHeight - gapSafe;
  648. } else {
  649. if(resize) {
  650. dialogHeight.value = 680;
  651. }
  652. }
  653. })
  654. };
  655. const selectCurrencyPopHandle = () => {
  656. Report.reportLog({
  657. pageSource: Report.pageSource.currencySelectorPage,
  658. businessType: Report.businessType.pageView,
  659. });
  660. showCurrencyPop.value = true;
  661. nextTick(() => {
  662. if(currencyListDom.value) {
  663. currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
  664. }
  665. })
  666. }
  667. /**
  668. * 获取实际支付金额
  669. */
  670. const getPayAmount = async (amountValue) => {
  671. let res = await payCalcFee({
  672. params: {
  673. amountValue,
  674. currencyCode: currentCurrencyInfo.value.currencyCode,
  675. payChannel: 'paypal',
  676. },
  677. });
  678. if (res.code == 0) {
  679. let { finalAmountValue, feeDesc } = res.data;
  680. payConfig.value.feeDesc = feeDesc;
  681. if (finalAmountValue > 0) {
  682. finalAmountData.value = res.data;
  683. }
  684. }
  685. return res.data;
  686. };
  687. const saveDiscordGuildInfo = () => {
  688. let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
  689. //保存服务器信息
  690. Report.reportLog({
  691. pageSource: Report.pageSource.publisherDialog,
  692. businessType: Report.businessType.buttonClick,
  693. objectType: Report.objectType.saveDiscordGuildData
  694. }, {
  695. reportData: discordInviteInfo.value
  696. });
  697. if(guildId && inviteCode && inviteUrl) {
  698. saveInviteGuildInfo({
  699. params: {
  700. guildId,
  701. inviteCode,
  702. inviteUrl
  703. }
  704. })
  705. }
  706. }
  707. const confirm = () => {
  708. if(depositGuide.value) { //余额不够去充值
  709. goTopUp();
  710. return;
  711. }
  712. if (submitIng.value || iptErrMsgTxt.value) {
  713. return;
  714. }
  715. let { totalCount = 0 } = baseFormData;
  716. if (!totalCount) {
  717. return;
  718. }
  719. saveDiscordGuildInfo();
  720. submitRequest();
  721. };
  722. /**
  723. * 货币列表-选中货币
  724. */
  725. const selectCurrency = (params) => {
  726. let { currencies } = params;
  727. tempCurrentCurrencyList.value = currencies;
  728. depositGuide.value = false;
  729. if (currencies.length > 1) {
  730. showCurrencyPop.value = false;
  731. showCurrencySelect.value = true;
  732. } else {
  733. selectCurrencyAfter(currencies[0])
  734. }
  735. };
  736. const selectCurrencyAfter = (params, openWindow = true) => {
  737. tempCurrentCurrencyInfo.value = params;
  738. depositGuide.value = false;
  739. showCurrencySelect.value = false;
  740. currentCurrencyInfo.value = params;
  741. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  742. if (openWindow === false) {
  743. return
  744. };
  745. if (params.currencyCode != "USD" && params.balance < params.minAmount) {
  746. let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
  747. messageBoxBlock({
  748. title: `Whether to deposit ${tokenSymbol}`,
  749. content: `Insufficient ${tokenSymbol} balance`,
  750. });
  751. } else {
  752. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  753. showCurrencyPop.value = false;
  754. finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
  755. calcDomZoom();
  756. resetFormIpt();
  757. onIptSetErrorTxt();
  758. }
  759. }
  760. const calcDomZoom = () => {
  761. nextTick(() => {
  762. let maxWidth = 68;
  763. var textWidth = document.querySelector('.text').offsetWidth;
  764. if(textWidth > 68) {
  765. var scale = maxWidth / textWidth;
  766. document.querySelector('.text').style.zoom = scale;
  767. }
  768. })
  769. }
  770. const resetFormIpt = () => {
  771. baseFormData.amountValue = "";
  772. baseFormData.totalCount = "";
  773. }
  774. const setLocalSelectCurrencyInfo = (params = {}) => {
  775. setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
  776. }
  777. const setCurrentCurrencyListInfo = (params = {}) => {
  778. setChromeStorage({ selectCurrencyList : JSON.stringify(params)})
  779. }
  780. /**
  781. * 获取完货币列表
  782. */
  783. const setCurrentCurrencyInfo = (params) => {
  784. }
  785. const messageBoxBlock = ({ title = "", content = "" }) => {
  786. showMessageBox.value = true;
  787. messageBoxData.value.title = title;
  788. messageBoxData.value.content = content;
  789. };
  790. /**
  791. * 确定
  792. */
  793. const messageBoxConfirm = () => {
  794. showMessageBox.value = false;
  795. goTopUp();
  796. };
  797. /**
  798. * 取消
  799. */
  800. const messageBoxCancel = () => {
  801. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  802. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  803. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  804. showMessageBox.value = false;
  805. showCurrencyPop.value = false;
  806. showCurrencySelect.value = false;
  807. calcDomZoom();
  808. resetFormIpt();
  809. onIptSetErrorTxt();
  810. };
  811. /**
  812. * 去充值
  813. */
  814. const goTopUp = () => {
  815. Report.reportLog({
  816. pageSource: Report.pageSource.rechargePage,
  817. businessType: Report.businessType.pageView,
  818. });
  819. showComType.value = 'topUp';
  820. }
  821. /**
  822. * 充值done事件
  823. */
  824. const topUpDone = () => {
  825. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  826. asyncIng.value = true;
  827. depositGuide.value = false;
  828. asyncIng.value = false;
  829. showCurrencyPop.value = false;
  830. showCurrencySelect.value = false;
  831. showComType.value = 'default';
  832. calcDomZoom();
  833. onIptSetErrorTxt()
  834. asyncTokenRechRecord((res) => {
  835. if(res.code == 0 && res.data && res.data.length) {
  836. let currencyInfo = res.data[0];
  837. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  838. currentCurrencyInfo.value.balance = currencyInfo.balance;
  839. onIptSetErrorTxt()
  840. }
  841. }
  842. })
  843. }
  844. /**
  845. * 更新货币余额
  846. */
  847. const updateCurrencyBanlce = () => {
  848. if(!refreshRotate.value) {
  849. refreshRotate.value = true;
  850. setTimeout(() => {
  851. refreshRotate.value = false;
  852. }, 1000)
  853. }
  854. asyncTokenRechRecord((res) => {
  855. if(res.code == 0 && res.data && res.data.length) {
  856. let currencyInfo = res.data[0];
  857. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  858. currentCurrencyInfo.value.balance = currencyInfo.balance;
  859. }
  860. }
  861. })
  862. }
  863. /**
  864. * 同步链上交易
  865. */
  866. const asyncTokenRechRecord = (cb) => {
  867. syncChainTokenRechargeRecord({
  868. params: {
  869. currencyCode: currentCurrencyInfo.value.currencyCode
  870. }
  871. }).then(res => {
  872. cb && cb(res)
  873. })
  874. }
  875. /**
  876. * 提交表单请求
  877. */
  878. const submitRequest = async () => {
  879. let { amountValue = 0, totalCount = 0 } = baseFormData;
  880. baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
  881. // 组装提交参数
  882. let finishConditions = [];
  883. for (let i = 0; i < formList.length; i++) {
  884. let item = {};
  885. item.type = formList[i]["type"];
  886. if (item.type == 1 && atUserList.value.length) {
  887. // follow 参数
  888. let relatedUsers = atUserList.value.filter(item => item.name);
  889. item.relatedUsers = relatedUsers;
  890. finishConditions.push(item);
  891. } else if (formList[i]["type"] == 7) {
  892. // join discord
  893. if(formList[i]["checked"] && formList[i]["text"]) {
  894. item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
  895. finishConditions.push(item);
  896. }
  897. } else if (formList[i]["checked"]) {
  898. // 其余任务
  899. finishConditions.push(item);
  900. }
  901. }
  902. let receiveConditions = openAntiBot.value ? "" : [];
  903. // 提交参数
  904. let formData = {
  905. amountCurrencyCode: baseFormData.amountCurrencyCode,
  906. amountValue,
  907. totalCount,
  908. finishConditions,
  909. receiveConditions,
  910. payAmountValue: amountValue
  911. };
  912. submitIng.value = true;
  913. // 法币支付需要计算费率
  914. if(formData.amountCurrencyCode == "USD") {
  915. let payAmountRes = await getPayAmount(amountValue);
  916. formData["payAmountValue"] = payAmountRes.finalAmountValue;
  917. }
  918. let data = {
  919. params: {
  920. postBizData: JSON.stringify(formData),
  921. postSrc: 1, //1 twitter
  922. postType: 1, //1 红包
  923. },
  924. };
  925. postPublish(data).then((res) => {
  926. submitIng.value = false;
  927. if (res.code == 0) {
  928. publishRes = res.data;
  929. postId.value = res.data.postId;
  930. Report.reportLog({
  931. pageSource: Report.pageSource.previewPage,
  932. businessType: Report.businessType.pageView,
  933. });
  934. showComType.value = "preview";
  935. previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
  936. isBack.value = false;
  937. } else {
  938. console.log(res);
  939. }
  940. })
  941. .catch((err) => {
  942. console.log(err);
  943. });
  944. };
  945. const calcFontSize = (str, domWidth, maxSize) => {
  946. let lenstr = str.length;
  947. let num = parseInt(domWidth / lenstr);
  948. let fontSize = num < maxSize ? num : maxSize
  949. return fontSize;
  950. }
  951. /**
  952. * 初始化提交参数
  953. */
  954. const initParams = () => {
  955. resetFormIpt();
  956. // clear follow value
  957. atUserList.value = [];
  958. submitIng.value = false;
  959. isBack.value = false;
  960. showCurrencyPop.value = false;
  961. showCurrencySelect.value = false;
  962. openAntiBot.value = false;
  963. tempCurrentCurrencyInfo.value = {};
  964. currentCurrencyInfo.value = {};
  965. // clear discord value
  966. setDiscordIptTxt({text: ''});
  967. discordInviteInfo.value = {};
  968. };
  969. const setDiscordIptTxt = ({text}) => {
  970. const index = formList.findIndex(item => item.type == 7);
  971. formList[index]['text'] = text;
  972. }
  973. /**
  974. * 支付完成回调
  975. */
  976. const payPalFinsh = (params) => {
  977. let {payNetwork, payStatus} = params;
  978. // token 支付
  979. if(payNetwork == 'bsc') {
  980. payStatusHandle(payStatus);
  981. } else {
  982. // 法币支付
  983. let transaction = params.transaction;
  984. let loadingInstance = ElLoading.service({
  985. background: "rgba(0,0,0,.3)",
  986. });
  987. verifyPaypalResult({
  988. params: {
  989. paypalTransactionId: transaction.id,
  990. postId: publishRes.postId,
  991. paypalClientId: paypalClientId.value,
  992. },
  993. }).then((res) => {
  994. loadingInstance.close();
  995. if (res.code == 0) {
  996. if (res.data) {
  997. payStatusHandle(res.data.payStatus)
  998. }
  999. }
  1000. })
  1001. .catch(() => {
  1002. loadingInstance.close();
  1003. });
  1004. }
  1005. };
  1006. const payStatusHandle = (payStatus) => {
  1007. //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
  1008. switch (payStatus) {
  1009. case 1:
  1010. emits("payPalFinsh", { publishRes });
  1011. showComType.value = "default";
  1012. initParams();
  1013. break;
  1014. case 2:
  1015. // ElMessage({
  1016. // message: "Pay Fail",
  1017. // type: "warning",
  1018. // });
  1019. break;
  1020. case 3:
  1021. // ElMessage({
  1022. // message: "Pay Exceptions",
  1023. // type: "warning",
  1024. // });
  1025. break;
  1026. case 4:
  1027. // ElMessage({
  1028. // message: "Pay Exceptions",
  1029. // type: "warning",
  1030. // });
  1031. break;
  1032. }
  1033. }
  1034. /**
  1035. * follow组件触发新增关注人
  1036. */
  1037. const addFollowUser = (params) => {
  1038. atUserList.value.push(params);
  1039. };
  1040. const setFollowUser = (params) => {
  1041. atUserList.value[params.index]["name"] = params.name;
  1042. };
  1043. const delFollowUser = (params) => {
  1044. atUserList.value.splice(params.index, 1);
  1045. };
  1046. const onAmountInput = () => {
  1047. let val = baseFormData.amountValue;
  1048. // val = val.replace(/[^\d^\.]+/g, "");
  1049. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1050. if(val == '00') {
  1051. val = '0'
  1052. }
  1053. if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
  1054. let arr = val.split('.');
  1055. if(arr[0].startsWith('0')) {
  1056. let num = +arr[0];
  1057. val = num + '.' + arr[1];
  1058. }
  1059. }
  1060. baseFormData.amountValue = val;
  1061. setInputErrorMsg({from: 'amount', type:'input'});
  1062. return val;
  1063. };
  1064. const onCountInput = () => {
  1065. let val = baseFormData.totalCount;
  1066. if (val == 0) {
  1067. val = "";
  1068. }
  1069. // val = val.replace(/[^\d]/g, "");
  1070. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1071. baseFormData.totalCount = val;
  1072. setInputErrorMsg({from: 'count', type:'input'});
  1073. return val;
  1074. };
  1075. /**
  1076. * 金额输入失焦
  1077. */
  1078. const onAmountBlur = () => {
  1079. setInputErrorMsg({from: 'amount', type:'blur'});
  1080. };
  1081. /**
  1082. * count失焦,校验输入结果
  1083. */
  1084. const onCountBlur = () => {
  1085. setInputErrorMsg({from: 'count', type:'blur'});
  1086. };
  1087. /**
  1088. * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
  1089. */
  1090. const calcIptValue = (cb) => {
  1091. let amountValue = baseFormData.amountValue;
  1092. let totalCount = baseFormData.totalCount;
  1093. let flag = true;
  1094. if (!amountValue || !totalCount) {
  1095. return {
  1096. flag
  1097. };
  1098. }
  1099. if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
  1100. flag = false;
  1101. }
  1102. return {
  1103. flag,
  1104. count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
  1105. }
  1106. };
  1107. /**
  1108. * 设置输入提示语
  1109. */
  1110. const setInputErrorMsg = () => {
  1111. onIptSetErrorTxt();
  1112. };
  1113. /**
  1114. * 输入时 检测设置错误信息
  1115. */
  1116. const onIptSetErrorTxt = (params = {}) => {
  1117. depositGuide.value = false;
  1118. if(!currentCurrencyInfo.value.currencyCode) {
  1119. iptErrMsgTxt.value = "Select a reward"
  1120. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  1121. iptErrMsgTxt.value = "Enter an amount";
  1122. } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
  1123. iptErrMsgTxt.value = "Enter the number of winners";
  1124. } else if(+baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
  1125. let res = calcIptValue();
  1126. if (!res.flag) {
  1127. iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
  1128. } else {
  1129. iptErrMsgTxt.value = "";
  1130. if(params.actionType != 'discord_blur') {
  1131. setDiscordErrTxt({getDuildId: true});
  1132. }
  1133. }
  1134. } else {
  1135. setDiscordErrTxt({getDuildId: true}, () => {
  1136. iptErrMsgTxt.value = '';
  1137. });
  1138. }
  1139. }
  1140. /**
  1141. * 监听开关触发事件
  1142. */
  1143. const formSwitchChange = (val, params, index) => {
  1144. closeDiscordTask(val, params, index);
  1145. }
  1146. const hideTask = (params, index) => {
  1147. formList[index]['checked'] = false;
  1148. formList[index]['show'] = false;
  1149. closeDiscordTask(false, {type: 7}, index)
  1150. }
  1151. const clickDropdown = (params, index) => {
  1152. formList[index]['show'] = true;
  1153. formList[index]['checked'] = true;
  1154. }
  1155. const closeDiscordTask = (val, params, index) => {
  1156. if(params.type == 7) {
  1157. if(!val) {
  1158. //错误类型 discord 清空discord错误校验
  1159. if(iptErrType == 'discord') {
  1160. iptErrMsgTxt.value = '';
  1161. formList[index]['text'] = '';
  1162. onIptSetErrorTxt();
  1163. }
  1164. } else {
  1165. onIptSetErrorTxt();
  1166. }
  1167. }
  1168. }
  1169. /** 监听 discord 输入 */
  1170. const onIptDiscordAddress = (e, index) => {
  1171. let val = formList[index].text;
  1172. let checked = formList[index].checked;
  1173. if(val && !checked) {
  1174. checked = true;
  1175. formList[index].checked = checked;
  1176. formList[index].text = formList[index].text.replace(/\s/g,'');
  1177. } else if(!val){
  1178. discordInviteInfo.value = {};
  1179. }
  1180. onIptDiscordDebounce()
  1181. }
  1182. const onBlurDiscordAddress = (e, index) => {
  1183. setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
  1184. }
  1185. const getDiscordIptData = () => {
  1186. let discordItem = formList.find(item => item.type == 7);
  1187. return discordItem;
  1188. }
  1189. /**
  1190. * 设置输入discord错误提示信息
  1191. */
  1192. const setDiscordErrTxt = (params = {showPop: false}, cb) => {
  1193. let discordData = getDiscordIptData() || {};
  1194. if(discordData.checked) {
  1195. if(discordData.text) {
  1196. let validata = checkInviteUrl(discordData.text);
  1197. if(validata) {
  1198. getDiscordInviteInfo({inviteUrl: discordData.text, getDuildId: params.getDuildId}, (res) => {
  1199. console.log('discordData',res)
  1200. // 未知的邀请链接
  1201. if(res.inviteCode != res.data.code || !res.data.guildId) {
  1202. iptErrMsgTxt.value = discordIptErrTxt;
  1203. iptErrType = 'discord';
  1204. } else {
  1205. if(res.data.expires !== null) {
  1206. // 不是永久邀请链接
  1207. iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
  1208. iptErrType = '';
  1209. } else {
  1210. if(iptErrMsgTxt.value) {
  1211. iptErrMsgTxt.value = '';
  1212. iptErrType = '';
  1213. }
  1214. if(params.showPop && res.data) {
  1215. showDiscordInvitePop.value = true;
  1216. setTimeout(() => {
  1217. showDiscordInvitePop.value = false;
  1218. }, 2000)
  1219. }
  1220. if(params.fromType == 'discord') {
  1221. onIptSetErrorTxt();
  1222. }
  1223. }
  1224. }
  1225. cb && cb(res)
  1226. })
  1227. } else {
  1228. iptErrMsgTxt.value = discordIptErrTxt;
  1229. iptErrType = 'discord';
  1230. }
  1231. } else {
  1232. if(params.actionType == 'discord_blur') {
  1233. onIptSetErrorTxt({acitonType: 'discord_blur'});
  1234. } else {
  1235. // 设置空提示
  1236. iptErrMsgTxt.value = discordIptEmptyErrTxt;
  1237. iptErrType = 'discord';
  1238. }
  1239. }
  1240. } else {
  1241. cb && cb();
  1242. }
  1243. }
  1244. const onIptDiscordDebounce = debounce(function() {
  1245. setDiscordErrTxt({fromType: 'discord', showPop: true});
  1246. }, 800)
  1247. /**
  1248. * 校验 discord邀请url
  1249. */
  1250. const checkInviteUrl = (inviteUrl) => {
  1251. let flag = false;
  1252. const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
  1253. const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
  1254. const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
  1255. const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
  1256. const INVITE_URL_PREFIX_5 = 'discord.gg/';
  1257. const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
  1258. const arr = [INVITE_URL_PREFIX_1, INVITE_URL_PREFIX_2, INVITE_URL_PREFIX_3, INVITE_URL_PREFIX_4, INVITE_URL_PREFIX_5, INVITE_URL_PREFIX_6]
  1259. if(inviteUrl) {
  1260. if(arr.indexOf(inviteUrl) > -1) {
  1261. flag = false;
  1262. } else {
  1263. let isPass = false;
  1264. for(let i = 0; i < arr.length; i++) {
  1265. let item = arr[i];
  1266. if(inviteUrl.startsWith(item)) {
  1267. isPass = true;
  1268. break;
  1269. }
  1270. }
  1271. flag = isPass;
  1272. }
  1273. }
  1274. return flag;
  1275. }
  1276. /**获取discord 邀请信息 */
  1277. const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
  1278. if(!inviteUrl) return;
  1279. let inviteCode = '';
  1280. let arr = inviteUrl.split('/');
  1281. if(arr.length > 0) {
  1282. inviteCode = arr[arr.length - 1];
  1283. }
  1284. if(!getDuildId && discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
  1285. return;
  1286. }
  1287. getInviteGuildInfo({
  1288. inviteCode
  1289. }).then(res => {
  1290. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1291. if(resData.data.guildId) {
  1292. cb && cb(resData);
  1293. } else {
  1294. //DISCORD 接口未获取到服务器信息 resdata
  1295. Report.reportLog({
  1296. pageSource: Report.pageSource.publisherDialog,
  1297. businessType: Report.businessType.buttonClick,
  1298. objectType: Report.objectType.getDiscordGuildNoData
  1299. }, {
  1300. resData: resData
  1301. });
  1302. getGuildInfoByOpenApi({inviteCode}, cb);
  1303. }
  1304. }).catch((err) => {
  1305. //DISCORD 接口 catch
  1306. Report.reportLog({
  1307. pageSource: Report.pageSource.publisherDialog,
  1308. businessType: Report.businessType.buttonClick,
  1309. objectType: Report.objectType.getDiscordGuildCatch
  1310. }, {
  1311. err: err
  1312. });
  1313. let errMsg = err;
  1314. if(typeof errMsg == 'object') {
  1315. errMsg = JSON.stringify(err);
  1316. }
  1317. if(errMsg.indexOf('code 404') > -1) {
  1318. discordInviteInfo.value = {};
  1319. iptErrMsgTxt.value = discordIptErrTxt;
  1320. } else {
  1321. getGuildInfoByOpenApi({inviteCode}, cb);
  1322. }
  1323. });
  1324. }
  1325. const getGuildInfoByOpenApi = (params, cb) => {
  1326. let { inviteCode } = params;
  1327. getInviteGuildInfoByOpenApi({
  1328. inviteCode
  1329. }).then(res => {
  1330. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1331. if(resData.data.guildId) {
  1332. cb && cb(resData);
  1333. } else {
  1334. //OPENAPI 接口未获取到服务器信息 resdata
  1335. Report.reportLog({
  1336. pageSource: Report.pageSource.publisherDialog,
  1337. businessType: Report.businessType.buttonClick,
  1338. objectType: Report.objectType.getDiscordGuildOpenApiNoData
  1339. }, {
  1340. resData: resData
  1341. });
  1342. }
  1343. }).catch((err) => {
  1344. // OPENAPI 接口 catch 限频
  1345. Report.reportLog({
  1346. pageSource: Report.pageSource.publisherDialog,
  1347. businessType: Report.businessType.buttonClick,
  1348. objectType: Report.objectType.getDiscordGuildOpenApiCatch
  1349. }, {
  1350. err: err
  1351. });
  1352. if(iptErrMsgTxt.value && iptErrType == 'discord') {
  1353. iptErrMsgTxt.value = '';
  1354. iptErrType = '';
  1355. }
  1356. });
  1357. }
  1358. const inviteGuildResHandler = (res, params) => {
  1359. let {inviteCode, inviteUrl} = params;
  1360. if(!res) {
  1361. res = {};
  1362. }
  1363. let {name, icon, id} = res.guild || {};
  1364. icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
  1365. let resData = {
  1366. inviteCode,
  1367. data: {
  1368. code: res.code,
  1369. guildId: id,
  1370. inviteUrl,
  1371. inviteCode,
  1372. expires: res.expires_at,
  1373. name,
  1374. icon,
  1375. }
  1376. }
  1377. if(res.code == inviteCode) {
  1378. discordInviteInfo.value = resData.data;
  1379. } else {
  1380. discordInviteInfo.value = {};
  1381. iptErrMsgTxt.value = discordIptErrTxt;
  1382. }
  1383. return resData;
  1384. };
  1385. /**
  1386. * 获取支付配置(paypalClientId)
  1387. */
  1388. const setPayConfig = () => {
  1389. getPayConfig({
  1390. params: {},
  1391. }).then((res) => {
  1392. if (res.code == 0) {
  1393. payConfig.value = res.data;
  1394. paypalClientId.value = res.data.paypalClientId;
  1395. }
  1396. });
  1397. };
  1398. /**
  1399. * 获取配置
  1400. */
  1401. const setFrontConfig = () => {
  1402. getFrontConfig({
  1403. params: {},
  1404. }).then((res) => {
  1405. if (res.code == 0) {
  1406. paypalHtml.value = res.data.paypalHtml;
  1407. }
  1408. });
  1409. };
  1410. const goTransactionsList = () => {
  1411. window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
  1412. }
  1413. /**
  1414. * 默认获取上次选中的货币信息
  1415. */
  1416. const getLocalCurrencyInfoByCode = () => {
  1417. if(!currentCurrencyInfo.value.currencyCode) {
  1418. getCurrencyInfo();
  1419. }
  1420. }
  1421. const getCurrencyInfo = async (_params) => {
  1422. let { loop = false} = _params || {};
  1423. let {accessToken = ''} = await getChromeStorage('userInfo') || {};
  1424. if (accessToken) {
  1425. getChromeStorage('selectCurrencyInfo', (res) => {
  1426. if(res && res.currencyCode) {
  1427. getCurrencyInfoByCode({
  1428. params: {
  1429. currencyCode: res.currencyCode
  1430. }
  1431. }).then(res => {
  1432. if(res.code == 0 && res.data) {
  1433. currentCurrencyInfo.value = res.data;
  1434. tempCurrentCurrencyInfo.value = res.data;
  1435. if(!loop) {
  1436. onIptSetErrorTxt();
  1437. }
  1438. }
  1439. });
  1440. }
  1441. })
  1442. getChromeStorage('selectCurrencyList', (res) => {
  1443. if (showCurrencySelect.value === false) {
  1444. tempCurrentCurrencyList.value = res;
  1445. }
  1446. })
  1447. }
  1448. }
  1449. onMounted(() => {
  1450. setFrontConfig();
  1451. setPayConfig();
  1452. getLocalCurrencyInfoByCode();
  1453. document.onkeydown = function (e) {
  1454. var keyNum = window.event ? e.keyCode : e.which;
  1455. let escKey = 27;
  1456. if (keyNum == escKey) {
  1457. if (visible.value) {
  1458. // close();
  1459. }
  1460. }
  1461. };
  1462. window.addEventListener('resize', function () {
  1463. setDialogHeight(true);
  1464. })
  1465. });
  1466. </script>
  1467. <style lang="scss" scoped>
  1468. .overlay {
  1469. position: fixed;
  1470. top: 0;
  1471. right: 0;
  1472. bottom: 0;
  1473. left: 0;
  1474. z-index: 1000;
  1475. height: 100%;
  1476. background-color: rgba(0, 0, 0, 0.5);
  1477. overflow: auto;
  1478. .content {
  1479. height: 620px;
  1480. background: #ffffff;
  1481. border-radius: 20px;
  1482. position: absolute;
  1483. left: 50%;
  1484. top: 50%;
  1485. transform: translate(-50%, -50%);
  1486. box-sizing: border-box;
  1487. z-index: 2000;
  1488. .pop-mask {
  1489. width: 100%;
  1490. height:100%;
  1491. position: absolute;
  1492. z-index:900;
  1493. }
  1494. .head {
  1495. border-bottom: 1px solid #ececec;
  1496. height: 48px;
  1497. box-sizing: border-box;
  1498. display: flex;
  1499. align-items: center;
  1500. justify-content: space-between;
  1501. padding: 0 14px;
  1502. .left {
  1503. display: flex;
  1504. align-items: center;
  1505. .title {
  1506. font-size: 16px;
  1507. font-weight: 500;
  1508. }
  1509. .close-btn {
  1510. display: flex;
  1511. align-items: center;
  1512. width: max-content;
  1513. margin-right: 12px;
  1514. cursor: pointer;
  1515. }
  1516. }
  1517. .right {
  1518. .more {
  1519. cursor: pointer;
  1520. }
  1521. .area-option {
  1522. width: 100%;
  1523. height: 100%;
  1524. position: absolute;
  1525. top: 0;
  1526. left: 0;
  1527. z-index: 111;
  1528. .option {
  1529. position: absolute;
  1530. top: 43px;
  1531. right: 15px;
  1532. background: #fff;
  1533. filter: drop-shadow(0px 3px 20px rgba(0, 0, 0, 0.2));
  1534. width: 240px;
  1535. border-radius: 15px;
  1536. overflow: hidden;
  1537. .item {
  1538. width: 100%;
  1539. height: 50px;
  1540. display: flex;
  1541. align-items: center;
  1542. cursor: pointer;
  1543. border-top: 1px solid #E9E9E9;
  1544. img {
  1545. margin-left: 15px;
  1546. width: 30px;
  1547. height: 30px;
  1548. margin-right: 6px;
  1549. }
  1550. span {
  1551. font-weight: 500;
  1552. font-size: 14px;
  1553. }
  1554. }
  1555. .item:first-child {
  1556. border-top: 0;
  1557. }
  1558. .item:hover {
  1559. background: #F5F5F5;
  1560. }
  1561. }
  1562. }
  1563. }
  1564. }
  1565. .body {
  1566. box-sizing: border-box;
  1567. height: calc(100% - 48px);
  1568. display: flex;
  1569. position: relative;
  1570. .icon-guide-select {
  1571. width: 40px;
  1572. position: absolute;
  1573. top: 78px;
  1574. left: 25px;
  1575. z-index: 1000;
  1576. }
  1577. .body-content {
  1578. display:flex;
  1579. width:100%;
  1580. }
  1581. .currency-pop {
  1582. position: absolute;
  1583. width: 375px;
  1584. height: 480px;
  1585. top: 85px;
  1586. left: 88px;
  1587. z-index: 1000;
  1588. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1589. background-color: #fff;
  1590. border-radius: 20px;
  1591. overflow-y: auto;
  1592. }
  1593. .currency-pop-select {
  1594. position: absolute;
  1595. width: 375px;
  1596. max-height: 480px;
  1597. top: 85px;
  1598. left: 88px;
  1599. z-index: 1000;
  1600. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1601. background-color: #fff;
  1602. border-radius: 20px;
  1603. overflow-y: scroll;
  1604. }
  1605. .left,
  1606. .right {
  1607. height: 100%;
  1608. }
  1609. .left {
  1610. width: 50px;
  1611. display: flex;
  1612. flex-direction: column;
  1613. justify-content: space-between;
  1614. align-items: center;
  1615. .gift-pack-wrapper {
  1616. width: 100%;
  1617. height: 55px;
  1618. background: #f5f5f5;
  1619. display: flex;
  1620. align-items: center;
  1621. justify-content: center;
  1622. }
  1623. .bottom {
  1624. .icon {
  1625. display: block;
  1626. margin-bottom: 26px;
  1627. }
  1628. }
  1629. }
  1630. .right {
  1631. width: calc(100% - 50px);
  1632. box-sizing: border-box;
  1633. position: relative;
  1634. border-left: 1px solid #ececec;
  1635. .form-wrapper {
  1636. padding: 0px 18px 18px 18px;
  1637. height: calc(100% - 80px);
  1638. overflow-y: auto;
  1639. overflow-x: hidden;
  1640. box-sizing: border-box;
  1641. .img-mode {
  1642. margin-left: -18px;
  1643. }
  1644. .form-base-help {
  1645. display: flex;
  1646. justify-content: space-between;
  1647. margin-top: 10px;
  1648. .currency-operation:before{
  1649. box-sizing: content-box;
  1650. width: 0px;
  1651. height: 0px;
  1652. position: absolute;
  1653. top: -16px;;
  1654. left:46px;
  1655. padding:0;
  1656. border-bottom:8px solid #FFFFFF;
  1657. border-top:8px solid transparent;
  1658. border-left:8px solid transparent;
  1659. border-right:8px solid transparent;
  1660. display: block;
  1661. content:'';
  1662. z-index: 12;
  1663. }
  1664. .currency-operation:after{
  1665. box-sizing: content-box;
  1666. width: 0px;
  1667. height: 0px;
  1668. position: absolute;
  1669. top: -18px;;
  1670. left:45px;
  1671. padding:0;
  1672. border-bottom:9px solid #EAEAEA;
  1673. border-top:9px solid transparent;
  1674. border-left:9px solid transparent;
  1675. border-right:9px solid transparent;
  1676. display: block;
  1677. content:'';
  1678. z-index:10
  1679. }
  1680. .currency-operation {
  1681. position: relative;
  1682. height: 36px;
  1683. border: 1px solid #EAEAEA;
  1684. box-sizing: border-box;
  1685. padding: 10px;
  1686. display: flex;
  1687. align-items: center;
  1688. border-radius: 100px;
  1689. .balance,
  1690. .amount {
  1691. display: flex;
  1692. align-items: center;
  1693. }
  1694. .balance {
  1695. font-weight: 400;
  1696. font-size: 13px;
  1697. img {
  1698. width: 16px;
  1699. height: 16px;
  1700. margin-right: 3px;
  1701. }
  1702. }
  1703. .amount {
  1704. font-weight: 500;
  1705. font-size: 13px;
  1706. color: #4e4e4e;
  1707. margin-left: 5px;
  1708. img {
  1709. margin-left: 5px;
  1710. cursor: pointer;
  1711. }
  1712. }
  1713. .top-up {
  1714. font-weight: 500;
  1715. font-size: 12px;
  1716. color: #ff9839;
  1717. cursor: pointer;
  1718. margin-left: 8px;
  1719. }
  1720. }
  1721. .msg {
  1722. font-weight: 400;
  1723. font-size: 12px;
  1724. color: #acacac;
  1725. }
  1726. }
  1727. .form-base {
  1728. display: flex;
  1729. justify-content: space-between;
  1730. align-items: center;
  1731. margin-top: 14px;
  1732. .item {
  1733. width: 250px;
  1734. height: 50px;
  1735. box-sizing: border-box;
  1736. border-radius: 14px;
  1737. border: 1px solid #D1D9DD;
  1738. display: flex;
  1739. align-items: center;
  1740. justify-content: space-between;
  1741. padding: 16px 14px;
  1742. input {
  1743. width: 102px;
  1744. text-align: right;
  1745. font-weight: 500;
  1746. font-size: 18px;
  1747. border: none;
  1748. outline: none;
  1749. box-sizing: border-box;
  1750. }
  1751. input::placeholder {
  1752. color: #c5c5c5;
  1753. }
  1754. .label {
  1755. font-weight: 500;
  1756. font-size: 15px;
  1757. display: flex;
  1758. align-items: center;
  1759. .icon {
  1760. width: 20px;
  1761. height: 20px;
  1762. margin-right: 8px;
  1763. }
  1764. }
  1765. }
  1766. .item:first-child {
  1767. margin-right: 14px
  1768. }
  1769. .currency-select-wrapper {
  1770. padding: 0 !important;
  1771. input {
  1772. padding-right: 14px;
  1773. }
  1774. .currency-select {
  1775. max-width: 136px;
  1776. cursor: pointer;
  1777. background: #1D9BF0;
  1778. margin-left: 6px;
  1779. padding: 6px 10px;
  1780. border-radius: 12px;
  1781. color: #fff;
  1782. .text {
  1783. white-space: nowrap;
  1784. zoom: 0.85;
  1785. }
  1786. .arrow {
  1787. margin-left: 5px;
  1788. }
  1789. }
  1790. .selected {
  1791. background: #F4F4F4 !important;
  1792. color: #000 !important;
  1793. }
  1794. }
  1795. }
  1796. .form-label {
  1797. margin-top: 14px;
  1798. margin-bottom: 10px;
  1799. font-weight: 500;
  1800. font-size: 14px;
  1801. display: flex;
  1802. align-items: center;
  1803. justify-content: space-between;
  1804. .icon-add-task {
  1805. cursor: pointer;
  1806. }
  1807. }
  1808. .form-require {
  1809. box-sizing: border-box;
  1810. border-radius: 15px;
  1811. margin-top: 12px;
  1812. border: 1px solid #D1D9DD;
  1813. .form-item {
  1814. min-height: 50px;
  1815. display: flex;
  1816. align-items: center;
  1817. justify-content: space-between;
  1818. margin: 0 16px;
  1819. border-bottom: 1px solid #ececec;
  1820. padding: 8px 0;
  1821. box-sizing: border-box;
  1822. .item-left {
  1823. display: flex;
  1824. }
  1825. .label {
  1826. min-width: 76px;
  1827. display: flex;
  1828. align-items: center;
  1829. font-size: 15px;
  1830. font-weight: 500;
  1831. .icon {
  1832. margin-right: 10px;
  1833. }
  1834. }
  1835. .control {
  1836. min-width: 258px;
  1837. margin-left: 18px;
  1838. box-sizing: border-box;
  1839. border-left: 1px solid #ECECEC;
  1840. position: relative;
  1841. .discord-address {
  1842. border: none;
  1843. outline: none;
  1844. color: #1D9BF0;
  1845. font-weight: 500;
  1846. font-size: 14px;
  1847. width: 100%;
  1848. height: 34px;
  1849. padding-left: 15px;
  1850. }
  1851. .discord-address::placeholder {
  1852. color: #c5c5c5;
  1853. }
  1854. .discord-invite-info {
  1855. position: absolute;
  1856. top: 40px;
  1857. left: 0;
  1858. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1859. background: #fff;
  1860. border-radius: 16px;
  1861. padding: 16px;
  1862. box-sizing: border-box;
  1863. display: flex;
  1864. align-items: center;
  1865. cursor: pointer;
  1866. .icon {
  1867. width: 40px;
  1868. height: 40px;
  1869. margin-right: 10px;
  1870. border-radius: 50%;
  1871. }
  1872. .name {
  1873. font-weight: 600;
  1874. font-size: 16px;
  1875. color: #101419;
  1876. width: 193px;
  1877. height: 20px;
  1878. overflow: hidden;
  1879. white-space: nowrap;
  1880. text-overflow: ellipsis;
  1881. display: inline-block;
  1882. }
  1883. }
  1884. }
  1885. .icon-task-close {
  1886. margin-left: 6px;
  1887. cursor: pointer;
  1888. }
  1889. }
  1890. .border-hide {
  1891. border-bottom: none !important;
  1892. }
  1893. }
  1894. }
  1895. .anti-bot-wrapper {
  1896. width: 100%;
  1897. height: 50px;
  1898. display: flex;
  1899. align-items: center;
  1900. justify-content: space-between;
  1901. box-sizing: border-box;
  1902. border-radius: 15px;
  1903. padding: 0 18px;
  1904. margin-top: 14px;
  1905. border: 1px solid #D1D9DD;
  1906. .label {
  1907. display: flex;
  1908. align-items: center;
  1909. font-size: 15px;
  1910. font-weight: 500;
  1911. .icon-bot {
  1912. margin-right: 8px;
  1913. }
  1914. .icon-beta {
  1915. margin-left: 5px;
  1916. margin-right: 8px;
  1917. }
  1918. .icon-question {
  1919. cursor: pointer;
  1920. }
  1921. }
  1922. }
  1923. .tips-wrapper {
  1924. margin: 16px 0 0 12px !important;
  1925. padding: 0px !important;
  1926. .title,
  1927. .row {
  1928. font-weight: 400;
  1929. font-size: 12px;
  1930. color: #A39F9F;
  1931. }
  1932. .row {
  1933. box-sizing: border-box;
  1934. line-height: 16px;
  1935. }
  1936. .more {
  1937. color: #1D9BF0;
  1938. font-size: 13px;
  1939. padding-left: 4px;
  1940. cursor: pointer;
  1941. }
  1942. }
  1943. .submit-btn-wrapper {
  1944. width: 100%;
  1945. background: #fff;
  1946. position: absolute;
  1947. bottom: 18px;
  1948. left: 0;
  1949. box-sizing: border-box;
  1950. padding: 16px 18px 0 18px;
  1951. .submit-btn {
  1952. width: 100%;
  1953. height: 46px;
  1954. text-align: center;
  1955. background: #4a99e9;
  1956. border-radius: 100px;
  1957. color: #fff;
  1958. display: flex;
  1959. align-items: center;
  1960. justify-content: center;
  1961. font-size: 16px;
  1962. font-weight: 500;
  1963. cursor: pointer;
  1964. .icon-loading {
  1965. width: 20px;
  1966. height: 20px;
  1967. margin-right: 3px;
  1968. }
  1969. }
  1970. .disabled-submit {
  1971. background-color: #D9D9D9;
  1972. }
  1973. }
  1974. }
  1975. .fill-right {
  1976. width: 100% !important;
  1977. border-bottom-left-radius: 16px;
  1978. }
  1979. }
  1980. }
  1981. }
  1982. .preview {
  1983. padding: 30px 40px;
  1984. .card {
  1985. float: left;
  1986. position: relative;
  1987. .flash {
  1988. overflow: hidden;
  1989. height: 460px;
  1990. border-radius: 26px;
  1991. border: solid 1px #ECECEC;
  1992. }
  1993. &.center {
  1994. margin-left: 50%;
  1995. transform: translateX(-50%);
  1996. }
  1997. }
  1998. .card-title {
  1999. height: 32px;
  2000. .img {
  2001. float: left;
  2002. width: 20px;
  2003. height: 20px;
  2004. margin-right: 8px;
  2005. }
  2006. .font {
  2007. float: left;
  2008. font-size: 17px;
  2009. font-weight: 500;
  2010. span {
  2011. color: #0091e9;
  2012. }
  2013. }
  2014. }
  2015. .card-content {
  2016. float: right;
  2017. width: 430px;
  2018. }
  2019. .card-amount {
  2020. overflow: hidden;
  2021. display: flex;
  2022. height: 80px;
  2023. padding: 20px;
  2024. border-radius: 20px;
  2025. border: 1px solid #E6E6E6;
  2026. .icon {
  2027. width: 40px;
  2028. height: 40px;
  2029. }
  2030. .con {
  2031. flex: 1;
  2032. padding: 0 10px;
  2033. .desc {
  2034. color: rgba($color: #000000, $alpha: 0.5);
  2035. font-size: 12px;
  2036. margin-bottom: 4px;
  2037. }
  2038. .price {
  2039. font-size: 16px;
  2040. font-weight: bold;
  2041. }
  2042. }
  2043. .refresh {
  2044. cursor: pointer;
  2045. width: 50px;
  2046. height: 50px;
  2047. margin-top: -5px;
  2048. }
  2049. }
  2050. .card-list {
  2051. padding: 20px;
  2052. border-radius: 20px;
  2053. border: 1px solid #E6E6E6;
  2054. .item {
  2055. display: flex;
  2056. justify-content: space-between;
  2057. align-items: center;
  2058. height: 47px;
  2059. font-size: 14px;
  2060. font-weight: 500;
  2061. box-shadow: inset 0px -1px 0px #EAEAEA;
  2062. }
  2063. }
  2064. }
  2065. .icon-refresh-rotate {
  2066. transform: rotate(360deg);
  2067. transition-duration: 1s;
  2068. }
  2069. .payment {
  2070. .balance {
  2071. display: flex;
  2072. margin-right: 20px;
  2073. .icon {
  2074. width: 40px;
  2075. height: 40px;
  2076. }
  2077. .con {
  2078. padding: 0 5px;
  2079. .desc {
  2080. color: rgba($color: #000000, $alpha: 0.5);
  2081. font-size: 12px;
  2082. margin-bottom: 4px;
  2083. }
  2084. .price {
  2085. font-size: 14px;
  2086. font-weight: bold;
  2087. }
  2088. }
  2089. .refresh {
  2090. width: 40px;
  2091. cursor: pointer;
  2092. margin-left: -5px;
  2093. }
  2094. }
  2095. }
  2096. </style>