BankInfoTab.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  1. <template>
  2. <view class="user-form crm-form">
  3. <uni-row class="demo-uni-row uni-row1">
  4. <uni-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  5. <view class="card">
  6. <view class="bank-menu card-header">
  7. <view v-for="item in bankTypes" :key="item.key" class="bank-menu-item"
  8. :class="{ active: selectedBankType === item.key }" @click="selectedBankType = item.key">
  9. <!-- <image class="bank-icon" :src="item.icon" mode="widthFix" />-->
  10. <text>{{ item.label }}</text>
  11. </view>
  12. </view>
  13. <view class="card-body">
  14. <view class="bank-content" v-if="selectedBankType === 'crypto'">
  15. <view class="d-flex flex-wrap align-items-center header-title mb-3 card-header">
  16. <view class="h4">
  17. {{ t('blockchain.item2') }}
  18. </view>
  19. <view class="add-wallet-btn" @click="addBank()" v-if="cryptoWallets.length < 2">
  20. <text>+</text>
  21. <text>{{ `${t('Btn.New')}${t('blockchain.item2')}` }}</text>
  22. </view>
  23. </view>
  24. <view class="bank-info bg-gray bg-opacity-05 card" v-for="(item, index) in cryptoWallets" :key="item.id">
  25. <view class="bank-header card-header">
  26. <uni-row style="width: 100%;">
  27. <uni-col :xs="24" :sm="24" :md="24" :lg="8" :xl="8">
  28. <view class="bank-title">
  29. <text>{{ currentBankType?.label }} {{ index + 1 }}</text>
  30. </view>
  31. </uni-col>
  32. <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  33. <view class="actions">
  34. <view class="bank-actions">
  35. <view class="action-btn bg-secondary btn-dark" v-if="item.authStatus == 0"
  36. type="primary" v-t="'State.ToCertified'"
  37. @click="doReady(item.id, item)" />
  38. <view class="action-btn bg-secondary btn-dark" v-if="item.authStatus == 0"
  39. type="primary" @click="openCardDialog(item.id, item)"
  40. v-t="'PersonalManagement.CardVerify.Title'" />
  41. <view class="action-btn bg-secondary btn-dark"
  42. v-if="!editingId && item.authStatus !== 1" @tap="startEdit(item)"
  43. v-t="'Btn.Editor'" />
  44. <template v-if="editingId === item.id">
  45. <view class="action-btn bg-secondary btn-dark" @tap="saveBank(item)"
  46. v-t="'Btn.Save'" />
  47. <view class="action-btn bg-secondary btn-dark" @tap="cancelEdit()"
  48. v-t="'Btn.Cancel'" />
  49. </template>
  50. <view class="action-btn bg-secondary btn-dark" @tap="confirmDelete(item)"
  51. v-t="'Btn.Delete'" />
  52. </view>
  53. </view>
  54. </uni-col>
  55. </uni-row>
  56. </view>
  57. <uni-forms :model="item" labelWidth="200" label-position="top">
  58. <uni-row class="card-body custom-row" :gutter="20">
  59. <uni-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  60. <uni-forms-item :label="t('blockchain.item3')">
  61. <uni-easyinput :clearable="false" v-model="item.addressName"
  62. :disabled="editingId !== item.id"
  63. :placeholder="locale == 'es' ? 'Introduzca el nombre de la red' : t('placeholder.input')" />
  64. </uni-forms-item>
  65. </uni-col>
  66. <uni-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  67. <uni-forms-item :label="t('blockchain.item4')">
  68. <uni-easyinput :clearable="false" v-model="item.address"
  69. :disabled="editingId !== item.id"
  70. :placeholder="locale == 'es' ? 'Introduzca la dirección de la billetera' : t('placeholder.input')" />
  71. </uni-forms-item>
  72. </uni-col>
  73. <uni-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"
  74. v-if="item.cardFiles && item.cardFiles.length">
  75. <uni-forms-item :label="t('PersonalManagement.Label.CertificationPhoto')">
  76. <view class="photo-upload">
  77. <view v-for="(file, idx) in item.cardFiles" :key="idx" class="photo-item">
  78. <image class="photo-preview" :src="updateUrl + file.path"
  79. mode="aspectFill" />
  80. </view>
  81. </view>
  82. </uni-forms-item>
  83. </uni-col>
  84. <uni-col :xs="24">
  85. <uni-forms-item class="checkbox-item">
  86. <uni-data-checkbox :disabled="editingId !== item.id" v-model="item.defaultBank1" multiple
  87. :localdata="hobbys" />
  88. </uni-forms-item>
  89. </uni-col>
  90. </uni-row>
  91. </uni-forms>
  92. </view>
  93. </view>
  94. <view class="bank-content" v-if="selectedBankType === 'unionpay'">
  95. <view class="d-flex flex-wrap align-items-center header-title card-header mb-3">
  96. <view class="h4">
  97. {{ t('PersonalManagement.Title.ChinaUnionPayCard') }}
  98. </view>
  99. <view class="add-wallet-btn" @click="addBank()" v-if="unionpayCards.length < 2">
  100. <text>+</text>
  101. <text>{{ `${t('Btn.New')}${t('PersonalManagement.Title.ChinaUnionPayCard')}` }}</text>
  102. </view>
  103. </view>
  104. <view class="bank-info bg-gray bg-opacity-05 card" v-for="(item, index) in unionpayCards" :key="item.id">
  105. <view class="bank-header card-header">
  106. <uni-row style="width: 100%;">
  107. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  108. <view class="bank-title">
  109. <text>{{ currentBankType?.label }}{{ index + 1 }}</text>
  110. </view>
  111. </uni-col>
  112. <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  113. <view class="bank-actions">
  114. <view class="action-btn bg-secondary btn-dark"
  115. v-if="!editingId && item.authStatus !== 1" @tap="startEdit(item)"
  116. v-t="'Btn.Editor'" />
  117. <template v-if="editingId === item.id">
  118. <view class="action-btn bg-secondary btn-dark" @tap="saveBank(item)"
  119. v-t="'Btn.Save'" />
  120. <view class="action-btn bg-secondary btn-dark" @tap="cancelEdit()"
  121. v-t="'Btn.Cancel'" />
  122. </template>
  123. <view class="action-btn delete btn-dark" @tap="confirmDelete(item)"
  124. v-t="'Btn.Delete'" />
  125. </view>
  126. </uni-col>
  127. </uni-row>
  128. </view>
  129. <uni-forms :model="item" labelWidth="200" label-position="top">
  130. <uni-row class="card-body custom-row" :gutter="20">
  131. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  132. <uni-forms-item :label="t('PersonalManagement.Label.BankAccountName')">
  133. <uni-easyinput :clearable="false" v-model="item.bankUname" :disabled="true"
  134. :placeholder="locale == 'es' ? 'Introduzca el nombre de la red' : t('placeholder.input')" />
  135. </uni-forms-item>
  136. </uni-col>
  137. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  138. <uni-forms-item :label="t('PersonalManagement.Label.BankName')">
  139. <cwg-combox :clearable="false" :filterable="true" v-model:value="item.bankName"
  140. :options="bankOptions" :placeholder="t('placeholder.choose')"
  141. :disabled="editingId !== item.id" @change="onStateChange" />
  142. </uni-forms-item>
  143. </uni-col>
  144. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  145. <uni-forms-item :label="t('PersonalManagement.Label.BankAccount')">
  146. <uni-easyinput :clearable="false" v-model="item.bankCardNum"
  147. :disabled="editingId !== item.id"
  148. :placeholder="locale == 'es' ? 'Introduzca la dirección de la billetera' : t('placeholder.input')" />
  149. </uni-forms-item>
  150. </uni-col>
  151. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  152. <uni-forms-item :label="t('PersonalManagement.Label.AccountOpeningBranch')">
  153. <uni-easyinput :clearable="false" v-model="item.bankBranchName"
  154. :disabled="editingId !== item.id"
  155. :placeholder="locale == 'es' ? 'Introduzca la dirección de la billetera' : t('placeholder.input')" />
  156. </uni-forms-item>
  157. </uni-col>
  158. <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  159. <uni-forms-item :label="t('PersonalManagement.Label.CertificationPhoto')">
  160. <cwg-file-picker-wrapper
  161. v-model="item.bankFront"
  162. :disabled="editingId !== item.id"
  163. :delIcon="editingId === item.id"
  164. :limit="1"
  165. uploadUrl="/custom/bank/upload"
  166. :baseUrl="updateUrl"
  167. :imageWidth="120"
  168. :imageHeight="120"
  169. uploadText="点击上传"
  170. replaceText="点击替换" noImageText="暂无图片"
  171. :showPreviewDelete="editingId === item.id"
  172. @update:modelValue="(val) => handleFileUpdate(val, item, 'bankFront')" />
  173. </uni-forms-item>
  174. </uni-col>
  175. <uni-col :xs="24">
  176. <uni-forms-item class="checkbox-item">
  177. <uni-data-checkbox :disabled="editingId !== item.id" v-model="item.defaultBank1"
  178. multiple :localdata="hobbys" />
  179. </uni-forms-item>
  180. </uni-col>
  181. </uni-row>
  182. </uni-forms>
  183. </view>
  184. </view>
  185. <view class="bank-content" v-if="selectedBankType === 'bank'">
  186. <view class="d-flex flex-wrap align-items-center card-header header-title mb-3">
  187. <view class="h4">
  188. {{ t('PersonalManagement.Title.BankWireTransfer') }}
  189. </view>
  190. <view class="add-wallet-btn" @click="addBank()" v-if="wireTransfers.length < 2">
  191. <text>+</text>
  192. <text>{{ `${t('Btn.New')}${t('PersonalManagement.Title.BankWireTransfer')}` }}</text>
  193. </view>
  194. </view>
  195. <view class="bank-info bg-gray bg-opacity-05 card" v-for="(item, index) in wireTransfers" :key="item.id">
  196. <view class="bank-header card-header ">
  197. <uni-row style="width: 100%;">
  198. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  199. <view class="bank-title">
  200. <text>{{ currentBankType?.label }} {{ index + 1 }}</text>
  201. </view>
  202. </uni-col>
  203. <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  204. <view class="bank-actions">
  205. <view class="action-btn bg-secondary btn-dark"
  206. v-if="!editingId && item.authStatus !== 1" @tap="startEdit(item)"
  207. v-t="'Btn.Editor'" />
  208. <template v-if="editingId === item.id">
  209. <view class="action-btn bg-secondary btn-dark" @tap="saveBank(item)"
  210. v-t="'Btn.Save'" />
  211. <view class="action-btn bg-secondary btn-dark" @tap="cancelEdit()"
  212. v-t="'Btn.Cancel'" />
  213. </template>
  214. <view class="action-btn delete btn-dark" @tap="confirmDelete(item)"
  215. v-t="'Btn.Delete'" />
  216. </view>
  217. </uni-col>
  218. </uni-row>
  219. </view>
  220. <uni-forms :model="item" labelWidth="200" label-position="top">
  221. <uni-row class="card-body custom-row" :gutter="20">
  222. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8" >
  223. <uni-forms-item :label="t('PersonalManagement.Label.BankAccountName')">
  224. <uni-easyinput :clearable="false" v-model="item.bankUname" :disabled="true"
  225. :placeholder="locale == 'es' ? 'Introduzca el nombre de la red' : t('placeholder.input')" />
  226. </uni-forms-item>
  227. </uni-col>
  228. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  229. <uni-forms-item :label="t('PersonalManagement.Label.BankAccount')">
  230. <uni-easyinput :clearable="false" v-model="item.bankCardNum"
  231. :disabled="editingId !== item.id"
  232. :placeholder="locale == 'es' ? 'Introduzca la dirección de la billetera' : t('placeholder.input')" />
  233. </uni-forms-item>
  234. </uni-col>
  235. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  236. <uni-forms-item :label="t('PersonalManagement.Label.BankName')">
  237. <uni-easyinput :clearable="false" v-model="item.bankName"
  238. :disabled="editingId !== item.id"
  239. :placeholder="locale == 'es' ? 'Introduzca el nombre del banco' : t('placeholder.input')" />
  240. </uni-forms-item>
  241. </uni-col>
  242. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  243. <uni-forms-item :label="t('PersonalManagement.Label.BankAddress')">
  244. <uni-easyinput :clearable="false" v-model="item.bankAddr"
  245. :placeholder="locale == 'es' ? 'Introduzca la dirección del banco' : t('placeholder.input')"
  246. :disabled="editingId !== item.id" />
  247. </uni-forms-item>
  248. </uni-col>
  249. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  250. <uni-forms-item :label="t('PersonalManagement.Label.SwiftBIC')">
  251. <uni-easyinput :clearable="false" v-model="item.swiftCode"
  252. :placeholder="locale == 'es' ? 'Introduzca el SWIFT/BIC' : t('placeholder.input')"
  253. :disabled="editingId !== item.id" />
  254. </uni-forms-item>
  255. </uni-col>
  256. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  257. <uni-forms-item :label="t('PersonalManagement.Label.BankCode')">
  258. <uni-easyinput :clearable="false" v-model="item.bankCode"
  259. :placeholder="locale == 'es' ? 'Introduzca el código del banco' : t('placeholder.input')"
  260. :disabled="editingId !== item.id" />
  261. </uni-forms-item>
  262. </uni-col>
  263. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  264. <uni-forms-item
  265. :label="locale == 'es' ? 'Número de sucursal (opcional)' : 'Account Agency NO'">
  266. <uni-easyinput :clearable="false" v-model="item.agencyNo"
  267. :placeholder="locale == 'es' ? 'Introduzca el número de sucursal' : t('placeholder.input')"
  268. :disabled="editingId !== item.id" />
  269. </uni-forms-item>
  270. </uni-col>
  271. <uni-col :xs="24">
  272. <uni-forms-item class="checkbox-item">
  273. <uni-data-checkbox :disabled="editingId !== item.id" v-model="item.defaultBank1"
  274. multiple :localdata="hobbys" />
  275. </uni-forms-item>
  276. </uni-col>
  277. </uni-row>
  278. </uni-forms>
  279. </view>
  280. </view>
  281. <view class="bank-content" v-if="selectedBankType === 'credit'">
  282. <view class="d-flex flex-wrap align-items-center header-title card-header mb-3">
  283. <view class="h4">
  284. {{ t('PersonalManagement.Label.CreditCard') }}
  285. </view>
  286. <view class="add-wallet-btn" @click="addBank()" v-if="creditCards.length < 2">
  287. <text>+</text>
  288. <text>{{ `${t('Btn.New')}${t('PersonalManagement.Label.CreditCard')}` }}</text>
  289. </view>
  290. </view>
  291. <view class="bank-info bg-gray bg-opacity-05 card" v-for="(item, index) in creditCards" :key="item.id">
  292. <view class="bank-header card-header">
  293. <uni-row style="width: 100%;">
  294. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  295. <view class="bank-title">
  296. <text>{{ currentBankType?.label }} {{ index + 1 }}</text>
  297. </view>
  298. </uni-col>
  299. <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  300. <view class="bank-actions">
  301. <view class="action-btn bg-secondary btn-dark"
  302. v-if="!editingId && item.authStatus !== 1" @tap="startEdit(item)"
  303. v-t="'Btn.Editor'" />
  304. <template v-if="editingId === item.id">
  305. <view class="action-btn bg-secondary btn-dark" @tap="saveBank(item)"
  306. v-t="'Btn.Save'" />
  307. <view class="action-btn bg-secondary btn-dark" @tap="cancelEdit()"
  308. v-t="'Btn.Cancel'" />
  309. </template>
  310. <view class="action-btn delete btn-dark" @tap="confirmDelete(item)"
  311. v-t="'Btn.Delete'" />
  312. </view>
  313. </uni-col>
  314. </uni-row>
  315. </view>
  316. <uni-forms :model="item" labelWidth="200" label-position="top">
  317. <uni-row class="card-body custom-row" :gutter="20">
  318. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  319. <uni-forms-item :label="t('PersonalManagement.Label.CreditCardAccountName')">
  320. <uni-easyinput :clearable="false" v-model="item.bankUname" :disabled="true"
  321. :placeholder="t('placeholder.input')" />
  322. </uni-forms-item>
  323. </uni-col>
  324. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  325. <uni-forms-item :label="t('PersonalManagement.Label.CreditCardAccount')">
  326. <uni-easyinput :clearable="false" v-model="item.bankCardNum"
  327. :disabled="editingId !== item.id"
  328. :placeholder="locale == 'es' ? 'Introduzca el número de tarjeta' : t('placeholder.input')" />
  329. </uni-forms-item>
  330. </uni-col>
  331. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  332. <uni-forms-item :label="t('PersonalManagement.Label.ExpirationYear')">
  333. <uni-easyinput :clearable="false" v-model="item.expiryYearMonth"
  334. :disabled="editingId !== item.id"
  335. :placeholder="locale == 'es' ? 'Introduzca MM/AA' : t('placeholder.input')" />
  336. </uni-forms-item>
  337. </uni-col>
  338. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  339. <uni-forms-item :label="t('CVV')">
  340. <uni-easyinput :clearable="false" v-model="item.cvv"
  341. :disabled="editingId !== item.id"
  342. :placeholder="locale == 'es' ? 'Introduzca el CVV' : t('placeholder.input')" />
  343. </uni-forms-item>
  344. </uni-col>
  345. <uni-col :xs="24">
  346. <uni-forms-item class="checkbox-item">
  347. <uni-data-checkbox :disabled="editingId !== item.id" v-model="item.defaultBank1"
  348. multiple :localdata="hobbys" />
  349. </uni-forms-item>
  350. </uni-col>
  351. </uni-row>
  352. </uni-forms>
  353. </view>
  354. </view>
  355. </view>
  356. </view>
  357. </uni-col>
  358. </uni-row>
  359. </view>
  360. <!-- 删除确认弹窗 -->
  361. <uni-popup ref="deletePopup" type="dialog">
  362. <uni-popup-dialog :title="t('Msg.SystemPrompt')" :content="t('Msg.Delete')" @confirm="deleteBank"
  363. @close="closeDeletePopup" />
  364. </uni-popup>
  365. <!-- 新增银行弹窗 -->
  366. <add-bank-dialog ref="addBankDialogRef" @success="addSuccess" />
  367. <!-- kyc认证弹窗 -->
  368. <kyc-auth-dialog ref="kycDialogRef" />
  369. <!-- 证件认证弹窗 -->
  370. <card-auth-dialog ref="cardDialogRef" />
  371. </template>
  372. <script setup lang="ts">
  373. import { computed, ref, onMounted } from 'vue'
  374. import { useI18n } from 'vue-i18n'
  375. import { personalApi } from '@/service/personal'
  376. import KycAuthDialog from './KycAuthDialog.vue'
  377. import CardAuthDialog from './CardAuthDialog.vue'
  378. import AddBankDialog from '@/components/AddBankDialog.vue'
  379. import config from '@/config'
  380. import { BankType } from './bank'
  381. const { t, locale } = useI18n()
  382. interface BankListType {
  383. key: string;
  384. label: string;
  385. icon: string;
  386. }
  387. interface BankInfo {
  388. id?: string;
  389. type: number;
  390. defaultBank: boolean;
  391. approveStatus?: number;
  392. authStatus?: number;
  393. blockchainName: string;
  394. walletAddress: string;
  395. photos?: string[];
  396. expiryYearMonth?: string;
  397. expiryYear?: string;
  398. expiryMonth?: string;
  399. [key: string]: any;
  400. }
  401. const selectedBankType = ref<string>('crypto')
  402. const bankTypes = computed<BankListType[]>(() => [
  403. { key: 'crypto', label: t('blockchain.item2'), icon: '/static/images/info/bank-info_1.png' },
  404. {
  405. key: 'unionpay',
  406. label: t('PersonalManagement.Title.ChinaUnionPayCard'),
  407. icon: '/static/images/info/bank-info_2.png',
  408. },
  409. { key: 'bank', label: t('PersonalManagement.Title.BankWireTransfer'), icon: '/static/images/info/bank-info_3.png' },
  410. { key: 'credit', label: t('PersonalManagement.Label.CreditCard'), icon: '/static/images/info/bank-info_4.png' },
  411. ])
  412. const currentBankType = computed(() => bankTypes.value.find((item: BankListType) => item.key === selectedBankType.value))
  413. const hobbys = computed(() => {
  414. switch (selectedBankType.value) {
  415. case 'crypto':
  416. return [{ value: 1, text: t('blockchain.item8') }]
  417. case 'unionpay':
  418. return [{ value: 1, text: t('PersonalManagement.Title.DefaultBank') }]
  419. case 'bank':
  420. return [{ value: 1, text: t('PersonalManagement.Title.DefaultWire') }]
  421. case 'credit':
  422. return [{ value: 1, text: t('PersonalManagement.Title.DefaultCredit') }]
  423. }
  424. })
  425. // 状态
  426. const updateUrl = config.Host05
  427. const editingId = ref(null)
  428. const bankList = ref([])
  429. const isZh = computed(() => ['cn', 'zh', 'zhHant'].includes(locale.value))
  430. const getLangName = (item: any) => (isZh.value ? item.name : item.enName)
  431. const createOptions = (list: any[], valueKey = 'code') => {
  432. return list.map((item) => ({
  433. text: getLangName(item),
  434. value: getLangName(item),
  435. }))
  436. }
  437. const bankOptions = computed(() => createOptions(bankList.value, 'name'))
  438. // 银行数据
  439. const bankData = ref({
  440. [BankType.CRYPTO]: [],
  441. [BankType.UNIONPAY]: [],
  442. [BankType.WIRE_TRANSFER]: [],
  443. [BankType.CREDIT_CARD]: [],
  444. })
  445. // 计算属性 - 各类型银行列表
  446. const cryptoWallets = computed(() => bankData.value[BankType.CRYPTO] || [])
  447. const unionpayCards = computed(() => bankData.value[BankType.UNIONPAY] || [])
  448. const wireTransfers = computed(() => bankData.value[BankType.WIRE_TRANSFER] || [])
  449. const creditCards = computed(() => bankData.value[BankType.CREDIT_CARD] || [])
  450. // 弹出层ref
  451. const deletePopup = ref(null)
  452. const deleteTarget = ref(null)
  453. // 开始编辑
  454. const startEdit = (item) => {
  455. editingId.value = item.id
  456. }
  457. // 取消编辑
  458. const cancelEdit = () => {
  459. editingId.value = null
  460. getBankInfo() // 重新加载数据
  461. }
  462. // 保存银行信息
  463. const saveBank = async (item) => {
  464. if (selectedBankType.value === 'crypto' && item.approveStatus == 1) {
  465. uni.showToast({
  466. title: '加密钱包认证审核中',
  467. icon: 'none',
  468. })
  469. return
  470. }
  471. try {
  472. const params = { ...item }
  473. params.defaultBank = params.defaultBank1[0] ? 1 : 0
  474. if (params.type === BankType.CREDIT_CARD && params.expiryYearMonth) {
  475. const [year, month] = params.expiryYearMonth.split('/')
  476. params.expiryYear = year
  477. params.expiryMonth = month
  478. }
  479. const res = await personalApi.customBankUpdate(params)
  480. if (res.code === 200) {
  481. uni.hideLoading()
  482. uni.showToast({
  483. title: t('Msg.Success'),
  484. icon: 'success',
  485. })
  486. editingId.value = null
  487. getBankInfo()
  488. } else {
  489. throw new Error(res.msg)
  490. }
  491. } catch (error) {
  492. uni.hideLoading()
  493. uni.showToast({
  494. title: error.message || t('Msg.Fail'),
  495. icon: 'none',
  496. })
  497. }
  498. }
  499. // 删除
  500. const confirmDelete = (item) => {
  501. if (selectedBankType.value === 'crypto' && item.approveStatus == 1) {
  502. uni.showToast({
  503. title: '加密钱包认证审核中',
  504. icon: 'none',
  505. })
  506. return
  507. }
  508. deleteTarget.value = item
  509. deletePopup.value.open()
  510. }
  511. // 关闭删除弹窗
  512. const closeDeletePopup = () => {
  513. deletePopup.value.close()
  514. deleteTarget.value = null
  515. }
  516. // 执行删除
  517. const deleteBank = async () => {
  518. if (!deleteTarget.value) return
  519. try {
  520. const res = await personalApi.customBankDelete({
  521. ids: [deleteTarget.value.id],
  522. })
  523. if (res.code === 200) {
  524. uni.hideLoading()
  525. uni.showToast({
  526. title: t('Msg.DeleteSuccess'),
  527. icon: 'success',
  528. })
  529. deletePopup.value.close()
  530. deleteTarget.value = null
  531. getBankInfo()
  532. } else {
  533. uni.showToast({
  534. title: res.msg,
  535. icon: 'none',
  536. })
  537. }
  538. } catch (error) {
  539. uni.hideLoading()
  540. uni.showToast({
  541. title: error.msg,
  542. icon: 'none',
  543. })
  544. deletePopup.value.close()
  545. }
  546. }
  547. // 新增银行信息
  548. const addBankDialogRef = ref(null)
  549. function addBank() {
  550. switch (selectedBankType.value) {
  551. case 'crypto':
  552. openAddCrypto()
  553. break
  554. case 'unionpay':
  555. openAddUnionpay()
  556. break
  557. case 'bank':
  558. openAddBank()
  559. break
  560. case 'credit':
  561. openAddCredit()
  562. break
  563. }
  564. }
  565. function openAddCrypto() {
  566. const wallets = cryptoWallets.value || []
  567. // 1️⃣ 没有钱包
  568. if (wallets.length === 0) {
  569. addBankDialogRef.value?.open(4)
  570. return
  571. }
  572. // 2️⃣ 是否存在未认证钱包
  573. const hasUnAuth = wallets.some(
  574. item => item.authStatus === 0 || item.approveStatus === 1,
  575. )
  576. if (hasUnAuth) {
  577. uni.showToast({
  578. title: '加密钱包未认证',
  579. icon: 'none',
  580. })
  581. return
  582. }
  583. // 3️⃣ 是否达到上限
  584. if (wallets.length >= 2) {
  585. uni.showToast({
  586. title: t('blockchain.item9'),
  587. icon: 'none',
  588. })
  589. return
  590. }
  591. // 4️⃣ 正常打开
  592. addBankDialogRef.value?.open(4)
  593. }
  594. function openAddUnionpay() {
  595. const wallets = unionpayCards.value || []
  596. if (wallets.length === 0) {
  597. addBankDialogRef.value?.open(1)
  598. return
  599. }
  600. if (wallets.length >= 2) {
  601. uni.showToast({
  602. title: t('Msg.UnionPayCARDS'),
  603. icon: 'none',
  604. })
  605. return
  606. }
  607. addBankDialogRef.value?.open(1)
  608. }
  609. function openAddBank() {
  610. const wallets = wireTransfers.value || []
  611. if (wallets.length === 0) {
  612. addBankDialogRef.value?.open(2)
  613. return
  614. }
  615. if (wallets.length >= 2) {
  616. uni.showToast({
  617. title: t('Msg.WireTransfers'),
  618. icon: 'none',
  619. })
  620. return
  621. }
  622. addBankDialogRef.value?.open(2)
  623. }
  624. function openAddCredit() {
  625. const wallets = creditCards.value || []
  626. if (wallets.length === 0) {
  627. addBankDialogRef.value?.open(3)
  628. return
  629. }
  630. addBankDialogRef.value?.open(3)
  631. }
  632. // 新增银行信息成功回调
  633. const addSuccess = (e) => {
  634. if (selectedBankType.value === 'crypto') {
  635. openKycDialog(e)
  636. }
  637. getBankInfo()
  638. }
  639. // kyc认证和证件认证
  640. const kycDialogRef = ref(null)
  641. const cardDialogRef = ref(null)
  642. // kyc认证
  643. const doReady = (bankId, item) => {
  644. if (item.approveStatus == 1) {
  645. uni.showToast({
  646. title: '加密钱包认证审核中',
  647. icon: 'none',
  648. })
  649. return
  650. }
  651. if (item.authStatus == 1) {
  652. uni.showToast({
  653. title: '加密钱包已认证',
  654. icon: 'none',
  655. })
  656. return
  657. }
  658. openKycDialog(bankId)
  659. }
  660. // 打开kyc认证弹窗
  661. function openKycDialog(e) {
  662. kycDialogRef.value?.open(e)
  663. }
  664. // 打开证件认证弹窗
  665. function openCardDialog(e, item) {
  666. if (item.approveStatus == 1) {
  667. uni.showToast({
  668. title: '加密钱包认证审核中',
  669. icon: 'none',
  670. })
  671. return
  672. }
  673. if (item.authStatus == 1) {
  674. uni.showToast({
  675. title: '加密钱包已认证',
  676. icon: 'none',
  677. })
  678. return
  679. }
  680. cardDialogRef.value?.open(e, item)
  681. }
  682. // 掩码卡号
  683. const maskCardNumber = (num) => {
  684. if (!num) return '--'
  685. if (num.length <= 4) return num
  686. return '**** **** **** ' + num.slice(-4)
  687. }
  688. // 获取银行列表
  689. const getBankList = async () => {
  690. const res = await personalApi.BankList({})
  691. if (res.code === 200) {
  692. bankList.value = res.data
  693. }
  694. }
  695. // 文件更新处理
  696. const handleFileUpdate = (newValue, item, field) => {
  697. item[field] = newValue
  698. }
  699. // 或者如果你需要在上传成功后做其他操作
  700. const handleUploadComplete = (result, item, field) => {
  701. if (result.success) {
  702. console.log('上传完成:', result.paths)
  703. // 可以在这里做其他操作,比如保存到服务器
  704. }
  705. }
  706. // 获取银行信息
  707. const getBankInfo = async () => {
  708. try {
  709. const res = await personalApi.customBankList({})
  710. if (res.code === 200) {
  711. // 清空数据
  712. bankData.value = {
  713. [BankType.CRYPTO]: [],
  714. [BankType.UNIONPAY]: [],
  715. [BankType.WIRE_TRANSFER]: [],
  716. [BankType.CREDIT_CARD]: [],
  717. }
  718. // 分类数据
  719. res.data.forEach(item => {
  720. item.defaultBank1 = item.defaultBank == 1 ? [1] : []
  721. if (item.type === BankType.UNIONPAY) {
  722. bankData.value[BankType.UNIONPAY].push(item)
  723. } else if (item.type === BankType.WIRE_TRANSFER) {
  724. bankData.value[BankType.WIRE_TRANSFER].push(item)
  725. } else if (item.type === BankType.CREDIT_CARD) {
  726. item.expiryYearMonth = item.expiryYear && item.expiryMonth
  727. ? `${item.expiryYear}/${item.expiryMonth}`
  728. : ''
  729. bankData.value[BankType.CREDIT_CARD].push(item)
  730. } else if (item.type === BankType.CRYPTO) {
  731. bankData.value[BankType.CRYPTO].push(item)
  732. }
  733. })
  734. }
  735. } catch (error) {
  736. uni.showToast({
  737. title: error.message || t('Msg.Fail'),
  738. icon: 'none',
  739. })
  740. }
  741. }
  742. // 获取银行信息
  743. onMounted(() => {
  744. getBankList()
  745. getBankInfo()
  746. })
  747. </script>
  748. <style scoped lang="scss">
  749. @import "@/uni.scss";
  750. .user-form {
  751. margin-top: px2rpx(30);
  752. }
  753. :deep(.uni-row1) {
  754. .uni-col {
  755. }
  756. .uni-forms-item {
  757. min-height: px2rpx(79);
  758. margin-bottom: px2rpx(10);
  759. }
  760. .uni-easyinput__content {
  761. background-color: var(--bs-secondary-bg) !important;
  762. }
  763. }
  764. .bank-menu {
  765. // background: #fff;
  766. display: flex;
  767. flex-wrap: wrap;
  768. overflow: hidden;
  769. &.card-header {
  770. padding: px2rpx(10) px2rpx(20);
  771. }
  772. .bank-menu-item {
  773. flex: 1;
  774. min-width: px2rpx(260);
  775. display: flex;
  776. align-items: center;
  777. justify-content: center;
  778. //gap: px2rpx(12);
  779. padding: 0 px2rpx(16);
  780. cursor: pointer;
  781. font-size: px2rpx(16);
  782. font-weight: bold;
  783. color: var(--bs-emphasis-color);
  784. transition: all 0.3s;
  785. height: px2rpx(36);
  786. border-radius: px2rpx(8);
  787. .bank-icon {
  788. width: px2rpx(50);
  789. }
  790. &.active {
  791. background: var(--bs-secondary);
  792. color: #ffffff;
  793. border-radius: px2rpx(8);
  794. &:hover {
  795. background: var(--bs-link-hover-color-rgb);
  796. color: #ffffff;
  797. }
  798. }
  799. &:hover {
  800. background: var(--bs-link-hover-color-rgb);
  801. color: var(--bs-secondary);
  802. }
  803. &.active:hover {
  804. background: #d11920;
  805. }
  806. }
  807. }
  808. .bank-content {
  809. //border-radius: px2rpx(8);
  810. .bank-info {
  811. margin-bottom: px2rpx(20);
  812. .bank-header {
  813. display: flex;
  814. justify-content: space-between;
  815. align-items: center;
  816. //border-bottom: 1px solid #f3f4f6;
  817. .bank-title {
  818. display: flex;
  819. align-items: center;
  820. font-size: px2rpx(20);
  821. font-weight: 600;
  822. line-height: px2rpx(32);
  823. color: #1f2937;
  824. //margin-bottom: px2rpx(20);
  825. }
  826. .actions {
  827. display: flex;
  828. flex-direction: column;
  829. }
  830. @media screen and (max-width: 992px) {
  831. .bank-actions {
  832. justify-content: flex-start !important;
  833. }
  834. }
  835. .bank-actions {
  836. display: flex;
  837. gap: px2rpx(20);
  838. align-items: center;
  839. flex-wrap: wrap;
  840. //margin-bottom: px2rpx(10);
  841. justify-content: flex-end;
  842. .action-btn {
  843. padding: px2rpx(8) px2rpx(16);
  844. border: 1px solid #d1d5db;
  845. border-radius: px2rpx(4);
  846. font-size: px2rpx(14);
  847. cursor: pointer;
  848. background: #fff;
  849. transition: all 0.3s;
  850. &:hover {
  851. background: #f3f4f6;
  852. }
  853. &.delete {
  854. background: var(--bs-btn-bg);
  855. color: #fff;
  856. border-color: var(--bs-btn-bg);
  857. &:hover {
  858. background: var(--bs-btn-hover-bg);
  859. }
  860. }
  861. }
  862. }
  863. }
  864. }
  865. .photo-upload {
  866. display: flex;
  867. flex-wrap: wrap;
  868. gap: px2rpx(16);
  869. .photo-item {
  870. width: px2rpx(120);
  871. height: px2rpx(120);
  872. border-radius: px2rpx(8);
  873. overflow: hidden;
  874. background: #f3f4f6;
  875. .photo-preview {
  876. width: 100%;
  877. height: 100%;
  878. }
  879. }
  880. }
  881. .header-title {
  882. justify-content: space-between;
  883. padding: 0 0 px2rpx(20) 0;
  884. }
  885. .add-wallet-btn {
  886. height: px2rpx(40);
  887. background: var(--bs-secondary);
  888. color: #fff;
  889. border-radius: px2rpx(20);
  890. padding: 0 px2rpx(20);
  891. display: flex;
  892. align-items: center;
  893. justify-content: center;
  894. gap: px2rpx(8);
  895. font-size: px2rpx(16);
  896. font-weight: 600;
  897. cursor: pointer;
  898. transition: all 0.3s;
  899. &:hover {
  900. background: #d11920;
  901. }
  902. }
  903. .bankFront {
  904. width: 100%;
  905. // 上传包装器
  906. .upload-wrapper {
  907. :deep(.uni-file-picker) {
  908. .file-picker__box {
  909. border: none;
  910. background: transparent;
  911. }
  912. // 文件列表容器
  913. .file-picker__box-list {
  914. display: flex;
  915. gap: px2rpx(16);
  916. flex-wrap: wrap;
  917. // 已上传的文件项
  918. .file-picker__box-item {
  919. width: px2rpx(300) !important;
  920. height: px2rpx(300) !important;
  921. margin: 0;
  922. border: 1px solid #e5e7eb;
  923. border-radius: px2rpx(8);
  924. overflow: hidden;
  925. position: relative;
  926. // 图片预览
  927. .file-picker__box-item-image {
  928. width: 100%;
  929. height: 100%;
  930. object-fit: cover;
  931. }
  932. // 删除按钮
  933. .file-picker__box-item-close {
  934. position: absolute;
  935. top: px2rpx(4);
  936. right: px2rpx(4);
  937. width: px2rpx(24);
  938. height: px2rpx(24);
  939. background: rgba(0, 0, 0, 0.5);
  940. border-radius: 50%;
  941. display: flex;
  942. align-items: center;
  943. justify-content: center;
  944. &::before {
  945. content: '×';
  946. color: var(--bs-emphasis-color);
  947. font-size: px2rpx(28);
  948. line-height: 1;
  949. }
  950. .close-icon {
  951. display: none;
  952. }
  953. }
  954. }
  955. }
  956. // 上传按钮
  957. .file-picker__box-add {
  958. width: px2rpx(300) !important;
  959. height: px2rpx(300) !important;
  960. margin: 0;
  961. border: 2rpx dashed #d1d5db;
  962. border-radius: px2rpx(8);
  963. background: #f9fafb;
  964. transition: all 0.3s;
  965. &:hover {
  966. border-color: #ea2027;
  967. background: #fef2f2;
  968. }
  969. // 自定义上传按钮内容
  970. .custom-upload-btn {
  971. width: 100%;
  972. height: 100%;
  973. display: flex;
  974. flex-direction: column;
  975. align-items: center;
  976. justify-content: center;
  977. .plus {
  978. font-size: px2rpx(48);
  979. color: #9ca3af;
  980. line-height: 1;
  981. margin-bottom: px2rpx(8);
  982. }
  983. .tip {
  984. font-size: px2rpx(24);
  985. color: #6b7280;
  986. }
  987. }
  988. // 隐藏默认的加号
  989. .add-icon {
  990. display: none;
  991. }
  992. }
  993. // 上传进度
  994. .file-picker__box-progress {
  995. width: px2rpx(300);
  996. height: px2rpx(300);
  997. border-radius: px2rpx(8);
  998. background: rgba(0, 0, 0, 0.5);
  999. color: var(--bs-emphasis-color);
  1000. }
  1001. }
  1002. }
  1003. // 图片预览
  1004. .image-preview {
  1005. .preview-image {
  1006. width: px2rpx(300);
  1007. height: px2rpx(300);
  1008. border-radius: px2rpx(8);
  1009. object-fit: cover;
  1010. cursor: pointer;
  1011. border: 1px solid #e5e7eb;
  1012. }
  1013. .no-image {
  1014. width: px2rpx(300);
  1015. height: px2rpx(300);
  1016. display: flex;
  1017. align-items: center;
  1018. justify-content: center;
  1019. background: #f5f5f5;
  1020. border-radius: px2rpx(8);
  1021. color: var(--bs-heading-color);
  1022. font-size: px2rpx(24);
  1023. border: 1px solid #e5e7eb;
  1024. }
  1025. }
  1026. }
  1027. }
  1028. .custom-row {
  1029. gap: px2rpx(20); // 使用 gap 替代 gutter
  1030. }
  1031. </style>