import { ModalConfig } from "/@/components/PageModal/src/types";
import { isLicense } from "/@/utils/validate";

const modalConfig: ModalConfig = {
  title: "企业客户发票",
  colLayout: { span: 24 },
  itemStyle: {},
  contact: "invoice_mobile",
  formItems: [
    {
      field: "invoice_title",
      type: "input",
      label: "发票抬头名称",
      labelWidth: "120px",
      placeholder: "发票抬头名称",
      rules: [
        { required: true, trigger: "change", message: "请输入发票抬头名称" }
      ]
    },
    {
      field: "invoice_code",
      type: "input",
      labelWidth: "120px",
      label: "纳税识别号",
      placeholder: "纳税识别号",
      rules: [
        {
          validator(_, value) {
            return isLicense(value);
          },
          required: true,
          message: "纳税人识别号格式不正确"
        }
      ]
    },
    {
      field: "invoice_bank",
      type: "input",
      labelWidth: "120px",
      label: "企业开户银行",
      placeholder: "企业开户银行",
      rules: [
        { required: true, trigger: "change", message: "请输入企业开户银行" }
      ]
    },
    {
      field: "invoice_bankNo",
      type: "input",
      labelWidth: "120px",
      label: "银行账户",
      placeholder: "银行账户",
      rules: [{ required: true, trigger: "change", message: "请输入银行账户" }]
    },
    {
      field: "invoice_addr",
      type: "input",
      labelWidth: "120px",
      label: "企业注册地址",
      placeholder: "企业注册地址",
      rules: [
        { required: true, trigger: "change", message: "请输入企业注册地址" }
      ]
    },
    {
      field: "invoice_mobile",
      type: "contact",
      label: "企业联系方式",
      labelWidth: "120px",
      placeholder: "企业联系方式",
      rules: [
        { required: true, trigger: "change", message: "请输入企业联系方式" }
      ]
    }
  ]
};

export default modalConfig;
