withdraw.vue 67 KB

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