<template>
  <div>
    <el-alert
      title="课酬信息"
      type="info"
      :closable="false"
      class="baseMsg"
    ></el-alert>
    <div v-if="(activeType&&payForm.giveCourseType=='MEMBER')||(activeType&&!payForm.giveCourseType)">
          <empty desc="该活动方案未设置课程，无需设置课酬信息"  />
    </div>
    <el-form
    v-else
      :model="salaryForm"
      label-width="150px"
      label-position="right"
      :inline="true"
      ref="salaryForm"
    >
      <el-row v-if="payForm.courseType == 'VIP'">
        <el-form-item
          v-if="courseTeachModeOnline"
          label="付费VIP线上课课酬"
          prop="vipOnlineSalarySettlement.salarySettlementType"
          :rules="[{required: true, message: '请选择付费VIP线上课课酬'}]"
        >
          <el-select
            style="width: 240px !important"
            v-model.trim="
              salaryForm.vipOnlineSalarySettlement.salarySettlementType
            "
            placeholder="请选择付费VIP线上课课酬"
            clearable
            :disabled="isDisabled"

          >
            <el-option label="自定义课酬" value="FIXED_SALARY"></el-option>
            <el-option label="标准课酬" value="TEACHER_DEFAULT"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          v-if="
            salaryForm.vipOnlineSalarySettlement.salarySettlementType ==
            'FIXED_SALARY'&&courseTeachModeOnline
          "
          label="自定义课时课酬"
          prop="vipOnlineSalarySettlement.settlementValue"
           :rules="[{required: true, message: '请输入自定义课时课酬'}]"
        >
          <el-input
            v-model.number="
              salaryForm.vipOnlineSalarySettlement.settlementValue
            "
            type="number"
            style="width: 240px"
            placeholder="自定义课时课酬"
            :disabled="isDisabled"
          >
            <template slot="append">课时/元</template>
          </el-input>
        </el-form-item>
      </el-row>
      <el-row v-if="payForm.courseType == 'VIP'">
        <el-form-item
         v-if="courseTeachModeOffline"
          label="付费VIP线下课课酬"
          prop="vipOfflineSalarySettlement.salarySettlementType"
           :rules="[{required: true, message: '请选择付费VIP线下课课酬'}]"
        >
          <el-select
            style="width: 240px !important"
            v-model.trim="
              salaryForm.vipOfflineSalarySettlement.salarySettlementType
            "
            placeholder="请选择付费VIP线下课课酬"
            clearable
            :disabled="isDisabled"
          >
            <el-option label="自定义课酬" value="FIXED_SALARY"></el-option>
            <el-option label="标准课酬" value="TEACHER_DEFAULT"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="自定义课时课酬"
           :rules="[{required: true, message: '请输入自定义课时课酬'}]"
          prop="vipOfflineSalarySettlement.settlementValue"
          v-if="
            salaryForm.vipOfflineSalarySettlement.salarySettlementType ==
            'FIXED_SALARY'&&courseTeachModeOffline
          "
        >
          <el-input
            v-model.number="
              salaryForm.vipOfflineSalarySettlement.settlementValue
            "
            type="number"
            style="width: 240px"
            placeholder="自定义课时课酬"
            :disabled="isDisabled"
          >
            <template slot="append">课时/元</template>
          </el-input>
        </el-form-item>
      </el-row>
      <el-row>
        <el-form-item
          label="付费网管课课酬"
          prop="practiceSalarySettlement.salarySettlementType"
          v-if="payForm.courseType == 'PRACTICE'"
           :rules="[{required: true, message: '请选择付费网管课课酬'}]"
        >
          <el-select
            style="width: 240px !important"
            v-model.trim="
              salaryForm.practiceSalarySettlement.salarySettlementType
            "
            placeholder="请选择付费网管课课酬"
            clearable
            :disabled="isDisabled"
          >
            <el-option label="自定义课酬" value="FIXED_SALARY"></el-option>
            <el-option label="标准课酬" value="TEACHER_DEFAULT"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
         :rules="[{required: true, message: '请输入自定义课时课酬'}]"
          label="自定义课时课酬"
          prop="practiceSalarySettlement.settlementValue"
          v-if="
            salaryForm.practiceSalarySettlement.salarySettlementType ==
            'FIXED_SALARY'&&payForm.courseType == 'PRACTICE'
          "
        >
          <el-input
            v-model.number="salaryForm.practiceSalarySettlement.settlementValue"
            type="number"
            style="width: 240px"
            placeholder="自定义课时课酬"
            :disabled="isDisabled"
          >
            <template slot="append">课时/元</template>
          </el-input>
        </el-form-item>
      </el-row>
      <el-row>
        <el-form-item
       v-if="giveCourseTeachModeOnline"
          label="赠送VIP线上课课酬"
          prop="giveVipOnlineSalarySettlement.salarySettlementType"
             :rules="[{required: true, message: '请选择赠送VIP线上课课酬'}]"
        >
          <el-select
            style="width: 240px !important"
            v-model.trim="
              salaryForm.giveVipOnlineSalarySettlement.salarySettlementType
            "
            placeholder="请选择赠送VIP线上课课酬"
            clearable
            :disabled="isDisabled"
          >
            <el-option label="自定义课酬" value="FIXED_SALARY"></el-option>
            <el-option label="标准课酬" value="TEACHER_DEFAULT"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
         :rules="[{required: true, message: '请输入自定义课时课酬'}]"
          label="自定义课时课酬"
          prop="giveVipOnlineSalarySettlement.settlementValue"
          v-if="
            salaryForm.giveVipOnlineSalarySettlement.salarySettlementType ==
            'FIXED_SALARY'&&giveCourseTeachModeOnline
          "
        >
          <el-input
            v-model.number="
              salaryForm.giveVipOnlineSalarySettlement.settlementValue
            "
            type="number"
            style="width: 240px"
            placeholder="自定义课时课酬"
            :disabled="isDisabled"
          >
            <template slot="append">课时/元</template>
          </el-input>
        </el-form-item>
      </el-row>
      <el-row   v-if="giveCourseTeachModeOffline">
        <el-form-item
          label="赠送VIP线下课课酬"
          prop="giveVipOfflineSalarySettlement.salarySettlementType"
           :rules="[{required: true, message: '请选择赠送VIP线下课课酬'}]"
        >
          <el-select
            style="width: 240px !important"
            v-model.trim="
              salaryForm.giveVipOfflineSalarySettlement.salarySettlementType
            "
            placeholder="请选择赠送VIP线下课课酬"
            clearable
            :disabled="isDisabled"
          >
            <el-option label="自定义课酬" value="FIXED_SALARY"></el-option>
            <el-option label="标准课酬" value="TEACHER_DEFAULT"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="自定义课时课酬"
           :rules="[{required: true, message: '请输入自定义课时课酬'}]"
          prop="giveVipOfflineSalarySettlement.settlementValue"
          v-if="
            salaryForm.giveVipOfflineSalarySettlement.salarySettlementType ==
            'FIXED_SALARY'&&giveCourseTeachModeOffline
          "
        >
          <el-input
            v-model.number="
              salaryForm.giveVipOfflineSalarySettlement.settlementValue
            "
            type="number"
            style="width: 240px"
            placeholder="自定义课时课酬"
            :disabled="isDisabled"
          >
            <template slot="append">课时/元</template>
          </el-input>
        </el-form-item>
      </el-row>
      <el-row v-if="payForm.giveCourseType=='PRACTICE'&&payForm.giveCourseNum>0">
        <el-form-item
          label="赠送网管课课酬"
          prop="givePracticeSalarySettlement.salarySettlementType"
          :rules="[{required: true, message: '请选择赠送网管课课酬'}]"
        >
          <el-select
            style="width: 240px !important"
            v-model.trim="
              salaryForm.givePracticeSalarySettlement.salarySettlementType
            "
            placeholder="请选择赠送网管课课酬"
            clearable
            :disabled="isDisabled"
          >
            <el-option label="自定义课酬" value="FIXED_SALARY"></el-option>
            <el-option label="标准课酬" value="TEACHER_DEFAULT"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="自定义课时课酬"
          prop="givePracticeSalarySettlement.settlementValue"
          v-if="
            salaryForm.givePracticeSalarySettlement.salarySettlementType ==
            'FIXED_SALARY'&&payForm.giveCourseType=='PRACTICE'&&payForm.giveCourseNum>0
          "
        >
          <el-input
            v-model.number="
              salaryForm.givePracticeSalarySettlement.settlementValue
            "
            type="number"
            style="width: 240px"
            placeholder="自定义课时课酬"
            :disabled="isDisabled"
          >
            <template slot="append">课时/元</template>
          </el-input>
        </el-form-item>
      </el-row>
    </el-form>
  </div>
