withdraw.vue 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item5')" />
  4. <uni-loading v-if="loading" />
  5. <view class="custom-deposit-container" v-else>
  6. <view class="custom-withdraw">
  7. <!-- 步骤2:支付通道列表 -->
  8. <view class="box box-step2">
  9. <view class="b-card">
  10. <view class="card-top">
  11. <text class="tit">{{ t('Custom.Deposit.Title22')
  12. }}</text>
  13. <cwg-combox :clearable="false" v-model:value="channelId" :options="channelListOptions"
  14. :placeholder="t('placeholder.choose')">
  15. </cwg-combox>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 步骤3:填写出金信息 -->
  20. <view class="box box-step3">
  21. <view class="b-card">
  22. <view class="card-top">
  23. <!-- 注意事项 -->
  24. <!-- 表单 -->
  25. <uni-forms ref="formRef" :model="form" :rules="rules" label-width="200" label-position="top"
  26. class="form base-info-form" validate-trigger="submit">
  27. <view class="demo-uni-row uni-row1 uni-row2">
  28. <!-- 银行选择区域(当有银行列表时) -->
  29. <view v-if="bankDate.length">
  30. <view class="tit">
  31. <text>{{ t('Custom.Withdraw.Title5') }}</text>
  32. </view>
  33. </view>
  34. <view v-if="bankDate.length">
  35. <uni-forms-item name="bankCode">
  36. <cwg-combox v-model:value="form.bankCode" :options="bankOptions"
  37. :placeholder="t('placeholder.choose')" />
  38. </uni-forms-item>
  39. </view>
  40. <!-- 电子钱包标题 -->
  41. <view
  42. v-if="['CHANNEL_TYPE_WALLET', 'CHANNEL_TYPE_ALI_WALLET'].includes(channelData.type)">
  43. <view class="tit">
  44. <text>{{ getWalletLabel }}</text>
  45. </view>
  46. </view>
  47. <!-- 电子钱包地址输入 -->
  48. <view
  49. v-if="(channelData.type == 'CHANNEL_TYPE_WALLET' || channelData.type == 'CHANNEL_TYPE_ALI_WALLET')">
  50. <uni-forms-item name="address">
  51. <uni-easyinput v-model="form.address" :placeholder="t('placeholder.input')"
  52. autocomplete="off" />
  53. </uni-forms-item>
  54. </view>
  55. <!-- 数字货币区域 -->
  56. <view class="card-tit" v-if="channelData.type == 'DIGITAL_CURRENCY'">
  57. <div
  58. style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
  59. <view class="tit">
  60. <text>{{ t('Custom.Withdraw.Title6') }}</text>
  61. </view>
  62. <div class="add-back">
  63. <text>{{ t('blockchain.item10') }}</text>
  64. <text class="add-btn crm-cursor"
  65. @click="openAddBankCard('add_bankBlockchain')">
  66. {{ t('Custom.Withdraw.addBank1') }}
  67. </text>
  68. </div>
  69. </div>
  70. </view>
  71. <view v-if="channelData.type == 'DIGITAL_CURRENCY'">
  72. <uni-forms-item>
  73. <cwg-combox v-model:value="myId" :options="digitalOptions"
  74. :placeholder="t('placeholder.choose')" @change="onDigitalCurrencyChange"
  75. :disabled="!ruleForm.bankBlockchain.length" />
  76. </uni-forms-item>
  77. </view>
  78. <view v-if="channelData.type == 'DIGITAL_CURRENCY'">
  79. <uni-forms-item :label="t('blockchain.item3')">
  80. <uni-easyinput disabled v-model="form.addressName" />
  81. </uni-forms-item>
  82. </view>
  83. <view v-if="channelData.type == 'DIGITAL_CURRENCY'">
  84. <uni-forms-item :label="t('blockchain.item4')">
  85. <uni-easyinput disabled v-model="form.address" />
  86. </uni-forms-item>
  87. </view>
  88. <view v-if="channelData.type == 'DIGITAL_CURRENCY' && form.addressProve">
  89. <uni-forms-item :label="t('blockchain.item5')">
  90. <div style="height: 100%; width: 100%" v-if="form.addressProve">
  91. <cwg-link type="pdf1"
  92. v-if="form.addressProve && (form.addressProve.slice(-3).toLowerCase() === 'pdf')"
  93. :url="imgUrl + form.addressProve" target="_blank"
  94. style="text-decoration: none; min-width: auto; width: auto; color: #ffffff; padding: 5px 10px;"
  95. class="state crm_state_blue">
  96. PDF
  97. </cwg-link>
  98. <image v-else style="width: 50px; height: 50px"
  99. :src="imgUrl + form.addressProve" mode="aspectFill"
  100. @click="previewImage(imgUrl + form.addressProve)" />
  101. </div>
  102. </uni-forms-item>
  103. </view>
  104. <view v-if="channelData.type == 'DIGITAL_CURRENCY'">
  105. <view class="tit" style="margin: 0 0 20px">
  106. <i class="iconfont iconi"></i>
  107. <text>{{ t('Custom.Deposit.Des') }}</text>
  108. </view>
  109. </view>
  110. <!-- 银行卡/电汇/信用卡区域 -->
  111. <view class="card-tit"
  112. v-if="isStep3 && (channelData.type == 'BANK_TELEGRAPHIC' || channelData.type == 'BANK' || channelData.type == 'CHANNEL_TYPE_CARD')">
  113. <div
  114. 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'"
  122. class="add-btn crm-cursor"
  123. @click="openAddBankCard('add_wireTransfer')">
  124. {{ t('Custom.Withdraw.addBank1') }}
  125. </text>
  126. <text v-if="channelData.type == 'BANK'">{{
  127. t('Custom.Withdraw.addBank')
  128. }}</text>
  129. <text v-if="channelData.type == 'BANK'" class="add-btn crm-cursor"
  130. @click="openAddBankCard('add_bankCard')">
  131. {{ t('Custom.Withdraw.addBank1') }}
  132. </text>
  133. <text v-if="channelData.type == 'CHANNEL_TYPE_CARD'">{{
  134. t('PersonalManagement.Label.addCreditCard') }}</text>
  135. <text v-if="channelData.type == 'CHANNEL_TYPE_CARD'"
  136. class="add-btn crm-cursor"
  137. @click="openAddBankCard('add_CreditCard')">
  138. {{ t('Custom.Withdraw.addBank1') }}
  139. </text>
  140. </div>
  141. </div>
  142. </view>
  143. <!-- 网银支付信息(BANK) -->
  144. <view v-if="channelData.type == 'BANK'">
  145. <uni-forms-item>
  146. <cwg-combox v-model:value="myId" :options="bankCardOptions"
  147. :placeholder="t('placeholder.choose')" @change="chooseBank" />
  148. </uni-forms-item>
  149. </view>
  150. <view v-if="channelData.type == 'BANK'">
  151. <uni-forms-item :label="t('Custom.Withdraw.UserName')">
  152. <uni-easyinput disabled v-model="form.bankUname" />
  153. </uni-forms-item>
  154. </view>
  155. <view v-if="channelData.type == 'BANK'">
  156. <uni-forms-item :label="t('Custom.Withdraw.BankCardNum')">
  157. <uni-easyinput disabled v-model="form.bankCardNum" />
  158. </uni-forms-item>
  159. </view>
  160. <view v-if="channelData.type == 'BANK'">
  161. <uni-forms-item :label="t('Custom.Withdraw.BankName')">
  162. <uni-easyinput disabled v-model="form.bankName" />
  163. </uni-forms-item>
  164. </view>
  165. <view v-if="channelData.type == 'BANK'">
  166. <uni-forms-item :label="t('Custom.Withdraw.bankBranchName')">
  167. <uni-easyinput disabled v-model="form.bankBranchName" />
  168. </uni-forms-item>
  169. </view>
  170. <!-- 信用卡信息 -->
  171. <view v-if="channelData.type == 'CHANNEL_TYPE_CARD'">
  172. <uni-forms-item>
  173. <cwg-combox v-model:value="myId" :options="bankCardOptions"
  174. :placeholder="t('placeholder.choose')" @change="chooseBank" />
  175. </uni-forms-item>
  176. </view>
  177. <view v-if="channelData.type == 'CHANNEL_TYPE_CARD'">
  178. <uni-forms-item :label="t('PersonalManagement.Label.CreditCardAccountName')">
  179. <uni-easyinput disabled v-model="form.bankUname" />
  180. </uni-forms-item>
  181. </view>
  182. <view v-if="channelData.type == 'CHANNEL_TYPE_CARD'">
  183. <uni-forms-item :label="t('PersonalManagement.Label.CreditCardAccount')">
  184. <uni-easyinput disabled v-model="form.bankCardNum" />
  185. </uni-forms-item>
  186. </view>
  187. <view v-if="channelData.type == 'CHANNEL_TYPE_CARD'">
  188. <uni-forms-item label="CVV">
  189. <uni-easyinput disabled v-model="form.cvv" />
  190. </uni-forms-item>
  191. </view>
  192. <view v-if="channelData.type == 'CHANNEL_TYPE_CARD'">
  193. <uni-forms-item :label="t('PersonalManagement.Label.ExpirationYear')">
  194. <uni-easyinput disabled v-model="form.expiryYearMonth" />
  195. </uni-forms-item>
  196. </view>
  197. <!-- 电汇信息 -->
  198. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  199. <uni-forms-item>
  200. <cwg-combox v-model:value="myId" :options="bankCardOptions"
  201. :placeholder="t('placeholder.choose')" @change="chooseBank" />
  202. </uni-forms-item>
  203. </view>
  204. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  205. <uni-forms-item :label="t('Custom.Withdraw.UserName')">
  206. <uni-easyinput disabled v-model="form.bankUname" />
  207. </uni-forms-item>
  208. </view>
  209. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  210. <uni-forms-item :label="t('Custom.Withdraw.BankCardNum')">
  211. <uni-easyinput disabled v-model="form.bankCardNum" />
  212. </uni-forms-item>
  213. </view>
  214. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  215. <uni-forms-item :label="t('Custom.Withdraw.BankName')">
  216. <uni-easyinput disabled v-model="form.bankName" />
  217. </uni-forms-item>
  218. </view>
  219. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  220. <uni-forms-item :label="t('Custom.Withdraw.swiftCode')">
  221. <uni-easyinput disabled v-model="form.swiftCode" />
  222. </uni-forms-item>
  223. </view>
  224. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  225. <uni-forms-item :label="t('Custom.Withdraw.bankCode')">
  226. <uni-easyinput disabled v-model="form.customBankCode" />
  227. </uni-forms-item>
  228. </view>
  229. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  230. <uni-forms-item :label="t('Custom.Withdraw.bankAddr')">
  231. <uni-easyinput disabled v-model="form.bankAddr" />
  232. </uni-forms-item>
  233. </view>
  234. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  235. <!-- Account Agency NO -->
  236. <uni-forms-item :label="'Account Agency NO'" name="agencyNo">
  237. <uni-easyinput v-model="form.agencyNo" />
  238. </uni-forms-item>
  239. </view>
  240. <view
  241. v-if="channelData.type == 'BANK_TELEGRAPHIC' && channelData.code == 'PAY_RETAILER_REMIT_PAY_KEY_BRW'">
  242. <uni-forms-item label="CPF" name="cpf">
  243. <uni-easyinput v-model="form.cpf" />
  244. </uni-forms-item>
  245. </view>
  246. <!-- 电汇金额区域 -->
  247. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  248. <view class="tit">
  249. <text>{{ t('Custom.Withdraw.Title3') }}</text>
  250. </view>
  251. </view>
  252. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'">
  253. <uni-forms-item :label="t('Custom.Withdraw.CurrencyType')" name="currency">
  254. <cwg-combox v-model:value="form.currency"
  255. :options="[{ text: 'USD', value: 'USD' }]" />
  256. </uni-forms-item>
  257. </view>
  258. <view v-if="channelData.type == 'BANK_TELEGRAPHIC'" class="amount-box">
  259. <uni-forms-item :label="t('Custom.Withdraw.amount')" name="amount"
  260. :error-message="amountErrorMessage" class="amount-input">
  261. <uni-easyinput v-model.trim="form.amount" type="number"
  262. @blur="validateAmount" />
  263. </uni-forms-item>
  264. <!-- <view class="btn" v-t="'State.All'" @click="setAllAmount"></view> -->
  265. </view>
  266. <!-- 非电汇的金额区域 -->
  267. <view v-if="channelData.type != 'BANK_TELEGRAPHIC'">
  268. <view class="tit">
  269. <text>{{ t('Custom.Withdraw.Title3') + '(' + channelData.currency + ')'
  270. }}</text>
  271. </view>
  272. </view>
  273. <view v-if="channelData.type != 'BANK_TELEGRAPHIC'" class="amount-box amount-box1">
  274. <uni-forms-item name="amount" :error-message="amountErrorMessage"
  275. class="amount-input">
  276. <uni-easyinput v-model.trim="form.amount" autocomplete="off" type="number"
  277. @blur="validateAmount" />
  278. </uni-forms-item>
  279. <!-- <view class="btn" v-t="'State.All'" @click="setAllAmount"></view> -->
  280. </view>
  281. </view>
  282. <view class="agree">
  283. <uni-forms-item name="agree2">
  284. <checkbox-group :value="form.agree2 ? ['1'] : []" @change="onAgree2Change">
  285. <label class="checkbox">
  286. <checkbox value="1" :checked="form.agree2" />
  287. <view class="crm-cursor"
  288. style="text-decoration: underline; display: inline-block; margin-left: 10px;"
  289. @click.stop="dialogCheckTip = true">
  290. {{ t('Custom.Withdraw.Des') }}
  291. </view>
  292. </label>
  293. </checkbox-group>
  294. </uni-forms-item>
  295. </view>
  296. <view class="agree" v-if="dialogTipsIsShow">
  297. <uni-forms-item name="agree3">
  298. <checkbox-group :value="form.agree3 ? ['1'] : []" @change="onAgree3Change">
  299. <label class="checkbox">
  300. <checkbox value="1" :checked="form.agree3" />
  301. <view class="crm-cursor"
  302. style="display: inline-block; margin-left: 10px;">
  303. * {{ t('Custom.Withdraw.item1') }}<br />
  304. {{ t('Custom.Withdraw.item1_1') }}<br />
  305. {{ t('Custom.Withdraw.item1_2') }}
  306. </view>
  307. </label>
  308. </checkbox-group>
  309. </uni-forms-item>
  310. </view>
  311. <button class="s-btn" type="primary" @click="openTips">{{ t('Btn.Submit') }}</button>
  312. </uni-forms>
  313. </view>
  314. </view>
  315. </view>
  316. <!-- 提示弹窗 -->
  317. <cwg-tips-popup v-model:visible="dialogTips" content="Custom.Withdraw.item2"
  318. @confirm="closeTipsConfirm" />
  319. <cwg-tips-popup v-model:visible="dialogCheckInto" content="ApplicationDialog.Des42_1"
  320. title="ApplicationDialog.Des41_1" @confirm="closeTipsConfirm" />
  321. <cwg-tips-popup v-model:visible="dialogCheckInto1" content="ApplicationDialog.Des42"
  322. title="ApplicationDialog.Des41" @confirm="closeTipsConfirm" />
  323. <!-- 弹窗:确认信息 -->
  324. <cwg-check-confirm-popup v-model:visible="dialogCheckConfirm" :title="t('Home.page_customer.item3')"
  325. :channelData="channelData" :code="code" :selectCodes="selectCodes" :params="form"
  326. :FreeNumber="FreeNumber" :userName="userName" :dialogCheckConfirm_form="dialogCheckConfirm_form"
  327. :login="loginValue" type="IB" @confirm="submit" />
  328. <!-- 协议弹窗 -->
  329. <cwg-tips-popup v-model:visible="dialogCheckTip"
  330. :introduce="isZh ? introduce.introduce : introduce.enIntroduce" />
  331. <!-- 等待弹窗 -->
  332. <cwg-wait-popup v-model:visible="dialogCheckWait" type="center" :mask-click="false"
  333. :showFooters="false" />
  334. <!-- 最后失败弹窗 -->
  335. <cwg-error-popup v-model:visible="dialogError" @confirm="closeDia" :responseMessage="RES" />
  336. <!-- 最后成功弹窗 -->
  337. <cwg-success-popup v-model:visible="dialogSuccess" @confirm="closeDia" />
  338. <!-- 功能关闭弹出 -->
  339. <cwg-function-disabled-popup v-model:visible="InfoStatus5" :showFooters="false" @confirm="toHome" />
  340. <!-- kyc成功弹窗 -->
  341. <cwg-kyc-popup v-model:visible="dialogKyc" :qrText="text1" />
  342. <!--验证码-->
  343. <!-- 新增银行弹窗 -->
  344. <add-bank-dialog ref="addBankDialogRef" @success="addSuccess" />
  345. </view>
  346. <view class="step3-attention">
  347. <view class="tips" v-if="(introduce.introduce || introduce.enIntroduce)">
  348. <view>
  349. <rich-text class="attention" :nodes="isZh ? introduce.introduce : introduce.enIntroduce" />
  350. </view>
  351. </view>
  352. </view>
  353. </view>
  354. </cwg-page-wrapper>
  355. </template>
  356. <script setup>
  357. import { ref, reactive, computed, onMounted, nextTick, watch, onUnmounted } from 'vue'
  358. import { onLoad } from '@dcloudio/uni-app'
  359. import { showToast } from "@/utils/toast";
  360. import useUserStore from '@/stores/use-user-store'
  361. import { customApi } from "@/service/custom"
  362. import { financialApi } from "@/service/financial"
  363. import Config from "@/config/index"
  364. import AddBankDialog from '@/components/AddBankDialog.vue';
  365. import CwgCheckConfirmPopup from '../customer/components/WithdrawCheckConfirmPopup.vue'
  366. import CwgKycPopup from '../customer/components/KycPopup.vue'
  367. import PaymentMethodsList from '../customer/components/PaymentMethodsList.vue'
  368. import { useI18n } from 'vue-i18n'
  369. const { t, locale } = useI18n()
  370. const { Code, Host80 } = Config
  371. const isZh = computed(() => ['cn', 'zhHant'].includes(locale.value))
  372. // ---------- 辅助函数:替代原 this.Session ----------
  373. // 弹窗辅助(替代原 this.$pigeon)
  374. const $pigeon = {
  375. MessageError(msg) {
  376. uni.showToast({ title: msg, icon: 'none' })
  377. },
  378. MessageWarning(msg) {
  379. uni.showToast({ title: msg, icon: 'none' })
  380. },
  381. MessageConfirm(content, title, confirmText, cancelText, confirmCallback, cancelCallback) {
  382. uni.showModal({
  383. title,
  384. content,
  385. confirmText,
  386. cancelText,
  387. success(res) {
  388. if (res.confirm) confirmCallback && confirmCallback()
  389. else cancelCallback && cancelCallback()
  390. }
  391. })
  392. }
  393. }
  394. // 获取 metaInfo(用于二维码)
  395. const getMetaInfo = () => {
  396. const systemInfo = uni.getSystemInfoSync()
  397. return {
  398. userAgent: systemInfo.platform,
  399. screenWidth: systemInfo.screenWidth,
  400. screenHeight: systemInfo.screenHeight,
  401. deviceType: 'h5'
  402. }
  403. }
  404. // ---------- 响应式数据(完全保留原 data 结构) ----------
  405. const dialogFreeNumber = ref(false)
  406. const FreeNumber = ref(0)
  407. const InfoStatus5 = ref(false)
  408. const metaInfo = ref(null)
  409. const text1 = ref("")
  410. const flag = ref(false)
  411. const RES = ref("")
  412. const openType = ref("")
  413. const dialogInfoTradingAdd = ref(false)
  414. const ruleForm = reactive({
  415. bankInfo: [],
  416. bankWrit: [],
  417. xykInfo: [],
  418. bankBlockchain: []
  419. })
  420. const imgUrl = Host80
  421. const loginOptions = ref([])
  422. const loginValue = ref("")
  423. const code = ref("")
  424. const bankValid = ref("")
  425. const requestUrl = ref("")
  426. const isStep3 = ref(false)
  427. const step2 = ref(false)
  428. const step3 = ref(false)
  429. const dialogCheckTip = ref(false)
  430. const isChannel = ref(true)
  431. const pictLoading = ref(false)
  432. const tableData = reactive({
  433. International_Transfer: [],
  434. China_UnionPay: [],
  435. Digital_Currency: [],
  436. CHANNEL_TYPE_CARD: [],
  437. Electronic_Wallet: [],
  438. CHANNEL_TYPE_ALI_WALLET: [],
  439. UCARD_WALLET: []
  440. })
  441. //通道table-选择前后
  442. const activeTab = ref(1)
  443. // 🔥 自动过滤掉空数据的 tab
  444. const tabsConfig = computed(() => {
  445. const allTabs = [
  446. { text: t('Custom.Deposit.Channel3'), value: 1, type: 'Digital_Currency' },
  447. { text: t('Custom.Deposit.Channel2'), value: 2, type: 'China_UnionPay' },
  448. { text: t('Custom.Deposit.Channel4'), value: 3, type: 'Electronic_Wallet' },
  449. { text: t('Custom.Deposit.Channel1'), value: 4, type: 'International_Transfer' },
  450. { text: t('PersonalManagement.Label.CreditCard'), value: 5, type: 'CHANNEL_TYPE_CARD' },
  451. { text: t('card.title'), value: 6, type: 'UCARD_WALLET' },
  452. { text: t('Label.Ali'), value: 7, type: 'CHANNEL_TYPE_ALI_WALLET' },
  453. ]
  454. // ✅ 只保留有数据的 tab
  455. return allTabs.filter(tab => {
  456. return tableData[tab.type]?.length > 0
  457. })
  458. })
  459. // 当前选中的 tab 项
  460. const currentTab = computed(() => tabsConfig.value.find(t => t.value === activeTab.value))
  461. // 当前要渲染的表格数据
  462. const currentTableData = computed(() => {
  463. const type = currentTab.value?.type
  464. return type ? tableData[type] || [] : []
  465. })
  466. // ✅ 监听 tab 变化,自动选中第一个有数据的 tab
  467. watch(
  468. tabsConfig,
  469. (newTabs) => {
  470. if (newTabs.length > 0) {
  471. activeTab.value = newTabs[0].value // 选中第一个
  472. }
  473. },
  474. { immediate: true }
  475. )
  476. const bankDate = ref([])
  477. const channelData = ref({})
  478. const WireTransferAccount = ref({})
  479. const formRef = ref(null)
  480. const form = reactive({
  481. currency: "USD",
  482. amount: "",
  483. bankCode: '', // 银行代码(普通银行通道选择)
  484. address: '', // 电子钱包地址 / 数字货币地址(输入/展示)
  485. addressName: '', // 数字货币地址名称(展示)
  486. addressProve: '', // 数字货币地址证明文件路径(仅展示))
  487. bankUname: '', // 持卡人姓名
  488. bankCardNum: '', // 银行卡号
  489. bankName: '', // 银行名称
  490. bankBranchName: '', // 支行名称
  491. swiftCode: '', // SWIFT代码
  492. customBankCode: '', // 自定义银行代码
  493. bankAddr: '', // 银行地址
  494. agencyNo: '', // 代理机构编号(电汇专用,可编辑)
  495. cpf: '', // CPF号码(电汇专用,可编辑)
  496. cvv: '', // CVV码(电汇专用,可编辑)
  497. expiryYearMonth: '', // 过期年(电汇专用,可编辑)
  498. agree2: false,
  499. agree3: false,
  500. login: ''
  501. })
  502. const mAmount = reactive({
  503. minAmount: "",
  504. maxAmount: ""
  505. })
  506. const introduce = reactive({
  507. introduce: "",
  508. enIntroduce: ""
  509. })
  510. const bankInfoList = ref([])
  511. const bank = ref("")
  512. const myId = ref("")
  513. const bankPayType = ref("")
  514. const step3_bank_cur = ref("")
  515. const agree2 = ref(false)
  516. const form1 = ref({})
  517. const dialogCheck = ref(false)
  518. const dialogKyc = ref(false)
  519. const dialogVisible = ref(false)
  520. const dialogCheckWait = ref(false)
  521. const dialogCheckInto = ref(false)
  522. const dialogCheckInto1 = ref(false)
  523. const dialogNewBank = ref(false)
  524. const params = reactive({
  525. bankCardNum: "",
  526. bankUname: "",
  527. bankName: "",
  528. bankBranchName: "",
  529. bankAddr: "",
  530. swiftCode: "",
  531. bankFront: "",
  532. bankBack: "",
  533. defaultBank: false
  534. })
  535. const resetForm = async () => {
  536. await nextTick();
  537. formRef.value?.clearValidate(); // 再次清除可能因数据重置产生的新错误
  538. params.bankCardNum = ""
  539. params.bankUname = ""
  540. params.bankName = ""
  541. params.bankBranchName = ""
  542. params.bankAddr = ""
  543. params.swiftCode = ""
  544. params.bankFront = ""
  545. params.bankBack = ""
  546. params.defaultBank = false
  547. form.amount = ""
  548. form.amount1 = ""
  549. form.bankCode = ""
  550. form.address = ""
  551. form.addressName = ""
  552. form.addressProve = ""
  553. form.bankUname = ""
  554. form.bankCardNum = ""
  555. form.swiftCode = ""
  556. form.customBankCode = ""
  557. form.bankAddr = ""
  558. form.agencyNo = ""
  559. form.bankName = ""
  560. form.cpf = ""
  561. form.bankBranchName = ""
  562. form.cpf = ""
  563. form.cvv = ""
  564. form.expiryYearMonth = ""
  565. form.agree2 = false
  566. form.agree3 = false
  567. amountErrorMessage.value = ""
  568. flag.value = false
  569. loginValue.value = ""
  570. dialogCheck.value = false
  571. dialogVisible.value = false
  572. }
  573. const dialogTips = ref(false)
  574. const dialogTipsIsShow = ref(true)
  575. const dialogCheckConfirm = ref(false)
  576. const dialogCheckConfirm_form = reactive({
  577. amount: "",
  578. feeAmount: ""
  579. })
  580. // 验证规则(保留原结构,实际验证需配合表单组件)
  581. const rules = computed(() => ({
  582. bankCardNum: {
  583. rules: [
  584. {
  585. required: true,
  586. errorMessage: t('vaildate.input.empty'),
  587. trigger: 'blur',
  588. },
  589. ],
  590. },
  591. bankUname: {
  592. rules: [
  593. {
  594. required: true,
  595. errorMessage: t('vaildate.input.empty'),
  596. trigger: 'blur',
  597. },
  598. ],
  599. },
  600. bankName: {
  601. rules: [
  602. {
  603. required: true,
  604. errorMessage: t('vaildate.input.empty'),
  605. trigger: 'blur',
  606. },
  607. ],
  608. },
  609. bankBranchName: {
  610. rules: [
  611. {
  612. required: true,
  613. errorMessage: t('vaildate.input.empty'),
  614. trigger: 'blur',
  615. },
  616. ],
  617. },
  618. bankAddr: {
  619. rules: [
  620. {
  621. required: true,
  622. errorMessage: t('vaildate.input.empty'),
  623. trigger: 'blur',
  624. },
  625. ],
  626. },
  627. swiftCode: {
  628. rules: [
  629. {
  630. required: true,
  631. errorMessage: t('vaildate.input.empty'),
  632. trigger: 'blur',
  633. },
  634. ],
  635. },
  636. defaultBank: {
  637. rules: [
  638. {
  639. required: true,
  640. errorMessage: t('vaildate.select.empty'),
  641. trigger: 'change',
  642. },
  643. ],
  644. },
  645. bankCode: {
  646. rules: [
  647. {
  648. required: true,
  649. errorMessage: t('vaildate.select.empty'),
  650. trigger: 'change',
  651. },
  652. ],
  653. },
  654. message: {
  655. rules: [
  656. {
  657. required: true,
  658. errorMessage: t('vaildate.input.empty'),
  659. trigger: 'blur',
  660. },
  661. ],
  662. },
  663. address: {
  664. rules: [
  665. {
  666. required: true,
  667. errorMessage: t('vaildate.input.empty'),
  668. trigger: 'blur',
  669. },
  670. ],
  671. },
  672. amount: {
  673. rules: [
  674. {
  675. required: true,
  676. errorMessage: t('vaildate.amount.format'),
  677. },
  678. {
  679. validateFunction: (rule, value, data, callback) => {
  680. if (value && (Number(mAmount.minAmount) > Number(value) || Number(mAmount.maxAmount) < Number(value))) {
  681. callback(t('vaildate.amount.amount') + mAmount.minAmount + ' - ' + mAmount.maxAmount);
  682. return false;
  683. }
  684. if (/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
  685. return true;
  686. } else {
  687. callback(t('vaildate.amount.format'));
  688. return false;
  689. }
  690. },
  691. trigger: 'blur',
  692. },
  693. ],
  694. },
  695. agree2: {
  696. rules: [
  697. {
  698. validateFunction: (rule, value, data, callback) => {
  699. if (form.agree2) {
  700. return true;
  701. } else {
  702. callback(t('vaildate.agree.empty'));
  703. return false;
  704. }
  705. },
  706. trigger: 'change',
  707. },
  708. ],
  709. },
  710. agree3: {
  711. rules: [
  712. {
  713. validateFunction: (rule, value, data, callback) => {
  714. if (form.agree3) {
  715. return true;
  716. } else {
  717. callback(t('vaildate.agree.empty'));
  718. return false;
  719. }
  720. },
  721. trigger: 'change',
  722. },
  723. ],
  724. },
  725. agencyNo: {
  726. rules: [
  727. {
  728. required: true,
  729. errorMessage: t('vaildate.input.empty'),
  730. trigger: 'blur',
  731. },
  732. ],
  733. },
  734. cpf: {
  735. rules: [
  736. {
  737. required: true,
  738. errorMessage: t('vaildate.input.empty'),
  739. trigger: 'blur',
  740. },
  741. ],
  742. },
  743. }));
  744. const amountErrorMessage = ref('')
  745. const validateAmount = () => {
  746. const amount = form.amount
  747. if (!amount && amount !== 0) {
  748. amountErrorMessage.value = t('vaildate.amount.format')
  749. return false
  750. }
  751. if (mAmount.minAmount && mAmount.maxAmount) {
  752. const min = Number(mAmount.minAmount);
  753. const max = Number(mAmount.maxAmount);
  754. const numValue = Number(amount);
  755. if (numValue < min || numValue > max) {
  756. amountErrorMessage.value = t('vaildate.amount.amount') + min + '-' + max
  757. return false
  758. }
  759. }
  760. if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(amount)) {
  761. amountErrorMessage.value = t('vaildate.amount.format')
  762. return false
  763. }
  764. amountErrorMessage.value = ''
  765. return true
  766. }
  767. // ---------- 计算属性 ----------
  768. const loginComboxOptions = computed(() => {
  769. return loginOptions.value.map((item, index) => ({
  770. text: item.label,
  771. value: item.login
  772. }))
  773. })
  774. const digitalOptions = computed(() => {
  775. return ruleForm.bankBlockchain.map((item, index) => ({
  776. text: `${item.addressName}-${item.address}`,
  777. value: item.id
  778. }))
  779. })
  780. const groupTitleMap = {
  781. 'Ucard_Wallet': 'card.title',
  782. 'Digital_Currency': 'Custom.Deposit.Channel3',
  783. 'China_UnionPay': 'Custom.Deposit.Channel2',
  784. 'Electronic_Wallet': 'Custom.Deposit.Channel4',
  785. 'International_Transfer': 'Custom.Deposit.Channel1',
  786. 'CHANNEL_TYPE_CARD': 'PersonalManagement.Label.CreditCard',
  787. 'CHANNEL_TYPE_ALI_WALLET': 'Label.Ali'
  788. }
  789. const getWalletLabel = computed(() => {
  790. if (channelData.value.type === 'CHANNEL_TYPE_WALLET') return t('Custom.Withdraw.Title7')
  791. if (channelData.value.type === 'CHANNEL_TYPE_ALI_WALLET') return t('Label.AliAccout')
  792. return ''
  793. })
  794. const bankCardOptions = computed(() => {
  795. return bankList.value.map((item, index) => ({
  796. text: getBankLabel(item),
  797. value: item.id
  798. }))
  799. })
  800. const getBankLabel = (item) => {
  801. if (channelData.value.type === 'BANK' || channelData.value.type === 'BANK_TELEGRAPHIC') {
  802. return `${item.bankName}-${item.bankCardNum}`
  803. } else if (channelData.value.type === 'CHANNEL_TYPE_CARD') {
  804. return item.bankCardNum
  805. }
  806. return ''
  807. }
  808. const bankList = computed(() => {
  809. if (channelData.value.type === 'BANK') return ruleForm.bankInfo
  810. if (channelData.value.type === 'BANK_TELEGRAPHIC') return ruleForm.bankWrit
  811. if (channelData.value.type === 'CHANNEL_TYPE_CARD') return ruleForm.xykInfo
  812. if (channelData.value.type === 'DIGITAL_CURRENCY') return ruleForm.bankBlockchain
  813. return []
  814. })
  815. const bankOptions = computed(() => {
  816. return bankDate.value.map((item, index) => ({
  817. text: (locale.value === 'cn' || locale.value === 'zhHant') ? item.name : item.enName,
  818. value: item.code
  819. }))
  820. })
  821. // 最后确认
  822. const dialogSuccess = computed(() => dialogCheck.value && dialogVisible.value)
  823. // 最后失败
  824. const dialogError = computed(() => dialogCheck.value && !dialogVisible.value)
  825. const userStore = useUserStore()
  826. const ibInfo = computed(() => {
  827. return userStore?.userInfo?.ibInfo || {}
  828. })
  829. const getInfoStatus5 = computed(() => {
  830. if (ibInfo.value.closeFunctions && ibInfo.value.closeFunctions.length > 0) {
  831. return ibInfo.value.closeFunctions.indexOf("8") !== -1
  832. }
  833. return false
  834. })
  835. const isFree = computed(() => {
  836. let flagVal = false
  837. const startTime1 = "2024/11/01 00:00:00"
  838. const timezone = 2 // 目标时区偏移小时数
  839. const now = new Date()
  840. const utc = now.getTime() + now.getTimezoneOffset() * 60000
  841. const targetTime = new Date(utc + timezone * 3600000).getTime()
  842. const start = new Date(startTime1).getTime()
  843. if (targetTime > start) flagVal = true
  844. return flagVal
  845. })
  846. // ---------- 方法 ----------
  847. const getFreeNumber = async () => {
  848. if (!isFree.value) return
  849. if (getInfoStatus5.value === false) {
  850. dialogFreeNumber.value = true
  851. }
  852. const res = await financialApi.remainingReductionNumber({})
  853. if (res.code === Code.StatusOK) {
  854. FreeNumber.value = res.data || 0
  855. } else {
  856. $pigeon.MessageError(res.msg)
  857. }
  858. }
  859. const toHome = () => {
  860. uni.reLaunch({ url: "/pages/ib/index" })
  861. InfoStatus5.value = false
  862. }
  863. const isShowDialog = () => {
  864. const startTime1 = "2025/2/15 00:00:00"
  865. const timezone = 8
  866. const now = new Date()
  867. const utc = now.getTime() + now.getTimezoneOffset() * 60000
  868. const targetTime = new Date(utc + timezone * 3600000).getTime()
  869. const start = new Date(startTime1).getTime()
  870. if (targetTime > start) {
  871. dialogCheckInto.value = false
  872. // dialogCheckInto1.value = true
  873. } else {
  874. dialogCheckInto.value = true
  875. dialogCheckInto1.value = false
  876. }
  877. }
  878. const onAgree3Change = (e) => {
  879. form.agree3 = e.detail.value.length > 0
  880. }
  881. const onAgree2Change = (e) => {
  882. form.agree2 = e.detail.value.length > 0
  883. }
  884. const selectChange = () => {
  885. // 强制更新视图
  886. }
  887. // const openAddBankCard = (type) => {
  888. // if (type === "add_bankCard") {
  889. // if (ruleForm.bankInfo.length === 2) {
  890. // $pigeon.MessageConfirm(
  891. // t("Msg.UnionPayCARDS"),
  892. // t("Msg.SystemPrompt"),
  893. // t("Btn.Confirm"),
  894. // t("Btn.Cancel"),
  895. // async () => { },
  896. // () => { }
  897. // )
  898. // } else {
  899. // openType.value = "add_bankCard"
  900. // dialogInfoTradingAdd.value = true
  901. // }
  902. // } else if (type === "add_wireTransfer") {
  903. // if (ruleForm.bankWrit.length === 2) {
  904. // $pigeon.MessageConfirm(
  905. // t("Msg.WireTransfers"),
  906. // t("Msg.SystemPrompt"),
  907. // t("Btn.Confirm"),
  908. // t("Btn.Cancel"),
  909. // async () => { },
  910. // () => { }
  911. // )
  912. // } else {
  913. // openType.value = "add_wireTransfer"
  914. // dialogInfoTradingAdd.value = true
  915. // }
  916. // } else if (type === "add_CreditCard") {
  917. // openType.value = "add_CreditCard"
  918. // dialogInfoTradingAdd.value = true
  919. // } else if (type === "add_bankBlockchain") {
  920. // if (ruleForm.bankBlockchain.length === 2) {
  921. // $pigeon.MessageConfirm(
  922. // t("blockchain.item9"),
  923. // t("Msg.SystemPrompt"),
  924. // t("Btn.Confirm"),
  925. // t("Btn.Cancel"),
  926. // async () => { },
  927. // () => { }
  928. // )
  929. // } else {
  930. // openType.value = "add_bankBlockchain"
  931. // dialogInfoTradingAdd.value = true
  932. // }
  933. // }
  934. // }
  935. // 新增银行信息
  936. const addBankDialogRef = ref(null);
  937. function openAddBankCard(type) {
  938. switch (type) {
  939. case 'add_bankBlockchain':
  940. openAddCrypto()
  941. break;
  942. case 'add_bankCard':
  943. openAddUnionpay()
  944. break;
  945. case 'add_wireTransfer':
  946. openAddBank()
  947. break;
  948. case 'add_CreditCard':
  949. openAddCredit()
  950. break;
  951. }
  952. }
  953. function openAddCrypto() {
  954. const wallets = bankCardOptions.value || []
  955. // 1️⃣ 没有钱包
  956. if (wallets.length === 0) {
  957. addBankDialogRef.value?.open(4);
  958. return;
  959. }
  960. // 2️⃣ 是否存在未认证钱包
  961. const hasUnAuth = wallets.some(
  962. item => item.authStatus === 0 || item.approveStatus === 1
  963. );
  964. if (hasUnAuth) {
  965. uni.showToast({
  966. title: "加密钱包未认证",
  967. icon: "none"
  968. });
  969. return;
  970. }
  971. // 3️⃣ 是否达到上限
  972. if (wallets.length >= 2) {
  973. uni.showToast({
  974. title: t('blockchain.item9'),
  975. icon: "none"
  976. });
  977. return;
  978. }
  979. // 4️⃣ 正常打开
  980. addBankDialogRef.value?.open(4);
  981. }
  982. function openAddUnionpay() {
  983. const wallets = bankCardOptions.value || []
  984. if (wallets.length === 0) {
  985. addBankDialogRef.value?.open(1);
  986. return;
  987. }
  988. if (wallets.length >= 2) {
  989. uni.showToast({
  990. title: t('Msg.UnionPayCARDS'),
  991. icon: "none"
  992. });
  993. return;
  994. }
  995. addBankDialogRef.value?.open(1);
  996. }
  997. function openAddBank() {
  998. const wallets = bankCardOptions.value || []
  999. if (wallets.length === 0) {
  1000. addBankDialogRef.value?.open(2);
  1001. return;
  1002. }
  1003. if (wallets.length >= 2) {
  1004. uni.showToast({
  1005. title: t('Msg.WireTransfers'),
  1006. icon: "none"
  1007. });
  1008. return;
  1009. }
  1010. addBankDialogRef.value?.open(2);
  1011. }
  1012. function openAddCredit() {
  1013. const wallets = bankCardOptions.value || []
  1014. if (wallets.length === 0) {
  1015. addBankDialogRef.value?.open(3);
  1016. return;
  1017. }
  1018. addBankDialogRef.value?.open(3);
  1019. }
  1020. // 新增银行信息成功回调
  1021. const addSuccess = (e) => {
  1022. getBankInfo();
  1023. }
  1024. const closeDiaAdd = () => {
  1025. dialogInfoTradingAdd.value = false
  1026. }
  1027. const closeAdd = (val) => {
  1028. dialogInfoTradingAdd.value = val
  1029. }
  1030. const confirmToReload = () => {
  1031. dialogInfoTradingAdd.value = false
  1032. getBankInfo()
  1033. }
  1034. const getBankInfo = async () => {
  1035. const res = await financialApi.customBankList({})
  1036. if (res.code === Code.StatusOK) {
  1037. ruleForm.bankInfo = []
  1038. ruleForm.bankWrit = []
  1039. ruleForm.xykInfo = []
  1040. ruleForm.bankBlockchain = []
  1041. res.data.forEach(item => {
  1042. if (item.type === 1) {
  1043. item.customBankCode = item.bankCode
  1044. item.bankCode = null
  1045. ruleForm.bankInfo.push(item)
  1046. } else if (item.type === 2) {
  1047. item.customBankCode = item.bankCode
  1048. item.bankCode = null
  1049. ruleForm.bankWrit.push(item)
  1050. } else if (item.type === 3) {
  1051. item.customBankCode = item.bankCode
  1052. item.bankCode = null
  1053. item.expiryYearMonth = (item.expiryYear || "") + "/" + (item.expiryMonth || "")
  1054. ruleForm.xykInfo.push(item)
  1055. } else if (item.type === 4) {
  1056. item.customBankCode = item.bankCode
  1057. item.bankCode = null
  1058. ruleForm.bankBlockchain.push(item)
  1059. }
  1060. if (channelData.value.type === "BANK" && item.defaultBank && item.type === 1) {
  1061. Object.assign(form, item)
  1062. myId.value = form.id
  1063. }
  1064. if (channelData.value.type === "BANK_TELEGRAPHIC" && item.defaultBank && item.type === 2) {
  1065. Object.assign(form, item)
  1066. myId.value = form.id
  1067. }
  1068. if (channelData.value.type === "CHANNEL_TYPE_CARD" && item.defaultBank && item.type === 3) {
  1069. myId.value = item.id
  1070. Object.assign(form, item)
  1071. }
  1072. if (channelData.value.type === "DIGITAL_CURRENCY" && item.defaultBank && item.type === 4) {
  1073. myId.value = item.id
  1074. Object.assign(form, item)
  1075. }
  1076. })
  1077. bankList.value = ref.data
  1078. } else {
  1079. $pigeon.MessageError(res.msg)
  1080. }
  1081. }
  1082. const onDigitalCurrencyChange = (val) => {
  1083. console.log(val, 22);
  1084. const item = ruleForm.bankBlockchain.find(b => b.id === val)
  1085. console.log(item, ruleForm.bankBlockchain);
  1086. chooseBank(item.id)
  1087. }
  1088. const chooseBank = (id) => {
  1089. const item = bankList.value.find(b => b.id === id)
  1090. if (channelData.value.type == "DIGITAL_CURRENCY") {
  1091. if (item.authStatus == 0) {
  1092. showToast(t("Msg.item11"));
  1093. return;
  1094. }
  1095. }
  1096. let codeTmp = "";
  1097. if (form.bankCode) {
  1098. codeTmp = form.bankCode;
  1099. }
  1100. console.log(form, 121212);
  1101. Object.assign(form, item)
  1102. console.log(form, 22212122);
  1103. form.agree2 = false
  1104. form.agree3 = false
  1105. if (channelData.value.type == "BANK_TELEGRAPHIC") {
  1106. form.currency = "USD";
  1107. if (codeTmp) {
  1108. form.bankCode = codeTmp;
  1109. }
  1110. }
  1111. }
  1112. const openTips = async () => {
  1113. if (channelData.value.type === "BANK_TELEGRAPHIC" && !myId.value) {
  1114. $pigeon.MessageWarning(t("vaildate.withdrawBank.empty"))
  1115. return
  1116. }
  1117. if (channelData.value.type === "BANK" && !myId.value) {
  1118. $pigeon.MessageWarning(t("vaildate.withdrawBank.empty"))
  1119. return
  1120. }
  1121. if (channelData.value.type === "CHANNEL_TYPE_CARD" && !myId.value) {
  1122. $pigeon.MessageWarning(t("vaildate.withdrawBank.empty"))
  1123. return
  1124. }
  1125. if (channelData.value.type === "DIGITAL_CURRENCY" && !myId.value) {
  1126. $pigeon.MessageWarning(t("blockchain.item11"))
  1127. return
  1128. }
  1129. // 此处模拟表单验证,实际应调用 uni-forms 的 validate
  1130. try {
  1131. if (formRef.value) {
  1132. const valid = await formRef.value.validate()
  1133. if (dialogTipsIsShow.value) {
  1134. dialogTips.value = true
  1135. } else {
  1136. submit("form")
  1137. }
  1138. }
  1139. } catch (error) {
  1140. if (error instanceof Array) {
  1141. showToast(error[0].errorMessage);
  1142. return
  1143. } else {
  1144. RES.value = error.msg;
  1145. }
  1146. }
  1147. }
  1148. const openTipsConfirm = () => {
  1149. dialogCheckConfirm.value = false
  1150. submit("form")
  1151. }
  1152. const closeTipsConfirm = () => {
  1153. dialogTips.value = false
  1154. dialogCheckConfirm.value = true
  1155. }
  1156. const closeDia = () => {
  1157. resetForm()
  1158. dialogCheck.value = false
  1159. dialogVisible.value = false
  1160. showTable()
  1161. }
  1162. const qrCode = async (serial) => {
  1163. metaInfo.value = getMetaInfo()
  1164. const res = await customApi.getWebsdkLink1({
  1165. serial,
  1166. metaInfo: metaInfo.value
  1167. })
  1168. if (res.code === Code.StatusOK) {
  1169. text1.value = JSON.parse(res.data).url
  1170. dialogKyc.value = true
  1171. flag.value = false
  1172. } else {
  1173. flag.value = false
  1174. }
  1175. }
  1176. const submit = async (formName) => {
  1177. if (channelData.value.type === "BANK_TELEGRAPHIC" && !myId.value) {
  1178. $pigeon.MessageWarning(t("vaildate.withdrawBank.empty"))
  1179. return
  1180. }
  1181. if (channelData.value.type === "BANK" && !myId.value) {
  1182. $pigeon.MessageWarning(t("vaildate.withdrawBank.empty"))
  1183. return
  1184. }
  1185. if (channelData.value.type === "CHANNEL_TYPE_CARD" && !myId.value) {
  1186. $pigeon.MessageWarning(t("vaildate.withdrawBank.empty"))
  1187. return
  1188. }
  1189. if (channelData.value.type === "DIGITAL_CURRENCY" && !myId.value) {
  1190. $pigeon.MessageWarning(t("blockchain.item11"))
  1191. return
  1192. }
  1193. // 模拟表单验证
  1194. try {
  1195. if (formRef.value) {
  1196. await formRef.value.validate()
  1197. if (flag.value) return
  1198. flag.value = true
  1199. dialogCheckWait.value = true
  1200. form.amount = Number(form.amount)
  1201. let res
  1202. if (channelData.value.type === "DIGITAL_CURRENCY") {
  1203. res = await financialApi.ibWithdrawAapplyDigitalCurrency(channelData.value.requestUrl, {
  1204. // login: loginValue.value,
  1205. payType: channelData.value.code,
  1206. ...form
  1207. })
  1208. } else if (["CHANNEL_TYPE_WALLET", "UCARD_WALLET", "CHANNEL_TYPE_ALI_WALLET"].includes(channelData.value.type)) {
  1209. res = await financialApi.ibWithdrawAapplyDigitalCurrency(channelData.value.requestUrl, {
  1210. // login: loginValue.value,
  1211. payType: channelData.value.code,
  1212. ...form
  1213. })
  1214. } else if (channelData.value.type === "BANK" || channelData.value.type === "BANK_TELEGRAPHIC") {
  1215. res = await financialApi.ibWithdrawApplyBank(channelData.value.requestUrl, {
  1216. // login: loginValue.value,
  1217. payType: channelData.value.code,
  1218. ...form
  1219. })
  1220. } else if (channelData.value.type === "CHANNEL_TYPE_CARD") {
  1221. res = await financialApi.WithdrawApplyBank(channelData.value.requestUrl, {
  1222. // login: loginValue.value,
  1223. payType: channelData.value.code,
  1224. ...form
  1225. })
  1226. }
  1227. if (res && res.code === Code.StatusOK) {
  1228. dialogCheck.value = true
  1229. dialogVisible.value = true
  1230. // qrCode(res.data)
  1231. flag.value = false
  1232. } else {
  1233. RES.value = res?.msg || "error"
  1234. dialogCheck.value = true
  1235. dialogVisible.value = false
  1236. flag.value = false
  1237. }
  1238. dialogCheckWait.value = false
  1239. }
  1240. } catch (error) {
  1241. if (error instanceof Array) {
  1242. showToast(error[0].errorMessage);
  1243. return
  1244. } else {
  1245. RES.value = error.msg;
  1246. dialogCheck.value = true;
  1247. dialogCheckWait.value = false;
  1248. dialogVisible.value = false;
  1249. flag.value = false;
  1250. }
  1251. }
  1252. }
  1253. const Initialize = () => {
  1254. loginValue.value = ""
  1255. isStep3.value = true
  1256. step2.value = false
  1257. step3.value = false
  1258. showTable()
  1259. }
  1260. const isShowStep3 = (row) => {
  1261. if (row.bankValid && isChannel.value) {
  1262. getBankList(row)
  1263. isChannel.value = false
  1264. channelData.value = row
  1265. mAmount.minAmount = row.minAmount
  1266. mAmount.maxAmount = row.maxAmount
  1267. } else {
  1268. bankDate.value = []
  1269. channelData.value = row
  1270. mAmount.minAmount = row.minAmount
  1271. mAmount.maxAmount = row.maxAmount
  1272. }
  1273. if (row.code === "UNION_PAY_TELEGRAPHIC") {
  1274. WireTransferAccount.value = JSON.parse(row.property)
  1275. }
  1276. if (["BANK", "BANK_TELEGRAPHIC", "CHANNEL_TYPE_CARD", "DIGITAL_CURRENCY"].includes(row.type)) {
  1277. getBankInfo()
  1278. step3_bank_cur.value = "bank"
  1279. form.login = loginValue.value
  1280. form.payType = row.code
  1281. bankPayType.value = row.code
  1282. }
  1283. // 重置 tableData
  1284. tableData.International_Transfer = []
  1285. tableData.China_UnionPay = []
  1286. tableData.Digital_Currency = []
  1287. tableData.CHANNEL_TYPE_CARD = []
  1288. tableData.Electronic_Wallet = []
  1289. tableData.CHANNEL_TYPE_ALI_WALLET = []
  1290. tableData.UCARD_WALLET = []
  1291. if (row.type === "BANK_TELEGRAPHIC") tableData.International_Transfer[0] = row
  1292. if (row.type === "BANK") tableData.China_UnionPay[0] = row
  1293. if (row.type === "DIGITAL_CURRENCY") tableData.Digital_Currency[0] = row
  1294. if (row.type === "CHANNEL_TYPE_WALLET") tableData.Electronic_Wallet[0] = row
  1295. if (row.type === "UCARD_WALLET") tableData.UCARD_WALLET[0] = row
  1296. if (row.type === "CHANNEL_TYPE_CARD") tableData.CHANNEL_TYPE_CARD[0] = row
  1297. if (row.type === "CHANNEL_TYPE_ALI_WALLET") tableData.CHANNEL_TYPE_ALI_WALLET[0] = row
  1298. introduce.introduce = row.introduce
  1299. introduce.enIntroduce = row.enIntroduce
  1300. loading.value = false
  1301. }
  1302. const showTable = () => {
  1303. resetForm()
  1304. myId.value = null
  1305. isChannel.value = true
  1306. getDepositList()
  1307. // 重置表单
  1308. form.currency = "USD"
  1309. // 其他重置...
  1310. }
  1311. const getDateList = async () => {
  1312. const res = await customApi.CustomDropdown({ platform: "" })
  1313. if (res.code === Code.StatusOK) {
  1314. loginOptions.value = res.data
  1315. } else {
  1316. $pigeon.MessageError(res.msg)
  1317. }
  1318. }
  1319. const getDepositList = async () => {
  1320. pictLoading.value = true
  1321. tableData.International_Transfer = []
  1322. tableData.China_UnionPay = []
  1323. tableData.Digital_Currency = []
  1324. tableData.CHANNEL_TYPE_CARD = []
  1325. tableData.Electronic_Wallet = []
  1326. tableData.CHANNEL_TYPE_ALI_WALLET = []
  1327. tableData.UCARD_WALLET = []
  1328. const res = await financialApi.RemitChannelList({})
  1329. if (res.code === Code.StatusOK) {
  1330. res.data.forEach(item => {
  1331. if (item.type === "BANK_TELEGRAPHIC") tableData.International_Transfer.push(item)
  1332. if (item.type === "BANK") tableData.China_UnionPay.push(item)
  1333. if (item.type === "DIGITAL_CURRENCY") tableData.Digital_Currency.push(item)
  1334. if (item.type === "CHANNEL_TYPE_WALLET") tableData.Electronic_Wallet.push(item)
  1335. if (item.type === "UCARD_WALLET") tableData.UCARD_WALLET.push(item)
  1336. if (item.type === "CHANNEL_TYPE_CARD") tableData.CHANNEL_TYPE_CARD.push(item)
  1337. if (item.type === "CHANNEL_TYPE_ALI_WALLET") tableData.CHANNEL_TYPE_ALI_WALLET.push(item)
  1338. })
  1339. pictLoading.value = false
  1340. } else {
  1341. $pigeon.MessageError(res.msg)
  1342. pictLoading.value = false
  1343. }
  1344. }
  1345. const getBankList = async (row) => {
  1346. const res = await financialApi.BankList({ channelCode: row.code })
  1347. if (res.code === Code.StatusOK) {
  1348. const bank = res.data
  1349. const data = []
  1350. bank.forEach(j => {
  1351. if (!j.minAmount && j.minAmount !== 0) j.minAmount = row.minAmount
  1352. if (!j.maxAmount && j.maxAmount !== 0) j.maxAmount = row.maxAmount
  1353. j.payType = row.code
  1354. data.push(j)
  1355. })
  1356. bankDate.value = data
  1357. } else {
  1358. $pigeon.MessageError(res.msg)
  1359. }
  1360. }
  1361. const cancelBank = () => {
  1362. dialogNewBank.value = false
  1363. // 重置 params 表单
  1364. Object.assign(params, {
  1365. bankCardNum: "",
  1366. bankUname: "",
  1367. bankName: "",
  1368. bankBranchName: "",
  1369. bankAddr: "",
  1370. swiftCode: "",
  1371. bankFront: "",
  1372. bankBack: "",
  1373. defaultBank: false
  1374. })
  1375. }
  1376. // 新改内容
  1377. // userStore.paymentChannel.value
  1378. // userStore.channelList.value
  1379. const channel = computed(() => userStore.paymentChannel)
  1380. const channelList = computed(() => userStore.channelList)
  1381. const channelListOptions = ref([])
  1382. const channelId = ref(null)
  1383. const loading = ref(false)
  1384. const setAllAmount = () => {
  1385. const found = loginOptions.value.find(opt => opt.login === Number(loginValue.value))
  1386. params.amount = parseInt(found.balance)
  1387. validateAmount()
  1388. }
  1389. const allTabs = computed(() => {
  1390. return {
  1391. "Digital_Currency": t('Custom.Deposit.Channel3'),
  1392. "China_UnionPay": t('Custom.Deposit.Channel2'),
  1393. "Electronic_Wallet": t('Custom.Deposit.Channel4'),
  1394. "International_Transfer": t('Custom.Deposit.Channel1'),
  1395. "CHANNEL_TYPE_CARD": t('PersonalManagement.Label.CreditCard'),
  1396. "UCARD_WALLET": t('card.title'),
  1397. "CHANNEL_TYPE_ALI_WALLET": t('Label.Ali'),
  1398. }
  1399. })
  1400. function formatChannels(data) {
  1401. const result = []
  1402. // 遍历每个分类
  1403. for (const key in data) {
  1404. const list = data[key] || []
  1405. // 插入分类标题(禁用项)
  1406. if (list.length) {
  1407. result.push({
  1408. text: allTabs.value[key],
  1409. value: key,
  1410. disable: true
  1411. })
  1412. }
  1413. list.forEach(item => {
  1414. result.push({
  1415. ...item,
  1416. text: item.name,
  1417. value: item.code
  1418. })
  1419. })
  1420. }
  1421. return result
  1422. }
  1423. // ---------- 生命周期 ----------
  1424. onMounted(() => {
  1425. loading.value = true
  1426. if (channelList.value) {
  1427. channelListOptions.value = formatChannels(channelList.value)
  1428. }
  1429. channelId.value = channel.value
  1430. // getDateList()
  1431. // getDepositList()
  1432. getFreeNumber()
  1433. isShowDialog()
  1434. if (getInfoStatus5.value) {
  1435. InfoStatus5.value = true
  1436. return
  1437. }
  1438. })
  1439. onUnmounted(() => {
  1440. userStore.savePaymentChannel('')
  1441. userStore.saveChannelList('')
  1442. })
  1443. watch(channelId, async (newVal) => {
  1444. if (newVal) {
  1445. showTable()
  1446. let row = channelListOptions.value.find(item => item.code == newVal)
  1447. console.log(row, 2222);
  1448. isShowStep3(row)
  1449. }
  1450. });
  1451. // 监听 value 变化
  1452. // 监听 form.amount 变化
  1453. watch(() => form.amount, (newVal) => {
  1454. if (newVal && channelData.value.rate) {
  1455. form.amount1 = (newVal * channelData.value.rate).toFixed(2)
  1456. }
  1457. })
  1458. </script>
  1459. <style lang="scss" scoped>
  1460. @import "@/uni.scss";
  1461. .custom-withdraw {
  1462. width: px2rpx(566);
  1463. flex-shrink: 0;
  1464. .box {
  1465. margin-bottom: px2rpx(20);
  1466. .b-card {
  1467. .card-top {
  1468. .tit {
  1469. font-size: px2rpx(16);
  1470. font-weight: 600;
  1471. margin-bottom: px2rpx(16);
  1472. display: flex;
  1473. align-items: center;
  1474. color: var(--color-navy-900);
  1475. position: relative;
  1476. padding-left: 20px;
  1477. &:after {
  1478. content: '';
  1479. position: absolute;
  1480. left: 0;
  1481. top: 50%;
  1482. transform: translateY(-50%);
  1483. width: 0;
  1484. height: 0;
  1485. border-top: 6px solid transparent;
  1486. border-bottom: 6px solid transparent;
  1487. border-left: 8px solid currentColor;
  1488. }
  1489. .iconfont {
  1490. margin-right: px2rpx(8);
  1491. color: var(--color-primary);
  1492. font-size: px2rpx(18);
  1493. }
  1494. }
  1495. }
  1496. .channelType {
  1497. font-size: px2rpx(15);
  1498. font-weight: 600;
  1499. margin: px2rpx(24) 0 px2rpx(12);
  1500. color: var(--color-navy-700);
  1501. padding-left: px2rpx(8);
  1502. border-left: px2rpx(4) solid var(--color-primary);
  1503. }
  1504. }
  1505. }
  1506. .reselect-btn {
  1507. margin-top: px2rpx(20);
  1508. display: flex;
  1509. justify-content: flex-end;
  1510. }
  1511. .s-btn {
  1512. &.reselect {
  1513. background-color: var(--color-zinc-100);
  1514. color: var(--color-navy-700);
  1515. border: none;
  1516. font-size: px2rpx(14);
  1517. padding: px2rpx(8) px2rpx(20);
  1518. border-radius: px2rpx(8);
  1519. &:active {
  1520. background-color: var(--color-zinc-200);
  1521. }
  1522. }
  1523. &[type="primary"] {
  1524. width: 100%;
  1525. height: px2rpx(48);
  1526. background-color: #cf1322;
  1527. color: #fff;
  1528. border-radius: px2rpx(12);
  1529. font-size: px2rpx(16);
  1530. font-weight: 600;
  1531. display: flex;
  1532. align-items: center;
  1533. justify-content: center;
  1534. border: none;
  1535. margin-top: px2rpx(30);
  1536. transition: all 0.2s;
  1537. &:active {
  1538. transform: scale(0.98);
  1539. background-color: #cf1322;
  1540. }
  1541. }
  1542. }
  1543. .add-back {
  1544. display: flex;
  1545. justify-content: space-between;
  1546. align-items: center;
  1547. margin-bottom: px2rpx(12);
  1548. padding: px2rpx(12) px2rpx(16);
  1549. text {
  1550. font-size: px2rpx(14);
  1551. color: var(--color-navy-700);
  1552. font-weight: 500;
  1553. }
  1554. .add-btn {
  1555. color: var(--color-primary);
  1556. font-weight: 600;
  1557. text-decoration: underline;
  1558. &:active {
  1559. opacity: 0.7;
  1560. }
  1561. }
  1562. }
  1563. .proof {
  1564. margin-top: px2rpx(8);
  1565. border: px2rpx(1) dashed var(--color-zinc-300);
  1566. border-radius: px2rpx(8);
  1567. padding: px2rpx(8);
  1568. display: flex;
  1569. justify-content: center;
  1570. align-items: center;
  1571. background: var(--color-zinc-50);
  1572. .state {
  1573. padding: px2rpx(4) px2rpx(12);
  1574. border-radius: px2rpx(4);
  1575. font-size: px2rpx(12);
  1576. font-weight: bold;
  1577. }
  1578. }
  1579. .agree {
  1580. margin: px2rpx(24) 0;
  1581. display: flex;
  1582. align-items: flex-start;
  1583. .checkbox {
  1584. display: flex;
  1585. align-items: flex-start;
  1586. gap: px2rpx(8);
  1587. :deep(uni-checkbox .uni-checkbox-input) {
  1588. border-radius: px2rpx(4);
  1589. width: px2rpx(18);
  1590. height: px2rpx(18);
  1591. }
  1592. text {
  1593. font-size: px2rpx(13);
  1594. color: var(--color-zinc-500);
  1595. line-height: 1.5;
  1596. }
  1597. }
  1598. }
  1599. .step3-attention {
  1600. // background: var(--color-error-50, #fff1f0);
  1601. border-radius: px2rpx(12);
  1602. margin-bottom: px2rpx(20);
  1603. .tips {
  1604. line-height: 1.8;
  1605. font-size: px2rpx(12);
  1606. color: #909399;
  1607. background-color: #f9f9f9;
  1608. padding: px2rpx(12);
  1609. border-radius: px2rpx(4);
  1610. border-left: px2rpx(2) solid #cf1322;
  1611. .title {
  1612. font-weight: 600;
  1613. margin-bottom: px2rpx(6);
  1614. color: #606266;
  1615. }
  1616. }
  1617. .attention {
  1618. font-size: px2rpx(14);
  1619. // color: var(--color-error-600, #cf1322);
  1620. line-height: 1.6;
  1621. }
  1622. .btn-bottom {
  1623. margin-top: px2rpx(20);
  1624. display: flex;
  1625. justify-content: center;
  1626. .btn {
  1627. background: var(--color-error-600, #cf1322);
  1628. color: #fff;
  1629. padding: px2rpx(10) px2rpx(48);
  1630. border-radius: px2rpx(24);
  1631. font-size: px2rpx(15);
  1632. font-weight: 700;
  1633. box-shadow: 0 px2rpx(4) px2rpx(10) rgba(207, 19, 34, 0.2);
  1634. transition: all 0.2s;
  1635. &:active {
  1636. transform: scale(0.96);
  1637. opacity: 0.8;
  1638. }
  1639. }
  1640. }
  1641. }
  1642. :deep(.base-info-form) {
  1643. .uni-row1 {
  1644. .uni-col {
  1645. padding: 0 px2rpx(10) !important;
  1646. }
  1647. .uni-forms-item {
  1648. min-height: px2rpx(36);
  1649. margin-bottom: px2rpx(28);
  1650. }
  1651. .uni-easyinput__content-input {
  1652. height: px2rpx(35) !important;
  1653. }
  1654. }
  1655. }
  1656. @keyframes rotate {
  1657. from {
  1658. transform: rotate(0deg);
  1659. }
  1660. to {
  1661. transform: rotate(360deg);
  1662. }
  1663. }
  1664. }
  1665. .amount-box {
  1666. display: flex;
  1667. align-items: center;
  1668. gap: px2rpx(12);
  1669. .amount-input {
  1670. flex: 1;
  1671. }
  1672. .btn {
  1673. display: flex;
  1674. align-items: center;
  1675. justify-content: center;
  1676. font-size: px2rpx(14);
  1677. color: var(--color-zinc-600);
  1678. margin-bottom: px2rpx(12);
  1679. height: px2rpx(35);
  1680. background-color: #cf1322;
  1681. color: #fff;
  1682. border-radius: px2rpx(4);
  1683. font-weight: 600;
  1684. display: flex;
  1685. align-items: center;
  1686. justify-content: center;
  1687. border: none;
  1688. padding: 0 px2rpx(20);
  1689. margin-top: px2rpx(21);
  1690. cursor: pointer;
  1691. }
  1692. }
  1693. .amount-box1 {
  1694. align-items: flex-start;
  1695. .btn {
  1696. margin-top: px2rpx(0);
  1697. }
  1698. }
  1699. .custom-deposit-container {
  1700. width: 100%;
  1701. display: flex;
  1702. gap: px2rpx(60);
  1703. justify-content: space-between;
  1704. }
  1705. @media (max-width: 992px) {
  1706. .custom-deposit {
  1707. width: 100%;
  1708. margin-top: px2rpx(20);
  1709. }
  1710. .custom-deposit-container {
  1711. display: flex;
  1712. gap: px2rpx(30);
  1713. flex-wrap: wrap;
  1714. }
  1715. }
  1716. </style>