<template>
  <div class="main-contract-info">
    <cy-info-title>主合同信息</cy-info-title>
    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="150px" label-position="top" class="rule-form-orange">
      <el-form-item label="保理专户户名" prop="factoringAccountName">
        <el-input v-model="ruleForm.factoringAccountName" :disabled="disabled" placeholder="请输入保理专户户名" clearable />
      </el-form-item>
      <el-form-item label="保理专户账户" prop="factoringAccount">
        <el-input v-model="ruleForm.factoringAccount" :disabled="disabled" placeholder="请输入保理专户账户" clearable />
      </el-form-item>
      <el-form-item label="保理专户开户行" prop="factoringAccountBank">
        <el-input v-model="ruleForm.factoringAccountBank" :disabled="disabled" placeholder="请输入保理专户开户行" clearable />
      </el-form-item>
      <el-form-item label="我司指定账户户名" prop="ourAccountName">
        <el-input v-model="ruleForm.ourAccountName" :disabled="disabled" placeholder="请输入我司指定账户户名" clearable />
      </el-form-item>
      <el-form-item label="我司指定账户" prop="ourAccount">
        <el-input v-model="ruleForm.ourAccount" :disabled="disabled" placeholder="请输入我司指定账户" clearable />
      </el-form-item>
      <el-form-item label="我司指定账户开户行" prop="ourAccountBank">
        <el-input v-model="ruleForm.ourAccountBank" :disabled="disabled" placeholder="请输入我司指定账户开户行" clearable />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    detailsInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      ruleForm: {
        factoringAccountName: '',
        factoringAccount: '',
        factoringAccountBank: '',
        ourAccountName: '',
        ourAccount: '',
        ourAccountBank: ''
      },
      rules: {
        factoringAccountName: [
          { required: true, message: '请输入保理申请人联系人', trigger: 'blur' }
        ],
        factoringAccount: [
          { required: true, message: '请输入保理专户户名', trigger: 'blur' }
        ],
        factoringAccountBank: [
          { required: true, message: '请输入保理专户开户行', trigger: 'blur' }
        ],
        ourAccountName: [
          { required: true, message: '请输入我司指定账户户名', trigger: 'blur' }
        ],
        ourAccount: [
          { required: true, message: '请输入我司指定账户', trigger: 'blur' }
        ],
        ourAccountBank: [
          { required: true, message: '请输入我司指定账户开户行', trigger: 'blur' }
        ]
      }
    }
  },
  watch: {
    detailsInfo: {
      handler(newV) {
        this.$set(this, 'ruleForm', JSON.parse(JSON.stringify(newV)))
      },
      immediate: true,
      deep: true
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
