withdraw.vue 67 KB

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