withdrawal.vue 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_customer.item3')" />
  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. <cwg-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. "Ucard_Wallet": t('card.title'),
  1629. "Digital_Currency": t('Custom.Deposit.Channel3'),
  1630. "China_UnionPay": t('Custom.Deposit.Channel2'),
  1631. "Electronic_Wallet": t('Custom.Deposit.Channel4'),
  1632. "International_Transfer": t('Custom.Deposit.Channel1'),
  1633. "CHANNEL_TYPE_CARD": t('PersonalManagement.Label.CreditCard'),
  1634. "CHANNEL_TYPE_ALI_WALLET": t('Label.Ali'),
  1635. }
  1636. })
  1637. // 固定顺序数组
  1638. const tabOrder = [
  1639. "Ucard_Wallet",
  1640. "Digital_Currency",
  1641. "China_UnionPay",
  1642. "Electronic_Wallet",
  1643. "International_Transfer",
  1644. "CHANNEL_TYPE_CARD",
  1645. "CHANNEL_TYPE_ALI_WALLET"
  1646. ]
  1647. function formatChannels(data) {
  1648. const result = []
  1649. // 按固定顺序遍历
  1650. for (const key of tabOrder) {
  1651. const list = data[key] || []
  1652. if (list.length) {
  1653. result.push({
  1654. text: allTabs.value[key],
  1655. value: key,
  1656. disable: true
  1657. })
  1658. list.forEach(item => {
  1659. result.push({
  1660. ...item,
  1661. text: item.name,
  1662. value: item.code
  1663. })
  1664. })
  1665. }
  1666. }
  1667. return result
  1668. }
  1669. // -------------------- lifecycle --------------------
  1670. onMounted(() => {
  1671. if (channelList.value) {
  1672. channelListOptions.value = formatChannels(channelList.value)
  1673. }
  1674. channelId.value = channel.value
  1675. getDateList();
  1676. //调用手续费减免次数接口
  1677. getFreeNumber();
  1678. isNewYear24Open();
  1679. });
  1680. onUnmounted(() => {
  1681. userStore.savePaymentChannel('')
  1682. userStore.saveChannelList('')
  1683. })
  1684. // -------------------- watch --------------------
  1685. watch(channelId, async (newVal) => {
  1686. if (newVal) {
  1687. showTable()
  1688. let row = channelListOptions.value.find(item => item.code == newVal)
  1689. console.log(row, 123123);
  1690. isShowStep3(row)
  1691. }
  1692. });
  1693. watch(loginValue, (newVal) => {
  1694. if (newVal) {
  1695. // const found = loginOptions.value.find(opt => opt.login === Number(newVal))
  1696. // loginValueDoc.value = found.label
  1697. showTable();
  1698. }
  1699. });
  1700. watch(isStep3, async (newVal) => {
  1701. if (newVal) {
  1702. await nextTick();
  1703. formRef.value?.clearValidate(); // 先清除旧错误
  1704. await nextTick();
  1705. formRef.value?.clearValidate(); // 再次清除可能因数据重置产生的新错误
  1706. }
  1707. });
  1708. watch(() => form.amount, (newVal) => {
  1709. if (newVal && channelData.value.rate) {
  1710. // form.amount1 = (newVal * channelData.rate).toFixed(2);
  1711. if (isFree.value) {
  1712. let feeAmount = 0;
  1713. if (channelData.value.feeTypeBank) {
  1714. if (channelData.value.feeTypeBank == 1) {
  1715. feeAmount =
  1716. Number(newVal || 0) *
  1717. (Number(channelData.value.freeBank || 0) / 100);
  1718. } else if (channelData.value.feeTypeBank == 2) {
  1719. feeAmount = Number(channelData.value.feeAmountBank || 0);
  1720. }
  1721. } else {
  1722. if (channelData.value.feeType == 1) {
  1723. feeAmount =
  1724. Number(newVal || 0) *
  1725. (Number(channelData.value.free || 0) / 100);
  1726. } else if (channelData.value.feeType == 2) {
  1727. feeAmount = Number(channelData.value.feeAmount || 0);
  1728. }
  1729. }
  1730. if (FreeNumber.value > 0) {
  1731. form.amount1 = new Decimal(Number(newVal || 0))
  1732. .mul(new Decimal(Number(channelData.value.rate || 0)))
  1733. .toNumber();
  1734. } else {
  1735. form.amount1 = new Decimal(Number(newVal || 0))
  1736. .sub(new Decimal(Number(feeAmount || 0)))
  1737. .mul(new Decimal(Number(channelData.value.rate || 0)))
  1738. .toNumber();
  1739. }
  1740. } else {
  1741. form.amount1 = (newVal * channelData.value.rate).toFixed(2);
  1742. }
  1743. if (
  1744. ["CNY", "THB", "VND"].indexOf(channelData.value.transformCurrency) > -1
  1745. ) {
  1746. form.amount1 = parseInt(form.amount1);
  1747. }
  1748. }
  1749. });
  1750. </script>
  1751. <style lang="scss" scoped>
  1752. @import "@/uni.scss";
  1753. .custom-withdraw {
  1754. width: px2rpx(566);
  1755. flex-shrink: 0;
  1756. .box {
  1757. margin-bottom: px2rpx(20);
  1758. .b-card {
  1759. // background: #fff;
  1760. // border-radius: px2rpx(12);
  1761. // padding: px2rpx(20);
  1762. // box-shadow: 0 px2rpx(4) px2rpx(12) rgba(0, 0, 0, 0.03);
  1763. .card-top {
  1764. .tit {
  1765. font-size: px2rpx(16);
  1766. font-weight: 600;
  1767. margin-bottom: px2rpx(16);
  1768. display: flex;
  1769. align-items: center;
  1770. color: var(--color-navy-900);
  1771. position: relative;
  1772. padding-left: 20px;
  1773. &:after {
  1774. content: '';
  1775. position: absolute;
  1776. left: 0;
  1777. top: 50%;
  1778. transform: translateY(-50%);
  1779. width: 0;
  1780. height: 0;
  1781. border-top: 6px solid transparent;
  1782. border-bottom: 6px solid transparent;
  1783. border-left: 8px solid currentColor;
  1784. }
  1785. .iconfont {
  1786. margin-right: px2rpx(8);
  1787. color: var(--color-primary);
  1788. font-size: px2rpx(18);
  1789. }
  1790. }
  1791. }
  1792. .channelType {
  1793. font-size: px2rpx(15);
  1794. font-weight: 600;
  1795. margin: px2rpx(24) 0 px2rpx(12);
  1796. color: var(--color-navy-700);
  1797. padding-left: px2rpx(8);
  1798. border-left: px2rpx(4) solid var(--color-primary);
  1799. }
  1800. }
  1801. }
  1802. .reselect-btn {
  1803. margin-top: px2rpx(20);
  1804. display: flex;
  1805. justify-content: flex-end;
  1806. }
  1807. .s-btn {
  1808. &.reselect {
  1809. background-color: var(--color-zinc-100);
  1810. color: var(--color-navy-700);
  1811. border: none;
  1812. font-size: px2rpx(14);
  1813. padding: px2rpx(8) px2rpx(20);
  1814. border-radius: px2rpx(8);
  1815. &:active {
  1816. background-color: var(--color-zinc-200);
  1817. }
  1818. }
  1819. &[type="primary"] {
  1820. width: 100%;
  1821. height: px2rpx(48);
  1822. background-color: #cf1322;
  1823. color: #fff;
  1824. border-radius: px2rpx(12);
  1825. font-size: px2rpx(16);
  1826. font-weight: 600;
  1827. display: flex;
  1828. align-items: center;
  1829. justify-content: center;
  1830. border: none;
  1831. margin-top: px2rpx(30);
  1832. transition: all 0.2s;
  1833. &:active {
  1834. transform: scale(0.98);
  1835. background-color: #cf1322;
  1836. }
  1837. }
  1838. }
  1839. .add-back {
  1840. display: flex;
  1841. justify-content: space-between;
  1842. align-items: center;
  1843. margin-bottom: px2rpx(12);
  1844. padding: px2rpx(12) px2rpx(16);
  1845. text {
  1846. font-size: px2rpx(14);
  1847. color: var(--color-navy-700);
  1848. font-weight: 500;
  1849. }
  1850. .add-btn {
  1851. color: var(--color-primary);
  1852. font-weight: 600;
  1853. text-decoration: underline;
  1854. &:active {
  1855. opacity: 0.7;
  1856. }
  1857. }
  1858. }
  1859. .proof {
  1860. margin-top: px2rpx(8);
  1861. border: px2rpx(1) dashed var(--color-zinc-300);
  1862. border-radius: px2rpx(8);
  1863. padding: px2rpx(8);
  1864. display: flex;
  1865. justify-content: center;
  1866. align-items: center;
  1867. background: var(--color-zinc-50);
  1868. .state {
  1869. padding: px2rpx(4) px2rpx(12);
  1870. border-radius: px2rpx(4);
  1871. font-size: px2rpx(12);
  1872. font-weight: bold;
  1873. }
  1874. }
  1875. .agree {
  1876. margin: px2rpx(24) 0;
  1877. display: flex;
  1878. align-items: flex-start;
  1879. .checkbox {
  1880. display: flex;
  1881. align-items: flex-start;
  1882. gap: px2rpx(8);
  1883. :deep(uni-checkbox .uni-checkbox-input) {
  1884. border-radius: px2rpx(4);
  1885. width: px2rpx(18);
  1886. height: px2rpx(18);
  1887. }
  1888. text {
  1889. font-size: px2rpx(13);
  1890. color: var(--color-zinc-500);
  1891. line-height: 1.5;
  1892. }
  1893. }
  1894. }
  1895. .step3-attention {
  1896. // background: var(--color-error-50, #fff1f0);
  1897. border-radius: px2rpx(12);
  1898. margin-bottom: px2rpx(20);
  1899. .tips {
  1900. line-height: 1.8;
  1901. font-size: px2rpx(12);
  1902. color: #909399;
  1903. padding: px2rpx(12);
  1904. border-radius: px2rpx(4);
  1905. border-left: px2rpx(2) solid #cf1322;
  1906. .title {
  1907. font-weight: 600;
  1908. margin-bottom: px2rpx(6);
  1909. color: #606266;
  1910. }
  1911. }
  1912. .attention {
  1913. font-size: px2rpx(14);
  1914. // color: var(--color-error-600, #cf1322);
  1915. line-height: 1.6;
  1916. }
  1917. .btn-bottom {
  1918. margin-top: px2rpx(20);
  1919. display: flex;
  1920. justify-content: center;
  1921. .btn {
  1922. background: var(--color-error-600, #cf1322);
  1923. color: #fff;
  1924. padding: px2rpx(10) px2rpx(48);
  1925. border-radius: px2rpx(24);
  1926. font-size: px2rpx(15);
  1927. font-weight: 700;
  1928. box-shadow: 0 px2rpx(4) px2rpx(10) rgba(207, 19, 34, 0.2);
  1929. transition: all 0.2s;
  1930. &:active {
  1931. transform: scale(0.96);
  1932. opacity: 0.8;
  1933. }
  1934. }
  1935. }
  1936. }
  1937. :deep(.base-info-form) {
  1938. .uni-row1 {
  1939. .uni-col {
  1940. padding: 0 px2rpx(10) !important;
  1941. }
  1942. .uni-forms-item {
  1943. min-height: px2rpx(36);
  1944. margin-bottom: px2rpx(28);
  1945. }
  1946. .uni-easyinput__content-input {
  1947. height: px2rpx(35) !important;
  1948. }
  1949. }
  1950. }
  1951. @keyframes rotate {
  1952. from {
  1953. transform: rotate(0deg);
  1954. }
  1955. to {
  1956. transform: rotate(360deg);
  1957. }
  1958. }
  1959. }
  1960. .amount-box {
  1961. display: flex;
  1962. align-items: center;
  1963. gap: px2rpx(12);
  1964. .amount-input {
  1965. flex: 1;
  1966. }
  1967. .btn {
  1968. display: flex;
  1969. align-items: center;
  1970. justify-content: center;
  1971. font-size: px2rpx(14);
  1972. color: var(--color-zinc-600);
  1973. margin-bottom: px2rpx(12);
  1974. height: px2rpx(35);
  1975. background-color: #cf1322;
  1976. color: #fff;
  1977. border-radius: px2rpx(4);
  1978. font-weight: 600;
  1979. border: none;
  1980. padding: 0 px2rpx(20);
  1981. margin-top: px2rpx(21);
  1982. cursor: pointer;
  1983. }
  1984. }
  1985. .amount-box1 {
  1986. align-items: flex-start;
  1987. .btn {
  1988. margin-top: px2rpx(0);
  1989. }
  1990. }
  1991. .custom-deposit-container {
  1992. width: 100%;
  1993. display: flex;
  1994. gap: px2rpx(60);
  1995. justify-content: space-between;
  1996. }
  1997. @media (max-width: 992px) {
  1998. .custom-withdraw {
  1999. width: 100%;
  2000. margin-top: px2rpx(20);
  2001. }
  2002. .custom-deposit-container {
  2003. display: flex;
  2004. gap: px2rpx(30);
  2005. flex-wrap: wrap;
  2006. }
  2007. }
  2008. </style>