mo преди 4 години
родител
ревизия
6d88a2d623

+ 12 - 0
src/views/teamDetail/components/modals/class-pay-list-item.vue

@@ -113,6 +113,7 @@ export default {
         paymentPattern: null,
       },
       other: {},
+      
     };
   },
   mounted() {
@@ -237,7 +238,18 @@ export default {
         return 'error';
       }
     },
+   
   },
+   watch:{
+      'payInfo':{
+        deep:true,
+        immediate:true,
+         handler(newName, oldName) {
+          this.syncAllMoney();
+          // this.priceChange()
+        },
+      }
+    }
 };
 </script>
 <style lang="scss" scoped>

+ 21 - 9
src/views/teamDetail/components/modals/class-pay-list.vue

@@ -4,11 +4,9 @@
     title="课程时长设置"
     type="info" :closable='false'>
   </el-alert>
-    <el-form :mode='courseTimeForm' :inline='true' style="margin-top:20px;">
+    <el-form :model='courseTimeForm' ref='courseTimeForms' :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">
+       :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>
@@ -47,6 +45,8 @@
         :studentSubmitedData="studentSubmitedData"
         :classIdList="classIdList"
         :classGroupStudents="classGroupStudents"
+        
+        :selectPrices='classCourseMinuteMap'
         @close="showLastVisable = false"
         v-if="showLastVisable"
 
@@ -89,7 +89,8 @@ export default {
         timeList:[]
       },
       organId:'',
-      organCourseTime:{}
+      organCourseTime:{},
+      classCourseMinuteMap:{}
     };
   },
   async mounted(){
@@ -133,6 +134,10 @@ export default {
         name:'',
         seleched:this.studentList.map(stu=> {return stu.userId})
       }
+    this.courseTimeForm.timeList.map(item=>{
+     this.classCourseMinuteMap[item.type]=item.value
+    })
+    console.log(this.classCourseMinuteMap)
     this.showLastVisable = true
     },
     close() {
@@ -146,6 +151,8 @@ export default {
         .map((item) => item.$refs.form || item);
     },
     gotoLast() {
+       this.$refs.courseTimeForms.validate(_=>{
+        if(_){
       const forms = this.getForms();
       
       let musicGroupPaymentCalenderDtos = []
@@ -164,9 +171,13 @@ export default {
       if(arr.length>0){
         return
       }
-      // 弹出最后一页
-      this.musicGroupPaymentCalenderDtos = musicGroupPaymentCalenderDtos
+     
+           this.musicGroupPaymentCalenderDtos = musicGroupPaymentCalenderDtos
       this.init()
+        }
+      })
+      // 弹出最后一页
+     
            
     },
     submitResetClass(){
@@ -186,10 +197,11 @@ export default {
     },
     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
+         let courseCurrentPrice =val?val* this.payInfo[[k]][item.type].unitPrice:0
+         let courseTotalMinuties = val?val*this.payInfo[[k]][item.type].courseTotalNum:0
            this.$emit('resetPayInfo',item.type,courseCurrentPrice,courseTotalMinuties)
         }
       }

+ 30 - 42
src/views/teamDetail/components/modals/classroom-setting.vue

@@ -1,12 +1,6 @@
 <template>
   <div>
-    <el-form
-      :model="form"
-      inline
-      ref="form"
-      label-suffix=": "
-      label-width="130px"
-    >
+    <el-form :model="form" inline ref="form" label-suffix=": " label-width="130px">
       <el-row v-if="classType == 5">
         <el-form-item
           label="班级名称"
@@ -90,9 +84,7 @@
     </el-form>
     <div slot="footer" class="dialog-footer" v-if="classType != 5">
       <el-button @click="$listeners.close">取 消</el-button>
-      <el-button type="primary" v-if="!isEmpty" @click="submit"
-        >确 定</el-button
-      >
+      <el-button type="primary" v-if="!isEmpty" @click="submit">确 定</el-button>
     </div>
   </div>
 </template>
@@ -107,8 +99,8 @@ import {
 } from "@/api/buildTeam";
 import courseItem from "./classroom-setting-item";
 import { classTimeList } from "@/utils/searchArray";
-import MusicStore from '@/views/resetTeaming/store'
-import { queryByOrganIdAndCourseType } from '@/views/resetTeaming/api'
+import MusicStore from "@/views/resetTeaming/store";
+import { queryByOrganIdAndCourseType } from "@/views/resetTeaming/api";
 import { isEmpty } from "lodash";
 
 const classTimeListByType = {};
@@ -150,7 +142,7 @@ export default {
     "musicGroupPaymentCalenderDtos",
     "classIdList",
     "classGroupStudents",
-    "selectPrices"
+    "selectPrices",
   ],
   components: {
     courseItem,
@@ -196,27 +188,21 @@ export default {
       return isEmpty(this.form.classs);
     },
     musicGroup() {
-      return MusicStore.state.musicGroup
+      return MusicStore.state.musicGroup;
     },
   },
   async mounted() {
     try {
-      await MusicStore.dispatch('getBaseInfo', {
-        data: { musicGroupId: this.musicGroupId }
-      })
+      await MusicStore.dispatch("getBaseInfo", {
+        data: { musicGroupId: this.musicGroupId },
+      });
       const res = await queryByOrganIdAndCourseType({
-        organId: this.musicGroup.organId
-      })
-      this.prices = res.data
+        organId: this.musicGroup.organId,
+      });
+      this.prices = res.data;
     } catch (error) {}
     this.setCourseTypeListByName();
     this.formatClasss();
