import { FormRules } from "element-plus";

export const createRules: FormRules = {
  payNo: {
    trigger: "change",
    required: true,
    message: "请选择订单"
  },
  invArr: {
    required: true,
    message: "请上传发票",
    validator(_, value: Array<any>) {
      return value.length !== 0;
    }
  }
};

export const invoceRules: FormRules = {
  payNo: [
    {
      trigger: "blur",
      message: "请选择订单",
      required: true
    }
  ],
  invoiceType: [
    {
      trigger: "blur",
      message: "请选择发票类型",
      required: true
    }
  ],
  invType: [
    {
      trigger: "blur",
      message: "请选择申请方式",
      required: true
    }
  ],
  invNumber: [
    {
      trigger: "blur",
      message: "请输入发票号码",
      required: true
    }
  ],
  invCode: [
    {
      trigger: "blur",
      message: "请选择发票代码",
      required: true
    }
  ],
  open_time: [
    {
      trigger: "blur",
      message: "请选择开票时间",
      required: true
    }
  ],
  subtotal_amount: [
    {
      trigger: "blur",
      message: "请输入金额",
      required: true
    }
  ],
  invName: [
    {
      trigger: "blur",
      message: "请输入发票名称",
      required: true
    }
  ],
  checkNumber: [
    {
      trigger: "blur",
      message: "请输入校验码",
      required: true
    }
  ]
};

export const invoceRules_Electronics: FormRules = {
  payNo: [
    {
      trigger: "blur",
      message: "请选择订单",
      required: true
    }
  ],
  invoiceType: [
    {
      trigger: "blur",
      message: "请选择发票类型",
      required: true
    }
  ],
  invType: [
    {
      trigger: "blur",
      message: "请选择申请方式",
      required: true
    }
  ],
  invNumber: [
    {
      trigger: "blur",
      message: "请输入发票号码",
      required: true
    }
  ],
  subtotal_amount: [
    {
      trigger: "blur",
      message: "请输入金额",
      required: true
    }
  ],
  open_time: [
    {
      trigger: "blur",
      message: "请选择开票时间",
      required: true
    }
  ]
};
