withdraw.vue 67 KB

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