Quellcode durchsuchen

01/13 21:03

建团和跨团调整声部整合完毕
mo vor 5 Jahren
Ursprung
Commit
972053b723
2 geänderte Dateien mit 267 neuen und 88 gelöschten Zeilen
  1. 242 70
      src/views/teamBuild/components/teamSoundMoney.vue
  2. 25 18
      src/views/teamBuild/index.vue

+ 242 - 70
src/views/teamBuild/components/teamSoundMoney.vue

@@ -77,6 +77,7 @@
                            multiple
                            clearable
                            filterable
+                           @change="changezhonglei(scope.row)"
                            collapse-tags>
                   <el-option v-for="(item,index) in scope.row.goodsList"
                              :key='index'
@@ -99,14 +100,17 @@
         </el-table-column>
         <el-table-column label="乐器提供方式"
                          align="center"
-                         prop="fangshi"
-                         width="180">
+                         prop="fangshi">
           <template slot-scope="scope">
             <div>
               <!-- <div class="chiose"
                   >选择</div> -->
-              <span v-if="scope.row.fangshi">{{scope.row.fangshi | fangshiFilter(scope.row.fangshiprice)}}</span>
-              <el-popover placement="bottom"
+              <div style='white-space:pre'
+                   v-if="scope.row.fangshi.length >0">{{scope.row.fangshi | fangshiFilter(scope.row)}}</div>
+              <i class='el-icon-edit'
+                 @click="setGiveMode(scope.row)">
+              </i>
+              <!-- <el-popover placement="bottom"
                           v-model="scope.row.provideVisible"
                           v-if='scope.row.type == 1'>
                 <i class='el-icon-edit'
@@ -127,14 +131,11 @@
                           v-model="scope.row.fangshiprice"
                           style='width:180px; margin-top:20px'></el-input>
                 <div style="text-align: right; margin-top: 20px">
-                  <!-- <el-button size="mini"
-                             type="text"
-                             @click="scope.row.provideVisible = false">取消</el-button> -->
                   <el-button type="primary"
                              size="mini"
                              @click="scope.row.provideVisible  = false">确定</el-button>
                 </div>
-              </el-popover>
+              </el-popover> -->
             </div>
           </template>
         </el-table-column>
@@ -254,7 +255,7 @@
                  id: this.activeSoundList[item].id, //声部id
                  visible: false, // 当前乐器提供方式的pop提示框显示隐藏 -->
               <el-checkbox :label="sound.id"
-                           @change="checkinlist({'id':sound.id,'sound':sound.name,'jihua':0,'yuji':0,'zhonglei':[],'fangshi':'','fangshiprice':1500,'jiaopu':'','type':1,'typeVisible':false,'provideVisible':false,'markVisible':false,'goodsList':[],'markList':[],'markChioseList':[]})"
+                           @change="checkinlist({'id':sound.id,'sound':sound.name,'jihua':0,'yuji':0,'zhonglei':[],'fangshi':[],'fangshiprice':1500,'jiaopu':'','type':1,'typeVisible':false,'provideVisible':false,'markVisible':false,'goodsList':[],'markList':[],'markChioseList':[]})"
                            v-for="(sound,indexs) in item.subjects"
                            :key="indexs">{{sound.name }}</el-checkbox>
             </el-checkbox-group>
@@ -338,57 +339,75 @@
     <el-dialog tilte='请选择乐器的提供方式及减免金额'
                width="800px"
                :visible.sync="reductionVisible">
-      <div class="reductionWrap">
-        <div class="lineWrap">
-          <div class="item">乐器</div>
-          <div class="item">提供方式</div>
-          <div class="item">提供金额</div>
-          <div class="item">减免金额</div>
-        </div>
-
-        <div class="lineWrap">
-          <div class="item">乐器名</div>
-          <div class="item">
-            <el-checkbox></el-checkbox>
-            团购
-          </div>
-          <div class="item">
-            <el-input style="width:80%"></el-input>
-          </div>
-          <div class="item">
-            <el-input style="width:80%"></el-input>
+      <div v-if="editSound&&editSound.fangshi.length >0">
+        <div class="reductionWrap"
+             v-for="(item,index) in editSound.fangshi"
+             :key='index'>
+          <div class="lineWrap">
+            <div class="item">{{ item.shopName}}</div>
+            <div class="item">提供方式</div>
+            <div class="item">提供方式对应金额</div>
+            <div class="item">减免金额</div>
           </div>