-    // console.log("activeType", this.activeType);
-    // console.log("courseTypeList", this.courseTypeList);
-    // console.log("detail", this.detail);
-    // console.log("studentSubmitedData", this.studentSubmitedData);
-    // console.log("classType", this.classType);
-    // console.log("cooperationList", this.cooperationList);
   },
   methods: {
     setCourseTypeListByName() {
@@ -227,6 +213,7 @@ export default {
       this.courseTypeListByName = courseTypeListByName;
     },
     async formatClasss() {
+     
       if (this.detail) {
         let coreid = "";
         const assistant = [];
@@ -250,31 +237,35 @@ export default {
         return;
       }
 
-      try {
-        let res;
-        if (this.classType == 5) {
-          res = await findClassCourseMinute(this.classIdList);
-        } else {
+      let res = {};
+      if (this.classType == 5) {
+        // res = await findClassCourseMinute(this.classIdList);
+        res.data = this.selectPrices;
+        
+      } else {
+        try {
           res = await getMusicCourseSettingsWithStudents({
             musicGroupId: this.musicGroupId,
             studentIds,
             classGroupId,
           });
+        } catch (error) {
+          console.log(error);
         }
-
-        if (!res) return;
+        }
+        console.log(res);
+        if (Object.keys(res).length <= 0) return;
         this.musicCourseSettings = res.data;
 
         const classs = {};
         for (const item of this.courseTypeList) {
           const key = item.value;
           if (res.data[key]) {
-            console.log(this.selectPrices)
             classs[key] = {
               courseTotalMinuties: res.data[key],
               cycle: [
                 {
-                  time: (this.selectPrices ? this.selectPrices[key] : undefined),
+                  time: this.selectPrices ? this.selectPrices[key] : undefined,
                 },
               ],
             };
@@ -282,9 +273,7 @@ export default {
         }
         this.$set(this.form, "classs", classs);
         // this.courseTimes = courseTimes
-      } catch (error) {
-        console.log(error);
-      }
+      
     },
     submit() {
       this.$refs.form.validate(async (valid) => {
@@ -342,11 +331,10 @@ export default {
                 obj.classGroup4MixDtos = list;
                 obj.classGroupIds = this.classIdList;
                 obj.studentIds = this.studentSubmitedData.seleched;
-                obj.classGroupStudents = this.classGroupStudents
-                // console.log(obj);
+                obj.classGroupStudents = this.classGroupStudents;
+                obj.classCourseMinuteMap  = this.selectPrices
                 await mergeClassSplitClassAffirm(obj);
-                let grend = this.$parent.$parent.$parent.$parent.$parent.$parent
-                  .$parent;
+                let grend = this.$parent.$parent.$parent.$parent.$parent.$parent.$parent;
                 grend.closeStudentReset();
                 grend.getList();
                 return;