浏览代码

10/28 16:26

11
mo 4 年之前
父节点
当前提交
d3250f36b3

+ 3 - 1
src/views/accompanyManager/accompanys.vue

@@ -723,11 +723,13 @@ export default {
           this.courseData = res.data.rows;
           if (this.courseData.length > 0) {
             this.name = this.courseData[0].name;
+            this.expireForm.coursesExpireDate = this.courseData[0].coursesExpireDate.substring(0, 10);
             this.timers =
               this.courseData[0].coursesStartDate.substring(0, 10) +
               "至" +
               this.courseData[0].coursesExpireDate.substring(0, 10);
-            this.expireForm.coursesExpireDate = this.courseData[0].coursesExpireDate.substring(0, 10);
+
+
             let originalStartDate = this.courseData[0].coursesStartDate ? new Date(this.courseData[0].coursesStartDate) : new Date()
             let buyMonths = this.courseData[0].buyMonths
             let lastDayNum = nextMonthLastDay(originalStartDate.getFullYear(), (originalStartDate.getMonth() + buyMonths + 1))

+ 53 - 10
src/views/teamBuild/components/soundSetComponents/chioseMusic.vue

@@ -1,24 +1,39 @@
 <template>
   <div>
 
-    <div class="chioseMusic coreItemRow">
-      <p class="title">可选乐器1:</p>
+    <div class="chioseMusic coreItemRow"
+         v-for="(music,index) in item.chioseMusic">
+      <p class="title">可选乐器{{index+1}}:</p>
       <el-select style="width:180px"
-                 v-model="goods">
-        <el-option label="1"
-                   value="1"></el-option>
+                 v-model="music.musical"
+                 @change="(val)=>{chioseMusic(val,music)}">
+        <el-option v-for="(item,index) in item.goodsList"
+                   :key="index"
+                   :label="item.name"
+                   :value="item.id"></el-option>
       </el-select>
-      <el-radio-group v-model="radio"
+      <el-radio-group v-model="music.type"
                       class="marginLeft10">
-        <el-radio :label="3">团购</el-radio>
-        <el-radio :label="6">租赁</el-radio>
-        <el-radio :label="9">免费</el-radio>
+        <el-radio label="GROUP">团购</el-radio>
+        <el-radio label="LEASE">租赁</el-radio>
+        <el-radio label="FREE">免费</el-radio>
       </el-radio-group>
       <el-input type="number"
+                v-if="music.type == 'GROUP'"
                 class="marginLeft10"
+                v-model="music.groupPrice"
                 disabled
                 style="width:140px"> <template slot="append">元</template></el-input>
+      <el-input type="number"
+                v-else-if="music.type == 'LEASE'"
+                v-model="music.borrowPrice"
+                class="marginLeft10"
+                style="width:140px"> <template slot="append">元</template></el-input>
+      <div style="width:150px"
+           v-else></div>
       <i class="el-icon-close marginLeft10"
+         v-if="item.chioseMusic.length >1"
+         @click="deleteMusic(music)"
          style="font-size:20px; cursor: pointer;"></i>
     </div>
     <div class="coreItemRow">
@@ -27,18 +42,46 @@
                  plain
                  style="width:558px"
                  size="mini"
-                 icon="el-icon-plus">新增可选乐器</el-button>
+                 icon="el-icon-plus"
+                 @click="addMusic">新增可选乐器</el-button>
     </div>
   </div>
 </template>
 <script>
 export default {
+  props: ['item'],
   data () {
     return {
       radio: '',
       goods: ''
     }
+  },
+  mounted () { },
+  methods: {
+    chioseMusic (val, music) {
+
+
+      this.item.goodsList.map((some, index) => {
+        if (some.id == val) {
+          music.groupPrice = some.groupPurchasePrice
+          console.log(music)
+        }
+      })
+    },
+    addMusic () {
+      this.item.chioseMusic.push({ musical: '', type: 'GROUP', groupPrice: 0, borrowPrice: 1500 })
+      this.$emit('lookMusic')
+    },
+    deleteMusic (music) {
+
+      this.item.chioseMusic.forEach((element, index) => {
+        if (element.musical == music.musical) {
+          this.item.chioseMusic.splice(index, 1)
+        }
+      });
+    }
   }
+
 }
 </script>
 <style lang="scss" scoped>

+ 6 - 6
src/views/teamBuild/components/soundSetComponents/chioseSoundList.vue

@@ -3,7 +3,7 @@
 
     <div class="soundWrap">
 
-      <el-checkbox-group v-model.trim="activeSound">
+      <el-checkbox-group v-model.trim="activeSoundList">
         <div class="itemList">
           <div class="categroy"
                v-for="(item,index) in soundList"
@@ -18,7 +18,7 @@
       </el-checkbox-group>
 
     </div>
-    <p class="soundSubP">当前选择声部数:{{chioseSoundNum}}</p>
+    <p class="soundSubP">当前选择声部数:{{activeSoundList.length}}</p>
     <div class="btnWraps">
       <el-button @click="generates"
                  type="primary">
@@ -30,11 +30,11 @@
 </template>
 <script>
 export default {
-  props: ['soundList', 'childSoundList'],
+  props: ['soundList', 'childSoundList', 'activeSound'],
   data () {
     return {
       chioseSoundNum: '',
-      activeSound: [],
+      activeSoundList: this.activeSound,
     }
   },
   mounted () {
@@ -42,10 +42,10 @@ export default {
   },
   methods: {
     generates () {
-      this.$emit('chioseSound', this.activeSound)
+      this.$emit('chioseSound', this.activeSoundList)
     },
     changeCheck () {
-      console.log(this.activeSound)
+      console.log(this.activeSoundList)
     }
   }
 }

+ 130 - 10
src/views/teamBuild/components/teamSoundSet.vue

@@ -13,23 +13,39 @@
     <div class="coreWrap">
       <el-checkbox-group v-model="checkList"
                          @change='lookCheck'>
-        <el-collapse>
-          <el-collapse-item>
+        <el-collapse v-model="activeSound"
+                     accordion
+                     @change="changeActiveSound">
+          <el-collapse-item v-for="(item,index) in activeSoundList"
+                            :name="item.id"
+                            :key="index">
             <template slot="title">
               <div class="coreItemTitle">
-                <el-checkbox label="单簧管"
-                             value='1'></el-checkbox>
+                <el-checkbox :label="item.id">{{item.sound}}</el-checkbox>
               </div>
             </template>
             <div class="coreItem">
               <div class="coreItemRow">
                 <p class="title">计划招生人数:</p>
-                <el-input style="width:180px"></el-input>
+                <el-input style="width:180px"
+                          v-model="item.expectedStudentNum"></el-input>
               </div>
             </div>
-            <chioseMusic />
-            <el-divider></el-divider>
-            <chioseAccessory />
+            <chioseMusic :item="item"
+                         @lookMusic="lookMusic" />
+            <div class="coreItemRow">
+              <p class="title">教辅:</p>
+              <el-select style="width:558px!important;"
+                         v-model="item.markChioseList"
+                         clearable
+                         filterable
+                         multiple>
+                <el-option v-for="(item,index) in item.markList"
+                           :key="index"
+                           :label="item.name"
+                           :value="item.id"></el-option>
+              </el-select>
+            </div>
           </el-collapse-item>
 
         </el-collapse>
@@ -39,6 +55,7 @@
                :visible.sync="soundVisible"
                :modal-append-to-body="false">
       <chioseSoundList :soundList="soundList"
+                       :activeSound='activeSound'
                        @chioseSound="chioseSound" />
     </el-dialog>
   </div>
@@ -66,6 +83,7 @@ export default {
   components: { chioseMusic, chioseAccessory, chioseSoundList },
   data () {
     return {
+      topfor: null, // 第一页的数据
       chioseSoundNum: 0,
       PlannedCount: 0,
       checkList: [],
@@ -73,6 +91,10 @@ export default {
       Frules: null,
       soundList: [], // 接口返回的一级二级声部
       soundVisible: false, // 设置声部弹窗
+      childSoundList: [],
+      teamStatus: '',// 乐团状态
+      activeSoundList: [], //列表上的声部
+      activeSound: null, // 展开的列表
     }
   },
   mounted () {
@@ -81,6 +103,10 @@ export default {
   activated () { },
   methods: {
     init () {
+      // 获取第一页的数据
+      this.topfor = this.$store.getters.topinfo;
+      let type = this.topfor.type;
+      this.teamStatus = this.$route.query.type;
       if (this.$route.query.search) {
         this.Fsearch = this.$route.query.search;
       }
@@ -90,15 +116,108 @@ export default {
       getSoundTree({ tenantId: 1 }).then(res => {
         if (res.code == 200) {
           this.soundList = res.data.rows
+          if (this.teamStatus == "newTeam") {
+            getDefaultSubject({
+              chargeTypeId: type,
+              organId: this.topfor.section,
+              number: 1
+            }).then(res => {
+              if (res.code == 200) {
+                let activeSound = []
+                this.activeSoundList = res.data.map(item => {
+                  activeSound.push(item.id)
+                  return this.initSound(item);
+                });
+                this.activeSound = activeSound;
+
+                //  = arr;
+                // this.soundList.forEach((item, i) => {
+                //   item.subjects.forEach((some, j) => {
+                //     res.data.forEach((sub, x) => {
+                //       if (sub.id == some.id) {
+                //         this.soundLists[i].push(some.id);
+                //       }
+                //     });
+                //   });
+                // });
+                // 并且把所有soundLists 里面
+              }
+            });
+          }
         }
       });
+      getSubject({ tenantId: 1 }).then(res => {
+        if (res.code == 200) {
+          this.childSoundList = res.data
+        }
+      })
     },
     lookCheck (val) {
       console.log(val)
     },
     chioseSound (activeSound) {
-      console.log(activeSound)
+      // 同步数据
+      this.activeSound = activeSound;
+      let newSoundList = []
+
+      for (let i in this.childSoundList) {
+        if (activeSound.includes(this.childSoundList[i].id)) {
+          console.log(this.childSoundList[i])
+          newSoundList.push(this.initSound(this.childSoundList[i]))
+        }
+
+      }
+
+      let idList = this.activeSoundList.map(item => {
+        console.log(item)
+        return item.id
+      })
+      console.log(newSoundList, idList, this.activeSoundList)
+      for (let x in newSoundList) {
+        if (idList.includes(newSoundList[x].id)) {
+          console.log(x)
+          newSoundList[x] = this.activeSoundList[x]
+        }
+      }
+      this.activeSoundList = newSoundList
       this.soundVisible = false
+    },
+    initSound (item) {
+      let obj = {
+        id: item.id,
+        sound: item.name,
+        expectedStudentNum: item.expectedStudentNum,
+        chioseMusic: [{ musical: '', type: 'GROUP', groupPrice: 0, borrowPrice: 1500 }],
+        markChioseList: [],
+        goodsList: [],
+        markList: [],
+
+      }
+      return obj
+    },
+    changeActiveSound (val) {
+      this.activeSoundList.map(item => {
+        if (item.id == val) {
+          getSubjectGoods({ subjectId: item.id, chargeTypeId: this.topfor.type }).then(res => {
+            if (res.code == 200) {
+              let goodList = []
+              let markList = []
+              res.data.forEach(item => {
+                if (item.type == 'INSTRUMENT') {
+                  goodList.push(item)
+                } else if (item.type == 'ACCESSORIES') {
+                  markList.push(item)
+                }
+              })
+              item.goodsList = goodList;
+              item.markList = markList;
+            }
+          });
+        }
+      })
+    },
+    lookMusic () {
+      console.log(this.activeSoundList)
     }
   }
 }
@@ -126,9 +245,10 @@ export default {
   padding: 0 20px;
 }
 .coreItem {
-  padding: 25px 20px 0;
+  padding: 25px 0 0;
 }
 .coreItemRow {
+  padding: 0 20px;
   line-height: 50px;
   display: flex;
   flex-direction: row;