give-dialog.vue 107 KB

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