
<!-- 驳回原因用户姓名输入 -->
<template>
  <a-form
    ref="form"
    v-bind="formItemLayout"
    :form="form"
  >
    <a-form-item label="推荐人信息" style="padding-top:30px;">
      <a-input
        v-decorator="[
          'parent_mobile',
          {
            rules: [
              { required: true, message: `请输入推荐人信息!`, type: 'string' },
            ]
          }
        ]"
        :placeholder="`请输入推荐人信息!`"
      />
    </a-form-item>
  </a-form>
</template>

<script>
import { editMiddlesUser } from '@/api/user'
export default {
  name: 'EditRole',
  props: {
    item: {
      type: Object,
      default: () => {
          return {}
        }
    }
  },
  data: () => ({
    formItemLayout: {
      labelCol: { span: 6 },
      wrapperCol: { span: 14 }
    },
    loading: false
  }),
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  methods: {
    onOk () {
      return new Promise(resolve => {
        this.form.validateFields((errors, values) => {
          if (!errors) {
            const params = {
              user_id: this.item.user.user_id,
              parent_mobile: values.parent_mobile
            }
            editMiddlesUser(params).then((res) => {
              this.$notification.success({
                message: '成功',
                description: '修改推荐人成功'
              })
              resolve(true)
            }).catch((err) => {
              this.$notification.error({
                message: '失败',
                description: err.message
              })
              resolve(false)
            })
          }
        })
      })
    }
  }
}
</script>

<style scoped>

</style>
