Index.vue 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <app-view class="g-layout">
  3. <template #header>
  4. <app-navbar :title="$t('user.authentication.title')" />
  5. </template>
  6. <template v-if="userInfo && !loading">
  7. <CellGroup :title="t('user.authentication.subtitle')" inset>
  8. <Cell :title="$t('user.authentication.customername')" :value="userInfo.customername" />
  9. <Cell :title="$t('user.authentication.cardtype')"
  10. :value="getCertificateTypeCodeName(userInfo.cardtypeid)" />
  11. <Cell :title="$t('user.authentication.cardnum')" :value="userInfo.cardnum" />
  12. <Cell :title="$t('banksign.mobilephone')" :value="userInfo.mobile2" v-if="userInfo.mobile2" />
  13. <Cell :title="$t('banksign.bankname1')" :value="userInfo.bankbankname" v-if="userInfo.bankbankname" />
  14. <Cell :title="$t('banksign.bankno')" :value="userInfo.bankaccount" v-if="userInfo.bankaccount" />
  15. <Cell v-if="userInfo.userinfotype === 1" :title="$t('user.authentication.cardfrontphoto')">
  16. <Image fit="contain" :src="getFileUrl(userInfo.cardfrontphotourl)" width="100" height="100" />
  17. </Cell>
  18. <Cell v-if="userInfo.userinfotype === 2" :title="$t('user.authentication.cardfrontphoto1')">
  19. <Image fit="contain" :src="getFileUrl(userInfo.cardfrontphotourl)" width="100" height="100" />
  20. </Cell>
  21. <Cell :title="$t('user.authentication.cardbackphoto')"
  22. v-if="showCardBackPhoto && userInfo.userinfotype === 1">
  23. <Image fit="contain" :src="getFileUrl(userInfo.cardbackphotourl)" width="100" height="100" />
  24. </Cell>
  25. <Cell :title="halfBodyPhotoTitle" v-if="showHalfBodyPhoto && userInfo.userinfotype === 1">
  26. <Image fit="contain" :src="getFileUrl(userInfo.halfbodyphotourl)" width="100" height="100" />
  27. </Cell>
  28. <Cell :title="$t('user.authentication.authstatus')"
  29. :value="getAuthStatusName(userStore.userAccount.hasauth)" />
  30. </CellGroup>
  31. <div class="g-layout-block g-layout-block--inset"
  32. v-if="userStore.userAccount.hasauth === AuthStatus.Rejected && userStore.userAccount.modifystatus === 1">
  33. <Button type="primary" round block @click="routerTo('account-certification')">重新认证</Button>
  34. </div>
  35. </template>
  36. </app-view>
  37. </template>
  38. <script lang="ts" setup>
  39. import { shallowRef, onActivated, computed } from 'vue'
  40. import { Button, CellGroup, Cell, Image, showLoadingToast } from 'vant'
  41. import { useNavigation } from '@mobile/router/navigation'
  42. import { AuthStatus, getAuthStatusName } from '@/constants/account'
  43. import { queryWrDraftUserInfo } from '@/services/api/account'
  44. import { useRequest } from '@/hooks/request'
  45. import { getCertificateTypeCodeName } from '@/constants/account'
  46. import { getFileUrl } from '@/filters'
  47. import { getWskhOpenAccountConfigs } from '@/services/api/account'
  48. import { i18n, useUserStore } from '@/stores'
  49. const { routerTo } = useNavigation()
  50. const { t } = i18n.global
  51. const userStore = useUserStore()
  52. const showHalfBodyPhoto = shallowRef(false)
  53. const showCardBackPhoto = shallowRef(false)
  54. const halfBodyPhotoTitle = shallowRef('')
  55. const toast = showLoadingToast({ duration: 0 })
  56. // 查询实名认证信息
  57. const { data, loading, run } = useRequest(queryWrDraftUserInfo, {
  58. manual: true,
  59. onSuccess: (res) => {
  60. data.value = res.data[0]
  61. },
  62. onFinally: () => {
  63. userStore.getUserData().finally(() => {
  64. toast.close()
  65. })
  66. }
  67. })
  68. const userInfo = computed(() => data.value ?? userStore.userInfo)
  69. // 获取网上开户配置
  70. useRequest(getWskhOpenAccountConfigs, {
  71. defaultParams: {
  72. configs: '53,54,78'
  73. },
  74. onSuccess: (res) => {
  75. const configMap = new Map(res.data.map((item) => [item.configid, item.configvalue]))
  76. /// 是否显示半身照和 证件背面照
  77. showCardBackPhoto.value = configMap.get(53) === '1'
  78. showHalfBodyPhoto.value = configMap.get(54) === '1'
  79. halfBodyPhotoTitle.value = configMap.get(78) ?? t('user.authentication.halfbodyphoto')
  80. }
  81. })
  82. onActivated(() => {
  83. toast.open({ message: '加载中...' })
  84. run()
  85. })
  86. </script>