<template>
  <div class="step-one">
    <p class="title">请提交您的实名认证信息：</p>
    <el-form
      label-position="right"
      label-width="120px"
      class="form"
      ref="company"
    >
      <el-form-item label="企业名称" class="form-item">
        <el-input
          v-model="company.name"
          placeholder="请输入企业名称"
        ></el-input>
      </el-form-item>
      <el-form-item label="证件号" class="form-item">
        <el-input
          v-model="company.uscd"
          placeholder="请输入统一社会信用代码或组织机构代码"
        ></el-input>
      </el-form-item>
      <el-form-item label="法人姓名" class="form-item">
        <el-input
          v-model="company.corporations_name"
          placeholder="请输入法人姓名"
        ></el-input>
      </el-form-item>
    </el-form>
    <el-button
      class="confirm-btn"
      type="primary"
      @click="confirm()"
      :disabled="disabled"
      >提交审核</el-button
    >
  </div>
</template>
<script lang="ts">
import Vue from "vue";
import { enterBaseInfo } from "./Api.service";
export default Vue.extend({
  data() {
    return {
      company: {
        name: "",
        uscd: "",
        corporations_name: "",
      },
      disabled: false,
    };
  },
  methods: {
    async confirm() {
      if (this.company.name.trim() === "") {
        this.$message("企业名称不可为空");
        return;
      } else if (this.company.uscd.trim() === "") {
        this.$message("证件号不可为空");
        return;
      } else if (this.company.corporations_name.trim() === "") {
        this.$message("法人姓名不可为空");
        return;
      }
      this.disabled = true;
      const res = await enterBaseInfo(this.company);
      if (res && res.code === 200) {
        this.$message({
          message: "企业基本信息录入成功。",
          type: "success",
        });
        this.$emit("success");
      }
      this.disabled = false;
    },
  },
});
</script>

<style lang="less" scoped>
.step-one {
  .title {
    margin-top: 50px;
    margin-left: 47px;
    font-size: 20px;
    font-family: PingFangSC-Semibold;
    font-weight: 600;
    color: rgba(53, 53, 53, 1);
    line-height: 40px;
  }
  .form {
    width: 900px;
  }
  .form .el-input {
    width: 610px;
  }
  .form-item {
    margin-bottom: 28px;
  }
  .confirm-btn {
    margin-top: 10px;
    margin-left: 50px;
  }
}
</style>
<style>
.step-one .el-form-item__content {
  margin-left: 141px !important;
}
</style>
