index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <!-- 签约账号管理 -->
  2. <template>
  3. <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey"
  4. :expand-row-keys="expandKeys" @row-click="rowClick">
  5. <template #headerLeft>
  6. <template v-if="((hasAQAuth && hasSignContract) || !hasAQAuth) && [AuthStatus.Certified, AuthStatus.Submitted].includes(authStatus) && ![SignStatus.Audit, SignStatus.Signing, SignStatus.Signed].includes(signStatus)">
  7. <el-button type="primary" size="small"
  8. @click="showComponent('sign')">添加签约账户</el-button>
  9. </template>
  10. <template v-if="[AuthStatus.Certified, AuthStatus.Submitted].includes(authStatus) && hasAQAuth">
  11. <el-button type="primary" size="small"
  12. @click="showComponent('protocol')">合同签署</el-button>
  13. </template>
  14. <el-button type="warning" size="small" v-if="authStatus === AuthStatus.Uncertified"
  15. @click="openComponent('certification-aq')">实名认证</el-button>
  16. </template>
  17. <!-- 证件类型 -->
  18. <template #cardtype="{ value }">
  19. {{ getCertificateTypeCodeName(Number(value)) }}
  20. </template>
  21. <!-- 状态 -->
  22. <template #signstatus="{ value }">
  23. {{ getSignStatusName(value) }}
  24. </template>
  25. <!-- 展开行 -->
  26. <template #expand="{ row }">
  27. <div class="buttonbar">
  28. <el-button v-if="row.signstatus === SignStatus.Signed && cusBank?.canrelease === 1" type="danger"
  29. size="small" @click="openComponent('cancel')">解约</el-button>
  30. <el-button
  31. v-if="[SignStatus.Unsigned, SignStatus.Refuse, SignStatus.Rescinded].includes(row.signstatus) || (row.signstatus === SignStatus.Signed && cusBank?.canmodifysigninfo === 1)"
  32. type="primary" size="small" @click="beforeShowComponent(row)">修改</el-button>
  33. </div>
  34. </template>
  35. </app-table>
  36. <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)" @closed="closeComponent"
  37. v-if="componentId" />
  38. </template>
  39. <script lang="ts" setup>
  40. import { shallowRef, defineAsyncComponent, onMounted, computed, ref } from 'vue'
  41. import { ElMessageBox } from 'element-plus'
  42. import { useComponent } from '@/hooks/component'
  43. import { useComposeTable } from '@pc/components/base/table'
  44. import { useRequest } from '@/hooks/request'
  45. import { queryBankAccountSign, queryCusBankSignBank } from '@/services/api/bank'
  46. import { getSignStatusName, SignStatus } from '@/constants/bank'
  47. import { getCertificateTypeCodeName } from '@/constants/account'
  48. import { queryUserAccount, queryUsereSignRecords } from '@/services/api/account'
  49. import { AuthStatus } from '@/constants/account'
  50. import { useUserStore } from '@/stores'
  51. import { ElMessage } from 'element-plus'
  52. import AppTable from '@pc/components/base/table/index.vue'
  53. import service from '@/services'
  54. import { queryMdUserSwapProtocol } from '@/services/api/swap'
  55. import { getUserId, getMemberUserId } from '@/services/methods/user'
  56. const componentMap = new Map<string, unknown>([
  57. ['cancel', defineAsyncComponent(() => import('./components/cancel/index.vue'))],
  58. ['sign', defineAsyncComponent(() => import('./components/sign/index.vue'))],
  59. ['certification', defineAsyncComponent(() => import('./components/certification/index.vue'))], // 实名认证,
  60. ['certification-aq', defineAsyncComponent(() => import('./components/certification-aq/index.vue'))], // 实名认证
  61. ['protocol', defineAsyncComponent(() => import('./components/protocol/index.vue'))], // 合同签署
  62. ])
  63. const useStore = useUserStore()
  64. const authStatus = shallowRef(AuthStatus.Certified) // 实名认证状态
  65. const signStatus = shallowRef(SignStatus.Unsigned)
  66. const cusBank = shallowRef<Model.CusBankSignBankRsp>()
  67. const oem = service.getConfig('oem')
  68. const { rowKey, expandKeys, rowClick, selectedRow } = useComposeTable<Model.BankAccountSignRsp>({ rowKey: 'applyexchticket' })
  69. const { loading, dataList, run } = useRequest(queryBankAccountSign, {
  70. onSuccess: (res) => {
  71. /// 签约状态
  72. if (res.data.length != 0) {
  73. signStatus.value = res.data[0].signstatus
  74. }
  75. }
  76. })
  77. /// 查询用户掉期协议签署表
  78. const { dataList: protocolList} = useRequest(queryMdUserSwapProtocol, {
  79. params: {
  80. userId: getUserId()
  81. }
  82. })
  83. /// 查询爱签签约协议信息
  84. const { dataList: records} = useRequest(queryUsereSignRecords, {
  85. params: {
  86. userId: getUserId(),
  87. memberUserId: getMemberUserId(),
  88. }
  89. })
  90. /// 判断是否能签约
  91. const hasSignContract = computed(() => {
  92. if ( oem.toLowerCase() === 'tjmd' ) {
  93. return protocolList.value.some(e => { return e.protocolstatus === 4 })
  94. } else if ( oem.toLowerCase() === 'zrwyt' ) {
  95. return records.value.some(e => { return e.recordstatus === 3 && e.templatetype === 2 })
  96. } else if (oem.toLowerCase() === 'gcszt' ) {
  97. return !records.value.some(e => { return e.recordstatus != 3 })
  98. }
  99. return true
  100. })
  101. /// 是否爱签实名认证
  102. const hasAQAuth = computed(() => {
  103. if ( oem.toLowerCase() === 'tjmd' ) {
  104. return true
  105. } else if ( oem.toLowerCase() === 'zrwyt' ) {
  106. return records.value.some(e => { return e.recordstatus === 3 && e.templatetype === 1 })
  107. } else if ( oem.toLowerCase() === 'gcszt' ) {
  108. return true
  109. }
  110. return true
  111. })
  112. /// 查询托管银行信息
  113. useRequest(queryCusBankSignBank, {
  114. onSuccess: (res) => {
  115. /// 签约状态
  116. if (res.data.length != 0) {
  117. cusBank.value = res.data[0]
  118. }
  119. }
  120. })
  121. const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
  122. run()
  123. })
  124. const showComponent = ((componentName: string) => {
  125. /// 认证请求中 不能操作
  126. if (authStatus.value === AuthStatus.Submitted) {
  127. ElMessage.error('实名认证正在审核中,暂不能进行签约请求操作!')
  128. return
  129. }
  130. openComponent(componentName)
  131. })
  132. const beforeShowComponent = (row: Model.BankAccountSignRsp) => {
  133. if (row.cusbankid === 'jdjs') {
  134. ElMessageBox.alert('请先发函到结算中心修改信息后再修改,否则将会影响入金、出金。').finally(() => {
  135. showComponent('sign')
  136. })
  137. } else {
  138. showComponent('sign')
  139. }
  140. }
  141. const tableColumns = shallowRef<Model.TableColumn[]>([
  142. { prop: 'accountcode', label: '资金账号' },
  143. { prop: 'accountname', label: '名称' },
  144. { prop: 'cardtype', label: '证件类型' },
  145. { prop: 'cardno', label: '证件号码' },
  146. { prop: 'cusbankname', label: '托管银行' },
  147. { prop: 'bankname', label: '签约银行' },
  148. { prop: 'bankaccountno', label: '签约银行账号' },
  149. { prop: 'currency', label: '币种' },
  150. { prop: 'signstatus', label: '状态' },
  151. { prop: 'remark', label: '备注' },
  152. ])
  153. onMounted(() => {
  154. useStore.getUserData()
  155. // 获取用户账号信息----------------待处理,直接用useStore
  156. queryUserAccount().then((res) => {
  157. authStatus.value = res.data.hasauth
  158. })
  159. })
  160. </script>