-        </div>
 
-        <div class="lineWrap">
-          <div class="item"></div>
-          <div class="item">
-            <el-checkbox></el-checkbox>
-            租赁
-          </div>
-          <div class="item">
-            <el-input style="width:80%"></el-input>
-          </div>
-          <div class="item">
-            <el-input style="width:80%"></el-input>
-          </div>
-        </div>
+          <div class="lineWrap">
+            <div class="item"></div>
+            <div class="item">
+              <el-checkbox v-model="item.mode.isGROUP"></el-checkbox>
+              团购
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        v-model="item.mode.price"></el-input>
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        v-model="item.mode.GROUP"></el-input>
+            </div>
 
-        <div class="lineWrap">
-          <div class="item"></div>
-          <div class="item">
-            <el-checkbox></el-checkbox>
-            自备
           </div>
-          <div class="item">
-            <el-input style="width:80%"></el-input>
+
+          <div class="lineWrap">
+            <div class="item"></div>
+            <div class="item">
+              <el-checkbox v-model="item.mode.isLEASE"></el-checkbox>
+              租赁
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        v-model="item.mode.depositFee"></el-input>
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        v-model="item.mode.LEASE"></el-input>
+            </div>
+
           </div>
-          <div class="item">
-            <el-input style="width:80%"></el-input>
+
+          <div class="lineWrap">
+            <div class="item"></div>
+            <div class="item">
+              <el-checkbox v-model="item.mode.isFREE"></el-checkbox>
+              免费
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        disabled></el-input>
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        v-model="item.mode.FREE"></el-input>
+            </div>
+
           </div>
         </div>
       </div>
 
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button type="primary"
+                   @click="resetSoundItem">确 定</el-button>
+      </div>
     </el-dialog>
   </div>
 </template>
