<script lang="ts" setup>
// import companyInfo from './companyInfo.vue'
import userInfo from './userInfo.vue'
import { CUR_STATUS } from '@/enums/common'
const visible = defineModel('visible', { default: false })
enum STATUS {
  FirstStep = 'info',
  SecondStep = 'success',
}
const status = ref(STATUS.FirstStep)
const countNum = ref(5)

const onSuccess = (val: CUR_STATUS) => {
  status.value = STATUS.SecondStep
  countDown()
}

const countDown = () => {
  countNum.value = 5
  const timer = setInterval(() => {
    countNum.value--
    if (countNum.value === 0) {
      clearInterval(timer)
      visible.value = false
    }
  }, 1000)
}
</script>

<template>
  <a-modal v-model:open="visible" :footer="false" :width="560" wrapClassName="custom-info" :keyboard="false" :maskClosable="false" :closable="false">
    <div v-if="status === STATUS.FirstStep">
      <user-info @success="onSuccess" v-model:visible="visible" />
    </div>
    <div v-if="status === STATUS.SecondStep" class="text-center py-100px">
      <div class="px-80px">
        <img class="w-88px h-88px" src="@/assets/images/success.png" alt="" />
        <div>
          <h3 class="c-#000 fw-700 fs-34 mb-10px mt-38px">Information submitted</h3>
          <div class="c-#999 mb-20px">We will conduct the audit within 7 working days, and the audit results will be communicated via email</div>
          <div class="c-#999 mb-20px">You can view the submission form in the Personal Center - My Profile</div>
        </div>
        <div class="c-#999 mt-20px">
          {{ countNum }}s后自动关闭
        </div>
      </div>
    </div>
  </a-modal>
</template>

<style lang="less">
.custom-info {
  .ant-modal {
    .ant-modal-content {
      border-radius: 18px;
      padding: 0 !important;
    }
  }
}
</style>
