|  | @@ -1,5 +1,19 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  | +     <el-alert
 | 
	
		
			
				|  |  | +    title="课程时长设置"
 | 
	
		
			
				|  |  | +    type="info" :closable='false'>
 | 
	
		
			
				|  |  | +  </el-alert>
 | 
	
		
			
				|  |  | +    <el-form :mode='courseTimeForm' :inline='true' style="margin-top:20px;">
 | 
	
		
			
				|  |  | +      <el-form-item v-for="(item,index) in courseTimeForm.timeList" :key="index" :label="item.label" 
 | 
	
		
			
				|  |  | +       :prop="'timeList.' + index + '.value'" :rules="{
 | 
	
		
			
				|  |  | +      required: true, message: '请选择课程时长', trigger: 'blur'
 | 
	
		
			
				|  |  | +    }" label-width="80px">
 | 
	
		
			
				|  |  | +        <el-select clearable v-model="item.value" placeholder="请选择课程时长" @change="(val)=>setCourseTime(item,val)">
 | 
	
		
			
				|  |  | +          <el-option v-for="(time,index) in item.list" :key='index' :value='time' :label="time"></el-option>
 | 
	
		
			
				|  |  | +        </el-select>
 | 
	
		
			
				|  |  | +       </el-form-item>
 | 
	
		
			
				|  |  | +    </el-form>
 | 
	
		
			
				|  |  |      <classPayListItem
 | 
	
		
			
				|  |  |        :payInfo="payInfo"
 | 
	
		
			
				|  |  |        ref="base"
 | 
	
	
		
			
				|  | @@ -50,8 +64,11 @@ import classNewInfo from "./class-new-info";
 | 
	
		
			
				|  |  |  import classPayListItem from './class-pay-list-item'
 | 
	
		
			
				|  |  |  import classSetting from './classroom-setting'
 | 
	
		
			
				|  |  |  import  {getCourseType} from "@/utils/utils"
 | 
	
		
			
				|  |  | +import {courseType,classTime} from '@/constant'
 | 
	
		
			
				|  |  | +import { getOrganCourseDurationSettings} from '@/api/buildTeam'
 | 
	
		
			
				|  |  | +import MusicStore from '@/views/resetTeaming/store'
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  | -  props: ["form", "payInfo", "courseTypesByType","classIdList"],
 | 
	
		
			
				|  |  | +  props: ["form", "payInfo", "courseTypesByType","classIdList","addCourseType"],
 | 
	
		
			
				|  |  |    components: {
 | 
	
		
			
				|  |  |      classNewInfo,
 | 
	
		
			
				|  |  |      classPayListItem,
 | 
	
	
		
			
				|  | @@ -67,11 +84,34 @@ export default {
 | 
	
		
			
				|  |  |        activeType:'',
 | 
	
		
			
				|  |  |        courseTypeList:[],
 | 
	
		
			
				|  |  |        studentSubmitedData:{},
 | 
	
		
			
				|  |  | -      classGroupStudents:[]
 | 
	
		
			
				|  |  | +      classGroupStudents:[],
 | 
	
		
			
				|  |  | +      courseTimeForm:{
 | 
	
		
			
				|  |  | +        timeList:[]
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      organId:'',
 | 
	
		
			
				|  |  | +      organCourseTime:{}
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  async mounted(){
 | 
	
		
			
				|  |  | +    // 1.查询该分部下得所有课程时长
 | 
	
		
			
				|  |  | +    // 2.组成select需要得选项并且指定
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  
 | 
	
		
			
				|  |  | +         this.teamid = this.$route.query.id;
 | 
	
		
			
				|  |  | +        MusicStore.dispatch('getBaseInfo', {
 | 
	
		
			
				|  |  | +          data: { musicGroupId: this.teamid }
 | 
	
		
			
				|  |  | +        }).then(async (res) => {
 | 
	
		
			
				|  |  | +          this.organId =res.data.musicGroup.organId
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +          try{
 | 
	
		
			
				|  |  | +           const res = await getOrganCourseDurationSettings({organId:this.organId})
 | 
	
		
			
				|  |  | +           this.organCourseTime = res.data;
 | 
	
		
			
				|  |  | +             
 | 
	
		
			
				|  |  | +           this.setTimeList(res.data)
 | 
	
		
			
				|  |  | +           
 | 
	
		
			
				|  |  | +          }catch{}
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  |      init(){
 | 
	
		
			
				|  |  |         this.$store.dispatch('setTeachers')
 | 
	
	
		
			
				|  | @@ -88,9 +128,7 @@ export default {
 | 
	
		
			
				|  |  |        this.classGroupStudents = classGroupStudents
 | 
	
		
			
				|  |  |        this.teamid = this.$route.query.id
 | 
	
		
			
				|  |  |        this.activeType = this.form.classList[0].type
 | 
	
		
			
				|  |  | -      console.log(this.form.classList)
 | 
	
		
			
				|  |  |        this.courseTypeList = getCourseType(this.activeType) 
 | 
	
		
			
				|  |  | -      console.log('courseTypeList:',this.courseTypeList)
 | 
	
		
			
				|  |  |        this.studentSubmitedData = {
 | 
	
		
			
				|  |  |          name:'',
 | 
	
		
			
				|  |  |          seleched:this.studentList.map(stu=> {return stu.userId})
 | 
	
	
		
			
				|  | @@ -109,16 +147,23 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      gotoLast() {
 | 
	
		
			
				|  |  |        const forms = this.getForms();
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  |        let musicGroupPaymentCalenderDtos = []
 | 
	
		
			
				|  |  |        // 判断有没有缴费项目(因为又可能没有)
 | 
	
		
			
				|  |  |        // let flag = false
 | 
	
		
			
				|  |  | +      let arr = []
 | 
	
		
			
				|  |  |        for (const form of forms) {
 | 
	
		
			
				|  |  |           let data =  form.getData()
 | 
	
		
			
				|  |  | -        if(data){
 | 
	
		
			
				|  |  | +        if(data=='error'){
 | 
	
		
			
				|  |  | +          arr.push(data)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(data&&data!='error'){
 | 
	
		
			
				|  |  |            musicGroupPaymentCalenderDtos.push(data)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +      if(arr.length>0){
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        // 弹出最后一页
 | 
	
		
			
				|  |  |        this.musicGroupPaymentCalenderDtos = musicGroupPaymentCalenderDtos
 | 
	
		
			
				|  |  |        this.init()
 | 
	
	
		
			
				|  | @@ -126,6 +171,30 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      submitResetClass(){
 | 
	
		
			
				|  |  |        this.$refs.classSetting.submit()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    setTimeList(organCourseTime){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      this.addCourseType.map(course=>{
 | 
	
		
			
				|  |  | +        let arr = []
 | 
	
		
			
				|  |  | +      if(organCourseTime[course]){
 | 
	
		
			
				|  |  | +         arr =organCourseTime[course].split(',')
 | 
	
		
			
				|  |  | +      }else {
 | 
	
		
			
				|  |  | +        arr = [classTime[course]]
 | 
	
		
			
				|  |  | +      } 
 | 
	
		
			
				|  |  | +        this.courseTimeForm.timeList.push({type:course,value:'',label:courseType[course],list:arr})
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    setCourseTime(item,val){
 | 
	
		
			
				|  |  | +      console.log(this.payInfo)
 | 
	
		
			
				|  |  | +      for(let k in this.payInfo){
 | 
	
		
			
				|  |  | +        if( this.payInfo[k][item.type]){
 | 
	
		
			
				|  |  | +         let courseCurrentPrice =val* this.payInfo[[k]][item.type].unitPrice
 | 
	
		
			
				|  |  | +         let courseTotalMinuties = val
 | 
	
		
			
				|  |  | +           this.$emit('resetPayInfo',item.type,courseCurrentPrice,courseTotalMinuties)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  };
 |