|  | @@ -101,24 +101,139 @@ const formatCourseScheduleInfo = courseScheduleInfo => {
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const setInstrumentResultAllFalse = instrumentResult => {
 | 
	
		
			
				|  |  | +  const list = [...setInstrumentResultAllFalse(instrumentResult)]
 | 
	
		
			
				|  |  | +  list.forEach(instrRes => {
 | 
	
		
			
				|  |  | +    instrRes.checked = false
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  | +  return list
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const formatMusicGroupSubjectGoodsGroupList = goodsGroupList => {
 | 
	
		
			
				|  |  |    let instrumentInfo = {}
 | 
	
		
			
				|  |  | +  let instrumentResult = []
 | 
	
		
			
				|  |  | +  const accessOries = []
 | 
	
		
			
				|  |  | +  const otherResult = []
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    for (const item of goodsGroupList) {
 | 
	
		
			
				|  |  |      if (item.type === 'INSTRUMENT') {
 | 
	
		
			
				|  |  |        let KGPTJ = item.kitGroupPurchaseTypeJson ? JSON.parse(item.kitGroupPurchaseTypeJson) : {}
 | 
	
		
			
				|  |  | -      for (const key of KGPTJ) {
 | 
	
		
			
				|  |  | +      for (const key in KGPTJ) {
 | 
	
		
			
				|  |  |          let tempItem = {...item}
 | 
	
		
			
				|  |  |          tempItem.marketPrice = tempItem.goodsList[0].marketPrice
 | 
	
		
			
				|  |  |          tempItem.kitType = key
 | 
	
		
			
				|  |  |          tempItem.coupon = KGPTJ[key]
 | 
	
		
			
				|  |  | +        if (instrumentInfo.id) {
 | 
	
		
			
				|  |  | +          tempItem.checked = false
 | 
	
		
			
				|  |  | +          if (key === 'GROUP') {
 | 
	
		
			
				|  |  | +            if (
 | 
	
		
			
				|  |  | +              (instrumentInfo.kitType == 'GROUP' && instrumentInfo.price < tempItem.price) ||
 | 
	
		
			
				|  |  | +              instrumentInfo.kitType == 'LEASE' ||
 | 
	
		
			
				|  |  | +              instrumentInfo.kitType == 'FREE'
 | 
	
		
			
				|  |  | +            ) {
 | 
	
		
			
				|  |  | +              instrumentResult.forEach(instrRes => {
 | 
	
		
			
				|  |  | +                instrRes.checked = false
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +              tempItem.checked = true
 | 
	
		
			
				|  |  | +              instrumentInfo = {
 | 
	
		
			
				|  |  | +                id: tempItem.id,
 | 
	
		
			
				|  |  | +                price: tempItem.price,
 | 
	
		
			
				|  |  | +                kitType: key
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          } else if(key == 'LEASE') {
 | 
	
		
			
				|  |  | +            if(instrumentInfo.kitType == 'LEASE' && instrumentInfo.price < tempItem.price) {
 | 
	
		
			
				|  |  | +                instrumentResult.forEach(instrRes => {
 | 
	
		
			
				|  |  | +                  instrRes.checked = false
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +                tempItem.checked = true
 | 
	
		
			
				|  |  | +                instrumentInfo = {
 | 
	
		
			
				|  |  | +                id: tempItem.id,
 | 
	
		
			
				|  |  | +                price: tempItem.price,
 | 
	
		
			
				|  |  | +                kitType: key
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          } else if(key == 'FREE') {
 | 
	
		
			
				|  |  | +              if(instrumentInfo.kitType == 'FREE' && instrumentInfo.price < tempItem.price) {
 | 
	
		
			
				|  |  | +              instrumentResult.forEach(instrRes => {
 | 
	
		
			
				|  |  | +                instrRes.checked = false
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +              tempItem.checked = true
 | 
	
		
			
				|  |  | +              instrumentInfo = {
 | 
	
		
			
				|  |  | +                id: tempItem.id,
 | 
	
		
			
				|  |  | +                price: tempItem.price,
 | 
	
		
			
				|  |  | +                kitType: key
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          tempItem.checked = true
 | 
	
		
			
				|  |  | +          instrumentInfo = {
 | 
	
		
			
				|  |  | +            id: tempItem.id,
 | 
	
		
			
				|  |  | +            price: tempItem.price,
 | 
	
		
			
				|  |  | +            kitType: key
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        instrumentResult.push(tempItem)
 | 
	
		
			
				|  |  | +        let goodsList = item.goodsList[0].goodsList ? item.goodsList[0].goodsList : []
 | 
	
		
			
				|  |  | +        const accessGoods = []
 | 
	
		
			
				|  |  | +        goodsList.forEach(i => {
 | 
	
		
			
				|  |  | +          i.checked = true
 | 
	
		
			
				|  |  | +          accessGoods.push(i)
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +    } else if(item.type === 'ACCESSORIES') {
 | 
	
		
			
				|  |  | +      item.checked = true
 | 
	
		
			
				|  |  | +      accessOries.push(item)
 | 
	
		
			
				|  |  | +    } else if(item.type === 'OTHER') {
 | 
	
		
			
				|  |  | +      otherResult.push(item)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +  if(instrumentResult.length > 0) {
 | 
	
		
			
				|  |  | +    instrumentResult.push({
 | 
	
		
			
				|  |  | +      id: -1,
 | 
	
		
			
				|  |  | +      kitType: 'owned',
 | 
	
		
			
				|  |  | +      name: '自备',
 | 
	
		
			
				|  |  | +      price: 0,
 | 
	
		
			
				|  |  | +      marketPrice: 0,
 | 
	
		
			
				|  |  | +      checked: false
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  return {
 | 
	
		
			
				|  |  | +    instrumentInfo,
 | 
	
		
			
				|  |  | +    instrumentResult,
 | 
	
		
			
				|  |  | +    accessOries,
 | 
	
		
			
				|  |  | +    otherResult,
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // if(accessOries.length > 0) { // 判断打包,有没有辅件
 | 
	
		
			
				|  |  | +    // if(tempInstrument) {
 | 
	
		
			
				|  |  | +    //   accessOries.forEach(item => {
 | 
	
		
			
				|  |  | +    //     if(tempInstrument[item.id] && tempInstrument[item.id] === 'ACCESSORIES') {
 | 
	
		
			
				|  |  | +    //       item.checked = true
 | 
	
		
			
				|  |  | +    //     } else {
 | 
	
		
			
				|  |  | +    //       item.checked = false
 | 
	
		
			
				|  |  | +    //     }
 | 
	
		
			
				|  |  | +    //   })
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  | +  // } else {
 | 
	
		
			
				|  |  | +    // let accessIds = querys.goodsIds ? querys.goodsIds.split(',') : null
 | 
	
		
			
				|  |  | +    // if(accessIds) {
 | 
	
		
			
				|  |  | +    //   this.accessGoods.forEach(item => {
 | 
	
		
			
				|  |  | +    //     if(accessIds.indexOf(String(item.id)) >= 0) {
 | 
	
		
			
				|  |  | +    //       item.checked = true
 | 
	
		
			
				|  |  | +    //     } else {
 | 
	
		
			
				|  |  | +    //       item.checked = false
 | 
	
		
			
				|  |  | +    //     }
 | 
	
		
			
				|  |  | +    //   })
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  | +  // }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const formatGoods = data => {
 | 
	
		
			
				|  |  |    const { courseScheduleInfo, musicGroupSubjectGoodsGroupList, musicGroupSubjectPlan, otherGoods, studentGoods } = data
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  console.log(formatMusicGroupSubjectGoodsGroupList(musicGroupSubjectGoodsGroupList))
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default {
 | 
	
	
		
			
				|  | @@ -160,6 +275,7 @@ export default {
 | 
	
		
			
				|  |  |          musicGroupId: this.musicGroupId,
 | 
	
		
			
				|  |  |          subjectId: id,
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  | +      .then(res => formatGoods(res.data))
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      submit() {
 | 
	
		
			
				|  |  |        this.$listeners.close()
 |