give-dialog.vue 77 KB

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