<script setup>
import one from '@/views/upload-id-card/content/one.vue'
import {useUserStore} from "@/stores/userStore.js";
import {storeToRefs} from "pinia";
import router from "@/router/index.js";

const userStore = useUserStore()
const {submitReturnData, iDCardImage, idCardInfo} = storeToRefs(userStore);
const cancel=()=>{
  router.back()
}
const submitIdCard = () => {
  submitReturnData.value.artistName = idCardInfo.value.realName
  submitReturnData.value.gender = idCardInfo.value.sex === '男' ? 1 : 2
  submitReturnData.value.idCard = idCardInfo.value.iDNum
  submitReturnData.value.idCardStartDate = idCardInfo.value.issueDate
  submitReturnData.value.idCardEndDate = idCardInfo.value.expirationDate
  submitReturnData.value.idCardPhoto = iDCardImage.value.front
  submitReturnData.value.idCardBackPhoto = iDCardImage.value.back
  router.back()
}
</script>

<template>
  <div class="container">
    <div class="content1">
      <one></one>
    </div>
    <div class="content2">
      <div class="wrap1" @click="cancel">取消</div>
      <div class="wrap2" @click="submitIdCard">提交</div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.container {
  padding: 22px 22px 30px;

  .content2 {
    margin-top: 42px;
    display: flex;

    .wrap2 {
      margin-left: auto;
      width: 200px;
      height: 30px;
      border-radius: 15px;
      display: flex;
      justify-content: center;
      align-items: center;
      color: #fff;
      font-size: 14px;
      background-color: #2159C4;
    }

    .wrap1 {
      border-radius: 15px;
      width: 116px;
      height: 30px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 14px;
      color: #fff;
      background-color: #5A5A5A;
    }
  }
}
</style>
