BankInfoTab.vue 41 KB

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