withdrawal.vue 67 KB

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