give-dialog.vue 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008
  1. <template>
  2. <div class="overlay" v-if="visible">
  3. <div class="content"
  4. :style="{
  5. height: showComType === 'preview' ? 'calc(100vh - 40px)' : dialogStyle.dialogHeight + 'px',
  6. width: dialogStyle.dialogContentWidth + 'px',
  7. }">
  8. <div class="pop-mask"
  9. v-show="showCurrencyPop || showCurrencySelect"
  10. @click.stop="showCurrencyPop = false; showCurrencySelect=false">
  11. </div>
  12. <!-- head -->
  13. <give-dialog-head
  14. :title="publishType == 'REDPACKET' ? currentComData[showComType]['title'] : 'Tool Box'"
  15. :publishType="publishType"
  16. :showComType="showComType"
  17. :toolBoxPageData="toolBoxPageData"
  18. @close="close"></give-dialog-head>
  19. <!-- 内容 -->
  20. <div class="body">
  21. <!-- 充值组件 -->
  22. <top-up
  23. v-if="showComType == 'topUp'"
  24. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  25. @topUpDone="topUpDone">
  26. </top-up>
  27. <!-- 自定义红包封面 -->
  28. <giveaway-poster
  29. v-else-if="showComType == 'poster'"
  30. :baseFormData="baseFormData"
  31. :currentCurrencyInfo="currentCurrencyInfo"
  32. :customPosterInfo="customPosterInfo"
  33. @selectImage="selectImage"
  34. @confirmData="confirmData">
  35. </giveaway-poster>
  36. <!-- 表单填写容器 -->
  37. <div class="body-content" v-else>
  38. <!-- 货币列表 -->
  39. <div class="currency-pop" v-show="showCurrencyPop">
  40. <currency-list
  41. ref="currencyListDom"
  42. :showGeneralLottery="showGeneralLottery"
  43. @selectCurrency="selectCurrency"
  44. @setCurrencyList="setCurrentCurrencyInfo"
  45. @addGeneralLottery="addCustomizedRewardHandle"></currency-list>
  46. </div>
  47. <!-- 通用奖品编辑弹窗 -->
  48. <div class="customized-reward-edit-popup" v-if="showCustomizedRewardEditPopup">
  49. <customized-reward-edit-popup
  50. ref="rewardEditDom"
  51. :customizedReward="baseFormData.customizedReward"
  52. :rewardType="baseFormData.rewardType"
  53. @closeRewardPopup="closeRewardPopup"
  54. @removeReward="removeReward"
  55. @submitReward="submitReward"></customized-reward-edit-popup>
  56. </div>
  57. <div class="currency-pop-select" v-show="showCurrencySelect">
  58. <currency-select
  59. ref="currencySelectDom"
  60. :list="tempCurrentCurrencyList"
  61. @selectCurrency="selectCurrencyAfter"></currency-select>
  62. </div>
  63. <div class="left" v-if="showComType != 'preview' && toolBoxPageData.activePage != 'PREVIEW'">
  64. <div class="tab-item"
  65. :class="{'active-tab': item.type == publishType}"
  66. v-for="(item, index) in leftTabList"
  67. :key="index"
  68. @click="clickLeftTab(item, index)"
  69. >
  70. <img class="icon" :src="item.icon"/>
  71. </div>
  72. </div>
  73. <div class="right"
  74. :class="{'fill-right': showComType == 'preview' || toolBoxPageData.activePage == 'PREVIEW'}">
  75. <global-tip :type="'2'"></global-tip>
  76. <template v-if="publishType == 'TOOL_BOX'">
  77. <tool-box
  78. :pageData="{
  79. 'linkInputDescImage': toolBoxPageData.postEditorLinkInputDescImage,
  80. 'defaultLinkTitle': toolBoxPageData.postEditorDefaultLinkTitle
  81. }"
  82. :activePage="toolBoxPageData.activePage" @onPageChange="onToolBoxPageChange"
  83. @toolBoxPublishFinish="toolBoxPublishFinish"></tool-box>
  84. </template>
  85. <template v-else>
  86. <div class="form-wrapper" v-if="showComType == 'default'">
  87. <div class="form-left-sheet">
  88. <div class="base-form-wrapper">
  89. <div class="form-cell-content">
  90. <div class="select-mode-ele">
  91. <template v-for="(item, index) in publishModeList" :key="index">
  92. <img class="img"
  93. :src="selectModeInfo.index == index ? item.imgActive : item.imgInActive"
  94. @click="selectPublishMode(item, index)">
  95. <img class="img-tips" :src="item.imgInfoSrc" v-if="selectModeInfo.index == index" />
  96. </template>
  97. </div>
  98. <!-- 金额 -->
  99. <div class="form-base">
  100. <div class="form-cell">
  101. <div class="cell-title">
  102. <img class="title-icon" :src="require('@/assets/svg/icon-form-amount.svg')" />
  103. Amount
  104. </div>
  105. <div class="cell-content flex">
  106. <div class="currency-select"
  107. :class="{'selected': currencySelectCpd}"
  108. @click="selectCurrencyPopHandle">
  109. <img class="icon"
  110. v-if="currentIconCpd"
  111. :src="currentIconCpd"/>
  112. <component-zoom width="100" :txt="currentPrizeCpd">
  113. <div class="text">
  114. {{currentPrizeCpd}}
  115. </div>
  116. </component-zoom>
  117. <img class="arrow"
  118. :src="currentArrowCpd"/>
  119. </div>
  120. <form-input class="margin-left-10"
  121. :suffix="baseFormData.rewardType === RewardType.custom ? 'items' : currentCurrencyInfo.currencyCode ? currentPrizeCpd : ''">
  122. <template v-slot:content>
  123. <input style="width: 100px"
  124. v-model="baseFormData.amountValue"
  125. placeholder="0"
  126. autofocus
  127. @input="onAmountInput"
  128. @blur="onAmountBlur"/>
  129. </template>
  130. </form-input>
  131. <form-input class="margin-left-10"
  132. v-if="currentCurrencyInfo.currencyCode != 'USD' && baseFormData.rewardType != RewardType.custom"
  133. prefix="=$"
  134. suffix="USD">
  135. <template v-slot:content>
  136. <input style="width: 85px"
  137. v-model="treasureFormData.usdEstimateOrderAmount"
  138. @input="onUsdEstimateOrderAmountInput"
  139. @blur="onUsdEstimateOrderAmountInput"
  140. placeholder="0"/>
  141. </template>
  142. </form-input>
  143. </div>
  144. <!-- 刷新按钮、充值 -->
  145. <div class="currency-operation"
  146. v-if="currentCurrencyInfo.currencyCode">
  147. <div class="amount">
  148. Balance:
  149. <a-tooltip :title="currentCurrencyInfo.balance">
  150. {{ getBit(currentCurrencyInfo.balance) }}
  151. </a-tooltip>
  152. <img :class="{ 'icon-refresh-rotate': refreshRotate }"
  153. :src="require('@/assets/svg/icon-form-refresh.svg')"
  154. @click="updateCurrencyBanlce"/>
  155. </div>
  156. <div v-if="currentCurrencyInfo.currencyCode != 'USD'"
  157. class="top-up"
  158. @click="goTopUp">Deposit</div>
  159. </div>
  160. <div class="usd-min-message" v-show="isShowUsdMinMessage" v-html="selectModeInfo.type != PlayType.treasure ? checkUsdMinNumber('inTemplate') : checkTreasureAmountRange('inTemplate')"></div>
  161. </div>
  162. <!-- 人数 -->
  163. <div class="form-cell">
  164. <div class="cell-title">
  165. <img class="title-icon" :src="require('@/assets/svg/icon-form-winners.svg')" />
  166. {{selectModeInfo.type != PlayType.treasure ? 'Winners' : 'Growing Target'}}
  167. </div>
  168. <div class="cell-content">
  169. <div class="count-input-wrapper">
  170. <form-input :suffix="selectModeInfo.type != PlayType.treasure ? 'People' : 'Follower'">
  171. <template v-slot:content>
  172. <input style="width: 120px"
  173. v-model="baseFormData.totalCount"
  174. placeholder="0"
  175. :disabled="baseFormData.rewardType === RewardType.custom"
  176. @input="onCountInput"
  177. @blur="onCountBlur"/>
  178. </template>
  179. </form-input>
  180. <div class="fans-unit-txt" v-if="selectModeInfo.type == PlayType.treasure && treasureFormData.fansUnitAmount">
  181. <span>${{treasureFormData.fansUnitAmount}}</span> per New Follower
  182. </div>
  183. </div>
  184. <div class="count-msg" v-show="selectModeInfo.type == PlayType.common">Recommend Winners 50~500</div>
  185. </div>
  186. </div>
  187. <!-- 开奖时间 -->
  188. <div class="form-cell" v-if="selectModeInfo.type == PlayType.lottery">
  189. <div class="cell-title">
  190. <img class="title-icon" :src="require('@/assets/svg/icon-form-time.svg')" />
  191. Automatically Draw in
  192. </div>
  193. <div class="cell-content">
  194. <form-input suffix="Hour">
  195. <template v-slot:content>
  196. <input v-model="baseFormData.validityDuration"
  197. placeholder="0"
  198. @input="onValidityDurationInput"
  199. @blur="onValidityDurationBlur"/>
  200. </template>
  201. </form-input>
  202. </div>
  203. </div>
  204. <!-- 夺宝 follow -->
  205. <div class="form-cell" v-if="selectModeInfo.type == PlayType.treasure">
  206. <div class="cell-title">
  207. <img class="title-icon" :src="require('@/assets/svg/icon-form-follow.svg')" />
  208. Follow
  209. </div>
  210. <div class="cell-content">
  211. <follow-input style="padding: 0"
  212. padding="10px 12px"
  213. :isAddSelf="!isBack"
  214. :atUserList="atUserList"
  215. @addUser="addFollowUser"
  216. @setUser="setFollowUser"
  217. @delUser="delFollowUser"></follow-input>
  218. </div>
  219. </div>
  220. <!-- 任务 -->
  221. <div class="form-cell" v-if="selectModeInfo.type != PlayType.treasure">
  222. <div class="cell-title">
  223. <img class="title-icon" :src="require('@/assets/svg/icon-form-task.svg')"/>
  224. Tasks
  225. </div>
  226. <div class="form-cell-content form-require">
  227. <!-- 转推、like、关注 -->
  228. <div v-for="(item, index) in formList"
  229. :key="index">
  230. <div v-if="item.show" class="form-item"
  231. :class="{ 'border-hide': formList.length - 1 == index }">
  232. <div class="item-left">
  233. <div class="label">
  234. <img class="icon" :src="item.icon"/>
  235. {{ item.label }}
  236. </div>
  237. <div class="control"
  238. v-if="item.nodeType == 'textarea'">
  239. <follow-input
  240. padding="4px 12px"
  241. :isAddSelf="!isBack"
  242. :atUserList="atUserList"
  243. @addUser="addFollowUser"
  244. @setUser="setFollowUser"
  245. @delUser="delFollowUser"></follow-input>
  246. </div>
  247. <div class="control"
  248. v-if="item.nodeType == 'input'">
  249. <div v-if="showDiscordInvitePop"
  250. class="discord-invite-info"
  251. @click="showDiscordInvitePop = false">
  252. <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
  253. <span class="name">{{discordInviteInfo.name}}</span>
  254. </div>
  255. <input v-model="item.text"
  256. placeholder="Enter discord invite link"
  257. class="discord-address"
  258. @input="onIptDiscordAddress($event, index)"
  259. @blur="onBlurDiscordAddress($event, index)" />
  260. </div>
  261. </div>
  262. <div>
  263. <a-switch
  264. v-if="item.type > 3"
  265. v-model:checked="item.checked"
  266. @change="formSwitchChange($event, item, index)"/>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. <!-- 提示 -->
  274. <ul class="tips-wrapper" v-if="selectModeInfo.type != PlayType.treasure">
  275. <li class="row" style="white-space:nowrap;">
  276. Rewards can only be claimed after the target user completes all tasks you set.
  277. </li>
  278. <li class="row">
  279. Each user can only receive a reward once per task.
  280. </li>
  281. <li class="row" v-show="selectModeInfo.type == PlayType.common">
  282. 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.
  283. </li>
  284. </ul>
  285. </div>
  286. </div>
  287. </div>
  288. <div class="form-right-sheet">
  289. <!-- 自定义封面事件 -->
  290. <div style="width: 375px;height: 500px; zoom: .74;margin-left: 80px">
  291. <custom-card-cover :data="{
  292. ...baseFormData,
  293. ...currentCurrencyInfo,
  294. usdEstimateOrderAmount: treasureFormData.usdEstimateOrderAmount,
  295. upGainAmountUsdValue: treasureFormData.upGainAmountUsdValue,
  296. currencyIconUrl: currentCurrencyInfo.iconPath,
  297. customPosterUrl: customPosterInfo && customPosterInfo.after && customPosterInfo.after.imagePath || '',
  298. userInfo: {
  299. nickName: userInfo.name,
  300. avatarUrl: userInfo.avatarUrl
  301. },
  302. }"></custom-card-cover>
  303. </div>
  304. <div class="custom-cover-btn"
  305. v-if="selectModeInfo.type != PlayType.treasure"
  306. @click="customCoverImg">
  307. <img :src="require('@/assets/svg/icon-custom-cover-btn.svg')" />
  308. Custom
  309. </div>
  310. </div>
  311. <div class="submit-btn-wrapper">
  312. <div class="submit-btn"
  313. :class="{ 'disabled-submit': iptErrMsgTxt != ''}"
  314. @click="confirm">
  315. <img class="icon-loading"
  316. v-if="submitIng"
  317. :src="require('@/assets/svg/icon-btn-loading.svg')"/>
  318. {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
  319. </div>
  320. </div>
  321. </div>
  322. <!-- 预览 -->
  323. <template v-else-if="showComType == 'preview'">
  324. <preview-sheet
  325. :baseFormData="{
  326. ...baseFormData,
  327. usdEstimateOrderAmount: treasureFormData.usdEstimateOrderAmount
  328. }"
  329. :upGainAmountUsdValue="treasureFormData.upGainAmountUsdValue"
  330. :currentCurrencyInfo="currentCurrencyInfo"
  331. :tempCurrentCurrencyInfo="tempCurrentCurrencyInfo"
  332. :publishRes="publishRes"
  333. :previewFontSize="previewFontSize"
  334. :customPosterData="customPosterData"
  335. :finalAmountData="finalAmountData"
  336. @onTopUpDone="topUpDone"
  337. @onUpdateCurrencyBanlce="updateCurrencyBanlce"></preview-sheet>
  338. </template>
  339. <!-- 支付按钮 -->
  340. <div class="payment" v-show="showComType == 'preview'">
  341. <pay-button
  342. ref="payButtonDom"
  343. v-if="isMoneyRewardCpd"
  344. :finalAmountData="finalAmountData"
  345. :payConfig="{
  346. feeDesc: payConfig.feeDesc,
  347. amount: baseFormData.amountValue,
  348. postId,
  349. }"
  350. :currentCurrencyInfo="currentCurrencyInfo"
  351. :USDepositStatus = "USDepositStatus"
  352. :bizType="selectModeInfo.type"
  353. @showDepositMask="showDepositMessageBox = true"
  354. @payFinish="payFinish">
  355. <template v-slot:balance>
  356. <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) || currentCurrencyInfo.currencyCode == 'USD' ">
  357. <img class="icon" src="@/assets/subject/icon-balance.png" />
  358. <div class="con">
  359. <div class="desc">Balance</div>
  360. <div class="price">
  361. <template v-if="currentCurrencyInfo.currencyCode == 'USD'">
  362. $
  363. </template>
  364. {{currentCurrencyInfo.balance}}
  365. <template v-if="currentCurrencyInfo.currencyCode != 'USD'">
  366. {{currentCurrencyInfo.tokenSymbol}}
  367. </template>
  368. </div>
  369. </div>
  370. <img class="refresh"
  371. :class="{ 'icon-refresh-rotate': refreshRotate }"
  372. :src=" require('@/assets/svg/icon-form-refresh.svg')"
  373. @click="updateCurrencyBanlce"/>
  374. </div>
  375. </template>
  376. </pay-button>
  377. <div v-else class="btn-wrap" @click="payStatusHandle(1)"><div class="custom-submit">Confirm</div></div>
  378. </div>
  379. </template>
  380. </div>
  381. </div>
  382. </div>
  383. </div>
  384. <!-- 提示 -->
  385. <message-box
  386. :dialogVisible="showMessageBox"
  387. :title="messageBoxData.title"
  388. :content="messageBoxData.content"
  389. cancelTxt="Not yet"
  390. confirmTxt="Deposit"
  391. @cancel="messageBoxCancel"
  392. @confirm="messageBoxConfirm"></message-box>
  393. <!-- 预览页充值 -->
  394. <message-box
  395. :dialogVisible="showDepositMessageBox"
  396. title="Is the Deposit Completed?"
  397. @cancel="depositAchCancel"
  398. @confirm="depositAchConfirm"></message-box>
  399. <!-- 裁剪 -->
  400. <div class="dialog" v-if="cropperDialog">
  401. <div class="corp-title">
  402. <img class="back" :src="require('@/assets/svg/icon-back.svg')" @click="hiddenDialog" />
  403. <span>Crop</span>
  404. </div>
  405. <div class="corp-content">
  406. <vue-cropper
  407. ref="refCropper"
  408. :img="cropperOption.img"
  409. :output-type="cropperOption.outputType"
  410. :infoTrue="cropperOption.infoTrue"
  411. :full="cropperOption.full"
  412. :fixed="cropperOption.fixed"
  413. :fixed-number="cropperOption.fixedNumber"
  414. :auto-crop="cropperOption.autoCrop"
  415. :auto-crop-width="cropperOption.autoCropWidth"
  416. :auto-crop-height="cropperOption.autoCropHeight"
  417. :center-box="cropperOption.centerBox"
  418. :high="cropperOption.high"
  419. :max-img-size="cropperOption.max">
  420. </vue-cropper>
  421. </div>
  422. <div class="corp-footer">
  423. <button v-if="cropperLoading" class="confirm disable">
  424. <img :src=" require('@/assets/svg/icon-btn-loading.svg') " />
  425. <span>Confirm</span>
  426. </button>
  427. <button v-else class="confirm" @click="confirmImage">Confirm</button>
  428. </div>
  429. </div>
  430. <div class="dialog-mask" v-if="cropperDialog"></div>
  431. </div>
  432. </template>
  433. <script setup>
  434. import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, computed } from "vue";
  435. import { postPublish, syncChainTokenRechargeRecord, getCurrencyInfoByCode, getUser } from "@/http/publishApi";
  436. import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
  437. import { payCalcFee, getPayConfig } from "@/http/pay";
  438. import { upGainCalculate } from "@/http/treasureApi";
  439. import { getFrontConfig, calcRechargePayAmount } from "@/http/account";
  440. import { uploadSignature, uploadFile } from '@/http/media';
  441. import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
  442. import { debounce, getBit } from "@/uilts/help"
  443. import { PlayType, RewardType, TaskType } from '@/types';
  444. import Report from "@/log-center/log"
  445. import { ElMessage, ElLoading } from "element-plus";
  446. import "element-plus/es/components/message/style/css";
  447. import "element-plus/es/components/loading/style/css";
  448. import 'vue-cropper/dist/index.css'
  449. import { VueCropper } from "vue-cropper";
  450. import {create, all} from "mathjs";
  451. import { message } from 'ant-design-vue';
  452. import messageBox from "@/view/components/message-box.vue";
  453. import currencyList from "@/view/components/currency-list.vue";
  454. import currencySelect from "@/view/components/currency-select.vue";
  455. import followInput from "@/view/iframe/publish/components/follow-input";
  456. import payButton from "@/view/iframe/publish/components/pay-button";
  457. import topUp from "@/view/iframe/publish/components/top-up.vue";
  458. import toolBox from '@/view/iframe/publish/tool-box/index.vue'
  459. import giveawayPoster from '@/view/iframe/publish/components/giveaway-poster.vue';
  460. import giveDialogHead from "@/view/iframe/publish/components/give-dialog-head";
  461. import previewSheet from "@/view/iframe/publish/components/preview-sheet.vue";
  462. import formInput from "@/view/iframe/publish/components/form-input.vue";
  463. import GlobalTip from '@/view/components/global-tip.vue'
  464. import customCardCover from '@/view/components/custom-card-cover.vue'
  465. import CustomizedRewardEditPopup from '@/view/iframe/publish/components/customized-reward-edit';
  466. import ComponentZoom from '@/view/components/component-zoom.vue'
  467. const config = {
  468. number: 'BigNumber',
  469. }
  470. const math = create(all, config);
  471. //临时货币信息
  472. let tempCurrentCurrencyInfo = ref({});
  473. let tempCurrentCurrencyList = ref([]);
  474. let payConfig = ref({});
  475. let timer = ref(null);
  476. // 发布后返回的结果
  477. let publishRes = reactive({});
  478. //弹窗是否展示
  479. let visible = ref(false);
  480. let publishType = ref('REDPACKET');
  481. let userInfo = ref({})
  482. //弹窗高度
  483. let dialogStyle = reactive({
  484. dialogHeight: 670,
  485. dialogContentWidth: 1100
  486. })
  487. let USDepositStatus = ref('DEFAULT');
  488. let cropperOption = ref({
  489. img: '',
  490. full: true,
  491. infoTrue: true,
  492. fixed: true,
  493. fixedNumber: [16, 8.396],
  494. outputType: 'png',
  495. autoCrop: true,
  496. autoCropWidth: 99999,
  497. autoCropHeight: 99999,
  498. centerBox: true,
  499. high: true,
  500. max: 99999,
  501. })
  502. let cropperDialog = ref(false)
  503. let cropperLoading = ref(false)
  504. let cropperType = ref('before')
  505. let customPosterInfo = ref({})
  506. let customPosterData = ref({})
  507. let customShowNewImage = ref(false)
  508. let refCropper = ref('')
  509. // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
  510. let showComType = ref("default");
  511. let currentComData = {
  512. default: {
  513. title: "Giveaway",
  514. },
  515. preview: {
  516. title: "Giveaway",
  517. },
  518. topUp: {
  519. title: "Deposit",
  520. },
  521. poster: {
  522. title: "Giveaway Poster",
  523. }
  524. };
  525. // 机器人开关
  526. let openAntiBot = ref(false);
  527. // 是否正在提交
  528. let submitIng = ref(false);
  529. // 艾特关注人列表
  530. let atUserList = ref([]);
  531. // 表单错误提示
  532. let iptErrMsgTxt = ref("Select a reward");
  533. // usd最小金额限制提示展示
  534. let isShowUsdMinMessage = ref(false);
  535. // 是否返回
  536. let isBack = ref(false);
  537. // 展示消息提示
  538. let showMessageBox = ref(false);
  539. let showDepositMessageBox = ref(false);
  540. // 展示货币列表pop
  541. let showCurrencyPop = ref(false);
  542. let showCurrencySelect = ref(false);
  543. // 货币列表的dom
  544. let currencyListDom = ref(null);
  545. let payButtonDom = ref(null);
  546. // 刷新按钮旋转
  547. let refreshRotate = ref(false);
  548. // 预览字体大小
  549. let previewFontSize = ref(56);
  550. let postId = ref('');
  551. let showGeneralLottery = ref(false);
  552. let selectModeInfo = reactive({
  553. index: 0,
  554. type: PlayType.treasure
  555. })
  556. // 余额是否同步中
  557. let asyncIng = ref(false);
  558. let messageBoxData = ref({
  559. title: "",
  560. content: "",
  561. });
  562. // 真实支付金额数据
  563. let finalAmountData = ref({
  564. currencyCode: '',
  565. feeAmountValue: 0,
  566. finalAmountValue: 0,
  567. requestAmountValue: 0,
  568. });
  569. // 表单数据
  570. let baseFormData = reactive({
  571. amountCurrencyCode: "",
  572. amountValue: "",
  573. totalCount: "",
  574. validityDuration: "",
  575. type: selectModeInfo.type,
  576. rewardType: RewardType.money,
  577. customizedReward: "",
  578. });
  579. const defaultCurrentCurrencyInfo = {
  580. currencyCode: "",
  581. currencyName: "",
  582. balance: "",
  583. currencyType: "",
  584. iconPath: "",
  585. minAmount: "",
  586. tokenChain: "",
  587. tokenSymbol: "",
  588. usdEstimateBalance: ""
  589. }
  590. // 当前选择的货币信息
  591. let currentCurrencyInfo = ref(defaultCurrentCurrencyInfo);
  592. const discordIptErrTxt = 'Discord invite link is wrong';
  593. const discordIptEmptyErrTxt = 'Enter discord invite link';
  594. const discordIptNerverExpiresErrTxt = 'Make sure the Discord link never expires'
  595. const requireFollowTxt = 'Please add at least one user to follow at "Follow'
  596. let iptErrType = ''; //discord
  597. let formList = reactive([
  598. {
  599. label: "Follow",
  600. icon: require("@/assets/svg/icon-task-twitter.svg"),
  601. nodeType: "textarea",
  602. type: TaskType.twitterFollow,
  603. text: [],
  604. checked: true,
  605. show: true
  606. },
  607. {
  608. label: "Retweet & Like",
  609. icon: require("@/assets/svg/icon-task-twitter.svg"),
  610. nodeType: "div",
  611. type: TaskType.twitterRetweet,
  612. checked: true,
  613. show: true
  614. },
  615. {
  616. label: "Like Tweet",
  617. icon: require("@/assets/svg/icon-task-twitter.svg"),
  618. nodeType: "div",
  619. type: TaskType.twitterLikeTweet,
  620. checked: true,
  621. show: false
  622. },
  623. {
  624. label: "Comment and Tag 3 friends",
  625. icon: require("@/assets/svg/icon-task-twitter.svg"),
  626. nodeType: "div",
  627. type: TaskType.twitterCommentAndTag,
  628. checked: true,
  629. show: true
  630. },
  631. {
  632. label: "Repost to Facebook",
  633. icon: require("@/assets/svg/icon-task-facebook.svg"),
  634. nodeType: "div",
  635. text: '',
  636. type: TaskType.repostToFacebook,
  637. checked: false,
  638. show: true
  639. },
  640. {
  641. label: "Join Discord",
  642. icon: require("@/assets/svg/icon-discord-mini.svg"),
  643. nodeType: "input",
  644. text: '',
  645. type: TaskType.joinDiscord,
  646. checked: false,
  647. show: true
  648. },
  649. ]);
  650. let publishModeList = reactive([
  651. {
  652. imgActive: require("@/assets/svg/img-T1.svg"),
  653. imgInActive: require("@/assets/svg/img-T0.svg"),
  654. imgInfoSrc: require("@/assets/svg/img-P1.svg"),
  655. type: PlayType.treasure
  656. },
  657. {
  658. imgActive: require("@/assets/svg/img-LT1.svg"),
  659. imgInActive: require("@/assets/svg/img-LT0.svg"),
  660. imgInfoSrc: require("@/assets/svg/img-P2.svg"),
  661. type: PlayType.lottery
  662. },
  663. {
  664. imgActive: require("@/assets/svg/img-A1.svg"),
  665. imgInActive: require("@/assets/svg/img-A0.svg"),
  666. imgInfoSrc: require("@/assets/svg/img-P3.svg"),
  667. type: PlayType.common
  668. }
  669. ])
  670. let discordInviteInfo = ref({});
  671. let showDiscordInvitePop = ref(false);
  672. let showCustomizedRewardEditPopup = ref(false);
  673. let lotteryMaxHourDuration = 168;
  674. let leftTabList = reactive([
  675. {
  676. icon: require('@/assets/svg/icon-gift-pack.svg'),
  677. type: 'REDPACKET'
  678. },
  679. {
  680. icon: require('@/assets/svg/icon-tool-box-02.svg'),
  681. type: 'TOOL_BOX'
  682. }
  683. ])
  684. let toolBoxPageData = reactive({
  685. activePage: 'EDITOR', //EDITOR PREVIEW
  686. postEditorLinkInputDescImage: '',
  687. postEditorDefaultLinkTitle: ''
  688. })
  689. let treasureFormData = reactive({
  690. usdEstimateOrderAmount: '',
  691. fansUnitAmount: '',
  692. upGainAmountUsdValue: 0,
  693. })
  694. const props = defineProps({
  695. dialogData: {
  696. type: Object,
  697. default: () => {
  698. return {
  699. visible: false,
  700. type: 'REDPACKET'
  701. }
  702. },
  703. },
  704. });
  705. //selected prize icon cpd
  706. let currentIconCpd = computed(() => {
  707. if(baseFormData.rewardType === RewardType.custom) {
  708. return require("@/assets/svg/icon-gift.svg");
  709. } else {
  710. return currentCurrencyInfo.value.iconPath;
  711. }
  712. })
  713. // selected prize cpd
  714. let currentPrizeCpd = computed(() => {
  715. const {currencyCode, tokenSymbol} = currentCurrencyInfo.value
  716. if(baseFormData.rewardType === RewardType.custom) {
  717. return baseFormData.customizedReward;
  718. } else if(currencyCode == "USD") {
  719. return "USD";
  720. } else {
  721. return tokenSymbol || "Select a reward";
  722. }
  723. })
  724. let currencySelectCpd = computed(() => {
  725. return baseFormData.customizedReward || currentCurrencyInfo.value.currencyCode;
  726. })
  727. let currentArrowCpd = computed(() => {
  728. if(baseFormData.rewardType === RewardType.custom) {
  729. return require("@/assets/svg/icon-cell-arrow-right.svg");
  730. } else {
  731. return currentCurrencyInfo.value.currencyCode ? require("@/assets/svg/icon-form-arrow-down.svg") : require("@/assets/svg/icon-form-white-arrow-down.svg");
  732. }
  733. })
  734. let isMoneyRewardCpd =computed(() => baseFormData.rewardType === RewardType.money);
  735. watch(
  736. () => props.dialogData,
  737. (newVal) => {
  738. visible.value = newVal.visible;
  739. USDepositStatus.value = "DEFAULT"
  740. if (newVal.visible) {
  741. publishType.value = newVal.type;
  742. Report.reportLog({
  743. pageSource: Report.pageSource.publisherDialog,
  744. businessType: Report.businessType.pageView,
  745. }, {
  746. type: newVal.type == 'REDPACKET' ? Report.bizType.Treasure : Report.bizType.ToolBox
  747. });
  748. getLocalCurrencyInfoByCode();
  749. setTimeout(() => {
  750. setDialogStyle();
  751. }, 300);
  752. // 更新余额
  753. clearInterval(timer.value);
  754. timer.value = setInterval(() => {
  755. getCurrencyInfo({loop: true});
  756. }, 10000)
  757. } else {
  758. clearInterval(timer.value);
  759. }
  760. },
  761. {
  762. deep: true
  763. }
  764. );
  765. const emits = defineEmits(["close", "confirm", "postPublishFinish"]);
  766. const close = () => {
  767. USDepositStatus.value = "DEFAULT"
  768. if(publishType.value == 'TOOL_BOX') {
  769. closeToolBoxPage()
  770. } else {
  771. if (showComType.value != "default") {
  772. showComType.value = "default";
  773. isBack.value = true;
  774. } else {
  775. initParams();
  776. closeDialog();
  777. }
  778. }
  779. };
  780. const closeToolBoxPage = () => {
  781. if(toolBoxPageData.activePage == "EDITOR") {
  782. closeDialog();
  783. } else if(toolBoxPageData.activePage == "PREVIEW") {
  784. toolBoxPageData.activePage = "EDITOR";
  785. }
  786. };
  787. const closeDialog = () => {
  788. visible.value = false;
  789. emits("close", false);
  790. }
  791. /**
  792. * 设置弹窗高度
  793. */
  794. const setDialogStyle = (resize = false) => {
  795. nextTick(() => {
  796. let clientHeight = window.innerHeight;
  797. let clientWidth = window.innerWidth;
  798. let gapSafe = 40;
  799. if (dialogStyle.dialogHeight > clientHeight - gapSafe) {
  800. dialogStyle.dialogHeight = clientHeight - gapSafe;
  801. } else {
  802. if(resize) {
  803. dialogStyle.dialogHeight = 720;
  804. }
  805. }
  806. if(dialogStyle.dialogContentWidth > clientWidth - gapSafe) {
  807. dialogStyle.dialogContentWidth = clientWidth - gapSafe;
  808. } else {
  809. if(resize) {
  810. dialogStyle.dialogContentWidth = 1080;
  811. }
  812. }
  813. })
  814. };
  815. const selectCurrencyPopHandle = () => {
  816. Report.reportLog({
  817. pageSource: Report.pageSource.currencySelectorPage,
  818. businessType: Report.businessType.pageView,
  819. }, {
  820. type: Report.getCurrentBizType(selectModeInfo.type)
  821. });
  822. if(baseFormData.rewardType === RewardType.custom) {
  823. showCustomizedRewardEditPopup.value = true
  824. } else {
  825. showCurrencyPop.value = true;
  826. nextTick(() => {
  827. if(currencyListDom.value) {
  828. currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList({pageNum: 1});
  829. }
  830. })
  831. }
  832. }
  833. const saveDiscordGuildInfo = () => {
  834. let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
  835. //保存服务器信息
  836. Report.reportLog({
  837. pageSource: Report.pageSource.publisherDialog,
  838. businessType: Report.businessType.buttonClick,
  839. objectType: Report.objectType.saveDiscordGuildData
  840. }, {
  841. reportData: discordInviteInfo.value
  842. });
  843. if(guildId && inviteCode && inviteUrl) {
  844. saveInviteGuildInfo({
  845. params: {
  846. guildId,
  847. inviteCode,
  848. inviteUrl
  849. }
  850. })
  851. }
  852. }
  853. const confirm = () => {
  854. if (submitIng.value || iptErrMsgTxt.value) {
  855. return;
  856. }
  857. let { totalCount = 0 } = baseFormData;
  858. if(selectModeInfo.type != PlayType.treasure) {
  859. if (!totalCount) {
  860. return;
  861. }
  862. saveDiscordGuildInfo();
  863. }
  864. submitRequest();
  865. };
  866. /**
  867. * 货币列表-选中货币
  868. */
  869. const selectCurrency = (params) => {
  870. let { currencies } = params;
  871. tempCurrentCurrencyList.value = currencies;
  872. if (currencies.length > 1) {
  873. showCurrencyPop.value = false;
  874. showCurrencySelect.value = true;
  875. } else {
  876. selectCurrencyAfter(currencies[0])
  877. }
  878. };
  879. const selectCurrencyAfter = (params, openWindow = true) => {
  880. tempCurrentCurrencyInfo.value = params;
  881. showCurrencySelect.value = false;
  882. currentCurrencyInfo.value = params;
  883. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  884. if (openWindow === false) {
  885. return
  886. };
  887. if (params.currencyCode != "USD" && params.balance < params.minAmount) {
  888. let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
  889. messageBoxBlock({
  890. title: `Whether to deposit ${tokenSymbol}`,
  891. content: `Insufficient ${tokenSymbol} balance`,
  892. });
  893. } else {
  894. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  895. showCurrencyPop.value = false;
  896. finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
  897. resetFormIpt(false);
  898. onIptSetErrorTxt();
  899. }
  900. baseFormData.customizedReward = "";
  901. baseFormData.rewardType = RewardType.money;
  902. }
  903. const resetFormIpt = (clearMode = true) => {
  904. baseFormData.amountValue = "";
  905. baseFormData.totalCount = "";
  906. baseFormData.validityDuration = "";
  907. baseFormData.rewardType = RewardType.money;
  908. baseFormData.customizedReward = "";
  909. treasureFormData.usdEstimateOrderAmount = "";
  910. treasureFormData.upGainAmountUsdValue = "";
  911. if(clearMode) {
  912. selectModeInfo.index = 0;
  913. selectModeInfo.type = publishModeList[selectModeInfo.index]['type'];
  914. baseFormData.type = selectModeInfo.type;
  915. }
  916. }
  917. const setLocalSelectCurrencyInfo = (params = {}) => {
  918. setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
  919. }
  920. const setCurrentCurrencyListInfo = (params = {}) => {
  921. setChromeStorage({ selectCurrencyList : JSON.stringify(params)})
  922. }
  923. /**
  924. * 获取完货币列表
  925. */
  926. const setCurrentCurrencyInfo = (params) => {
  927. }
  928. const messageBoxBlock = ({ title = "", content = "" }) => {
  929. showMessageBox.value = true;
  930. messageBoxData.value.title = title;
  931. messageBoxData.value.content = content;
  932. };
  933. /**
  934. * 确定
  935. */
  936. const messageBoxConfirm = () => {
  937. showMessageBox.value = false;
  938. goTopUp();
  939. };
  940. /**
  941. * 取消
  942. */
  943. const messageBoxCancel = () => {
  944. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  945. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  946. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  947. showMessageBox.value = false;
  948. showCurrencyPop.value = false;
  949. showCurrencySelect.value = false;
  950. resetFormIpt(false);
  951. onIptSetErrorTxt();
  952. };
  953. /**
  954. * 去充值
  955. */
  956. const goTopUp = () => {
  957. Report.reportLog({
  958. pageSource: Report.pageSource.rechargePage,
  959. businessType: Report.businessType.pageView,
  960. }, {
  961. type: Report.getCurrentBizType(selectModeInfo.type)
  962. });
  963. showComType.value = 'topUp';
  964. }
  965. /*
  966. * 自定义封面
  967. */
  968. const customCoverImg = () => {
  969. customPosterInfo.value = {}
  970. if (Object.keys(customPosterData.value).length > 0) {
  971. customPosterInfo.value = customPosterData.value;
  972. }
  973. showComType.value = 'poster';
  974. customShowNewImage.value = false;
  975. setChromeStorage({ custom_poster_guide: Date.now() });
  976. }
  977. /**
  978. * 充值done事件
  979. */
  980. const topUpDone = () => {
  981. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  982. showCurrencyPop.value = false;
  983. showCurrencySelect.value = false;
  984. showComType.value = 'default';
  985. onIptSetErrorTxt();
  986. asyncTokenRechRecord((res) => {
  987. if(res.code == 0 && res.data && res.data.length) {
  988. let currencyInfo = res.data[0];
  989. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  990. currentCurrencyInfo.value.balance = currencyInfo.balance;
  991. onIptSetErrorTxt()
  992. }
  993. }
  994. })
  995. }
  996. /**
  997. * 更新货币余额
  998. */
  999. const updateCurrencyBanlce = async () => {
  1000. if(!refreshRotate.value) {
  1001. refreshRotate.value = true;
  1002. setTimeout(() => {
  1003. refreshRotate.value = false;
  1004. }, 1000)
  1005. }
  1006. if(currentCurrencyInfo.value.currencyCode == 'USD') {
  1007. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  1008. calcRechPayAmount({
  1009. currencyCode: currentCurrencyInfo.value.currencyCode,
  1010. orderAmountValue: baseFormData.amountValue,
  1011. payChannel: 'ach'
  1012. });
  1013. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  1014. currentCurrencyInfo.value = currencyInfoRes.data;
  1015. }
  1016. } else {
  1017. asyncTokenRechRecord((res) => {
  1018. if(res.code == 0 && res.data && res.data.length) {
  1019. let currencyInfo = res.data[0];
  1020. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  1021. currentCurrencyInfo.value.balance = currencyInfo.balance;
  1022. }
  1023. }
  1024. })
  1025. }
  1026. }
  1027. /**
  1028. * 同步链上交易
  1029. */
  1030. const asyncTokenRechRecord = (cb) => {
  1031. if(asyncIng.value) {
  1032. return;
  1033. }
  1034. asyncIng.value = true;
  1035. syncChainTokenRechargeRecord({
  1036. params: {
  1037. currencyCode: currentCurrencyInfo.value.currencyCode
  1038. }
  1039. }).then(res => {
  1040. asyncIng.value = false;
  1041. cb && cb(res)
  1042. }).catch((err) => {
  1043. asyncIng.value = false;
  1044. })
  1045. }
  1046. /**
  1047. * 提交表单请求
  1048. */
  1049. const submitRequest = async () => {
  1050. let {
  1051. amountValue = 0,
  1052. totalCount = 0,
  1053. rewardType = RewardType.money,
  1054. customizedReward = ""
  1055. } = baseFormData;
  1056. baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
  1057. // 组装提交参数
  1058. let finishConditions = selectModeInfo.type != PlayType.treasure ? getFinishCondition() : getTreasureFinishCondition();
  1059. let receiveConditions = openAntiBot.value ? "" : [];
  1060. let validityDuration = '';
  1061. if(baseFormData.type == PlayType.lottery) {
  1062. //小时转毫秒
  1063. let unit = process.env.NODE_ENV != 'production' ? 60 * 1000 : 60 * 60 * 1000;
  1064. validityDuration = baseFormData.validityDuration * unit;
  1065. } else {
  1066. validityDuration = '';
  1067. }
  1068. // 提交参数
  1069. let formData = {
  1070. amountValue,
  1071. totalCount,
  1072. finishConditions,
  1073. receiveConditions,
  1074. type: baseFormData.type,
  1075. posterType: 1,
  1076. validityDuration,
  1077. rewardType,
  1078. };
  1079. if(rewardType === RewardType.custom) {
  1080. // 通用奖品 类型的活动,添加奖品名称
  1081. formData.customizedReward = customizedReward;
  1082. delete formData.amountValue;
  1083. } else {
  1084. // 货币类型 添加货币code
  1085. formData.amountCurrencyCode = baseFormData.amountCurrencyCode;
  1086. formData.payAmountValue = baseFormData.payAmountValue;
  1087. }
  1088. submitIng.value = true;
  1089. // 自定义封面
  1090. if (Object.keys(customPosterData.value).length > 0) {
  1091. formData['posterType'] = 2;
  1092. if (customPosterData.value && customPosterData.value.after) {
  1093. formData['customPosterInstalled'] = customPosterData.value.after.objectKey || ''
  1094. }
  1095. if (customPosterData.value && customPosterData.value.before) {
  1096. formData['customPosterUninstalled'] = customPosterData.value.before.objectKey || ''
  1097. }
  1098. }
  1099. // 法币支付需要计算费率
  1100. if(formData.amountCurrencyCode == "USD") {
  1101. // 获取充值金额
  1102. await calcRechPayAmount({
  1103. currencyCode: currentCurrencyInfo.value.currencyCode,
  1104. orderAmountValue: baseFormData.amountValue,
  1105. payChannel: 'ach'
  1106. });
  1107. }
  1108. let data = {
  1109. params: {
  1110. postBizData: JSON.stringify(formData),
  1111. postSrc: 1, //1 twitter
  1112. postType: 1, //1 红包
  1113. },
  1114. };
  1115. postPublish(data).then((res) => {
  1116. submitIng.value = false;
  1117. if (res.code == 0) {
  1118. publishRes = res.data;
  1119. postId.value = res.data.postId;
  1120. Report.reportLog({
  1121. pageSource: Report.pageSource.previewPage,
  1122. businessType: Report.businessType.pageView,
  1123. }, {
  1124. type: Report.getCurrentBizType(selectModeInfo.type)
  1125. });
  1126. showComType.value = "preview";
  1127. previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
  1128. isBack.value = false;
  1129. } else {
  1130. console.log(res);
  1131. }
  1132. })
  1133. .catch((err) => {
  1134. console.log(err);
  1135. });
  1136. };
  1137. const getFinishCondition = () => {
  1138. let finishConditions = [];
  1139. for (let i = 0; i < formList.length; i++) {
  1140. let item = {};
  1141. item.type = formList[i]["type"];
  1142. if (item.type == TaskType.twitterFollow && atUserList.value.length) {
  1143. // follow 参数
  1144. let relatedUsers = atUserList.value.filter(item => item.name);
  1145. item.relatedUsers = relatedUsers;
  1146. finishConditions.push(item);
  1147. } else if (formList[i]["type"] == TaskType.joinDiscord) {
  1148. // join discord
  1149. if(formList[i]["checked"] && formList[i]["text"]) {
  1150. item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
  1151. finishConditions.push(item);
  1152. }
  1153. } else if (formList[i]["checked"]) {
  1154. // 其余任务
  1155. finishConditions.push(item);
  1156. }
  1157. }
  1158. return finishConditions;
  1159. }
  1160. const getTreasureFinishCondition = () => {
  1161. let finishConditions = [
  1162. {
  1163. type: TaskType.twitterLikeTweet
  1164. },
  1165. {
  1166. type: TaskType.twitterRePost
  1167. }
  1168. ];
  1169. if(atUserList.value.length) {
  1170. let relatedUsers = atUserList.value.filter(item => item.name);
  1171. finishConditions.push({
  1172. relatedUsers,
  1173. type: TaskType.twitterFollow
  1174. });
  1175. }
  1176. return finishConditions;
  1177. };
  1178. const calcFontSize = (str, domWidth, maxSize) => {
  1179. let lenstr = str.length;
  1180. let num = parseInt(domWidth / lenstr);
  1181. let fontSize = num < maxSize ? num : maxSize
  1182. return fontSize;
  1183. }
  1184. /**
  1185. * 初始化提交参数
  1186. */
  1187. const initParams = () => {
  1188. resetFormIpt();
  1189. // clear follow value
  1190. atUserList.value = [];
  1191. submitIng.value = false;
  1192. isBack.value = false;
  1193. showCurrencyPop.value = false;
  1194. showCurrencySelect.value = false;
  1195. openAntiBot.value = false;
  1196. tempCurrentCurrencyInfo.value = {};
  1197. currentCurrencyInfo.value = {};
  1198. publishType.value = 'REDPACKET';
  1199. // clear discord value
  1200. setDiscordIptTxt({text: ''});
  1201. discordInviteInfo.value = {};
  1202. customPosterInfo.value = {};
  1203. customPosterData.value = {};
  1204. };
  1205. const setDiscordIptTxt = ({text}) => {
  1206. const index = formList.findIndex(item => item.type == TaskType.joinDiscord);
  1207. formList[index]['text'] = text;
  1208. }
  1209. const calcRechPayAmount = async (params) => {
  1210. let res = await calcRechargePayAmount({
  1211. params : params
  1212. })
  1213. if (res.code == 0) {
  1214. let { feeDesc } = res.data;
  1215. payConfig.value.feeDesc = feeDesc;
  1216. finalAmountData.value = res.data;
  1217. }
  1218. return res.data;
  1219. }
  1220. /**
  1221. * 支付完成回调
  1222. */
  1223. const payFinish = (params) => {
  1224. let {payStatus} = params;
  1225. // 余额支付
  1226. payStatusHandle(payStatus);
  1227. };
  1228. const payStatusHandle = (payStatus) => {
  1229. //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
  1230. switch (payStatus) {
  1231. case 1:
  1232. emits("postPublishFinish", { publishRes });
  1233. showComType.value = "default";
  1234. initParams();
  1235. break;
  1236. case 2:
  1237. break;
  1238. case 3:
  1239. break;
  1240. case 4:
  1241. break;
  1242. }
  1243. }
  1244. /**
  1245. * follow组件触发新增关注人
  1246. */
  1247. const addFollowUser = (params) => {
  1248. atUserList.value.push(params);
  1249. };
  1250. const setFollowUser = (params) => {
  1251. atUserList.value[params.index]["name"] = params.name;
  1252. let userList = atUserList.value.filter(item => item.name);
  1253. if(selectModeInfo.type == PlayType.treasure) {
  1254. if(!userList.length) {
  1255. if(!iptErrMsgTxt.value) {
  1256. iptErrMsgTxt.value = requireFollowTxt;
  1257. }
  1258. } else {
  1259. if (iptErrMsgTxt.value == requireFollowTxt) {
  1260. iptErrMsgTxt.value = ""
  1261. }
  1262. }
  1263. }
  1264. };
  1265. const delFollowUser = (params) => {
  1266. atUserList.value.splice(params.index, 1);
  1267. let userList = atUserList.value.filter(item => item.name);
  1268. if(selectModeInfo.type == PlayType.treasure) {
  1269. if(!userList.length) {
  1270. if(!iptErrMsgTxt.value) {
  1271. iptErrMsgTxt.value = requireFollowTxt;
  1272. }
  1273. } else {
  1274. if (iptErrMsgTxt.value == requireFollowTxt) {
  1275. iptErrMsgTxt.value = ""
  1276. }
  1277. }
  1278. }
  1279. };
  1280. const calcUsdEstimate = (params) => {
  1281. if(!currentCurrencyInfo.value.currencyCode) {
  1282. return;
  1283. }
  1284. let {type} = params;
  1285. let calcData = {amount: 0, usdPrice: currentCurrencyInfo.value.usdPrice};
  1286. switch (type) {
  1287. case 'ORDER_AMOUNT':
  1288. calcData.amount = baseFormData.amountValue;
  1289. treasureFormData.usdEstimateOrderAmount = calcToken2UsdEstimate(calcData);
  1290. break;
  1291. }
  1292. }
  1293. const calcTokenEstimate = (params) => {
  1294. if(!currentCurrencyInfo.value.currencyCode) {
  1295. return;
  1296. }
  1297. let {type} = params;
  1298. let calcData = {amount: 0, usdPrice: currentCurrencyInfo.value.usdPrice};
  1299. switch (type) {
  1300. case 'ORDER_AMOUNT':
  1301. calcData.amount = treasureFormData.usdEstimateOrderAmount;
  1302. baseFormData.amountValue = calcUsd2TokenEstimate(calcData);
  1303. break;
  1304. }
  1305. }
  1306. /**
  1307. * token 转 USD 估值
  1308. */
  1309. const calcToken2UsdEstimate = (params) => {
  1310. if(!params.amount) {
  1311. return '';
  1312. }
  1313. let val = +math.format(math.evaluate(`${params.amount} * ${params.usdPrice}`));
  1314. return Math.floor(val * 100) / 100;
  1315. };
  1316. /**
  1317. * USD 转 token 估值
  1318. */
  1319. const calcUsd2TokenEstimate = (params) => {
  1320. if(!params.amount) {
  1321. return '';
  1322. }
  1323. let val = +math.format(math.evaluate(`${params.amount} / ${params.usdPrice}`)) ;
  1324. return val;
  1325. };
  1326. /**
  1327. * 计算粉丝单价
  1328. */
  1329. const calcFansUnitAmount = () => {
  1330. if(!baseFormData.totalCount || !baseFormData.amountValue) {
  1331. treasureFormData.upGainAmountUsdValue = ''
  1332. treasureFormData.fansUnitAmount = '';
  1333. return;
  1334. }
  1335. let unitAmount = baseFormData.amountValue / baseFormData.totalCount;
  1336. if(currentCurrencyInfo.value.currencyCode != 'USD') {
  1337. unitAmount = calcToken2UsdEstimate({amount: unitAmount, usdPrice: currentCurrencyInfo.value.usdPrice });
  1338. }
  1339. setUpGainAmountUsdValue({totalAmount: baseFormData.amountValue, unitPrice: unitAmount});
  1340. return unitAmount;
  1341. };
  1342. const setUpGainAmountUsdValue = (params) => {
  1343. const { usdPrice, currencyCode } = currentCurrencyInfo.value;
  1344. let {totalAmount, unitPrice} = params;
  1345. if(!currencyCode) return;
  1346. upGainCalculate({
  1347. params: {
  1348. amountValue: totalAmount,
  1349. currencyUsdPrice: usdPrice,
  1350. fansUnitAmountValue: unitPrice
  1351. }
  1352. }).then(res => {
  1353. if(res.code == 0 && res.data) {
  1354. treasureFormData.upGainAmountUsdValue = res.data.upGainAmountUsdValue
  1355. }
  1356. })
  1357. }
  1358. /**
  1359. * 奖励总金额 美元估值
  1360. */
  1361. const onUsdEstimateOrderAmountInput = () => {
  1362. let val = treasureFormData.usdEstimateOrderAmount;
  1363. val = String(val).replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
  1364. if(val == '00') {
  1365. val = '0'
  1366. }
  1367. treasureFormData.usdEstimateOrderAmount = val;
  1368. calcTokenEstimate({type: 'ORDER_AMOUNT'});
  1369. onIptSetErrorTxt();
  1370. if(selectModeInfo.type == PlayType.treasure) {
  1371. treasureFormData.fansUnitAmount = calcFansUnitAmount();
  1372. }
  1373. return val;
  1374. };
  1375. const onAmountInput = () => {
  1376. let val = baseFormData.amountValue;
  1377. // val = val.replace(/[^\d^\.]+/g, "");
  1378. val = String(val).replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1379. const maxCount = baseFormData.rewardType === RewardType.money ? Number.MAX_SAFE_INTEGER : 100000000;
  1380. if(val == '00') {
  1381. val = '0'
  1382. }
  1383. if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
  1384. let arr = val.split('.');
  1385. if(arr[0].startsWith('0')) {
  1386. let num = +arr[0];
  1387. val = num + '.' + arr[1];
  1388. }
  1389. }
  1390. if (baseFormData.rewardType === RewardType.custom) {
  1391. val = val.replace(/^(0)*/, '').replace(/\./, ''); // 通用奖品类型 过滤掉起始位的0和小数点符号
  1392. if (val > maxCount) {
  1393. val = maxCount
  1394. }
  1395. baseFormData.totalCount = val;
  1396. }
  1397. baseFormData.amountValue = val;
  1398. calcUsdEstimate({type: 'ORDER_AMOUNT'});
  1399. if(selectModeInfo.type == PlayType.treasure) {
  1400. treasureFormData.fansUnitAmount = calcFansUnitAmount();
  1401. }
  1402. onIptSetErrorTxt();
  1403. return val;
  1404. };
  1405. const onCountInput = () => {
  1406. let val = baseFormData.totalCount;
  1407. const maxCount = 100000000;
  1408. if (val == 0) {
  1409. val = "";
  1410. }
  1411. val = val.replace(/[^\d]/g, "");
  1412. if(val > maxCount) {
  1413. val = maxCount
  1414. }
  1415. baseFormData.totalCount = val;
  1416. if(selectModeInfo.type == PlayType.treasure) {
  1417. treasureFormData.fansUnitAmount = calcFansUnitAmount();
  1418. }
  1419. onIptSetErrorTxt();
  1420. return val;
  1421. };
  1422. const onValidityDurationInput = () => {
  1423. validityDurationHandler()
  1424. let val = onIptSetErrorTxt();
  1425. return val;
  1426. }
  1427. const onValidityDurationBlur = () => {
  1428. validityDurationHandler();
  1429. let val = onIptSetErrorTxt();
  1430. return val;
  1431. }
  1432. const validityDurationHandler = () => {
  1433. let val = baseFormData.validityDuration;
  1434. if (val == 0) {
  1435. val = "";
  1436. } else if(val > lotteryMaxHourDuration) {
  1437. val = lotteryMaxHourDuration+'';
  1438. }
  1439. val = val.replace(/[^\d]/g, "");
  1440. baseFormData.validityDuration = val;
  1441. return val;
  1442. }
  1443. /**
  1444. * 金额输入失焦
  1445. */
  1446. const onAmountBlur = () => {
  1447. onIptSetErrorTxt();
  1448. };
  1449. /**
  1450. * count失焦,校验输入结果
  1451. */
  1452. const onCountBlur = () => {
  1453. onIptSetErrorTxt();
  1454. };
  1455. /**
  1456. * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
  1457. */
  1458. const calcIptValue = (cb) => {
  1459. let amountValue = baseFormData.amountValue;
  1460. let totalCount = baseFormData.totalCount;
  1461. let flag = true;
  1462. if (!amountValue || !totalCount) {
  1463. return {
  1464. flag
  1465. };
  1466. }
  1467. if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
  1468. flag = false;
  1469. }
  1470. return {
  1471. flag,
  1472. count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
  1473. }
  1474. };
  1475. /**
  1476. * usd最小金额判断
  1477. * luckdropPostConfig是一个列表,需要根据当前的玩法选择对应的Limit信息比对
  1478. * luckdropPostConfig[i].usdLimitEnable 当前选中的token是否开启usd最小金额判断
  1479. */
  1480. const checkUsdMinNumber = (isInTemplate) => {
  1481. let forbiddenText = '';
  1482. const { usdPrice, luckdropPostConfig = [] } = currentCurrencyInfo.value;
  1483. let currentLuckDropConfig = luckdropPostConfig.find(item => item.luckdropType === selectModeInfo.type);
  1484. if (baseFormData.rewardType === RewardType.money && currentLuckDropConfig?.usdLimitEnable === 1) {
  1485. const { amountValue, totalCount } = baseFormData;
  1486. if (currentLuckDropConfig?.minTotalUsdAmount === 0 || currentLuckDropConfig?.minAvgUsdAmount === 0) {
  1487. // 当前token允许的usd最小金额为0 或单个红包最小金额为0,则无限制
  1488. return forbiddenText;
  1489. } else {
  1490. const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? math.format(math.evaluate(amountValue * usdPrice)) < currentLuckDropConfig.minTotalUsdAmount : false;
  1491. const isAvgForbidden = currentLuckDropConfig?.minAvgUsdAmount ? math.format(math.evaluate(amountValue / totalCount * usdPrice)) < currentLuckDropConfig.minAvgUsdAmount : false;
  1492. forbiddenText = isAmountForbidden && isAvgForbidden ?
  1493. `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
  1494. or the average prize must be above
  1495. ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
  1496. : '';
  1497. }
  1498. }
  1499. return forbiddenText;
  1500. };
  1501. const checkTreasureAmountRange = (isInTemplate) => {
  1502. let forbiddenText = '';
  1503. const { usdPrice, minAmount, luckdropPostConfig = [] } = currentCurrencyInfo.value;
  1504. let currentLuckDropConfig = luckdropPostConfig.find(item => item.luckdropType === selectModeInfo.type);
  1505. if (currentLuckDropConfig?.usdLimitEnable === 1) {
  1506. if (currentLuckDropConfig?.minTotalUsdAmount === 0 || currentLuckDropConfig?.minAvgUsdAmount === 0) {
  1507. // 当前token允许的usd最小金额为0 或单个红包最小金额为0,则无限制
  1508. return forbiddenText;
  1509. } else {
  1510. let txt = `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
  1511. and the average prize must be above
  1512. ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
  1513. const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? +math.format(math.evaluate(baseFormData.amountValue * usdPrice)) < currentLuckDropConfig?.minTotalUsdAmount : false;
  1514. const isAvgForbidden = treasureFormData.fansUnitAmount !== '' && currentLuckDropConfig?.minAvgUsdAmount ? treasureFormData.fansUnitAmount < minAmount || treasureFormData.fansUnitAmount < currentLuckDropConfig?.minAvgUsdAmount : false;
  1515. forbiddenText = isAmountForbidden || isAvgForbidden ? txt : '';
  1516. }
  1517. }
  1518. return forbiddenText;
  1519. };
  1520. const treasureFormValidata = () => {
  1521. console.log('treasureFormValidata')
  1522. isShowUsdMinMessage.value = false;
  1523. let userList = atUserList.value.filter(item => item.name);
  1524. if(!currentCurrencyInfo.value.currencyCode) {
  1525. iptErrMsgTxt.value = "Select a reward"
  1526. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  1527. iptErrMsgTxt.value = "Enter an amount";
  1528. } else if (iptErrMsgTxt.value = checkTreasureAmountRange()) {
  1529. //amount 是否大于 最小总金额
  1530. isShowUsdMinMessage.value = true;
  1531. } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
  1532. // 输入Follower
  1533. iptErrMsgTxt.value = 'Please enter "Growing Targe"';
  1534. } else if(iptErrMsgTxt.value = checkTreasureAmountRange()) {
  1535. // 粉丝单价是否 小于总金额规则 大于最小粉丝单价 、大于币种最小精度
  1536. isShowUsdMinMessage.value = true;
  1537. } else if(!userList.length) {
  1538. iptErrMsgTxt.value = requireFollowTxt;
  1539. } else {
  1540. isShowUsdMinMessage.value = false;
  1541. iptErrMsgTxt.value = "";
  1542. }
  1543. };
  1544. /**
  1545. * 输入时 检测设置错误信息
  1546. */
  1547. const onIptSetErrorTxt = (params = {}) => {
  1548. if(baseFormData.type == PlayType.treasure) {
  1549. treasureFormValidata();
  1550. return;
  1551. }
  1552. if((baseFormData.rewardType === RewardType.money && !currentCurrencyInfo.value.currencyCode)
  1553. || (baseFormData.rewardType === RewardType.custom && !baseFormData.customizedReward)) {
  1554. iptErrMsgTxt.value = "Select a reward"
  1555. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  1556. iptErrMsgTxt.value = "Enter an amount";
  1557. } else if (baseFormData.type != PlayType.treasure && (!baseFormData.totalCount || baseFormData.totalCount == '0')) {
  1558. iptErrMsgTxt.value = "Enter the number of winners";
  1559. } else if (iptErrMsgTxt.value = checkUsdMinNumber()) {
  1560. // 最小法币金额限制
  1561. return isShowUsdMinMessage.value = true;
  1562. } else if(baseFormData.rewardType === RewardType.money && baseFormData.type != PlayType.treasure && +baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
  1563. // 输入金额 小于 余额
  1564. let res = calcIptValue();
  1565. if (!res.flag) {
  1566. iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
  1567. } else {
  1568. if(baseFormData.type == PlayType.lottery && !baseFormData.validityDuration) {
  1569. iptErrMsgTxt.value = "Enter Automatically Draw";
  1570. } else {
  1571. //清空错误提示
  1572. iptErrMsgTxt.value = "";
  1573. if(params.actionType != 'discord_blur') {
  1574. setDiscordErrTxt({getDuildId: true});
  1575. }
  1576. }
  1577. }
  1578. } else if(baseFormData.type == PlayType.lottery && !baseFormData.validityDuration) {
  1579. // 抽奖模式 没有输入时长
  1580. iptErrMsgTxt.value = "Enter Automatically Draw";
  1581. } else {
  1582. if(baseFormData.type != PlayType.treasure) {
  1583. setDiscordErrTxt({getDuildId: true}, () => {
  1584. iptErrMsgTxt.value = '';
  1585. });
  1586. }
  1587. }
  1588. }
  1589. /**
  1590. * 监听开关触发事件
  1591. */
  1592. const formSwitchChange = (val, params, index) => {
  1593. closeDiscordTask(val, params, index);
  1594. }
  1595. const closeDiscordTask = (val, params, index) => {
  1596. if(params.type == TaskType.joinDiscord) {
  1597. if(!val) {
  1598. //错误类型 discord 清空discord错误校验
  1599. if(iptErrType == 'discord') {
  1600. iptErrMsgTxt.value = '';
  1601. formList[index]['text'] = '';
  1602. onIptSetErrorTxt();
  1603. }
  1604. } else {
  1605. onIptSetErrorTxt();
  1606. }
  1607. }
  1608. }
  1609. /** 监听 discord 输入 */
  1610. const onIptDiscordAddress = (e, index) => {
  1611. let val = formList[index].text;
  1612. let checked = formList[index].checked;
  1613. if(val && !checked) {
  1614. checked = true;
  1615. formList[index].checked = checked;
  1616. formList[index].text = formList[index].text.replace(/\s/g,'');
  1617. } else if(!val){
  1618. discordInviteInfo.value = {};
  1619. }
  1620. onIptDiscordDebounce()
  1621. }
  1622. const onBlurDiscordAddress = (e, index) => {
  1623. setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
  1624. }
  1625. const getDiscordIptData = () => {
  1626. let discordItem = formList.find(item => item.type == TaskType.joinDiscord);
  1627. return discordItem;
  1628. }
  1629. /**
  1630. * 设置输入discord错误提示信息
  1631. */
  1632. const setDiscordErrTxt = (params = {showPop: false}, cb) => {
  1633. let discordData = getDiscordIptData() || {};
  1634. if(discordData.checked) {
  1635. if(discordData.text) {
  1636. let validata = checkInviteUrl(discordData.text);
  1637. if(validata) {
  1638. getDiscordInviteInfo({inviteUrl: discordData.text, getDuildId: params.getDuildId}, (res) => {
  1639. console.log('discordData',res)
  1640. // 未知的邀请链接
  1641. if(res.inviteCode != res.data.code || !res.data.guildId) {
  1642. iptErrMsgTxt.value = discordIptErrTxt;
  1643. iptErrType = 'discord';
  1644. } else {
  1645. if(res.data.expires !== null) {
  1646. // 不是永久邀请链接
  1647. iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
  1648. iptErrType = '';
  1649. } else {
  1650. if(iptErrMsgTxt.value) {
  1651. iptErrMsgTxt.value = '';
  1652. iptErrType = '';
  1653. }
  1654. if(params.showPop && res.data) {
  1655. showDiscordInvitePop.value = true;
  1656. setTimeout(() => {
  1657. showDiscordInvitePop.value = false;
  1658. }, 2000)
  1659. }
  1660. if(params.fromType == 'discord') {
  1661. onIptSetErrorTxt();
  1662. }
  1663. }
  1664. }
  1665. cb && cb(res)
  1666. })
  1667. } else {
  1668. iptErrMsgTxt.value = discordIptErrTxt;
  1669. iptErrType = 'discord';
  1670. }
  1671. } else {
  1672. if(params.actionType == 'discord_blur') {
  1673. onIptSetErrorTxt({acitonType: 'discord_blur'});
  1674. } else {
  1675. // 设置空提示
  1676. iptErrMsgTxt.value = discordIptEmptyErrTxt;
  1677. iptErrType = 'discord';
  1678. }
  1679. }
  1680. } else {
  1681. cb && cb();
  1682. }
  1683. }
  1684. const onIptDiscordDebounce = debounce(function() {
  1685. setDiscordErrTxt({fromType: 'discord', showPop: true});
  1686. }, 800)
  1687. /**
  1688. * 校验 discord邀请url
  1689. */
  1690. const checkInviteUrl = (inviteUrl) => {
  1691. let flag = false;
  1692. const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
  1693. const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
  1694. const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
  1695. const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
  1696. const INVITE_URL_PREFIX_5 = 'discord.gg/';
  1697. const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
  1698. 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]
  1699. if(inviteUrl) {
  1700. if(arr.indexOf(inviteUrl) > -1) {
  1701. flag = false;
  1702. } else {
  1703. let isPass = false;
  1704. for(let i = 0; i < arr.length; i++) {
  1705. let item = arr[i];
  1706. if(inviteUrl.startsWith(item)) {
  1707. isPass = true;
  1708. break;
  1709. }
  1710. }
  1711. flag = isPass;
  1712. }
  1713. }
  1714. return flag;
  1715. }
  1716. /**获取discord 邀请信息 */
  1717. const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
  1718. if(!inviteUrl) return;
  1719. let inviteCode = '';
  1720. let arr = inviteUrl.split('/');
  1721. if(arr.length > 0) {
  1722. inviteCode = arr[arr.length - 1];
  1723. }
  1724. if(!getDuildId && discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
  1725. return;
  1726. }
  1727. getInviteGuildInfo({
  1728. inviteCode
  1729. }).then(res => {
  1730. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1731. if(resData.data.guildId) {
  1732. cb && cb(resData);
  1733. } else {
  1734. //DISCORD 接口未获取到服务器信息 resdata
  1735. Report.reportLog({
  1736. pageSource: Report.pageSource.publisherDialog,
  1737. businessType: Report.businessType.buttonClick,
  1738. objectType: Report.objectType.getDiscordGuildNoData
  1739. }, {
  1740. resData: resData
  1741. });
  1742. getGuildInfoByOpenApi({inviteCode}, cb);
  1743. }
  1744. }).catch((err) => {
  1745. //DISCORD 接口 catch
  1746. Report.reportLog({
  1747. pageSource: Report.pageSource.publisherDialog,
  1748. businessType: Report.businessType.buttonClick,
  1749. objectType: Report.objectType.getDiscordGuildCatch
  1750. }, {
  1751. err: err
  1752. });
  1753. let errMsg = err;
  1754. if(typeof errMsg == 'object') {
  1755. errMsg = JSON.stringify(err);
  1756. }
  1757. if(errMsg.indexOf('code 404') > -1) {
  1758. discordInviteInfo.value = {};
  1759. iptErrMsgTxt.value = discordIptErrTxt;
  1760. } else {
  1761. getGuildInfoByOpenApi({inviteCode}, cb);
  1762. }
  1763. });
  1764. }
  1765. const getGuildInfoByOpenApi = (params, cb) => {
  1766. let { inviteCode } = params;
  1767. getInviteGuildInfoByOpenApi({
  1768. inviteCode
  1769. }).then(res => {
  1770. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1771. if(resData.data.guildId) {
  1772. cb && cb(resData);
  1773. } else {
  1774. //OPENAPI 接口未获取到服务器信息 resdata
  1775. Report.reportLog({
  1776. pageSource: Report.pageSource.publisherDialog,
  1777. businessType: Report.businessType.buttonClick,
  1778. objectType: Report.objectType.getDiscordGuildOpenApiNoData
  1779. }, {
  1780. resData: resData
  1781. });
  1782. }
  1783. }).catch((err) => {
  1784. // OPENAPI 接口 catch 限频
  1785. Report.reportLog({
  1786. pageSource: Report.pageSource.publisherDialog,
  1787. businessType: Report.businessType.buttonClick,
  1788. objectType: Report.objectType.getDiscordGuildOpenApiCatch
  1789. }, {
  1790. err: err
  1791. });
  1792. if(iptErrMsgTxt.value && iptErrType == 'discord') {
  1793. iptErrMsgTxt.value = '';
  1794. iptErrType = '';
  1795. }
  1796. });
  1797. }
  1798. const inviteGuildResHandler = (res, params) => {
  1799. let {inviteCode, inviteUrl} = params;
  1800. if(!res) {
  1801. res = {};
  1802. }
  1803. let {name, icon, id} = res.guild || {};
  1804. icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
  1805. let resData = {
  1806. inviteCode,
  1807. data: {
  1808. code: res.code,
  1809. guildId: id,
  1810. inviteUrl,
  1811. inviteCode,
  1812. expires: res.expires_at,
  1813. name,
  1814. icon,
  1815. }
  1816. }
  1817. if(res.code == inviteCode) {
  1818. discordInviteInfo.value = resData.data;
  1819. } else {
  1820. discordInviteInfo.value = {};
  1821. iptErrMsgTxt.value = discordIptErrTxt;
  1822. }
  1823. return resData;
  1824. };
  1825. /**
  1826. * 获取支付配置(paypalClientId)
  1827. */
  1828. const setPayConfig = () => {
  1829. getPayConfig({
  1830. params: {},
  1831. }).then((res) => {
  1832. if (res.code == 0) {
  1833. payConfig.value = res.data;
  1834. }
  1835. });
  1836. };
  1837. /**
  1838. * 获取配置
  1839. */
  1840. const setFrontConfig = () => {
  1841. getFrontConfig({
  1842. params: {},
  1843. }).then((res) => {
  1844. if (res.code == 0) {
  1845. lotteryMaxHourDuration = res.data.lotteryMaxHourDuration;
  1846. toolBoxPageData.postEditorLinkInputDescImage = res.data.postEditorLinkInputDescImage;
  1847. toolBoxPageData.postEditorDefaultLinkTitle = res.data.postEditorDefaultLinkTitle;
  1848. }
  1849. });
  1850. };
  1851. const getUserName = (screenName) => {
  1852. if(!screenName) return;
  1853. getUser({
  1854. params:{
  1855. screenName
  1856. }
  1857. }).then(res => {
  1858. if(res.code == 0) {
  1859. userInfo.value.name = res.data.name || ''
  1860. }
  1861. console.log(userInfo.value, 'userinfo')
  1862. });
  1863. }
  1864. /**
  1865. * 默认获取上次选中的货币信息
  1866. */
  1867. const getLocalCurrencyInfoByCode = async () => {
  1868. let storageUserInfo = await getChromeStorage('userInfo') || {};
  1869. userInfo.value = storageUserInfo;
  1870. getUserName(storageUserInfo.nickName);
  1871. if(!currentCurrencyInfo.value.currencyCode) {
  1872. getCurrencyInfo();
  1873. }
  1874. }
  1875. const getCurrencyInfo = async (_params) => {
  1876. let { loop = false} = _params || {};
  1877. if (userInfo.value && userInfo.value.accessToken) {
  1878. let {currencyCode = ''} = await getChromeStorage('selectCurrencyInfo') || {};
  1879. if(currencyCode) {
  1880. let currencyInfoRes = await getCurrencyByCode({currencyCode});
  1881. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  1882. let currentCurrencyCode= currentCurrencyInfo.value.currencyCode;
  1883. if(currentCurrencyCode && currentCurrencyCode == currencyInfoRes.data.currencyCode || !currentCurrencyCode) {
  1884. currentCurrencyInfo.value = currencyInfoRes.data;
  1885. tempCurrentCurrencyInfo.value = currencyInfoRes.data;
  1886. if(!loop) {
  1887. onIptSetErrorTxt();
  1888. }
  1889. }
  1890. }
  1891. }
  1892. getChromeStorage('selectCurrencyList', (res) => {
  1893. if (showCurrencySelect.value === false) {
  1894. tempCurrentCurrencyList.value = res;
  1895. }
  1896. })
  1897. }
  1898. }
  1899. const getCurrencyByCode = async (params) => {
  1900. let res = await getCurrencyInfoByCode({
  1901. params: {
  1902. currencyCode: params.currencyCode
  1903. }
  1904. })
  1905. return res || {};
  1906. }
  1907. const selectPublishMode = (params, index) => {
  1908. selectModeInfo.index = index;
  1909. selectModeInfo.type = params.type;
  1910. baseFormData.type = params.type;
  1911. if(params.type == PlayType.treasure) {
  1912. baseFormData.rewardType = RewardType.money;
  1913. baseFormData.customizedReward = '';
  1914. showGeneralLottery.value = false;
  1915. } else {
  1916. showGeneralLottery.value = true;
  1917. }
  1918. Report.reportLog({
  1919. pageSource: Report.pageSource.publisherDialog,
  1920. businessType: Report.businessType.pageView,
  1921. }, {
  1922. type: Report.getCurrentBizType(selectModeInfo.type)
  1923. });
  1924. onIptSetErrorTxt();
  1925. }
  1926. const clickLeftTab = (params, index) => {
  1927. publishType.value = params.type;
  1928. Report.reportLog({
  1929. pageSource: Report.pageSource.publisherDialog,
  1930. businessType: Report.businessType.pageView,
  1931. }, {
  1932. type: params.type == 'REDPACKET' ? Report.bizType.Treasure : Report.bizType.ToolBox
  1933. });
  1934. }
  1935. const onToolBoxPageChange = (params) => {
  1936. toolBoxPageData.activePage = params.page;
  1937. };
  1938. const toolBoxPublishFinish = (params) => {
  1939. toolBoxPageData.activePage = 'EDITOR';
  1940. emits("postPublishFinish", { publishRes: params.publishRes });
  1941. }
  1942. // 截图相关
  1943. const showDialog = () => {
  1944. cropperDialog.value = true;
  1945. }
  1946. const hiddenDialog = () => {
  1947. cropperDialog.value = false;
  1948. cropperLoading.value = false;
  1949. }
  1950. const selectImage = (option) => {
  1951. // 设置图片
  1952. cropperOption.value.img = option.file
  1953. // 选取比例
  1954. if (option && option.type && option.type == 2) {
  1955. cropperType.value = 'after';
  1956. cropperOption.value.fixedNumber = [1, 1];
  1957. } else {
  1958. cropperType.value = 'before';
  1959. cropperOption.value.fixedNumber = [16, 8.396];
  1960. }
  1961. nextTick(() => {
  1962. showDialog()
  1963. })
  1964. }
  1965. const confirmImage = () => {
  1966. let contentType = 'image/png';
  1967. cropperLoading.value = true;
  1968. if (refCropper.value) {
  1969. refCropper.value.getCropBlob(imgData => {
  1970. uploadSignature({
  1971. params: {
  1972. bizType: 1,
  1973. fileType: 1,
  1974. contentType: contentType,
  1975. fileSuffix: 'png',
  1976. }
  1977. }).then(res => {
  1978. let { code, data } = res;
  1979. if (code === 0) {
  1980. let reader = new FileReader()
  1981. reader.readAsArrayBuffer(imgData)
  1982. reader.onload = function(e) {
  1983. let execFile = e.target.result;
  1984. uploadFile({
  1985. url: data.url,
  1986. data: new Blob([execFile]),
  1987. headers: {
  1988. 'Authorization': data.authorization,
  1989. 'x-amz-date': data.date,
  1990. 'Content-Type': contentType
  1991. }
  1992. }).then(res => {
  1993. let { status } = res
  1994. if (status == 200) {
  1995. successImage(data)
  1996. }
  1997. }).finally(() => {
  1998. cropperLoading.value = false;
  1999. })
  2000. }
  2001. }
  2002. })
  2003. })
  2004. }
  2005. }
  2006. const successImage = (data) => {
  2007. hiddenDialog()
  2008. // setPosterInfo
  2009. customPosterInfo.value[cropperType.value] = data;
  2010. }
  2011. const confirmData = (data) => {
  2012. close()
  2013. customPosterData.value = customPosterInfo.value;
  2014. }
  2015. /**
  2016. * 显示通用奖品名称编辑框
  2017. */
  2018. const addCustomizedRewardHandle = () => {
  2019. showCurrencyPop.value = false;
  2020. showCustomizedRewardEditPopup.value = true;
  2021. }
  2022. const closeRewardPopup = () => {
  2023. showCustomizedRewardEditPopup.value = false;
  2024. }
  2025. const removeReward = () => {
  2026. showCustomizedRewardEditPopup.value = false;
  2027. resetFormIpt(false);
  2028. onIptSetErrorTxt();
  2029. }
  2030. // 提交通用奖品
  2031. const submitReward = (reward) => {
  2032. if(baseFormData.customizedReward !== reward) {
  2033. // 有修改时,重置之前已提交的数据
  2034. resetFormIpt(false);
  2035. }
  2036. baseFormData.rewardType = RewardType.custom;
  2037. baseFormData.customizedReward = reward;
  2038. showCustomizedRewardEditPopup.value = false;
  2039. currentCurrencyInfo.value = defaultCurrentCurrencyInfo;
  2040. setLocalSelectCurrencyInfo(defaultCurrentCurrencyInfo);
  2041. onIptSetErrorTxt();
  2042. }
  2043. const updateUSDeposit = async () => {
  2044. if(showDepositMessageBox.value) {
  2045. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  2046. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  2047. currentCurrencyInfo.value = currencyInfoRes.data;
  2048. let {balance} = currencyInfoRes.data;
  2049. if(balance >= finalAmountData.value.orderAmountValue) {
  2050. USDepositStatus.value = 'SUCCESS';
  2051. }
  2052. }
  2053. }
  2054. };
  2055. const depositAchCancel = async () => {
  2056. showDepositMessageBox.value = false;
  2057. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  2058. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  2059. currentCurrencyInfo.value = currencyInfoRes.data;
  2060. let {balance} = currencyInfoRes.data;
  2061. if(balance >= finalAmountData.value.orderAmountValue) {
  2062. USDepositStatus.value = 'SUCCESS';
  2063. }
  2064. }
  2065. }
  2066. const depositAchConfirm = async () => {
  2067. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  2068. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  2069. showDepositMessageBox.value = false;
  2070. currentCurrencyInfo.value = currencyInfoRes.data;
  2071. let {balance} = currencyInfoRes.data;
  2072. if(balance >= finalAmountData.value.orderAmountValue) {
  2073. USDepositStatus.value = 'SUCCESS';
  2074. payButtonDom.value && payButtonDom.value.balancePay();
  2075. } else {
  2076. message.info('Deposit failed, please try again later');
  2077. }
  2078. }
  2079. }
  2080. const onPageVisbile = () => {
  2081. document.addEventListener('visibilitychange', function () {
  2082. let isHidden = document.hidden;
  2083. if (!isHidden) {
  2084. updateUSDeposit();
  2085. }
  2086. });
  2087. }
  2088. onMounted(() => {
  2089. setFrontConfig();
  2090. setPayConfig();
  2091. getLocalCurrencyInfoByCode();
  2092. onPageVisbile();
  2093. window.addEventListener('resize', function () {
  2094. setDialogStyle(true);
  2095. })
  2096. // showNewImage
  2097. getChromeStorage('custom_poster_guide', (info) => {
  2098. if (!info) {
  2099. customShowNewImage.value = true
  2100. }
  2101. })
  2102. });
  2103. </script>
  2104. <style lang="scss">
  2105. .font-color-1D9BF0 {
  2106. color: #1D9BF0;
  2107. }
  2108. .margin-left-10 {
  2109. margin-left: 10px;
  2110. }
  2111. </style>
  2112. <style lang="scss" scoped>
  2113. :deep() .ant-switch {
  2114. background-color: #E9ECEE;
  2115. height: 14px;
  2116. line-height: 16px;
  2117. min-width: 36px;
  2118. }
  2119. :deep() .ant-switch-checked {
  2120. background-color: #AED8F5 !important;
  2121. }
  2122. :deep() .ant-switch::after {
  2123. width: 20px;
  2124. height: 20px;
  2125. top: -4px;
  2126. left: -1px;
  2127. }
  2128. :deep() .ant-switch-checked::after {
  2129. background-color: #1D9BF0 !important;
  2130. margin-left: 3px;
  2131. left: 100% !important;
  2132. }
  2133. .overlay {
  2134. position: fixed;
  2135. top: 0;
  2136. right: 0;
  2137. bottom: 0;
  2138. left: 0;
  2139. z-index: 1000;
  2140. width: 100%;
  2141. height: 100%;
  2142. background-color: rgba(0, 0, 0, 0.5);
  2143. overflow: auto;
  2144. .content {
  2145. height: 620px;
  2146. background: #ffffff;
  2147. border-radius: 20px;
  2148. position: absolute;
  2149. left: 50%;
  2150. top: 50%;
  2151. transform: translate(-50%, -50%);
  2152. box-sizing: border-box;
  2153. z-index: 2000;
  2154. max-height: 825px;
  2155. .pop-mask {
  2156. width: 100%;
  2157. height:100%;
  2158. position: absolute;
  2159. z-index:900;
  2160. }
  2161. .body {
  2162. box-sizing: border-box;
  2163. height: calc(100% - 48px);
  2164. display: flex;
  2165. position: relative;
  2166. .body-content {
  2167. display:flex;
  2168. width:100%;
  2169. }
  2170. .currency-pop {
  2171. position: absolute;
  2172. width: 375px;
  2173. height: 480px;
  2174. top: 85px;
  2175. left: 88px;
  2176. z-index: 1000;
  2177. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2178. background-color: #fff;
  2179. border-radius: 20px;
  2180. overflow-y: auto;
  2181. }
  2182. .currency-pop-select {
  2183. position: absolute;
  2184. width: 375px;
  2185. max-height: 480px;
  2186. top: 85px;
  2187. left: 88px;
  2188. z-index: 1000;
  2189. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2190. background-color: #fff;
  2191. border-radius: 20px;
  2192. overflow-y: scroll;
  2193. }
  2194. .left,
  2195. .right {
  2196. height: 100%;
  2197. }
  2198. .left {
  2199. width: 50px;
  2200. display: flex;
  2201. flex-direction: column;
  2202. align-items: center;
  2203. .tab-item {
  2204. width: 100%;
  2205. height: 55px;
  2206. display: flex;
  2207. align-items: center;
  2208. justify-content: center;
  2209. cursor: pointer;
  2210. }
  2211. .active-tab {
  2212. background-color: #D2EAFC;
  2213. }
  2214. .bottom {
  2215. .icon {
  2216. display: block;
  2217. margin-bottom: 26px;
  2218. }
  2219. }
  2220. }
  2221. .right {
  2222. width: calc(100% - 50px);
  2223. box-sizing: border-box;
  2224. position: relative;
  2225. border-left: 1px solid #ececec;
  2226. .form-wrapper {
  2227. padding: 18px 80px 18px 80px;
  2228. height: calc(100% - 80px);
  2229. overflow: auto;
  2230. box-sizing: border-box;
  2231. display: flex;
  2232. .form-left-sheet {
  2233. width: 500px;
  2234. }
  2235. .form-right-sheet {
  2236. .custom-cover-btn {
  2237. margin-top: 12px;
  2238. display: flex;
  2239. align-items: center;
  2240. cursor: pointer;
  2241. color: #494949;
  2242. font-weight: 400;
  2243. font-size: 12px;
  2244. float: right;
  2245. }
  2246. }
  2247. .base-form-wrapper {
  2248. margin-right: 30px;
  2249. width: 100%;
  2250. .form-cell-content {
  2251. .select-mode-ele {
  2252. display: flex;
  2253. cursor: pointer;
  2254. position: relative;
  2255. height: 120px;
  2256. img {
  2257. -webkit-user-drag: none;
  2258. }
  2259. .img:last-child {
  2260. margin-right: 0px !important;
  2261. }
  2262. .img {
  2263. width: 158px;
  2264. height: 80px;
  2265. border-radius: 5px;
  2266. margin-right: 13px;
  2267. }
  2268. .img-tips {
  2269. position: absolute;
  2270. left: 0;
  2271. bottom: -2px;
  2272. }
  2273. }
  2274. .form-base {
  2275. .form-cell {
  2276. margin-top: 28px;
  2277. .cell-title {
  2278. color: #2F2F2F;
  2279. font-weight: 500;
  2280. font-size: 13px;
  2281. display: flex;
  2282. align-items: center;
  2283. margin-bottom: 10px;
  2284. .title-icon {
  2285. width: 20px;
  2286. margin-right: 4px;
  2287. }
  2288. }
  2289. .flex {
  2290. display: flex;
  2291. align-items: center;
  2292. }
  2293. .cell-content {
  2294. .count-input-wrapper {
  2295. display: flex;
  2296. align-items: center;
  2297. .fans-unit-txt {
  2298. margin-left: 10px;
  2299. color: #7E7E7E;
  2300. font-size: 12px;
  2301. font-weight: 400;
  2302. span {
  2303. color: #C88726;
  2304. }
  2305. }
  2306. }
  2307. input {
  2308. width: 178px;
  2309. font-weight: 500;
  2310. font-size: 14px;
  2311. color: #000000;
  2312. border: none;
  2313. outline: none;
  2314. box-sizing: border-box;
  2315. }
  2316. input::placeholder {
  2317. color: #999999;
  2318. }
  2319. input:disabled {
  2320. color: #999999;
  2321. background-color: #fff;
  2322. }
  2323. .count-msg {
  2324. font-weight: 400;
  2325. font-size: 12px;
  2326. color: #B3B3B3;
  2327. margin-top: 12px;
  2328. }
  2329. }
  2330. }
  2331. .currency-select {
  2332. cursor: pointer;
  2333. background: #1D9BF0;
  2334. padding: 0 10px;
  2335. border-radius: 5px;
  2336. color: #fff;
  2337. width: max-content;
  2338. max-width: 234px;
  2339. display: flex;
  2340. align-items: center;
  2341. height: 38px;
  2342. box-sizing: border-box;
  2343. .icon {
  2344. width: 20px;
  2345. margin-right: 8px;
  2346. }
  2347. .text {
  2348. white-space: nowrap;
  2349. font-weight: 500;
  2350. font-size: 14px;
  2351. }
  2352. .arrow {
  2353. margin-left: 5px;
  2354. }
  2355. }
  2356. .selected {
  2357. background: #FFF !important;
  2358. border: 1px solid #D9D9D9;
  2359. .text {
  2360. color: #000 !important;
  2361. }
  2362. }
  2363. .automatically-input {
  2364. border-top: 1px solid #D1D9DD;
  2365. .input-wrapper {
  2366. margin-right: 16px;
  2367. box-sizing: border-box;
  2368. input {
  2369. padding-right: 4px !important;
  2370. }
  2371. .unit {
  2372. font-weight: 700;
  2373. font-size: 26px;
  2374. opacity: 0.5;
  2375. }
  2376. }
  2377. }
  2378. }
  2379. }
  2380. }
  2381. .currency-operation {
  2382. position: relative;
  2383. box-sizing: border-box;
  2384. display: flex;
  2385. align-items: center;
  2386. margin-top: 8px;
  2387. background: #F8F8F8;
  2388. border-radius: 3px;
  2389. width: 100%;
  2390. height: 28px;
  2391. padding-left: 10px;
  2392. .balance,
  2393. .amount {
  2394. display: flex;
  2395. align-items: center;
  2396. }
  2397. .amount {
  2398. font-weight: 400;
  2399. font-size: 12px;
  2400. color: #A39F9F;
  2401. img {
  2402. margin-left: 6px;
  2403. cursor: pointer;
  2404. }
  2405. }
  2406. .top-up {
  2407. font-weight: 500;
  2408. font-size: 12px;
  2409. color: #1D9BF0;
  2410. cursor: pointer;
  2411. margin-left: 4px;
  2412. }
  2413. }
  2414. .form-label {
  2415. margin-top: 14px;
  2416. margin-bottom: 10px;
  2417. font-weight: 500;
  2418. font-size: 14px;
  2419. display: flex;
  2420. align-items: center;
  2421. justify-content: space-between;
  2422. .icon-add-task {
  2423. cursor: pointer;
  2424. }
  2425. }
  2426. .form-require {
  2427. box-sizing: border-box;
  2428. border-radius: 15px;
  2429. border: 1px solid #D1D9DD;
  2430. .form-item {
  2431. min-height: 54px;
  2432. display: flex;
  2433. align-items: center;
  2434. justify-content: space-between;
  2435. margin: 0 16px;
  2436. border-bottom: 1px solid #ececec;
  2437. padding: 8px 0;
  2438. box-sizing: border-box;
  2439. .item-left {
  2440. display: flex;
  2441. }
  2442. .label {
  2443. min-width: 76px;
  2444. display: flex;
  2445. align-items: center;
  2446. font-size: 15px;
  2447. font-weight: 500;
  2448. .icon {
  2449. margin-right: 10px;
  2450. }
  2451. }
  2452. .control {
  2453. min-width: 258px;
  2454. margin-left: 6px;
  2455. box-sizing: border-box;
  2456. position: relative;
  2457. .discord-address {
  2458. border: none;
  2459. outline: none;
  2460. color: #1D9BF0;
  2461. font-weight: 500;
  2462. font-size: 14px;
  2463. width: 100%;
  2464. height: 34px;
  2465. padding-left: 15px;
  2466. }
  2467. .discord-address::placeholder {
  2468. color: #c5c5c5;
  2469. }
  2470. .discord-invite-info {
  2471. position: absolute;
  2472. top: 40px;
  2473. left: 0;
  2474. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2475. background: #fff;
  2476. border-radius: 16px;
  2477. padding: 16px;
  2478. box-sizing: border-box;
  2479. display: flex;
  2480. align-items: center;
  2481. cursor: pointer;
  2482. .icon {
  2483. width: 40px;
  2484. height: 40px;
  2485. margin-right: 10px;
  2486. border-radius: 50%;
  2487. }
  2488. .name {
  2489. font-weight: 600;
  2490. font-size: 16px;
  2491. color: #101419;
  2492. width: 193px;
  2493. height: 20px;
  2494. overflow: hidden;
  2495. white-space: nowrap;
  2496. text-overflow: ellipsis;
  2497. display: inline-block;
  2498. }
  2499. }
  2500. }
  2501. .icon-task-close {
  2502. margin-left: 6px;
  2503. cursor: pointer;
  2504. }
  2505. }
  2506. .border-hide {
  2507. border-bottom: none !important;
  2508. }
  2509. }
  2510. }
  2511. .usd-min-message {
  2512. font-style: normal;
  2513. font-weight: 400;
  2514. font-size: 12px;
  2515. line-height: 16px;
  2516. letter-spacing: 0.3px;
  2517. color: #C88726;
  2518. margin-top: 8px;
  2519. }
  2520. .tips-wrapper {
  2521. margin: 16px 0 0 12px !important;
  2522. padding: 0px !important;
  2523. .title,
  2524. .row {
  2525. font-weight: 400;
  2526. font-size: 12px;
  2527. color: #A39F9F;
  2528. }
  2529. .row {
  2530. box-sizing: border-box;
  2531. line-height: 16px;
  2532. }
  2533. }
  2534. .submit-btn-wrapper {
  2535. width: 100%;
  2536. background: #fff;
  2537. position: absolute;
  2538. bottom: 18px;
  2539. left: 0;
  2540. box-sizing: border-box;
  2541. padding: 16px 18px 0 18px;
  2542. .submit-btn {
  2543. width: 100%;
  2544. height: 46px;
  2545. text-align: center;
  2546. background: #4a99e9;
  2547. border-radius: 100px;
  2548. color: #fff;
  2549. display: flex;
  2550. align-items: center;
  2551. justify-content: center;
  2552. font-size: 16px;
  2553. font-weight: 500;
  2554. cursor: pointer;
  2555. .icon-loading {
  2556. width: 20px;
  2557. height: 20px;
  2558. margin-right: 3px;
  2559. }
  2560. }
  2561. .disabled-submit {
  2562. background-color: #D9D9D9;
  2563. }
  2564. }
  2565. }
  2566. .fill-right {
  2567. width: 100% !important;
  2568. border-bottom-left-radius: 16px;
  2569. }
  2570. }
  2571. }
  2572. }
  2573. .icon-refresh-rotate {
  2574. transform: rotate(360deg);
  2575. transition-duration: 1s;
  2576. }
  2577. .payment {
  2578. .balance {
  2579. display: flex;
  2580. margin-right: 20px;
  2581. .icon {
  2582. width: 40px;
  2583. height: 40px;
  2584. }
  2585. .con {
  2586. padding: 0 5px;
  2587. .desc {
  2588. color: rgba($color: #000000, $alpha: 0.5);
  2589. font-size: 12px;
  2590. margin-bottom: 4px;
  2591. }
  2592. .price {
  2593. font-size: 14px;
  2594. font-weight: bold;
  2595. word-break: break-all;
  2596. }
  2597. }
  2598. .refresh {
  2599. width: 40px;
  2600. cursor: pointer;
  2601. margin-left: -5px;
  2602. }
  2603. }
  2604. .btn-wrap {
  2605. width: 100%;
  2606. height: 80px;
  2607. background-color: #fff;
  2608. position: absolute;
  2609. left: 0;
  2610. bottom: 0;
  2611. box-shadow: 0px -1px 0px #ececec;
  2612. border-bottom-right-radius: 16px;
  2613. padding: 12px 30px;
  2614. box-sizing: border-box;
  2615. display: flex;
  2616. align-items: center;
  2617. justify-content: flex-end;
  2618. border-bottom-left-radius: 16px;
  2619. z-index: 999;
  2620. .custom-submit {
  2621. width: 200px;
  2622. height: 50px;
  2623. background: #1D9BF0;
  2624. border-radius: 50px;
  2625. font-weight: 700;
  2626. font-size: 18px;
  2627. line-height: 50px;
  2628. text-align: center;
  2629. letter-spacing: 0.3px;
  2630. color: #FFFFFF;
  2631. cursor: pointer;
  2632. }
  2633. }
  2634. }
  2635. .dialog {
  2636. position: absolute;
  2637. z-index: 2002;
  2638. top: 50%;
  2639. left: 50%;
  2640. transform: translate(-50%, -50%);
  2641. width: 800px;
  2642. height: calc(100% - 100px);
  2643. border-radius: 20px;
  2644. background-color: #ffffff;
  2645. .corp-title {
  2646. display: flex;
  2647. height: 48px;
  2648. align-items: center;
  2649. .back {
  2650. cursor: pointer;
  2651. width: 24px;
  2652. height: 24px;
  2653. margin: 0 12px;
  2654. }
  2655. span {
  2656. font-size: 16px;
  2657. font-weight: 500;
  2658. }
  2659. }
  2660. .corp-content {
  2661. width: 472px;
  2662. margin: auto;
  2663. height: calc(100% - 130px);
  2664. }
  2665. .corp-footer {
  2666. display: flex;
  2667. align-items: center;
  2668. justify-content: right;
  2669. height: 80px;
  2670. text-align: right;
  2671. padding-right: 30px;
  2672. .confirm {
  2673. cursor: pointer;
  2674. border: 0;
  2675. width: 200px;
  2676. height: 50px;
  2677. color: #ffffff;
  2678. font-size: 18px;
  2679. font-weight: 700;
  2680. border-radius: 25px;
  2681. background: #1D9BF0;
  2682. &.disable {
  2683. background: #D9D9D9;
  2684. img {
  2685. width: 20px;
  2686. margin-right: 10px;
  2687. }
  2688. }
  2689. }
  2690. }
  2691. }
  2692. .dialog-mask {
  2693. position: absolute;
  2694. z-index: 2001;
  2695. top: 0;
  2696. left: 0;
  2697. width: 100%;
  2698. height: 100%;
  2699. background-color: rgba(0, 0, 0, 0.5);
  2700. }
  2701. :deep() .vue-cropper {
  2702. background-image: none;
  2703. }
  2704. :deep() .cropper-modal {
  2705. background: rgba(0, 0, 0, .05);
  2706. }
  2707. </style>