</template>
<script>
export default {
  props: ["salaryForm", "payForm",'activeType','isDisabled'],
  data() {
    return {};
  },
  mounted() {},
  methods: {},
  computed: {
    courseTeachModeOnline() {
      return (this.payForm?.teachMode == -1 ||  this.payForm?.teachMode == 0)&&this.payForm?.courseType=='VIP';
    },
    courseTeachModeOffline() {
       return (this.payForm?.teachMode == -1 ||  this.payForm?.teachMode == 1)&&this.payForm?.courseType=='VIP';
    },
    giveCourseTeachModeOnline() {
       return (this.payForm?.giveTeachMode == -1 ||  this.payForm?.giveTeachMode == 0)&&this.payForm?.fullMinusCourseTimes>0&&this.payForm?.giveCourseType=='VIP'&&this.payForm?.giveCourseNum>0;
    },
    giveCourseTeachModeOffline() {
     return (this.payForm?.giveTeachMode == -1 ||  this.payForm?.giveTeachMode == 1)&&this.payForm?.fullMinusCourseTimes>0&&this.payForm?.giveCourseType=='VIP'&&this.payForm?.giveCourseNum>0;
    },
  },
};
</script>
<style lang="scss" scoped>
.baseMsg {
  margin: 30px 0;
}
</style>
