<template>
  <div>
    <el-form :model="quitForm" ref="quitForm" :rules="quitRules">
      <el-form-item label="审核状态" prop="status">
        <el-radio v-model.trim="quitForm.status" label="APPROVED"
          >通过</el-radio
        >
        <el-radio v-model.trim="quitForm.status" label="DENIED"
          >拒绝</el-radio
        >
      </el-form-item>
      <el-form-item label="退团原因" prop="reason">
        <el-input type="textarea" v-model.trim="quitForm.reason" placeholder="请填写退团原因"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer" style="text-align: right;">
      <el-button @click="$emit('close')">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </div>
</template>
<script>
import { quitMusicGroup } from '@/api/journal'
export default {
  props: ['detail'],
  data() {
    return {
      quitForm: {
        status: '',
        isRefundCourseFee: false,
        isRefundInstrumentFee: false,
        isRefundTeachingAssistantsFee: false,
        reason: null,
      },
      quitRules: {
        status: [{ required: true, message: "请选择审核状态" }],
        reason: [{ required: true, message: "请填写退团原因" }],
      },
    }
  },
  methods: {
    submit() {
      this.$refs.quitForm.validate(async valid => {
        if (valid) {
          try {
            await this.$confirm("是否确定退团?", "提示", {
              type: 'warning',
            })
            await quitMusicGroup({
              id: this.detail.id,
              ...this.quitForm
            })
            this.$emit('close')
            this.$emit('submited')
            this.$message.success("退团成功")
          } catch (error) {}
        }
      })
    }
  }
}
</script>
