give-dialog.vue 109 KB

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