<template>
  <div class="app-container">
    <el-card shadow="always" style="width: 55%; margin: 0 auto">
      <el-form ref="postRef" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="证件类型:" prop="type">
          <div>身份证</div>
        </el-form-item>
        <el-form-item label="姓名:" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="身份证号:" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入身份证号" />
        </el-form-item>
        <el-form-item label="银行卡账号:" prop="email">
          <el-input v-model="form.email" placeholder="请输入银行卡账号" />
        </el-form-item>
        <el-form-item label="开户行:" prop="address">
          <el-input v-model="form.address" placeholder="请输入开户行" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm">保存</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>
<script setup>
import { expert } from "@/api/identity/index";
const data = reactive({
  form: {},
  rules: {
    name: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
    phone: [{ required: true, message: "身份证号不能为空", trigger: "blur" }],
    email: [{ required: true, message: "银行卡账号不能为空", trigger: "blur" }],
    address: [{ required: true, message: "开户行不能为空", trigger: "blur" }],
  },
});

const { queryParams, form, rules } = toRefs(data);

const { proxy } = getCurrentInstance();
function submitForm(status) {
  proxy.$refs["postRef"].validate((valid) => {
    if (valid) {
      console.log(form.value);
      if (form.value.id != undefined) {
        // updatePost(form.value).then((response) => {
        //   proxy.$modal.msgSuccess("修改成功");
        //   open.value = false;
        //   getList();
        // });
      } else {
        // addPost(form.value).then((response) => {
        //   proxy.$modal.msgSuccess("新增成功");
        //   open.value = false;
        //   getList();
        // });
      }
    }
  });
  // if (proxy.$refs.expertForm.submitForm()) {
  //   expert(form).then((res) => {
  //     proxy.$modal.msgSuccess("新增成功");
  //     proxy.$router.go(-1);
  //   });
  // } else {
  //   console.log("校验未通过");
  // }
}
</script>