<template>
  <div class="bond-content">
    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="150px" label-position="left" class="rule-form">
      <div class="info-title">收款确认</div>
      <el-form-item label="保证金收款：" prop="depositCollection" style="width: 100%">
        <el-radio-group v-model="ruleForm.depositCollection" :disabled="disabled"  class="form-radio-border">
          <el-radio :label="1">确认</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item
        label="说明："
        style="width: 100%;"
        class="textarea-content"
        prop="comments"

      >
        <el-input type="textarea" :disabled="disabled" placeholder="请输入说明" v-model="ruleForm.comments" style="width: 100%;" rows="3" clearable></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
module.exports = {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    deatailsInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      ruleForm: {
        depositCollection: 1,
        comments: ''
      },
      rules: {
        depositCollection: [
          { required: true, message: '请选择证金收款', trigger: 'change' },
        ]
      }
    }
  },
  watch: {
    deatailsInfo: {
      handler(newV) {
        if(newV) {
          const { depositCollection, comments } = JSON.parse(JSON.stringify(newV))
          this.ruleForm.depositCollection = depositCollection
          this.ruleForm.comments = comments
        }

      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    getSubmit() {
      return new Promise((resolve, reject) => {
        this.$refs.ruleForm.validate(valid => {
          if(valid) {
            resolve(this.ruleForm)
          }else {
            reject()
          }
        })
      })
    }
  },
}
</script>

<style scoped>

</style>