@@ -399,7 +418,7 @@ export default {
   name: 'teamSoundMoney',
   data () {
     return {
-      reductionVisible: true,
+      reductionVisible: false,
       previewVisible: false, // 乐团预览
       dialogTableVisible: false,
       soundList: [],
@@ -416,12 +435,12 @@ export default {
       isNullFangshi: true,
       Fsearch: null,
       Frules: null,
+      editSound: null
     }
   },
   created () {
     // 判断是否带缓存参数
     this.init()
-
   },
   activated () {
     // 判断是否带缓存参
@@ -448,7 +467,7 @@ export default {
               if (res.code == 200) {
                 this.activeSoundList = res.data.map(item => {
                   // this.soundLists[0].push(item.subjectId)
-                  let obj = { 'id': item.id, 'sound': item.name, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': item.kitGroupPurchaseType, 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
+                  let obj = { 'id': item.id, 'sound': item.name, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': [], 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
                   // this.checkinlist(obj);
                   return obj;
                 })
@@ -472,10 +491,51 @@ export default {
             this.teamid = this.$route.query.id;
             findMusicGroupSubjectInfo({ musicGroupId: this.teamid }).then(res => {
               if (res.code == 200) {
-
+                // console.log(res.data)
                 this.activeSoundList = res.data.musicGroupSubjectPlans.map(item => {
-                  // this.soundLists[0].push(item.subjectId)
-                  let obj = { 'id': item.subjectId, 'sound': item.subName, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': item.kitGroupPurchaseType, 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
+                  let fangshi = []
+                  res.data.musicGroupSubjectGoodsGroups.forEach(sub => {
+                    if (sub.subjectId == item.subjectId && sub.type == 'INSTRUMENT') {
+                      let FREE, LEASE, GROUP;
+                      let isFREE = false
+                      let isLEASE = false
+                      let isGROUP = false
+                      let depositFee = sub.depositFee
+                      let price = sub.price
+                      if (sub.kitGroupPurchaseTypeJson) {
+                        let expectJson = JSON.parse(sub.kitGroupPurchaseTypeJson);
+
+                        if (expectJson && expectJson.FREE) {
+                          FREE = expectJson.FREE
+                          isFREE = true
+                        }
+                        if (expectJson && expectJson.LEASE) {
+                          LEASE = expectJson.LEASE
+                          isLEASE = true;
+                        }
+                        if (expectJson && expectJson.GROUP) {
+                          GROUP = expectJson.GROUP
+                          isGROUP = true
+                        }
+                      }
+
+                      fangshi.push({
+                        shopName: sub.name,
+                        id: sub.goodsIdList,
+                        mode: {
+                          'FREE': FREE || 0,
+                          'GROUP': GROUP || 0,
+                          'LEASE': LEASE || 0,
+                          'depositFee': depositFee || 0, // 保证金
+                          'price': price || 0,// 团购价
+                          'isFREE': isFREE,
+                          'isGROUP': isGROUP,
+                          'isLEASE': isLEASE,
+                        }
+                      })
+                    }
+                  })
+                  let obj = { 'id': item.subjectId, 'sound': item.subName, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': fangshi, 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
                   this.checkinlist(obj)
                   return obj;
                 })
@@ -607,6 +667,7 @@ export default {
     // 根据声部id获取可选乐器种类
     chioseType (row) {
       // 根据id查询可选类型种类
+
       let id = row.id;
       // 'subjectId': id, ' type'='INSTRUMENT'
       getGoods({ 'subjectId': id, 'type': 'INSTRUMENT' }).then(res => {
@@ -619,6 +680,10 @@ export default {
     closechioseType (row) {
       row.typeVisible = false;
     },
+    // 更改乐器可选规格重置提供方式
+    changezhonglei (row) {
+      row.fangshi = []
+    },
     // 根据声部id查询可选教辅
     chioseMark (row) {
       row.markVisible = true
@@ -720,15 +785,38 @@ export default {
                 goodsItem = goods
               }
             })
+            let kitGroupPurchaseTypeJson = ''
+            let price, depositFee;
+            active.fangshi.forEach(fs => {
+              if (fs.id == zl) {
+                price = fs.mode.price
+                depositFee = fs.mode.depositFee
+                let types = {}
+                if (fs.mode.isFREE) {
+                  types.FREE = fs.mode.FREE
+                }
+                if (fs.mode.isGROUP) {
+                  types.GROUP = fs.mode.GROUP
+                }
+                if (fs.mode.isLEASE) {
+                  types.LEASE = fs.mode.LEASE
+                }
+                kitGroupPurchaseTypeJson = JSON.stringify(types)
+              }
+            })
             let some = {
               subjectId: active.id,
               type: 'INSTRUMENT',
               goodsIdList: zl,
               name: goodsItem.name,
-              price: goodsItem.groupPurchasePrice
+              // price: goodsItem.groupPurchasePrice,
+              kitGroupPurchaseTypeJson,
+              price,
+              depositFee
             }
             obj.musicGroupSubjectGoodsGroups.push(some);
           })
+
           // 附件
           active.markList.forEach(mark => {
             if (mark.goods.length >= 1) {
@@ -755,7 +843,7 @@ export default {
           let item = {
             expectedStudentNum: active.jihua,
             fee: active.yuji,
-            kitGroupPurchaseType: active.fangshi,
+            // kitGroupPurchaseType: active.fangshi,
             subName: active.sound,
             subjectId: active.id,
             depositFee// depositFee  只有租赁才有
@@ -795,12 +883,36 @@ export default {
                 goodsItem = goods
               }
             })
+            let kitGroupPurchaseTypeJson = ''
+            let price, depositFee;
+            active.fangshi.forEach(fs => {
+              if (fs.id == zl) {
+                price = fs.mode.price
+                depositFee = fs.mode.depositFee
+                let types = {}
+
+                if (fs.mode.isFREE) {
+                  types.FREE = fs.mode.FREE
+                }
+                if (fs.mode.isGROUP) {
+                  types.GROUP = fs.mode.GROUP
+                }
+                if (fs.mode.isLEASE) {
+                  types.LEASE = fs.mode.LEASE
+                }
+                kitGroupPurchaseTypeJson = JSON.stringify(types)
+
+              }
+            })
             let some = {
               subjectId: active.id,
               type: 'INSTRUMENT',
               goodsIdList: zl,
               name: goodsItem.name,
-              price: goodsItem.groupPurchasePrice
+              kitGroupPurchaseTypeJson,
+              price,
+              depositFee
+              // price: goodsItem.groupPurchasePrice
             }
             obj.musicGroupSubjectGoodsGroups.push(some);
           })
@@ -832,7 +944,7 @@ export default {
           let item = {
             expectedStudentNum: active.jihua,
             fee: active.yuji,
-            kitGroupPurchaseType: active.fangshi,
+            // kitGroupPurchaseType: active.fangshi,
             subName: active.sound,
             subjectId: active.id,
             depositFee: depositFee // depositFee  只有租赁才有
@@ -894,6 +1006,53 @@ export default {
           })
         }
       })
+    },
+    // 设置乐器提供方式
+    setGiveMode (row) {
+      // goodsList
+      if (row.zhonglei.length <= 0) {
+        this.$message.error('请先选择乐器规格')
+        return
+      }
+      // row.fangshi = []
+      // row.zhonglei
+      // row.goodsList
+      if (row.fangshi[0] && row.fangshi[0].mode) {
+      } else {
+        for (let i in row.goodsList) {
+          for (let j in row.zhonglei) {
+
+            if (row.goodsList[i].id == row.zhonglei[j]) {
+
+              row.fangshi.push({
+                shopName: row.goodsList[i].name,
+                id: row.goodsList[i].id,
+                mode: {
+                  'FREE': 0,
+                  'GROUP': 0,
+                  'LEASE': 0,
+                  'depositFee': 0, // 保证金
+                  'price': 0,// 团购价
+                  'isFREE': false,
+                  'isGROUP': false,
+                  'isLEASE': false,
+                }
+              })
+            }
+          }
+        }
+      }
+
+      this.editSound = row;
+      this.reductionVisible = true
+    },
+    resetSoundItem () {
+      for (let i in this.activeSoundList) {
+        if (this.activeSoundList[i].id == this.editSound.id) {
+          this.activeSoundList[i].id = this.editSound.id
+          this.reductionVisible = false
+        }
+      }
     }
   },
   filters: {
@@ -918,16 +1077,29 @@ export default {
     },
     fangshiFilter (val, price) {
       let str = ''
-      if (val == 'FREE') {
-        str = '免费'
-        return str;
-      } else if (val == 'GROUP') {
-        str = '团购'
-        return str
-      } else if (val == 'LEASE') {
-        str = '借用'
+      for (let i in val) {
+        str += `${val[i].shopName}:`
+        if (val[i].mode.isFREE) {
+          str += `免费:0,减免金额${val[i].mode['FREE']}\n`
+        }
+        if (val[i].mode.isGROUP) {
+          str += `团购:${val[i].mode.price},减免金额${val[i].mode['GROUP']}\n`
+        }
+        if (val[i].mode.isLEASE) {
+          str += `租赁:${val[i].mode.depositFee},减免金额${val[i].mode['FREE']}\n`
+        }
       }
-      return str + '费用:' + price
+      // if (val == 'FREE') {
+      //   str = '免费'
+      //   return str;
+      // } else if (val == 'GROUP') {
+      //   str = '团购'
+      //   return str
+      // } else if (val == 'LEASE') {
+      //   str = '借用'
+      // }
+      // str = str.substring(0, str.length - 1)
+      return str
     },
     goodsFilter (val, list) {
       if (list.length <= 0) {

+ 25 - 18
src/views/teamBuild/index.vue

@@ -88,26 +88,33 @@ export default {
   },
   created () {
     // 判断 是新建乐团还是修改乐团 
-    this.teamStatus = this.$route.query.type;
-    if (this.$route.query.teamList) {
-      this.getTeamList = this.$route.query.teamList
-    }
-    // 判断是否带缓存参数
-    if (this.$route.query.search) {
-      this.Fsearch = this.$route.query.search;
-    }
-    if (this.$route.query.rules) {
-      this.Frules = this.$route.query.rules
-    }
-
-    if (this.teamStatus == 'newTeam') {
-      // 新建团
-      this.pageName = '建团申请'
-    } else {
-      this.pageName = '乐团修改'
-    }
+    this.init()
+  },
+  activated () {
+    this.activeIndex = 0
+    this.init()
   },
   methods: {
+    init () {
+      this.teamStatus = this.$route.query.type;
+      if (this.$route.query.teamList) {
+        this.getTeamList = this.$route.query.teamList
+      }
+      // 判断是否带缓存参数
+      if (this.$route.query.search) {
+        this.Fsearch = this.$route.query.search;
+      }
+      if (this.$route.query.rules) {
+        this.Frules = this.$route.query.rules
+      }
+
+      if (this.teamStatus == 'newTeam') {
+        // 新建团
+        this.pageName = '建团申请'
+      } else {
+        this.pageName = '乐团修改'
+      }
+    },
     chiosetab (val) {
       this.activeIndex = val;
     },