Index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <app-view class="bank-sign g-form">
  3. <template #header>
  4. <app-navbar title="代扣签约申请" />
  5. </template>
  6. <div class="bank-sign__container" v-if="signinfo">
  7. <CellGroup>
  8. <Cell title="用户编号" :value="signinfo?.jfhm" />
  9. <Cell title="账户签约状态" :value="getSignStatusName(signinfo?.accountsignstatus ?? 1)" />
  10. <!-- <Cell title="一次扣费限额" :value="handleNoneValue(signinfo?.yckfxe)" /> -->
  11. <Cell title="协议签署日期" :value="handleNoneValue(signinfo?.xyqsrq)" />
  12. <Cell title="协议生效日期" :value="handleNoneValue(signinfo?.xysxrq)" />
  13. <Cell title="扣款单位时间" :value="getGt_kksjdwName(signinfo?.kksjdw)" />
  14. <Cell title="扣款时间步长" :value="handleNoneValue(signinfo?.kksjbc)" />
  15. <!-- <Cell title="扣款周期内扣费限额" :value="handleNoneValue(signinfo?.kkzqnkfxe)" />
  16. <Cell title="扣费周期内限制笔数" :value="handleNoneValue(signinfo?.kkzqnxzbs)" /> -->
  17. </CellGroup>
  18. </div>
  19. <div class="bank-sign__empty" v-else>
  20. <Empty description="您还未添加签约账户" />
  21. </div>
  22. <template #footer>
  23. <div class="g-form__footer inset">
  24. <Button type="warning" round block @click="onCancelSumit"
  25. v-if="signStatus === SignStatus.Signed">解约</Button>
  26. <Button type="danger" round block @click="openComponent('apply')"
  27. v-if="[SignStatus.Unsigned, SignStatus.Rescinded].includes(signStatus)">添加代扣签约账户</Button>
  28. </div>
  29. </template>
  30. <component ref="componentRef" :is="componentMap.get(componentId)" @closed="closeComponent"
  31. v-if="componentId" />
  32. </app-view>
  33. </template>
  34. <script lang="ts" setup>
  35. import { defineAsyncComponent, shallowRef } from 'vue'
  36. import { CellGroup, Cell, Button, Empty, showFailToast } from 'vant'
  37. import { useComponent } from '@/hooks/component'
  38. import { queryGetGtwithholdsigninfo } from '@/services/api/bank'
  39. import { useRequest } from '@/hooks/request'
  40. import { getSignStatusName, SignStatus, getGt_kksjdwName } from '@/constants/bank'
  41. import { fullloading, dialog } from '@/utils/vant'
  42. import { useNavigation } from '@mobile/router/navigation'
  43. import { useDoYJF_WithholdSignOut } from '@/business/bank'
  44. import { handleNoneValue } from '@/filters'
  45. const componentMap = new Map<string, unknown>([
  46. ['apply', defineAsyncComponent(() => import('./components/apply/Index.vue'))],
  47. ])
  48. const { router } = useNavigation()
  49. const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
  50. run()
  51. })
  52. const signStatus = shallowRef(SignStatus.Unsigned)
  53. const { onSubmit } = useDoYJF_WithholdSignOut()
  54. const signinfo = shallowRef<Model.GTWithHoldSignInfoRsp>()
  55. const { run } = useRequest(queryGetGtwithholdsigninfo, {
  56. onSuccess: (res) => {
  57. /// 签约状态
  58. if (res.data.length != 0) {
  59. signStatus.value = res.data[0].accountsignstatus
  60. console.log(signStatus.value)
  61. /// 签约信息
  62. signinfo.value = res.data[0]
  63. }
  64. }
  65. })
  66. const onCancelSumit = () => {
  67. dialog({
  68. message: '确认解约?',
  69. showCancelButton: true
  70. }).then(() => {
  71. fullloading((hideLoading) => {
  72. onSubmit().then(() => {
  73. hideLoading()
  74. dialog('提交成功,请稍后确认结果。').then(() => {
  75. router.back()
  76. })
  77. }).catch((err) => {
  78. showFailToast(err)
  79. })
  80. })
  81. })
  82. }
  83. </script>
  84. <style lang="less">
  85. @import './index.less';
  86. </style>