withdrawal.vue 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Custom.Withdraw.Title')" />
  4. <uni-loading v-if="loading" />
  5. <view class="custom-deposit-container" v-else>
  6. <view class="custom-withdraw">
  7. <!-- 步骤1:选择账户 -->
  8. <view class="box box-step1">
  9. <view class="b-card">
  10. <view class="card-top">
  11. <text class="tit"><text class="iconfont icon-caret-right"></text>{{ t('Custom.Deposit.Title11') }}</text>
  12. <view class="base-info-form">
  13. <view class="uni-row2">
  14. <cwg-combox :clearable="false" v-model:value="loginValue" :options="loginComboxOptions"
  15. :placeholder="t('placeholder.choose')" @change="onAccountChange" />
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 步骤2:支付通道列表 -->
  22. <view class="box box-step2" v-if="step2">
  23. <view class="b-card">
  24. <view class="card-top">
  25. <text class="tit"><text class="iconfont icon-caret-right"></text>{{ t('Custom.Deposit.Title22') }}</text>
  26. <cwg-combox :clearable="false" v-model:value="channelId" :options="channelListOptions"
  27. :placeholder="t('placeholder.choose')">
  28. </cwg-combox>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 步骤3:填写出金信息 -->
  33. <view class="box box-step3" v-if="step3">
  34. <view class="b-card">
  35. <view class="card-top">
  36. <!-- 表单 -->
  37. <uni-forms ref="formRef" :model="form" :rules="rules" labelWidth="200" label-position="top"
  38. v-show="isStep3" class="base-info-form" validate-trigger="submit">
  39. <view class="demo-uni-row uni-row1 uni-row2">
  40. <!-- 银行选择(针对有银行列表的通道) -->
  41. <view v-if="bankDate.length">
  42. <view class="tit">
  43. <text>{{ t('Custom.Withdraw.Title5') }}</text>
  44. </view>
  45. </view>
  46. <view v-if="bankDate.length">
  47. <uni-forms-item name="bankCode">
  48. <cwg-combox :clearable="false" v-model:value="form.bankCode" :options="bankOptions"
  49. :placeholder="t('placeholder.choose')" @change="selectCode" />
  50. </uni-forms-item>
  51. </view>
  52. <!-- 电子钱包地址输入 -->
  53. <view v-if="['CHANNEL_TYPE_WALLET', 'CHANNEL_TYPE_ALI_WALLET'].includes(channelData.type)">
  54. <view class="tit">
  55. <text>{{ getWalletLabel }}</text>
  56. </view>
  57. </view>
  58. <!-- 电子钱包地址输入 -->
  59. <view v-if="['CHANNEL_TYPE_WALLET', 'CHANNEL_TYPE_ALI_WALLET'].includes(channelData.type)">
  60. <uni-forms-item name="address">
  61. <uni-easyinput :clearable="false" v-model="form.address" :placeholder="t('placeholder.input')" />
  62. </uni-forms-item>
  63. </view>
  64. <!-- 数字货币选择(从已保存地址中选择) -->
  65. <template v-if="channelData.type === 'DIGITAL_CURRENCY'">
  66. <view :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="channelData.type === 'DIGITAL_CURRENCY'">
  67. <view
  68. style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
  69. <view class="tit">
  70. <text>{{ t('Custom.Withdraw.Title6') }}</text>
  71. </view>
  72. <view class="add-back">
  73. <text>{{
  74. t('blockchain.item10') }}</text>
  75. <text class="add-btn crm-cursor" @click="openAddBankCard('add_bankBlockchain')">
  76. {{ t('Custom.Withdraw.addBank1') }}
  77. </text>
  78. </view>
  79. </view>
  80. <uni-forms-item>
  81. <cwg-combox :clearable="false" v-model:value="myId" :options="digitalOptions"
  82. :placeholder="t('placeholder.choose')" @change="onDigitalCurrencyChange"
  83. :disabled="!ruleForm.bankBlockchain.length" />
  84. </uni-forms-item>
  85. </view>
  86. <view>
  87. <uni-forms-item :label="t('blockchain.item3')">
  88. <uni-easyinput disabled v-model="form.addressName" />
  89. </uni-forms-item>
  90. </view>
  91. <view>
  92. <uni-forms-item :label="t('blockchain.item4')">
  93. <uni-easyinput disabled v-model="form.address" />
  94. </uni-forms-item>
  95. </view>
  96. <view v-if="form.addressProve">
  97. <uni-forms-item :label="t('blockchain.item5')">
  98. <view class="proof">
  99. <template v-if="form.addressProve && (form.addressProve.slice(-3).toLowerCase() === 'pdf')">
  100. <cwg-link type="pdf1" :url="imgUrl + form.addressProve" target="_blank"
  101. class="state crm_state_blue">PDF</cwg-link>
  102. </template>
  103. <image v-else :src="imgUrl + form.addressProve" mode="aspectFit"
  104. style="width: 100rpx; height: 100rpx;" @click="previewImage(imgUrl + form.addressProve)" />
  105. </view>
  106. </uni-forms-item>
  107. </view>
  108. <view :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  109. <text class="tit"><text class="iconfont iconi"></text>{{ t('Custom.Deposit.Des') }}</text>
  110. </view>
  111. </template>
  112. <view class="card-tit"
  113. v-if="isStep3 && (channelData.type == 'BANK_TELEGRAPHIC' || channelData.type == 'BANK' || channelData.type == 'CHANNEL_TYPE_CARD')">
  114. <div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
  115. <view class="tit">
  116. <text>{{ t('Custom.Withdraw.Title4') }}</text>
  117. </view>
  118. <div class="add-back">
  119. <text v-if="channelData.type == 'BANK_TELEGRAPHIC'">{{
  120. t('Custom.Withdraw.addWire') }}</text>
  121. <text v-if="channelData.type == 'BANK_TELEGRAPHIC'" class="add-btn crm-cursor"
  122. @click="openAddBankCard('add_wireTransfer')">
  123. {{ t('Custom.Withdraw.addBank1') }}
  124. </text>
  125. <text v-if="channelData.type == 'BANK'">{{
  126. t('Custom.Withdraw.addBank')
  127. }}</text>
  128. <text v-if="channelData.type == 'BANK'" class="add-btn crm-cursor"
  129. @click="openAddBankCard('add_bankCard')">
  130. {{ t('Custom.Withdraw.addBank1') }}
  131. </text>
  132. <text v-if="channelData.type == 'CHANNEL_TYPE_CARD'">{{
  133. t('PersonalManagement.Label.addCreditCard') }}</text>
  134. <text v-if="channelData.type == 'CHANNEL_TYPE_CARD'" class="add-btn crm-cursor"
  135. @click="openAddBankCard('add_CreditCard')">
  136. {{ t('Custom.Withdraw.addBank1') }}
  137. </text>
  138. </div>
  139. </div>
  140. </view>
  141. <!-- 银行卡/信用卡选择 -->
  142. <view :xs="24" :sm="24" :md="24" :lg="24" :xl="24"
  143. v-if="['BANK', 'BANK_TELEGRAPHIC', 'CHANNEL_TYPE_CARD'].includes(channelData.type)">
  144. <uni-forms-item>
  145. <cwg-combox :clearable="false" v-model:value="myId" :options="bankCardOptions"
  146. @change="chooseBank" :placeholder="t('placeholder.choose')" />
  147. </uni-forms-item>
  148. </view>
  149. <!-- 通用银行信息展示 -->
  150. <template v-if="channelData.type == 'BANK'">
  151. <view>
  152. <uni-forms-item :label="t('Custom.Withdraw.UserName')">
  153. <uni-easyinput disabled v-model="form.bankUname" />
  154. </uni-forms-item>
  155. </view>
  156. <view>
  157. <uni-forms-item :label="t('Custom.Withdraw.BankCardNum')">
  158. <uni-easyinput disabled v-model="form.bankCardNum" />
  159. </uni-forms-item>
  160. </view>
  161. <view>
  162. <uni-forms-item :label="t('Custom.Withdraw.BankName')">
  163. <uni-easyinput disabled v-model="form.bankName" />
  164. </uni-forms-item>
  165. </view>
  166. <view>
  167. <uni-forms-item :label="t('Custom.Withdraw.bankBranchName')">
  168. <uni-easyinput disabled v-model="form.bankBranchName" />
  169. </uni-forms-item>
  170. </view>
  171. </template>
  172. <!-- 信用卡信息展示(针对有信用卡列表的通道) -->
  173. <template v-if="channelData.type == 'CHANNEL_TYPE_CARD'">
  174. <view>
  175. <uni-forms-item :label="t('PersonalManagement.Label.CreditCardAccountName')">
  176. <uni-easyinput disabled v-model="form.bankUname" />
  177. </uni-forms-item>
  178. </view>
  179. <view>
  180. <uni-forms-item :label="t('PersonalManagement.Label.CreditCardAccount')">
  181. <uni-easyinput disabled v-model="form.bankCardNum" />
  182. </uni-forms-item>
  183. </view>
  184. <view>
  185. <uni-forms-item label="CVV">
  186. <uni-easyinput disabled v-model="form.cvv" />
  187. </uni-forms-item>
  188. </view>
  189. <view>
  190. <uni-forms-item :label="t('PersonalManagement.Label.ExpirationYear')">
  191. <uni-easyinput disabled v-model="form.expiryYearMonth" />
  192. </uni-forms-item>
  193. </view>
  194. </template>
  195. <!-- 银行电汇转账信息展示(针对有银行转账列表的通道) -->
  196. <template v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  197. <view>
  198. <uni-forms-item :label="t('Custom.Withdraw.UserName')">
  199. <uni-easyinput disabled v-model="form.bankUname" />
  200. </uni-forms-item>
  201. </view>
  202. <view>
  203. <uni-forms-item :label="t('Custom.Withdraw.BankCardNum')">
  204. <uni-easyinput disabled v-model="form.bankCardNum" />
  205. </uni-forms-item>
  206. </view>
  207. <view>
  208. <uni-forms-item :label="t('Custom.Withdraw.BankName')">
  209. <uni-easyinput disabled v-model="form.bankName" />
  210. </uni-forms-item>
  211. </view>
  212. <view>
  213. <uni-forms-item :label="t('Custom.Withdraw.swiftCode')">
  214. <uni-easyinput disabled v-model="form.swiftCode" />
  215. </uni-forms-item>
  216. </view>
  217. <view>
  218. <uni-forms-item :label="t('Custom.Withdraw.bankCode')">
  219. <uni-easyinput disabled v-model="form.customBankCode" />
  220. </uni-forms-item>
  221. </view>
  222. <view>
  223. <uni-forms-item :label="t('Custom.Withdraw.bankAddr')">
  224. <uni-easyinput disabled v-model="form.bankAddr" />
  225. </uni-forms-item>
  226. </view>
  227. <view>
  228. <uni-forms-item label="Account Agency NO" name="agencyNo"
  229. v-if="channelData.code == 'PAY_RETAILER_REMIT_PAY_KEY_BRW'">
  230. <uni-easyinput v-model="form.agencyNo" />
  231. </uni-forms-item>
  232. <uni-forms-item label="Account Agency NO" v-else>
  233. <uni-easyinput v-model="form.agencyNo" />
  234. </uni-forms-item>
  235. </view>
  236. <view v-if="channelData.code == 'PAY_RETAILER_REMIT_PAY_KEY_BRW'">
  237. <uni-forms-item label="CPF" name="cpf">
  238. <uni-easyinput v-model="form.cpf" />
  239. </uni-forms-item>
  240. </view>
  241. </template>
  242. <!-- 出金金额 -->
  243. <view v-if="channelData.type == 'BANK_TELEGRAPHIC' && isStep3">
  244. <view class="tit">
  245. <text>{{ t('Custom.Withdraw.Title3') }}</text>
  246. </view>
  247. </view>
  248. <view v-if="channelData.type != 'BANK_TELEGRAPHIC' && isStep3">
  249. <view class="tit">
  250. <text>{{ t('Custom.Withdraw.Title3') + '(' + channelData.currency + ')'
  251. }}</text>
  252. </view>
  253. </view>
  254. <view v-if="channelData.type !== 'BANK_TELEGRAPHIC'" class="amount-box amount-box1">
  255. <uni-forms-item name="amount" :error-message="amountErrorMessage" class="amount-input">
  256. <uni-easyinput v-model="form.amount" type="number" @blur="validateAmount" />
  257. </uni-forms-item>
  258. <view class="btn" v-t="'State.All'" @click="setAllAmount"></view>
  259. </view>
  260. <template v-else>
  261. <view>
  262. <uni-forms-item :label="t('Custom.Withdraw.CurrencyType')">
  263. <cwg-combox :clearable="false" v-model:value="form.currency"
  264. :options="[{ text: 'USD', value: 'USD' }]" @change="(val) => form.currency = val" />
  265. </uni-forms-item>
  266. </view>
  267. <view class="amount-box">
  268. <uni-forms-item :label="t('Custom.Withdraw.amount')" name="amount"
  269. :error-message="amountErrorMessage" class="amount-input">
  270. <uni-easyinput v-model="form.amount" type="number" @blur="validateAmount" />
  271. </uni-forms-item>
  272. <view class="btn" v-t="'State.All'" @click="setAllAmount"></view>
  273. </view>
  274. </template>
  275. </view>
  276. <!-- 协议同意 -->
  277. <view class="agree">
  278. <uni-forms-item name="agree2">
  279. <checkbox-group :value="form.agree2 ? ['1'] : []" @change="onAgree2Change">
  280. <label class="checkbox">
  281. <checkbox value="1" :checked="form.agree2" />
  282. <text class="crm-cursor" style="text-decoration: underline;"
  283. @click.stop="dialogCheckTip = true">{{
  284. t('Custom.Withdraw.Des') }}</text>
  285. </label>
  286. </checkbox-group>
  287. </uni-forms-item>
  288. </view>
  289. <view class="agree" v-if="dialogTipsIsShow">
  290. <uni-forms-item name="agree3">
  291. <checkbox-group :value="form.agree3 ? ['1'] : []" @change="onAgree3Change">
  292. <label class="checkbox">
  293. <checkbox value="1" :checked="form.agree3" />
  294. <text>* {{ t('Custom.Withdraw.item1') }}<br>{{ t('Custom.Withdraw.item1_1') }}<br>{{
  295. t('Custom.Withdraw.item1_2') }}</text>
  296. </label>
  297. </checkbox-group>
  298. </uni-forms-item>
  299. </view>
  300. <button class="s-btn" type="primary" @click="openTips">{{ t('Btn.Submit') }}</button>
  301. </uni-forms>
  302. </view>
  303. </view>
  304. </view>
  305. <!-- 提示弹窗 -->
  306. <cwg-tips-popup v-model:visible="dialogTips" content="Custom.Withdraw.item2" @confirm="closeTipsConfirm" />
  307. <!-- 弹窗:确认信息 -->
  308. <cwg-check-confirm-popup v-model:visible="dialogCheckConfirm" :title="t('Home.page_customer.item3')"
  309. :channelData="channelData" :code="code" :selectCodes="selectCodes" :params="form" :FreeNumber="FreeNumber"
  310. :userName="userName" :dialogCheckConfirm_form="dialogCheckConfirm_form" :login="loginValue"
  311. :loginDoc="loginValueDoc" @confirm="submit" />
  312. <!-- 协议弹窗 -->
  313. <cwg-tips-popup v-model:visible="dialogCheckTip"
  314. :introduce="isZh ? introduce.introduce : introduce.enIntroduce" />
  315. <!-- 等待弹窗 -->
  316. <cwg-wait-popup v-model:visible="dialogCheckWait" type="center" :mask-click="false" :showFooters="false" />
  317. <!-- 最后失败弹窗 -->
  318. <cwg-error-popup v-model:visible="dialogError" @confirm="closeDia" :responseMessage="RES" />
  319. <!-- 最后成功弹窗 -->
  320. <cwg-success-popup v-model:visible="dialogSuccess" @confirm="closeDia" />
  321. <!-- kyc成功弹窗 -->
  322. <cwg-kyc-popup v-model:visible="dialogKyc" :qrText="text1" />
  323. <!--验证码-->
  324. <cwg-email-code-popup v-model:visible="dialogDealResult" @confirm="submitCode" :api="emailCodeApi" />
  325. <!-- 新增银行弹窗 -->
  326. <add-bank-dialog ref="addBankDialogRef" @success="addSuccess" />
  327. </view>
  328. <view class="step3-attention">
  329. <view class="tips" v-if="(introduce.introduce || introduce.enIntroduce)">
  330. <view>
  331. <rich-text class="attention" :nodes="isZh ? introduce.introduce : introduce.enIntroduce" />
  332. </view>
  333. </view>
  334. </view>
  335. </view>
  336. </cwg-page-wrapper>
  337. </template>
  338. <script setup>
  339. import { ref, reactive, computed, onMounted, nextTick, watch, getCurrentInstance, onUnmounted } from 'vue'
  340. import { onLoad } from '@dcloudio/uni-app'
  341. import { showToast } from "@/utils/toast";
  342. import { isAfterJuly28 } from '@/utils/dateUtils'
  343. // import Drawer from "@/views/global/Drawer"
  344. import { customApi } from "@/service/custom"
  345. import { financialApi } from "@/service/financial"
  346. import { activityApi } from "@/service/activity"
  347. import Config from "@/config/index"
  348. import Decimal from "decimal.js"
  349. import QrCode from "@/components/QRCode.vue"
  350. // import logoImage from "@/assets/images/MTBG.jpg"
  351. import AddBankDialog from '@/components/AddBankDialog.vue';
  352. import PaymentMethodsList from './components/PaymentMethodsList.vue'
  353. import CwgCheckConfirmPopup from './components/WithdrawCheckConfirmPopup.vue'
  354. import CwgKycPopup from './components/KycPopup.vue'
  355. let { Code, Host80 } = Config
  356. import { useI18n } from 'vue-i18n'
  357. const { t, locale } = useI18n()
  358. import useRouter from '@/hooks/useRouter'
  359. const router = useRouter()
  360. import useUserStore from '@/stores/use-user-store'
  361. const userStore = useUserStore()
  362. const isZh = computed(() => ['cn', 'zhHant'].includes(locale.value))
  363. // 获取组件实例,用于访问全局挂载的属性和方法(替代 this)
  364. const { proxy } = getCurrentInstance()
  365. // -------------------- data --------------------
  366. const loginValue = ref("")
  367. const loginValueDoc = ref("")
  368. const hiddenSelect = ref(false)
  369. const metaInfo = ref(null)
  370. const text1 = ref("")
  371. // const logoImageRef = logoImage
  372. const dialogCheck1 = ref(false)
  373. const flag = ref(false)
  374. const RES = ref("")
  375. //银行
  376. const openType = ref("") //弹出类别
  377. const dialogInfoTradingAdd = ref(false) //新增
  378. const ruleForm = reactive({
  379. bankInfo: [], //银行信息
  380. bankWrit: [], //电汇信息
  381. xykInfo: [], //信用卡信息
  382. bankBlockchain: [], //区块链
  383. })
  384. const imgUrl = Host80 //图片地址
  385. const loginOptions = ref([])
  386. const value = ref("") //账号
  387. const code = ref("") //通道code
  388. const bankValid = ref("") //通道是否有银行
  389. const requestUrl = ref("") //通道地址
  390. const isStep3 = ref(false)
  391. const step2 = ref(false)
  392. const step3 = ref(false)
  393. const dialogCheckTip = ref(false)
  394. const isChannel = ref(true)
  395. const pictLoading = ref(false)
  396. const tableData = reactive({
  397. Digital_Currency: [],
  398. China_UnionPay: [],
  399. Electronic_Wallet: [],
  400. International_Transfer: [],
  401. CHANNEL_TYPE_CARD: [],
  402. CHANNEL_TYPE_ALI_WALLET: [],
  403. Ucard_Wallet: [],
  404. })
  405. //通道table-选择前后
  406. const activeTab = ref(1)
  407. // 🔥 自动过滤掉空数据的 tab
  408. const tabsConfig = computed(() => {
  409. const allTabs = [
  410. { text: t('Custom.Deposit.Channel3'), value: 1, type: 'Digital_Currency' },
  411. { text: t('Custom.Deposit.Channel2'), value: 2, type: 'China_UnionPay' },
  412. { text: t('Custom.Deposit.Channel4'), value: 3, type: 'Electronic_Wallet' },
  413. { text: t('Custom.Deposit.Channel1'), value: 4, type: 'International_Transfer' },
  414. { text: t('PersonalManagement.Label.CreditCard'), value: 5, type: 'CHANNEL_TYPE_CARD' },
  415. { text: t('card.title'), value: 6, type: 'Ucard_Wallet' },
  416. { text: t('Label.Ali'), value: 7, type: 'CHANNEL_TYPE_ALI_WALLET' },
  417. ]
  418. // ✅ 只保留有数据的 tab
  419. return allTabs.filter(tab => {
  420. return tableData[tab.type]?.length > 0
  421. })
  422. })
  423. // 当前选中的 tab 项
  424. const currentTab = computed(() => tabsConfig.value.find(t => t.value === activeTab.value))
  425. // 当前要渲染的表格数据
  426. const currentTableData = computed(() => {
  427. const type = currentTab.value?.type
  428. return type ? tableData[type] || [] : []
  429. })
  430. const bankDate = ref([]) //通道下的银行列表
  431. const channelData = ref({}) //当前选择的通道信息
  432. const WireTransferAccount = ref({}) //银行电汇信息
  433. //表单
  434. const form = reactive({
  435. currency: "USD",
  436. amount: "",
  437. amount1: "",
  438. bankCode: '', // 银行代码(普通银行通道选择)
  439. address: '', // 电子钱包地址 / 数字货币地址(输入/展示)
  440. addressName: '', // 数字货币地址名称(展示)
  441. addressProve: '', // 数字货币地址证明文件路径(仅展示))
  442. bankUname: '', // 持卡人姓名
  443. bankCardNum: '', // 银行卡号
  444. bankName: '', // 银行名称
  445. bankBranchName: '', // 支行名称
  446. swiftCode: '', // SWIFT代码
  447. customBankCode: '', // 自定义银行代码
  448. bankAddr: '', // 银行地址
  449. agencyNo: '', // 代理机构编号(电汇专用,可编辑)
  450. cpf: '', // CPF号码(电汇专用,可编辑)
  451. cvv: '', // CVV码(电汇专用,可编辑)
  452. expiryYearMonth: '', // 过期年(电汇专用,可编辑)
  453. agree2: false, // 协议勾选2
  454. agree3: false // 协议勾选3(当dialogTipsIsShow为true时显示)
  455. })
  456. const formRef = ref(null)
  457. const resetForm = () => {
  458. //表单重置后,需要手动重置一些状态
  459. form.amount = ""
  460. form.amount1 = ""
  461. form.bankCode = ""
  462. form.address = ""
  463. form.addressName = ""
  464. form.addressProve = ""
  465. form.bankUname = ""
  466. form.bankCardNum = ""
  467. form.swiftCode = ""
  468. form.customBankCode = ""
  469. form.bankAddr = ""
  470. form.agencyNo = ""
  471. form.bankName = ""
  472. form.cpf = ""
  473. form.bankBranchName = ""
  474. form.cpf = ""
  475. form.cvv = ""
  476. form.expiryYearMonth = ""
  477. form.agree2 = false
  478. form.agree3 = false
  479. amountErrorMessage.value = ""
  480. }
  481. //数量区间
  482. const mAmount = reactive({
  483. minAmount: "",
  484. maxAmount: "",
  485. })
  486. const introduce = reactive({
  487. introduce: "",
  488. enIntroduce: "",
  489. })
  490. //银行列表
  491. const bankInfoList = ref([])
  492. const bank = ref("")
  493. const myId = ref(null) //银行列表id
  494. const bankPayType = ref("") //临时放置通道code
  495. //银联/数字货币
  496. const step3_bank_cur = ref("")
  497. const agree2 = ref(false) //条款
  498. //数字表单
  499. const form1 = ref({})
  500. const dialogCheck = ref(false)
  501. const dialogKyc = ref(false)
  502. const dialogVisible = ref(false)
  503. const dialogCheckWait = ref(false)
  504. //新建银行弹窗
  505. const dialogNewBank = ref(false)
  506. const params = reactive({
  507. bankCardNum: "",
  508. bankUname: "",
  509. bankName: "",
  510. bankBranchName: "",
  511. bankAddr: "",
  512. swiftCode: "",
  513. bankFront: "",
  514. bankBack: "",
  515. defaultBank: false,
  516. })
  517. const dialogDealResult = ref(false)
  518. const emailCodeApi = ref(financialApi.withdrawCode)
  519. const dialogDealResult_form = reactive({
  520. emailCode: "", //数字货币出金,验证码
  521. })
  522. const dialogTips = ref(false) //提交时的确认弹窗
  523. const dialogTipsIsShow = ref(true) //提交时的确认弹窗-是否显示
  524. const dialogFreeNumber = ref(false) //可减免手续费用次数弹窗
  525. const FreeNumber = ref(0)
  526. const dialogCheckConfirm = ref(false)
  527. const dialogCheckConfirm_form = reactive({
  528. amount: "",
  529. feeAmount: "",
  530. })
  531. const tableDataNewYear24Flag = ref(false) //24新年庆典
  532. const tableDataNewYear24 = ref(false) //24新年庆典
  533. const NewYear24Data = reactive({
  534. balance: 0,
  535. income: 0,
  536. rate: 0,
  537. })
  538. const rules = computed(() => ({
  539. myId: {
  540. rules: [
  541. {
  542. required: true,
  543. errorMessage: t('vaildate.select.empty'),
  544. trigger: 'change',
  545. },
  546. ],
  547. },
  548. bankUname: {
  549. rules: [
  550. {
  551. required: true,
  552. errorMessage: t('vaildate.select.empty'),
  553. trigger: 'change',
  554. },
  555. ],
  556. },
  557. bankCode: {
  558. rules: [
  559. {
  560. required: true,
  561. errorMessage: t('vaildate.select.empty'),
  562. trigger: 'change',
  563. },
  564. ],
  565. },
  566. address: {
  567. rules: [
  568. {
  569. required: true,
  570. errorMessage: t('vaildate.input.empty'),
  571. trigger: 'blur',
  572. },
  573. ],
  574. },
  575. amount: {
  576. rules: [
  577. {
  578. required: true,
  579. errorMessage: t('vaildate.amount.format'),
  580. },
  581. {
  582. validateFunction: (rule, value, data, callback) => {
  583. if (
  584. !!value &&
  585. (mAmount.minAmount > value || mAmount.maxAmount < value)
  586. ) {
  587. callback(
  588. t('vaildate.amount.amount') +
  589. mAmount.minAmount +
  590. ' - ' +
  591. mAmount.maxAmount
  592. );
  593. return false;
  594. }
  595. if (/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
  596. return true;
  597. } else {
  598. callback(t('vaildate.amount.format'));
  599. return false;
  600. }
  601. },
  602. trigger: 'blur',
  603. },
  604. ],
  605. },
  606. agree2: {
  607. rules: [
  608. {
  609. validateFunction: (rule, value, data, callback) => {
  610. if (form.agree2) {
  611. return true;
  612. } else {
  613. callback(t('vaildate.agree.empty'));
  614. return false;
  615. }
  616. },
  617. trigger: 'change',
  618. },
  619. ],
  620. },
  621. agree3: {
  622. rules: [
  623. {
  624. validateFunction: (rule, value, data, callback) => {
  625. if (form.agree3) {
  626. return true;
  627. } else {
  628. callback(t('vaildate.agree.empty'));
  629. return false;
  630. }
  631. },
  632. trigger: 'change',
  633. },
  634. ],
  635. },
  636. agencyNo: {
  637. rules: [
  638. {
  639. required: true,
  640. errorMessage: t('vaildate.input.empty'),
  641. trigger: 'blur',
  642. },
  643. ],
  644. },
  645. cpf: {
  646. rules: [
  647. {
  648. required: true,
  649. errorMessage: t('vaildate.input.empty'),
  650. trigger: 'blur',
  651. },
  652. ],
  653. },
  654. emailCode: {
  655. rules: [
  656. {
  657. required: true,
  658. errorMessage: t('vaildate.code.empty'),
  659. trigger: 'blur',
  660. },
  661. ],
  662. },
  663. }));
  664. // 验证金额
  665. const amountErrorMessage = ref('')
  666. const validateAmount = () => {
  667. const amount = form.amount
  668. if (!amount && amount !== 0) {
  669. amountErrorMessage.value = t('vaildate.amount.format')
  670. return false
  671. }
  672. if (mAmount.minAmount && mAmount.maxAmount) {
  673. const min = Number(mAmount.minAmount);
  674. const max = Number(mAmount.maxAmount);
  675. const numValue = Number(amount);
  676. if (numValue < min || numValue > max) {
  677. amountErrorMessage.value = t('vaildate.amount.amount') + min + '-' + max
  678. return false
  679. }
  680. }
  681. if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(amount)) {
  682. amountErrorMessage.value = t('vaildate.amount.format')
  683. return false
  684. }
  685. amountErrorMessage.value = ''
  686. return true
  687. }
  688. // 分组标题映射
  689. const groupTitleMap = {
  690. 'Ucard_Wallet': 'card.title',
  691. 'Digital_Currency': 'Custom.Deposit.Channel3',
  692. 'China_UnionPay': 'Custom.Deposit.Channel2',
  693. 'Electronic_Wallet': 'Custom.Deposit.Channel4',
  694. 'International_Transfer': 'Custom.Deposit.Channel1',
  695. 'CHANNEL_TYPE_CARD': 'PersonalManagement.Label.CreditCard',
  696. 'CHANNEL_TYPE_ALI_WALLET': 'Label.Ali'
  697. }
  698. // -------------------- computed --------------------
  699. const getWalletLabel = computed(() => {
  700. if (channelData.value.type === 'CHANNEL_TYPE_WALLET') return t('Custom.Withdraw.Title7')
  701. if (channelData.value.type === 'UCARD_WALLET') return t('card.title')
  702. if (channelData.value.type === 'CHANNEL_TYPE_ALI_WALLET') return t('Label.AliAccout')
  703. return ''
  704. })
  705. // 最后确认
  706. const dialogSuccess = computed(() => dialogCheck.value && dialogVisible.value)
  707. // 最后失败
  708. const dialogError = computed(() => dialogCheck.value && !dialogVisible.value)
  709. const loginComboxOptions = computed(() => {
  710. return loginOptions.value.map((item, index) => ({
  711. text: item.label,
  712. value: item.login
  713. }))
  714. })
  715. const bankOptions = computed(() => {
  716. return bankDate.value.map((item, index) => ({
  717. text: isZh.value ? item.name : item.enName,
  718. value: item.code
  719. }))
  720. })
  721. const digitalOptions = computed(() => {
  722. return ruleForm.bankBlockchain.map((item, index) => ({
  723. text: `${item.addressName}-${item.address}`,
  724. value: item.id,
  725. disable: item.authStatus == 0,
  726. }))
  727. })
  728. const bankCardOptions = computed(() => {
  729. return bankList.value.map((item, index) => ({
  730. text: getBankLabel(item),
  731. value: item.id
  732. }))
  733. })
  734. const getBankLabel = (item) => {
  735. if (channelData.value.type === 'BANK' || channelData.value.type === 'BANK_TELEGRAPHIC') {
  736. return `${item.bankName}-${item.bankCardNum}`
  737. } else if (channelData.value.type === 'CHANNEL_TYPE_CARD') {
  738. return item.bankCardNum
  739. }
  740. return ''
  741. }
  742. const bankList = computed(() => {
  743. if (channelData.value.type === 'BANK') return ruleForm.bankInfo
  744. if (channelData.value.type === 'BANK_TELEGRAPHIC') return ruleForm.bankWrit
  745. if (channelData.value.type === 'CHANNEL_TYPE_CARD') return ruleForm.xykInfo
  746. if (channelData.value.type === 'DIGITAL_CURRENCY') return ruleForm.bankBlockchain
  747. return []
  748. })
  749. const isFree = computed(() => {
  750. let flag = false;
  751. let startTime1 = "2024/11/01 00:00:00";
  752. let timezone = 2; //目标时区时间,东3区 东时区正数 西市区负数
  753. let offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟
  754. let nowDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数
  755. let now = new Date(
  756. nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000
  757. ).getTime();
  758. let start = new Date(startTime1).getTime();
  759. if (now > start) {
  760. flag = true;
  761. }
  762. return flag;
  763. })
  764. // -------------------- methods --------------------
  765. const groupCurrency = (type) => {
  766. const symbol = { GBP: '£', USD: '$', EUR: '€', USC: '¢' }[type] || '$'
  767. return `: ${symbol}`
  768. }
  769. const groupCurrency1 = (type) => {
  770. const symbol = { GBP: '£', USD: '$', EUR: '€', USC: '¢' }[type] || '$'
  771. return `${symbol}`
  772. }
  773. function groupTypeName(type) {
  774. if (type == "1") {
  775. return t("AccountType.ClassicAccount");
  776. } else if (type == "2") {
  777. return t("AccountType.SeniorAccount");
  778. } else if (type == "3") {
  779. return isAfterJuly28() ? "--" : t("AccountType.AgencyAccount");
  780. } else if (type == "5") {
  781. return t("AccountType.SpeedAccount");
  782. } else if (type == "6") {
  783. return t("AccountType.SpeedAccount");
  784. } else if (type == "7") {
  785. return t("AccountType.StandardAccount");
  786. } else if (type == "8") {
  787. return t("AccountType.CentAccount");
  788. }
  789. }
  790. //回显
  791. const onAgree3Change = (e) => {
  792. form.agree3 = e.detail.value.length > 0
  793. }
  794. const onAgree2Change = (e) => {
  795. form.agree2 = e.detail.value.length > 0
  796. }
  797. function selectChange() {
  798. // proxy.$forceUpdate();
  799. }
  800. //新增
  801. // function openAddBankCard(type) {
  802. // if (type == "add_bankCard") {
  803. // if (ruleForm.bankInfo.length == 2) {
  804. // proxy.$pigeon.MessageConfirm(
  805. // t("Msg.UnionPayCARDS"),
  806. // t("Msg.SystemPrompt"),
  807. // t("Btn.Confirm"),
  808. // t("Btn.Cancel"),
  809. // async function () { },
  810. // function () { }
  811. // );
  812. // } else {
  813. // openType.value = "add_bankCard";
  814. // dialogInfoTradingAdd.value = true;
  815. // }
  816. // } else if (type == "add_wireTransfer") {
  817. // if (ruleForm.bankWrit.length == 2) {
  818. // proxy.$pigeon.MessageConfirm(
  819. // t("Msg.WireTransfers"),
  820. // t("Msg.SystemPrompt"),
  821. // t("Btn.Confirm"),
  822. // t("Btn.Cancel"),
  823. // async function () { },
  824. // function () { }
  825. // );
  826. // } else {
  827. // openType.value = "add_wireTransfer";
  828. // dialogInfoTradingAdd.value = true;
  829. // }
  830. // } else if (type == "add_CreditCard") {
  831. // openType.value = "add_CreditCard";
  832. // dialogInfoTradingAdd.value = true;
  833. // } else if (type == "add_bankBlockchain") {
  834. // if (ruleForm.bankBlockchain.length == 2) {
  835. // proxy.$pigeon.MessageConfirm(
  836. // t("blockchain.item9"),
  837. // t("Msg.SystemPrompt"),
  838. // t("Btn.Confirm"),
  839. // t("Btn.Cancel"),
  840. // async function () { },
  841. // function () { }
  842. // );
  843. // } else {
  844. // openType.value = "add_bankBlockchain";
  845. // dialogInfoTradingAdd.value = true;
  846. // }
  847. // }
  848. // }
  849. // 新增银行信息
  850. const addBankDialogRef = ref(null);
  851. function openAddBankCard(type) {
  852. console.log(type, 121212)
  853. switch (type) {
  854. case 'add_bankBlockchain':
  855. openAddCrypto()
  856. break;
  857. case 'add_bankCard':
  858. openAddUnionpay()
  859. break;
  860. case 'add_wireTransfer':
  861. openAddBank()
  862. break;
  863. case 'add_CreditCard':
  864. openAddCredit()
  865. break;
  866. }
  867. }
  868. function openAddCrypto() {
  869. const wallets = bankCardOptions.value || []
  870. // 1️⃣ 没有钱包
  871. if (wallets.length === 0) {
  872. addBankDialogRef.value?.open(4);
  873. return;
  874. }
  875. // 2️⃣ 是否存在未认证钱包
  876. const hasUnAuth = wallets.some(
  877. item => item.authStatus === 0 || item.approveStatus === 1
  878. );
  879. if (hasUnAuth) {
  880. uni.showToast({
  881. title: "加密钱包未认证",
  882. icon: "none"
  883. });
  884. return;
  885. }
  886. // 3️⃣ 是否达到上限
  887. if (wallets.length >= 2) {
  888. uni.showToast({
  889. title: t('blockchain.item9'),
  890. icon: "none"
  891. });
  892. return;
  893. }
  894. // 4️⃣ 正常打开
  895. addBankDialogRef.value?.open(4);
  896. }
  897. function openAddUnionpay() {
  898. const wallets = bankCardOptions.value || []
  899. if (wallets.length === 0) {
  900. addBankDialogRef.value?.open(1);
  901. return;
  902. }
  903. if (wallets.length >= 2) {
  904. uni.showToast({
  905. title: t('Msg.UnionPayCARDS'),
  906. icon: "none"
  907. });
  908. return;
  909. }
  910. addBankDialogRef.value?.open(1);
  911. }
  912. function openAddBank() {
  913. const wallets = bankCardOptions.value || []
  914. if (wallets.length === 0) {
  915. addBankDialogRef.value?.open(2);
  916. return;
  917. }
  918. if (wallets.length >= 2) {
  919. uni.showToast({
  920. title: t('Msg.WireTransfers'),
  921. icon: "none"
  922. });
  923. return;
  924. }
  925. addBankDialogRef.value?.open(2);
  926. }
  927. function openAddCredit() {
  928. const wallets = bankCardOptions.value || []
  929. if (wallets.length === 0) {
  930. addBankDialogRef.value?.open(3);
  931. return;
  932. }
  933. addBankDialogRef.value?.open(3);
  934. }
  935. // 新增银行信息成功回调
  936. const addSuccess = (e) => {
  937. getBankInfo();
  938. }
  939. function closeDiaAdd() {
  940. dialogInfoTradingAdd.value = false;
  941. }
  942. function closeAdd(val) {
  943. dialogInfoTradingAdd.value = val;
  944. }
  945. function confirmToReload() {
  946. dialogInfoTradingAdd.value = false;
  947. getBankInfo();
  948. }
  949. const getBankInfo = async () => {
  950. const res = await financialApi.customBankList({})
  951. if (res.code === Code.StatusOK) {
  952. ruleForm.bankInfo = []
  953. ruleForm.bankWrit = []
  954. ruleForm.xykInfo = []
  955. ruleForm.bankBlockchain = []
  956. res.data.forEach(item => {
  957. item.customBankCode = item.bankCode
  958. item.bankCode = null
  959. if (item.type === 1) ruleForm.bankInfo.push(item)
  960. else if (item.type === 2) ruleForm.bankWrit.push(item)
  961. else if (item.type === 3) {
  962. item.expiryYearMonth = `${item.expiryYear}/${item.expiryMonth}`
  963. ruleForm.xykInfo.push(item)
  964. } else if (item.type === 4) ruleForm.bankBlockchain.push(item)
  965. })
  966. // 如果有默认选中
  967. const findDefault = (list, type) => list.find(b => b.defaultBank && b.type === type)
  968. const defaultBank = findDefault(ruleForm.bankInfo, 1)
  969. const defaultWire = findDefault(ruleForm.bankWrit, 2)
  970. const defaultCard = findDefault(ruleForm.xykInfo, 3)
  971. const defaultDigital = findDefault(ruleForm.bankBlockchain, 4)
  972. if (channelData.value.type === 'BANK' && defaultBank) selectBankCard(defaultBank)
  973. if (channelData.value.type === 'BANK_TELEGRAPHIC' && defaultWire) selectBankCard(defaultWire)
  974. if (channelData.value.type === 'CHANNEL_TYPE_CARD' && defaultCard) selectBankCard(defaultCard)
  975. if (channelData.value.type === 'DIGITAL_CURRENCY' && defaultDigital && defaultDigital.authStatus === 1) selectDigital(defaultDigital)
  976. } else {
  977. uni.showToast({ title: res.msg, icon: 'none' })
  978. }
  979. }
  980. const selectBankCard = (item) => {
  981. const index = bankList.value.findIndex(b => b.id === item.id)
  982. if (index !== -1) {
  983. myId.value = item.id
  984. nextTick(() => {
  985. Object.assign(form, item)
  986. })
  987. }
  988. }
  989. const selectDigital = (item) => {
  990. const index = ruleForm.bankBlockchain.findIndex(b => b.id === item.id)
  991. if (index !== -1) {
  992. selectedDigitalIndex.value = item.id
  993. form.addressName = item.addressName
  994. form.address = item.address
  995. form.addressProve = item.addressProve
  996. }
  997. }
  998. const onDigitalCurrencyChange = (val) => {
  999. const item = ruleForm.bankBlockchain.find(b => b.id === val)
  1000. chooseBank(item.id)
  1001. }
  1002. function chooseBank(id) {
  1003. const item = bankList.value.find(b => b.id === id)
  1004. if (channelData.value.type == "DIGITAL_CURRENCY") {
  1005. if (item.authStatus == 0) {
  1006. showToast(t("Msg.item11"));
  1007. return;
  1008. }
  1009. }
  1010. let codeTmp = "";
  1011. if (form.bankCode) {
  1012. codeTmp = form.bankCode;
  1013. }
  1014. Object.assign(form, item);
  1015. form.agree2 = false;
  1016. form.agree3 = false;
  1017. if (channelData.value.type == "BANK_TELEGRAPHIC") {
  1018. form.currency = "USD";
  1019. if (codeTmp) {
  1020. form.bankCode = codeTmp;
  1021. }
  1022. }
  1023. }
  1024. function selectCode(codeVal) {
  1025. bankDate.value.forEach((item) => {
  1026. if (item.code == codeVal) {
  1027. // item.rate = 1
  1028. // mAmount.minAmount = item.minAmount || mAmount.minAmount;
  1029. // mAmount.maxAmount = item.maxAmount || mAmount.maxAmount;
  1030. channelData.value.rate = item.rate || channelData.value.rate;
  1031. channelData.value.transformCurrency =
  1032. item.currency || channelData.value.transformCurrency;
  1033. channelData.value.feeTypeBank = item.feeType || null;
  1034. channelData.value.freeBank = item.free || 0;
  1035. channelData.value.feeAmountBank = item.feeAmount || null;
  1036. }
  1037. });
  1038. }
  1039. //关闭提交后的弹出框
  1040. function closeDia() {
  1041. resetForm()
  1042. isStep3.value = false;
  1043. step2.value = false;
  1044. showTable();
  1045. loginValue.value = "";
  1046. dialogCheck.value = false;
  1047. dialogVisible.value = false;
  1048. }
  1049. //取消
  1050. function cancelCode() {
  1051. dialogDealResult.value = false;
  1052. }
  1053. //提交前弹窗确认
  1054. async function openTips() {
  1055. if (channelData.value.type == "BANK_TELEGRAPHIC" && !myId.value) {
  1056. showToast(t("vaildate.withdrawBank.empty"));
  1057. return;
  1058. }
  1059. if (channelData.value.type == "BANK" && !myId.value) {
  1060. showToast(t("vaildate.withdrawBank.empty"));
  1061. return;
  1062. }
  1063. if (channelData.value.type == "CHANNEL_TYPE_CARD" && !myId.value) {
  1064. showToast(t("vaildate.withdrawBank.empty"));
  1065. return;
  1066. }
  1067. if (channelData.value.type == "DIGITAL_CURRENCY" && !myId.value) {
  1068. showToast(t("blockchain.item11"));
  1069. return;
  1070. }
  1071. try {
  1072. if (formRef.value) {
  1073. const valid = await formRef.value.validate()
  1074. if (dialogTipsIsShow.value) {
  1075. dialogTips.value = true;
  1076. } else {
  1077. submit("form");
  1078. }
  1079. }
  1080. } catch (error) {
  1081. if (error instanceof Array) {
  1082. showToast(error[0].errorMessage);
  1083. return
  1084. } else {
  1085. RES.value = error.msg;
  1086. }
  1087. }
  1088. }
  1089. // 提示同意提交出金
  1090. function closeTipsConfirm() {
  1091. if (isFree.value) {
  1092. dialogTips.value = false;
  1093. if (channelData.value.feeTypeBank) {
  1094. if (channelData.value.feeTypeBank == 1) {
  1095. dialogCheckConfirm_form.feeAmount =
  1096. Number(form.amount || 0) *
  1097. (Number(channelData.value.freeBank || 0) / 100);
  1098. } else if (channelData.value.feeTypeBank == 2) {
  1099. dialogCheckConfirm_form.feeAmount = Number(
  1100. channelData.value.feeAmountBank || 0
  1101. );
  1102. }
  1103. } else {
  1104. if (channelData.value.feeType == 1) {
  1105. dialogCheckConfirm_form.feeAmount =
  1106. Number(form.amount || 0) *
  1107. (Number(channelData.value.free || 0) / 100);
  1108. } else if (channelData.value.feeType == 2) {
  1109. dialogCheckConfirm_form.feeAmount = Number(
  1110. channelData.value.feeAmount || 0
  1111. );
  1112. }
  1113. }
  1114. if (FreeNumber.value > 0) {
  1115. dialogCheckConfirm_form.amount = new Decimal(
  1116. Number(form.amount || 0)
  1117. )
  1118. .mul(new Decimal(Number(channelData.value.rate || 0)))
  1119. .toNumber();
  1120. } else {
  1121. dialogCheckConfirm_form.amount = new Decimal(
  1122. Number(form.amount || 0)
  1123. )
  1124. .sub(
  1125. new Decimal(Number(dialogCheckConfirm_form.feeAmount || 0))
  1126. )
  1127. .mul(new Decimal(Number(channelData.value.rate || 0)))
  1128. .toNumber();
  1129. }
  1130. if (
  1131. ["CNY", "THB", "VND"].indexOf(channelData.value.transformCurrency) > -1
  1132. ) {
  1133. dialogCheckConfirm_form.feeAmount = parseInt(
  1134. dialogCheckConfirm_form.feeAmount
  1135. );
  1136. dialogCheckConfirm_form.amount = parseInt(
  1137. dialogCheckConfirm_form.amount
  1138. );
  1139. }
  1140. dialogCheckConfirm.value = true;
  1141. } else {
  1142. dialogTips.value = false;
  1143. submit("form");
  1144. }
  1145. }
  1146. function getMetaInfo() {
  1147. metaInfo.value = window.getMetaInfo();
  1148. metaInfo.value = { ...metaInfo.value, deviceType: "h5" };
  1149. }
  1150. async function qrCode(serial) {
  1151. getMetaInfo()
  1152. let res = await customApi.getWebsdkLink({
  1153. serial,
  1154. metaInfo: metaInfo.value,
  1155. });
  1156. if (res.code == Code.StatusOK) {
  1157. text1.value = JSON.parse(res.data).url;
  1158. dialogKyc.value = true;
  1159. flag.value = false;
  1160. } else {
  1161. flag.value = false;
  1162. }
  1163. }
  1164. const submitCode = async (code) => {
  1165. if (channelData.value.type == "DIGITAL_CURRENCY") {
  1166. dialogDealResult_form.emailCode = code;
  1167. submit("form");
  1168. }
  1169. }
  1170. //提交
  1171. async function submit(formName) {
  1172. if (channelData.value.type == "BANK_TELEGRAPHIC" && !myId.value) {
  1173. showToast(t("vaildate.withdrawBank.empty"));
  1174. return;
  1175. }
  1176. if (channelData.value.type == "BANK" && !myId.value) {
  1177. showToast(t("vaildate.withdrawBank.empty"));
  1178. return;
  1179. }
  1180. if (channelData.value.type == "CHANNEL_TYPE_CARD" && !myId.value) {
  1181. showToast(t("vaildate.withdrawBank.empty"));
  1182. return;
  1183. }
  1184. if (channelData.value.type == "DIGITAL_CURRENCY" && !myId.value) {
  1185. showToast(t("blockchain.item11"));
  1186. return;
  1187. }
  1188. try {
  1189. if (formRef.value) {
  1190. await formRef.value.validate()
  1191. if (
  1192. channelData.value.type == "DIGITAL_CURRENCY" &&
  1193. !dialogDealResult_form.emailCode
  1194. ) {
  1195. // let res = await financialApi.withdrawCode({});
  1196. // if (res.code == Code.StatusOK) {
  1197. // dialogDealResult = true;
  1198. // } else {
  1199. // $pigeon.MessageWarning(res.msg);
  1200. // }
  1201. dialogDealResult.value = true;
  1202. return;
  1203. }
  1204. // 检查活动参与情况
  1205. // let selectedAccount = loginOptions.find(item => item.login === value);
  1206. // if (selectedAccount) {
  1207. // let activityRes = await activityApi.ActivityGiveLoginParticipate({
  1208. // login: value,
  1209. // platform: selectedAccount.platform,
  1210. // amount: form.amount
  1211. // });
  1212. //
  1213. // if (activityRes.code == Code.StatusOK && activityRes.data === false) {
  1214. // // 使用 Promise 包装确认对话框,等待用户选择
  1215. // try {
  1216. // await new Promise((resolve, reject) => {
  1217. // $pigeon.MessageConfirm(
  1218. // "您参加的活动正在进行中,发起申请后结束活动",
  1219. // $i18n.t("Msg.SystemPrompt"),
  1220. // $i18n.t("Btn.Confirm"),
  1221. // $i18n.t("Btn.Cancel"),
  1222. // () => {
  1223. // resolve(); // 确认时继续执行
  1224. // },
  1225. // () => {
  1226. // reject(); // 取消时阻止执行
  1227. // }
  1228. // );
  1229. // });
  1230. // } catch {
  1231. // return; // 用户点击取消,阻止执行
  1232. // }
  1233. // }
  1234. // }
  1235. if (flag.value) {
  1236. return;
  1237. } else {
  1238. flag.value = true;
  1239. }
  1240. dialogCheckWait.value = true;
  1241. if (channelData.value.type == "DIGITAL_CURRENCY") {
  1242. let res = await financialApi.WithdrawAapplyDigitalCurrency(
  1243. channelData.value.requestUrl,
  1244. {
  1245. login: loginValue.value,
  1246. payType: channelData.value.code,
  1247. emailCode: dialogDealResult_form.emailCode,
  1248. ...form,
  1249. }
  1250. );
  1251. if (res.code == Code.StatusOK) {
  1252. flag.value = false;
  1253. dialogCheck.value = true;
  1254. dialogVisible.value = true;
  1255. // qrCode(res.data)
  1256. } else {
  1257. RES.value = res.msg;
  1258. dialogCheck.value = true;
  1259. dialogVisible.value = false;
  1260. flag.value = false;
  1261. }
  1262. cancelCode();
  1263. } else if (
  1264. channelData.value.type == "CHANNEL_TYPE_WALLET" ||
  1265. channelData.value.type == "UCARD_WALLET" ||
  1266. channelData.value.type == "CHANNEL_TYPE_ALI_WALLET"
  1267. ) {
  1268. let res = await financialApi.WithdrawAapplyDigitalCurrency(
  1269. channelData.value.requestUrl,
  1270. {
  1271. login: loginValue.value,
  1272. payType: channelData.value.code,
  1273. ...form,
  1274. }
  1275. );
  1276. if (res.code == Code.StatusOK) {
  1277. flag.value = false;
  1278. dialogCheck.value = true;
  1279. dialogVisible.value = true;
  1280. // qrCode(res.data)
  1281. } else {
  1282. RES.value = res.msg;
  1283. dialogCheck.value = true;
  1284. dialogVisible.value = false;
  1285. flag.value = false;
  1286. }
  1287. console.log(res, 'res', RES.value);
  1288. } else if (channelData.value.type == "BANK") {
  1289. let res = await financialApi.WithdrawApplyBank(
  1290. channelData.value.requestUrl,
  1291. {
  1292. login: loginValue.value,
  1293. payType: channelData.value.code,
  1294. ...form,
  1295. }
  1296. );
  1297. if (res.code == Code.StatusOK) {
  1298. flag.value = false;
  1299. dialogCheck.value = true;
  1300. dialogVisible.value = true;
  1301. // qrCode(res.data)
  1302. } else {
  1303. RES.value = res.msg;
  1304. dialogCheck.value = true;
  1305. dialogVisible.value = false;
  1306. flag.value = false;
  1307. }
  1308. } else if (channelData.value.type == "BANK_TELEGRAPHIC") {
  1309. let res = await financialApi.WithdrawApplyBank(
  1310. channelData.value.requestUrl,
  1311. {
  1312. login: loginValue.value,
  1313. payType: channelData.value.code,
  1314. ...form,
  1315. }
  1316. );
  1317. if (res.code == Code.StatusOK) {
  1318. flag.value = false;
  1319. dialogCheck.value = true;
  1320. dialogVisible.value = true;
  1321. // qrCode(res.data)
  1322. } else {
  1323. RES.value = res.msg;
  1324. dialogCheck.value = true;
  1325. dialogVisible.value = false;
  1326. flag.value = false;
  1327. }
  1328. } else if (channelData.value.type == "CHANNEL_TYPE_CARD") {
  1329. let res = await financialApi.WithdrawApplyBank(
  1330. channelData.value.requestUrl,
  1331. {
  1332. login: loginValue.value,
  1333. payType: channelData.value.code,
  1334. ...form,
  1335. }
  1336. );
  1337. if (res.code == Code.StatusOK) {
  1338. flag.value = false;
  1339. dialogCheck.value = true;
  1340. dialogVisible.value = true;
  1341. // qrCode(res.data)
  1342. } else {
  1343. RES.value = res.msg;
  1344. dialogCheck.value = true;
  1345. dialogVisible.value = false;
  1346. flag.value = false;
  1347. }
  1348. }
  1349. dialogCheckWait.value = false;
  1350. }
  1351. } catch (error) {
  1352. if (error instanceof Array) {
  1353. showToast(error[0].errorMessage);
  1354. return
  1355. } else {
  1356. RES.value = error.msg;
  1357. dialogCheck.value = true;
  1358. dialogCheckWait.value = false;
  1359. dialogVisible.value = false;
  1360. flag.value = false;
  1361. }
  1362. }
  1363. }
  1364. //初始化
  1365. function Initialize() {
  1366. loginValue.value = "";
  1367. isStep3.value = false;
  1368. step2.value = false;
  1369. step3.value = false;
  1370. showTable();
  1371. }
  1372. //手续费减免次数接口
  1373. async function getFreeNumber() {
  1374. if (!isFree.value) {
  1375. return;
  1376. }
  1377. dialogFreeNumber.value = true;
  1378. let res = await financialApi.remainingReductionNumber({});
  1379. if (res.code == Code.StatusOK) {
  1380. FreeNumber.value = res.data || 0;
  1381. } else {
  1382. showToast(res.msg);
  1383. }
  1384. }
  1385. function toShop() {
  1386. // $router.push({ path: "/shop/home" }).catch((arr) => arr);
  1387. // uni-app 中可能需要使用 uni.navigateTo,此处保留原逻辑但注释掉,因为原代码是 Vue Router
  1388. // 若需要可以改为 uni.navigateTo
  1389. }
  1390. //选择支付方式
  1391. function isShowStep3(row) {
  1392. console.log(row, 222);
  1393. dialogCheckWait.value = false;
  1394. dialogVisible.value = false;
  1395. flag.value = false;
  1396. isStep3.value = true;
  1397. //判断是否有bank
  1398. if (row.bankValid && isChannel.value) {
  1399. getBankList(row);
  1400. isChannel.value = false;
  1401. step3.value = true;
  1402. channelData.value = row;
  1403. mAmount.minAmount = row.minAmount;
  1404. mAmount.maxAmount = row.maxAmount;
  1405. } else {
  1406. step3.value = true;
  1407. bankDate.value = [];
  1408. channelData.value = row;
  1409. mAmount.minAmount = row.minAmount;
  1410. mAmount.maxAmount = row.maxAmount;
  1411. }
  1412. if (row.code == "UNION_PAY_TELEGRAPHIC") {
  1413. WireTransferAccount.value = JSON.parse(row.property);
  1414. }
  1415. if (['BANK', 'BANK_TELEGRAPHIC', 'CHANNEL_TYPE_CARD', 'DIGITAL_CURRENCY'].includes(row.type)) {
  1416. getBankInfo();
  1417. step3_bank_cur.value = "bank";
  1418. form.login = loginValue.value;
  1419. form.payType = row.code;
  1420. bankPayType.value = row.code;
  1421. }
  1422. tableData.Ucard_Wallet = []
  1423. tableData.Digital_Currency = []
  1424. tableData.China_UnionPay = []
  1425. tableData.Electronic_Wallet = []
  1426. tableData.International_Transfer = []
  1427. tableData.CHANNEL_TYPE_CARD = []
  1428. tableData.CHANNEL_TYPE_ALI_WALLET = []
  1429. if (row.type === 'UCARD_WALLET') tableData.Ucard_Wallet = [row]
  1430. if (row.type === 'DIGITAL_CURRENCY') tableData.Digital_Currency = [row]
  1431. if (row.type === 'BANK') tableData.China_UnionPay = [row]
  1432. if (row.type === 'CHANNEL_TYPE_WALLET') tableData.Electronic_Wallet = [row]
  1433. if (row.type === 'BANK_TELEGRAPHIC') tableData.International_Transfer = [row]
  1434. if (row.type === 'CHANNEL_TYPE_CARD') tableData.CHANNEL_TYPE_CARD = [row]
  1435. if (row.type === 'CHANNEL_TYPE_ALI_WALLET') tableData.CHANNEL_TYPE_ALI_WALLET = [row]
  1436. introduce.introduce = row.introduce
  1437. introduce.enIntroduce = row.enIntroduce
  1438. }
  1439. //更换支付方式
  1440. function showTable() {
  1441. resetForm()
  1442. myId.value = null;
  1443. isChannel.value = true;
  1444. form.currency = "USD";
  1445. }
  1446. //获取账户信息
  1447. async function getDateList() {
  1448. loading.value = true
  1449. let res = await customApi.CustomDropdown({ platform: "" });
  1450. if (res.code == Code.StatusOK) {
  1451. loginOptions.value = res.data.map(item => ({
  1452. ...item,
  1453. label: `${item.login} - ${groupTypeName(item.type)} - ${t('Custom.Deposit.AvailableBalance')}${groupCurrency(item.currency)}${item.balance}`
  1454. }))
  1455. const route = getCurrentPages().pop().$page.options
  1456. if (route.login) {
  1457. const found = loginOptions.value.find(opt => opt.login === Number(route.login))
  1458. loginValue.value = found.login
  1459. loginValueDoc.value = found.label
  1460. step2.value = true;
  1461. // showTable();
  1462. }
  1463. } else {
  1464. showToast(res.msg);
  1465. }
  1466. loading.value = false
  1467. }
  1468. //获取出金通道
  1469. async function getDepositList() {
  1470. pictLoading.value = true;
  1471. tableData.Ucard_Wallet = [];
  1472. tableData.Digital_Currency = [];
  1473. tableData.China_UnionPay = [];
  1474. tableData.Electronic_Wallet = [];
  1475. tableData.International_Transfer = [];
  1476. tableData.CHANNEL_TYPE_CARD = [];
  1477. tableData.CHANNEL_TYPE_ALI_WALLET = [];
  1478. let res = await financialApi.RemitChannelList({});
  1479. if (res.code == Code.StatusOK) {
  1480. res.data.forEach(item => {
  1481. if (item.type === 'UCARD_WALLET') tableData.Ucard_Wallet.push(item)
  1482. if (item.type === 'DIGITAL_CURRENCY') tableData.Digital_Currency.push(item)
  1483. if (item.type === 'BANK') tableData.China_UnionPay.push(item)
  1484. if (item.type === 'CHANNEL_TYPE_WALLET') tableData.Electronic_Wallet.push(item)
  1485. if (item.type === 'BANK_TELEGRAPHIC') tableData.International_Transfer.push(item)
  1486. if (item.type === 'CHANNEL_TYPE_CARD') tableData.CHANNEL_TYPE_CARD.push(item)
  1487. if (item.type === 'CHANNEL_TYPE_ALI_WALLET') tableData.CHANNEL_TYPE_ALI_WALLET.push(item)
  1488. })
  1489. pictLoading.value = false;
  1490. } else {
  1491. showToast(res.msg);
  1492. pictLoading.value = false;
  1493. }
  1494. }
  1495. //获取出金通道银行列表
  1496. async function getBankList(row) {
  1497. let res = await financialApi.BankList({
  1498. channelCode: row.code,
  1499. });
  1500. if (res.code == Code.StatusOK) {
  1501. let bank = res.data;
  1502. let data = [];
  1503. bank.forEach((j) => {
  1504. if (!j.minAmount && j.minAmount != 0) {
  1505. j.minAmount = row.minAmount;
  1506. }
  1507. if (!j.maxAmount && j.maxAmount != 0) {
  1508. j.maxAmount = row.maxAmount;
  1509. }
  1510. j.payType = row.code;
  1511. data.push(j);
  1512. });
  1513. bankDate.value = data;
  1514. } else {
  1515. showToast(res.msg);
  1516. }
  1517. }
  1518. //取消
  1519. function cancelBank() {
  1520. dialogNewBank.value = false;
  1521. }
  1522. //24新年庆典
  1523. //是否到期-2023-11-25 00:00:00-2023-12-31 23:59:59
  1524. function isNewYear24Open() {
  1525. let endTime1 = "2025/3/31 23:59:59";
  1526. let startTime1 = "2025/1/1 00:00:00";
  1527. let timezone = 2; //目标时区时间,东3区 东时区正数 西市区负数
  1528. let offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟
  1529. let nowDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数
  1530. let now = new Date(
  1531. nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000
  1532. ).getTime();
  1533. let end = new Date(endTime1).getTime();
  1534. let start = new Date(startTime1).getTime();
  1535. if (now < end && start < now) {
  1536. ActivityNewYear24();
  1537. }
  1538. }
  1539. async function ActivityNewYear24() {
  1540. let res = await activityApi.ActivityNewYear24({});
  1541. if (res.code == Code.StatusOK) {
  1542. tableDataNewYear24.value = res.data;
  1543. if (typeof tableDataNewYear24.value == "object") {
  1544. toIncome();
  1545. }
  1546. } else {
  1547. showToast(res.msg);
  1548. }
  1549. }
  1550. function toIncome() {
  1551. NewYear24Data.balance = Number(tableDataNewYear24.value.balance) || 0;
  1552. // let rate = 0;
  1553. tableDataNewYear24.value.details.forEach((item) => {
  1554. if (
  1555. NewYear24Data.balance > item.min &&
  1556. NewYear24Data.balance <= item.max
  1557. ) {
  1558. NewYear24Data.rate = item.rate;
  1559. } else if (
  1560. NewYear24Data.balance > item.min &&
  1561. NewYear24Data.balance >= item.max &&
  1562. item.max == 0
  1563. ) {
  1564. NewYear24Data.rate = item.rate;
  1565. }
  1566. });
  1567. // console.log(NewYear24Data);
  1568. NewYear24Data.income = (
  1569. ((NewYear24Data.balance * NewYear24Data.rate) / 100 / 365) *
  1570. NewYear24RemainingTime()
  1571. ).toFixed(2);
  1572. tableDataNewYear24Flag.value = true;
  1573. }
  1574. function NewYear24RemainingTime() {
  1575. // let endTime1 = '2025/3/31 23:59:59';
  1576. // let startTime1 = '2025/1/1 00:00:00';
  1577. let timezone = 2; //目标时区时间,东3区 东时区正数 西市区负数
  1578. let offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟
  1579. let nowDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数
  1580. let now = new Date(
  1581. nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000
  1582. ).getTime();
  1583. // 获取当前月份的最后一天
  1584. let lastDayOfMonth = getFirstDayOfNextMonth();
  1585. // console.log(lastDayOfMonth);
  1586. let end = new Date(lastDayOfMonth).getTime();
  1587. // let now = new Date('2025/1/31 21:59:59').getTime();
  1588. // let end = new Date('2025/1/31 23:59:59').getTime();
  1589. let time = (end - now) / 60 / 60 / 1000 / 24;
  1590. time = Math.ceil(time);
  1591. return time;
  1592. }
  1593. function getFirstDayOfNextMonth() {
  1594. let timezone = 2; //目标时区时间,东3区 东时区正数 西市区负数
  1595. let offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟
  1596. let nowDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数
  1597. let now = new Date(
  1598. nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000
  1599. );
  1600. let lastDayOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0);
  1601. // console.log(lastDayOfMonth);
  1602. return lastDayOfMonth;
  1603. // const nextMonth = now.getMonth() + 1; // 当前月份加1
  1604. // const nextYear = now.getFullYear(); // 获取当前年份
  1605. // // 如果下个月大于11(即12月),年份需要增加1
  1606. // if (nextMonth > 11) {
  1607. // return new Date(nextYear + 1, 0, 1); // 下一年的1月1日
  1608. // } else {
  1609. // return new Date(nextYear, nextMonth, 1); // 下个月的1日
  1610. // }
  1611. }
  1612. // 新改内容
  1613. // userStore.paymentChannel.value
  1614. // userStore.channelList.value
  1615. const channel = computed(() => userStore.paymentChannel)
  1616. const channelList = computed(() => userStore.channelList)
  1617. const channelListOptions = ref([])
  1618. const channelId = ref(null)
  1619. const loading = ref(false)
  1620. const setAllAmount = () => {
  1621. const found = loginOptions.value.find(opt => opt.login === Number(loginValue.value))
  1622. console.log(found, 1212);
  1623. form.amount = parseInt(found.balance)
  1624. validateAmount()
  1625. }
  1626. const allTabs = computed(() => {
  1627. return {
  1628. "Digital_Currency": t('Custom.Deposit.Channel3'),
  1629. "China_UnionPay": t('Custom.Deposit.Channel2'),
  1630. "Electronic_Wallet": t('Custom.Deposit.Channel4'),
  1631. "International_Transfer": t('Custom.Deposit.Channel1'),
  1632. "CHANNEL_TYPE_CARD": t('PersonalManagement.Label.CreditCard'),
  1633. "Ucard_Wallet": t('card.title'),
  1634. "CHANNEL_TYPE_ALI_WALLET": t('Label.Ali'),
  1635. }
  1636. })
  1637. function formatChannels(data) {
  1638. const result = []
  1639. // 遍历每个分类
  1640. for (const key in data) {
  1641. const list = data[key] || []
  1642. // 插入分类标题(禁用项)
  1643. if (list.length) {
  1644. result.push({
  1645. text: allTabs.value[key],
  1646. value: key,
  1647. disable: true
  1648. })
  1649. }
  1650. list.forEach(item => {
  1651. result.push({
  1652. ...item,
  1653. text: item.name,
  1654. value: item.code
  1655. })
  1656. })
  1657. }
  1658. return result
  1659. }
  1660. // -------------------- lifecycle --------------------
  1661. onMounted(() => {
  1662. if (channelList.value) {
  1663. channelListOptions.value = formatChannels(channelList.value)
  1664. }
  1665. channelId.value = channel.value
  1666. getDateList();
  1667. //调用手续费减免次数接口
  1668. getFreeNumber();
  1669. isNewYear24Open();
  1670. });
  1671. onUnmounted(() => {
  1672. userStore.savePaymentChannel('')
  1673. userStore.saveChannelList('')
  1674. })
  1675. // -------------------- watch --------------------
  1676. watch(channelId, async (newVal) => {
  1677. if (newVal) {
  1678. showTable()
  1679. let row = channelListOptions.value.find(item => item.code == newVal)
  1680. console.log(row, 123123);
  1681. isShowStep3(row)
  1682. }
  1683. });
  1684. watch(loginValue, (newVal) => {
  1685. if (newVal) {
  1686. // const found = loginOptions.value.find(opt => opt.login === Number(newVal))
  1687. // loginValueDoc.value = found.label
  1688. showTable();
  1689. }
  1690. });
  1691. watch(isStep3, async (newVal) => {
  1692. if (newVal) {
  1693. await nextTick();
  1694. formRef.value?.clearValidate(); // 先清除旧错误
  1695. await nextTick();
  1696. formRef.value?.clearValidate(); // 再次清除可能因数据重置产生的新错误
  1697. }
  1698. });
  1699. watch(() => form.amount, (newVal) => {
  1700. if (newVal && channelData.value.rate) {
  1701. // form.amount1 = (newVal * channelData.rate).toFixed(2);
  1702. if (isFree.value) {
  1703. let feeAmount = 0;
  1704. if (channelData.value.feeTypeBank) {
  1705. if (channelData.value.feeTypeBank == 1) {
  1706. feeAmount =
  1707. Number(newVal || 0) *
  1708. (Number(channelData.value.freeBank || 0) / 100);
  1709. } else if (channelData.value.feeTypeBank == 2) {
  1710. feeAmount = Number(channelData.value.feeAmountBank || 0);
  1711. }
  1712. } else {
  1713. if (channelData.value.feeType == 1) {
  1714. feeAmount =
  1715. Number(newVal || 0) *
  1716. (Number(channelData.value.free || 0) / 100);
  1717. } else if (channelData.value.feeType == 2) {
  1718. feeAmount = Number(channelData.value.feeAmount || 0);
  1719. }
  1720. }
  1721. if (FreeNumber.value > 0) {
  1722. form.amount1 = new Decimal(Number(newVal || 0))
  1723. .mul(new Decimal(Number(channelData.value.rate || 0)))
  1724. .toNumber();
  1725. } else {
  1726. form.amount1 = new Decimal(Number(newVal || 0))
  1727. .sub(new Decimal(Number(feeAmount || 0)))
  1728. .mul(new Decimal(Number(channelData.value.rate || 0)))
  1729. .toNumber();
  1730. }
  1731. } else {
  1732. form.amount1 = (newVal * channelData.value.rate).toFixed(2);
  1733. }
  1734. if (
  1735. ["CNY", "THB", "VND"].indexOf(channelData.value.transformCurrency) > -1
  1736. ) {
  1737. form.amount1 = parseInt(form.amount1);
  1738. }
  1739. }
  1740. });
  1741. </script>
  1742. <style lang="scss" scoped>
  1743. @import "@/uni.scss";
  1744. .custom-withdraw {
  1745. width: px2rpx(566);
  1746. flex-shrink: 0;
  1747. .box {
  1748. margin-bottom: px2rpx(20);
  1749. .b-card {
  1750. // background: #fff;
  1751. // border-radius: px2rpx(12);
  1752. // padding: px2rpx(20);
  1753. // box-shadow: 0 px2rpx(4) px2rpx(12) rgba(0, 0, 0, 0.03);
  1754. .card-top {
  1755. .tit {
  1756. font-size: px2rpx(16);
  1757. font-weight: 600;
  1758. margin-bottom: px2rpx(16);
  1759. display: flex;
  1760. align-items: center;
  1761. color: var(--color-navy-900);
  1762. position: relative;
  1763. padding-left: 20px;
  1764. &:after {
  1765. content: '';
  1766. position: absolute;
  1767. left: 0;
  1768. top: 50%;
  1769. transform: translateY(-50%);
  1770. width: 0;
  1771. height: 0;
  1772. border-top: 6px solid transparent;
  1773. border-bottom: 6px solid transparent;
  1774. border-left: 8px solid currentColor;
  1775. }
  1776. .iconfont {
  1777. margin-right: px2rpx(8);
  1778. color: var(--color-primary);
  1779. font-size: px2rpx(18);
  1780. }
  1781. }
  1782. }
  1783. .channelType {
  1784. font-size: px2rpx(15);
  1785. font-weight: 600;
  1786. margin: px2rpx(24) 0 px2rpx(12);
  1787. color: var(--color-navy-700);
  1788. padding-left: px2rpx(8);
  1789. border-left: px2rpx(4) solid var(--color-primary);
  1790. }
  1791. }
  1792. }
  1793. .reselect-btn {
  1794. margin-top: px2rpx(20);
  1795. display: flex;
  1796. justify-content: flex-end;
  1797. }
  1798. .s-btn {
  1799. &.reselect {
  1800. background-color: var(--color-zinc-100);
  1801. color: var(--color-navy-700);
  1802. border: none;
  1803. font-size: px2rpx(14);
  1804. padding: px2rpx(8) px2rpx(20);
  1805. border-radius: px2rpx(8);
  1806. &:active {
  1807. background-color: var(--color-zinc-200);
  1808. }
  1809. }
  1810. &[type="primary"] {
  1811. width: 100%;
  1812. height: px2rpx(48);
  1813. background-color: #cf1322;
  1814. color: #fff;
  1815. border-radius: px2rpx(12);
  1816. font-size: px2rpx(16);
  1817. font-weight: 600;
  1818. display: flex;
  1819. align-items: center;
  1820. justify-content: center;
  1821. border: none;
  1822. margin-top: px2rpx(30);
  1823. transition: all 0.2s;
  1824. &:active {
  1825. transform: scale(0.98);
  1826. background-color: #cf1322;
  1827. }
  1828. }
  1829. }
  1830. .add-back {
  1831. display: flex;
  1832. justify-content: space-between;
  1833. align-items: center;
  1834. margin-bottom: px2rpx(12);
  1835. padding: px2rpx(12) px2rpx(16);
  1836. text {
  1837. font-size: px2rpx(14);
  1838. color: var(--color-navy-700);
  1839. font-weight: 500;
  1840. }
  1841. .add-btn {
  1842. color: var(--color-primary);
  1843. font-weight: 600;
  1844. text-decoration: underline;
  1845. &:active {
  1846. opacity: 0.7;
  1847. }
  1848. }
  1849. }
  1850. .proof {
  1851. margin-top: px2rpx(8);
  1852. border: px2rpx(1) dashed var(--color-zinc-300);
  1853. border-radius: px2rpx(8);
  1854. padding: px2rpx(8);
  1855. display: flex;
  1856. justify-content: center;
  1857. align-items: center;
  1858. background: var(--color-zinc-50);
  1859. .state {
  1860. padding: px2rpx(4) px2rpx(12);
  1861. border-radius: px2rpx(4);
  1862. font-size: px2rpx(12);
  1863. font-weight: bold;
  1864. }
  1865. }
  1866. .agree {
  1867. margin: px2rpx(24) 0;
  1868. display: flex;
  1869. align-items: flex-start;
  1870. .checkbox {
  1871. display: flex;
  1872. align-items: flex-start;
  1873. gap: px2rpx(8);
  1874. :deep(uni-checkbox .uni-checkbox-input) {
  1875. border-radius: px2rpx(4);
  1876. width: px2rpx(18);
  1877. height: px2rpx(18);
  1878. }
  1879. text {
  1880. font-size: px2rpx(13);
  1881. color: var(--color-zinc-500);
  1882. line-height: 1.5;
  1883. }
  1884. }
  1885. }
  1886. .step3-attention {
  1887. // background: var(--color-error-50, #fff1f0);
  1888. border-radius: px2rpx(12);
  1889. margin-bottom: px2rpx(20);
  1890. .tips {
  1891. line-height: 1.8;
  1892. font-size: px2rpx(12);
  1893. color: #909399;
  1894. padding: px2rpx(12);
  1895. border-radius: px2rpx(4);
  1896. border-left: px2rpx(2) solid #409eff;
  1897. .title {
  1898. font-weight: 600;
  1899. margin-bottom: px2rpx(6);
  1900. color: #606266;
  1901. }
  1902. }
  1903. .attention {
  1904. font-size: px2rpx(14);
  1905. // color: var(--color-error-600, #cf1322);
  1906. line-height: 1.6;
  1907. }
  1908. .btn-bottom {
  1909. margin-top: px2rpx(20);
  1910. display: flex;
  1911. justify-content: center;
  1912. .btn {
  1913. background: var(--color-error-600, #cf1322);
  1914. color: #fff;
  1915. padding: px2rpx(10) px2rpx(48);
  1916. border-radius: px2rpx(24);
  1917. font-size: px2rpx(15);
  1918. font-weight: 700;
  1919. box-shadow: 0 px2rpx(4) px2rpx(10) rgba(207, 19, 34, 0.2);
  1920. transition: all 0.2s;
  1921. &:active {
  1922. transform: scale(0.96);
  1923. opacity: 0.8;
  1924. }
  1925. }
  1926. }
  1927. }
  1928. :deep(.base-info-form) {
  1929. .uni-row1 {
  1930. .uni-col {
  1931. padding: 0 px2rpx(10) !important;
  1932. }
  1933. .uni-forms-item {
  1934. min-height: px2rpx(36);
  1935. margin-bottom: px2rpx(28);
  1936. }
  1937. .uni-easyinput__content-input {
  1938. height: px2rpx(35) !important;
  1939. }
  1940. }
  1941. }
  1942. @keyframes rotate {
  1943. from {
  1944. transform: rotate(0deg);
  1945. }
  1946. to {
  1947. transform: rotate(360deg);
  1948. }
  1949. }
  1950. }
  1951. .amount-box {
  1952. display: flex;
  1953. align-items: center;
  1954. gap: px2rpx(12);
  1955. .amount-input {
  1956. flex: 1;
  1957. }
  1958. .btn {
  1959. display: flex;
  1960. align-items: center;
  1961. justify-content: center;
  1962. font-size: px2rpx(14);
  1963. color: var(--color-zinc-600);
  1964. margin-bottom: px2rpx(12);
  1965. height: px2rpx(35);
  1966. background-color: #cf1322;
  1967. color: #fff;
  1968. border-radius: px2rpx(4);
  1969. font-weight: 600;
  1970. border: none;
  1971. padding: 0 px2rpx(20);
  1972. margin-top: px2rpx(21);
  1973. cursor: pointer;
  1974. }
  1975. }
  1976. .amount-box1 {
  1977. align-items: flex-start;
  1978. .btn {
  1979. margin-top: px2rpx(0);
  1980. }
  1981. }
  1982. .custom-deposit-container {
  1983. width: 100%;
  1984. display: flex;
  1985. gap: px2rpx(60);
  1986. justify-content: space-between;
  1987. }
  1988. @media (max-width: 992px) {
  1989. .custom-withdraw {
  1990. width: 100%;
  1991. margin-top: px2rpx(20);
  1992. }
  1993. .custom-deposit-container {
  1994. display: flex;
  1995. gap: px2rpx(30);
  1996. flex-wrap: wrap;
  1997. }
  1998. }
  1999. </style>