|  | @@ -7,19 +7,9 @@
 | 
	
		
			
				|  |  |        <el-form-item label="原教辅" prop="name">
 | 
	
		
			
				|  |  |          <span>{{originalAccessoriesGoods}}</span>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  | -      <!-- <el-form-item label="缴费时间" prop="name">
 | 
	
		
			
				|  |  | -        <el-date-picker
 | 
	
		
			
				|  |  | -          style="width: 100%"
 | 
	
		
			
				|  |  | -          v-model="form.time"
 | 
	
		
			
				|  |  | -          type="daterange"
 | 
	
		
			
				|  |  | -          range-separator="至"
 | 
	
		
			
				|  |  | -          start-placeholder="开始日期"
 | 
	
		
			
				|  |  | -          end-placeholder="结束日期">
 | 
	
		
			
				|  |  | -        </el-date-picker>
 | 
	
		
			
				|  |  | -      </el-form-item> -->
 | 
	
		
			
				|  |  |        <el-form-item label="更改声部" prop="name">
 | 
	
		
			
				|  |  |          <el-select
 | 
	
		
			
				|  |  | -          style="width: 100%"
 | 
	
		
			
				|  |  | +          style="width: 100%!important"
 | 
	
		
			
				|  |  |            v-model="form.subjectId"
 | 
	
		
			
				|  |  |            clearable
 | 
	
		
			
				|  |  |            @change="subjectChange"
 | 
	
	
		
			
				|  | @@ -34,7 +24,13 @@
 | 
	
		
			
				|  |  |          </el-select>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  |        <el-form-item label="更改乐器" prop="name">
 | 
	
		
			
				|  |  | -        <el-select style="width: 100%" v-model="form.musicalGoods" clearable placeholder="请选择乐器">
 | 
	
		
			
				|  |  | +        <el-select
 | 
	
		
			
				|  |  | +          style="width: 100%!important"
 | 
	
		
			
				|  |  | +          v-model="form.musicalGoods"
 | 
	
		
			
				|  |  | +          clearable
 | 
	
		
			
				|  |  | +          @change="musicalGoodsChange"
 | 
	
		
			
				|  |  | +          placeholder="请选择乐器"
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  |            <el-option
 | 
	
		
			
				|  |  |              v-for="item in musicalGoods"
 | 
	
		
			
				|  |  |              :key="item.id"
 | 
	
	
		
			
				|  | @@ -43,18 +39,23 @@
 | 
	
		
			
				|  |  |            </el-option>
 | 
	
		
			
				|  |  |          </el-select>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  | -      <el-form-item label="更换教辅" prop="name">
 | 
	
		
			
				|  |  | -        <el-select style="width: 100%" v-model="form.accessories" clearable placeholder="请选择教辅">
 | 
	
		
			
				|  |  | +      <el-form-item v-if="activeAccessories.length || groupList.length" label="更换教辅" prop="name">
 | 
	
		
			
				|  |  | +        <accessories
 | 
	
		
			
				|  |  | +          :list.sync="activeAccessories"
 | 
	
		
			
				|  |  | +          :groupList.sync="groupList"
 | 
	
		
			
				|  |  | +          @change="accessoriesChange"
 | 
	
		
			
				|  |  | +        />
 | 
	
		
			
				|  |  | +        <!-- <el-select style="width: 100%" v-model="form.accessories" clearable placeholder="请选择教辅">
 | 
	
		
			
				|  |  |            <el-option
 | 
	
		
			
				|  |  |              v-for="item in accessories"
 | 
	
		
			
				|  |  |              :key="item.id"
 | 
	
		
			
				|  |  |              :label="item.name"
 | 
	
		
			
				|  |  |              :value="item.id">
 | 
	
		
			
				|  |  |            </el-option>
 | 
	
		
			
				|  |  | -        </el-select>
 | 
	
		
			
				|  |  | +        </el-select> -->
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  |        <el-form-item label="支付差价" prop="name">
 | 
	
		
			
				|  |  | -        <span style="color: red;">0元</span>
 | 
	
		
			
				|  |  | +        <span style="color: red;">{{ spread }}元</span>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  |      </el-form>
 | 
	
		
			
				|  |  |      <div
 | 
	
	
		
			
				|  | @@ -68,6 +69,7 @@
 | 
	
		
			
				|  |  |        <el-button
 | 
	
		
			
				|  |  |          @click="cancel"
 | 
	
		
			
				|  |  |          type="danger"
 | 
	
		
			
				|  |  | +        v-if="detail.subjectChange"
 | 
	
		
			
				|  |  |        >取消订单</el-button>
 | 
	
		
			
				|  |  |        <el-button
 | 
	
		
			
				|  |  |          type="primary"
 | 
	
	
		
			
				|  | @@ -77,201 +79,94 @@
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { getStudentOriginal, getSubjectGoodsAndInfo } from '@/api/buildTeam'
 | 
	
		
			
				|  |  | +import { getStudentOriginal, getSubjectGoodsAndInfo, subjectChangeAdd, subjectChangeCancel } from '@/api/buildTeam'
 | 
	
		
			
				|  |  | +import accessories from './accessories'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const formatCourseScheduleInfo = courseScheduleInfo => {
 | 
	
		
			
				|  |  | -  let tempCheck = {},
 | 
	
		
			
				|  |  | -    tempCourse = {}
 | 
	
		
			
				|  |  | -  if (courseScheduleInfo) {
 | 
	
		
			
				|  |  | -    for (const i in courseScheduleInfo) {
 | 
	
		
			
				|  |  | -      if (courseScheduleInfo.hasOwnProperty(i)) {
 | 
	
		
			
				|  |  | -        const item = courseScheduleInfo[i];
 | 
	
		
			
				|  |  | -        if (item.isNew === 1) {
 | 
	
		
			
				|  |  | -          item.isStatus = true
 | 
	
		
			
				|  |  | -          tempCheck[i] = {...item}
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -          tempCourse[i] = {...item}
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const accessories = []
 | 
	
		
			
				|  |  | +  const accessoriesById = {}
 | 
	
		
			
				|  |  | +  const musicalGoods = []
 | 
	
		
			
				|  |  | +  const musicalGoodsById = {}
 | 
	
		
			
				|  |  | +  const groupList = []
 | 
	
		
			
				|  |  | +  const groupListById = {}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const accessoriesByGoods = {}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  if (data) {
 | 
	
		
			
				|  |  | +    const { musicGroupSubjectGoodsGroupList } = data
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const types = {}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for (const item of musicGroupSubjectGoodsGroupList) {
 | 
	
		
			
				|  |  | +      if (!types[item.type]) {
 | 
	
		
			
				|  |  | +        types[item.type] = []
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +      types[item.type].push(item)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  return {
 | 
	
		
			
				|  |  | -    tempCheck,
 | 
	
		
			
				|  |  | -    tempCourse,
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -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 = []
 | 
	
		
			
				|  |  | +    const typesKeys = Object.keys(types)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  for (const item of goodsGroupList) {
 | 
	
		
			
				|  |  | -    if (item.type === 'INSTRUMENT') {
 | 
	
		
			
				|  |  | -      let KGPTJ = item.kitGroupPurchaseTypeJson ? JSON.parse(item.kitGroupPurchaseTypeJson) : {}
 | 
	
		
			
				|  |  | -      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
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | +    for (const key of typesKeys) {
 | 
	
		
			
				|  |  | +      for (const item of types[key]) {
 | 
	
		
			
				|  |  | +        if (key === 'INSTRUMENT') {
 | 
	
		
			
				|  |  | +          let json = {}
 | 
	
		
			
				|  |  | +          try {
 | 
	
		
			
				|  |  | +            json = JSON.parse(item.kitGroupPurchaseTypeJson)
 | 
	
		
			
				|  |  | +          } catch (error) {}
 | 
	
		
			
				|  |  | +          const _item = {
 | 
	
		
			
				|  |  | +            ...item,
 | 
	
		
			
				|  |  | +            kitGroupPurchaseTypePrice: json[kitGroupPurchaseType]
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          musicalGoods.push(_item)
 | 
	
		
			
				|  |  | +          musicalGoodsById[item.id] = _item
 | 
	
		
			
				|  |  | +          if (!types.ACCESSORIES) {
 | 
	
		
			
				|  |  | +            if (!accessoriesByGoods[item.id]) {
 | 
	
		
			
				|  |  | +              accessoriesByGoods[item.id] = []
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -          } 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
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | +            const acs = item.goodsList[0].goodsList ? item.goodsList[0].goodsList : []
 | 
	
		
			
				|  |  | +            for (const goods of acs) {
 | 
	
		
			
				|  |  | +              accessoriesByGoods[item.id].push(goods)
 | 
	
		
			
				|  |  | +              accessoriesById[goods.id] = goods
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -          tempItem.checked = true
 | 
	
		
			
				|  |  | -          instrumentInfo = {
 | 
	
		
			
				|  |  | -            id: tempItem.id,
 | 
	
		
			
				|  |  | -            price: tempItem.price,
 | 
	
		
			
				|  |  | -            kitType: key
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +        } else if (item.type === 'ACCESSORIES') {
 | 
	
		
			
				|  |  | +          groupList.push(item)
 | 
	
		
			
				|  |  | +          groupListById[item.id] = item
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        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))
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
		
			
				|  |  | -  const { musicGroupSubjectGoodsGroupList } = data
 | 
	
		
			
				|  |  | -  const accessories = []
 | 
	
		
			
				|  |  | -  const accessoriesById = {}
 | 
	
		
			
				|  |  | -  const musicalGoods = []
 | 
	
		
			
				|  |  | -  const musicalGoodsById = {}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  for (const item of musicGroupSubjectGoodsGroupList) {
 | 
	
		
			
				|  |  | -    if (item.type === 'INSTRUMENT') {
 | 
	
		
			
				|  |  | -      let json = {}
 | 
	
		
			
				|  |  | -      try {
 | 
	
		
			
				|  |  | -        json = JSON.parse(item.kitGroupPurchaseTypeJson)
 | 
	
		
			
				|  |  | -      } catch (error) {}
 | 
	
		
			
				|  |  | -      const _item = {
 | 
	
		
			
				|  |  | -        ...item,
 | 
	
		
			
				|  |  | -        kitGroupPurchaseTypePrice: json[kitGroupPurchaseType]
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      musicalGoods.push(item)
 | 
	
		
			
				|  |  | -      musicalGoodsById[item.id] = item
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    return {
 | 
	
		
			
				|  |  |      accessories,
 | 
	
		
			
				|  |  | -    musicalGoods
 | 
	
		
			
				|  |  | +    accessoriesById,
 | 
	
		
			
				|  |  | +    musicalGoods,
 | 
	
		
			
				|  |  | +    musicalGoodsById,
 | 
	
		
			
				|  |  | +    groupList,
 | 
	
		
			
				|  |  | +    groupListById,
 | 
	
		
			
				|  |  | +    accessoriesByGoods
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    props: ['detail', 'musicGroupId', 'voiceList'],
 | 
	
		
			
				|  |  | +  components: {
 | 
	
		
			
				|  |  | +    accessories
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | +      oldAllMoney: 0,
 | 
	
		
			
				|  |  |        accessories: [],
 | 
	
		
			
				|  |  |        accessoriesByid: {},
 | 
	
		
			
				|  |  |        musicalGoods: [],
 | 
	
		
			
				|  |  |        musicalGoodsById: {},
 | 
	
		
			
				|  |  | +      groupList: [],
 | 
	
		
			
				|  |  | +      groupListById: {},
 | 
	
		
			
				|  |  | +      accessoriesByGoods: {},
 | 
	
		
			
				|  |  | +      selectAccessories: [],
 | 
	
		
			
				|  |  | +      selectAccessoriesMoney: 0,
 | 
	
		
			
				|  |  | +      kitGroupPurchaseTypePrice: 0,
 | 
	
		
			
				|  |  |        form: {
 | 
	
		
			
				|  |  |          subjectId: '',
 | 
	
		
			
				|  |  |          accessories: '',
 | 
	
	
		
			
				|  | @@ -281,6 +176,11 @@ export default {
 | 
	
		
			
				|  |  |        item: {},
 | 
	
		
			
				|  |  |        originalMusicalGoods: '',
 | 
	
		
			
				|  |  |        originalAccessoriesGoods: '',
 | 
	
		
			
				|  |  | +      originalAccessoriesPrice: 0,
 | 
	
		
			
				|  |  | +      originalMusicalPrice: 0,
 | 
	
		
			
				|  |  | +      originalCourseFee: 0,
 | 
	
		
			
				|  |  | +      musicGroupSubjectPlanFee: 0,
 | 
	
		
			
				|  |  | +      musicalPrice: 0,
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    watch: {
 | 
	
	
		
			
				|  | @@ -289,7 +189,23 @@ export default {
 | 
	
		
			
				|  |  |          this.fetchDetail()
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  computed: {
 | 
	
		
			
				|  |  | +    activeAccessories() {
 | 
	
		
			
				|  |  | +      const { musicalGoods } = this.form
 | 
	
		
			
				|  |  | +      return musicalGoods ? this.accessoriesByGoods[musicalGoods] || [] : []
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    spread() {
 | 
	
		
			
				|  |  | +      return (
 | 
	
		
			
				|  |  | +        this.musicalPrice +
 | 
	
		
			
				|  |  | +        this.selectAccessoriesMoney +
 | 
	
		
			
				|  |  | +        this.musicGroupSubjectPlanFee -
 | 
	
		
			
				|  |  | +        this.originalAccessoriesPrice -
 | 
	
		
			
				|  |  | +        this.originalMusicalPrice -
 | 
	
		
			
				|  |  | +        this.originalCourseFee -
 | 
	
		
			
				|  |  | +        this.kitGroupPurchaseTypePrice
 | 
	
		
			
				|  |  | +      )
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    mounted() {
 | 
	
		
			
				|  |  |      console.log(this.detail, this.voiceList)
 | 
	
	
		
			
				|  | @@ -306,25 +222,73 @@ export default {
 | 
	
		
			
				|  |  |        .then(res => {
 | 
	
		
			
				|  |  |          const { data } = res
 | 
	
		
			
				|  |  |          this.item = data
 | 
	
		
			
				|  |  | -        this.originalMusicalGoods = data.originalMusicalGoods.name
 | 
	
		
			
				|  |  | -        this.originalAccessoriesGoods = (data.originalAccessoriesGoods || []).map(item => item.name).join()
 | 
	
		
			
				|  |  | +        if (data) {
 | 
	
		
			
				|  |  | +          this.originalAccessoriesPrice = data.originalAccessoriesPrice
 | 
	
		
			
				|  |  | +          this.originalMusicalPrice = data.originalMusicalPrice
 | 
	
		
			
				|  |  | +          this.originalCourseFee = data.originalCourseFee
 | 
	
		
			
				|  |  | +          this.originalMusicalGoods = data.originalMusicalGoods.name
 | 
	
		
			
				|  |  | +          this.originalAccessoriesGoods = (data.originalAccessoriesGoods || []).map(item => item.name).join()
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      subjectChange(id) {
 | 
	
		
			
				|  |  | +      this.$set(this.form, 'musicalGoods', '')
 | 
	
		
			
				|  |  |        getSubjectGoodsAndInfo({
 | 
	
		
			
				|  |  |          musicGroupId: this.musicGroupId,
 | 
	
		
			
				|  |  |          subjectId: id,
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |        .then(res => {
 | 
	
		
			
				|  |  | -        const { accessories, musicalGoods, accessoriesById, musicalGoodsById } = formatAllGoods(res.data, this.item.kitGroupPurchaseType)
 | 
	
		
			
				|  |  | -        this.accessories = [...accessories]
 | 
	
		
			
				|  |  | -        this.accessoriesById = {...accessoriesById}
 | 
	
		
			
				|  |  | -        this.musicalGoods = [...musicalGoods]
 | 
	
		
			
				|  |  | -        this.musicalGoodsById = {...musicalGoodsById}
 | 
	
		
			
				|  |  | +        this.musicGroupSubjectPlanFee = res.data.musicGroupSubjectPlan.fee
 | 
	
		
			
				|  |  | +        const items = formatAllGoods(res.data, this.item.kitGroupPurchaseType)
 | 
	
		
			
				|  |  | +        for (const key in items) {
 | 
	
		
			
				|  |  | +          if (items.hasOwnProperty(key)) {
 | 
	
		
			
				|  |  | +            const item = items[key]
 | 
	
		
			
				|  |  | +            this[key] = item
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    musicalGoodsChange(val) {
 | 
	
		
			
				|  |  | +      const item = this.musicalGoodsById[val]
 | 
	
		
			
				|  |  | +      console.log(item)
 | 
	
		
			
				|  |  | +      this.musicalPrice = this.numFormat(item.price)
 | 
	
		
			
				|  |  | +      this.kitGroupPurchaseTypePrice = this.numFormat(item.kitGroupPurchaseTypePrice)
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    accessoriesChange(ids, money) {
 | 
	
		
			
				|  |  | +      console.log(ids, money)
 | 
	
		
			
				|  |  | +      this.selectAccessories = ids
 | 
	
		
			
				|  |  | +      this.selectAccessoriesMoney = money
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    numFormat(num) {
 | 
	
		
			
				|  |  | +      let _num = parseFloat(num)
 | 
	
		
			
				|  |  | +      if (isNaN(_num)) {
 | 
	
		
			
				|  |  | +        _num = 0
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return Math.floor(_num * 100) / 100
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      submit() {
 | 
	
		
			
				|  |  | +      subjectChangeAdd({
 | 
	
		
			
				|  |  | +        changeCourseFee: this.numFormat(this.musicGroupSubjectPlanFee),
 | 
	
		
			
				|  |  | +        changeAccessories: this.selectAccessories.join(','),
 | 
	
		
			
				|  |  | +        changeAccessoriesPrice: this.numFormat(this.selectAccessoriesMoney),
 | 
	
		
			
				|  |  | +        changeMusicalPrice: this.numFormat(this.musicalPrice - this.kitGroupPurchaseTypePrice),
 | 
	
		
			
				|  |  | +        originalCourseFee: this.originalCourseFee,
 | 
	
		
			
				|  |  | +        originalMusicalPrice: this.originalMusicalPrice,
 | 
	
		
			
				|  |  | +        originalMusical: this.item.originalMusical,
 | 
	
		
			
				|  |  | +        originalAccessories: this.item.originalAccessories,
 | 
	
		
			
				|  |  | +        originalAccessoriesPrice: this.originalAccessoriesPrice,
 | 
	
		
			
				|  |  | +        cooperationOrganId: this.item.cooperationOrganId,
 | 
	
		
			
				|  |  | +        kitGroupPurchaseType: this.item.kitGroupPurchaseType,
 | 
	
		
			
				|  |  | +        musicGroupId: this.musicGroupId,
 | 
	
		
			
				|  |  | +        studentId: this.detail.studentId,
 | 
	
		
			
				|  |  | +        changeMusical: this.form.musicalGoods,
 | 
	
		
			
				|  |  | +        originalCost: this.item.originalCost,
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  |        this.$listeners.close()
 | 
	
		
			
				|  |  | +      this.$message({
 | 
	
		
			
				|  |  | +        type: 'success',
 | 
	
		
			
				|  |  | +        message: '提交成功!'
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      cancel() {
 | 
	
		
			
				|  |  |        this.$confirm('是否确认取消订单?', '提示', {
 | 
	
	
		
			
				|  | @@ -333,9 +297,14 @@ export default {
 | 
	
		
			
				|  |  |          type: 'warning'
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |        .then(() => {
 | 
	
		
			
				|  |  | -        this.$message({
 | 
	
		
			
				|  |  | -          type: 'success',
 | 
	
		
			
				|  |  | -          message: '取消成功!'
 | 
	
		
			
				|  |  | +        subjectChangeCancel({
 | 
	
		
			
				|  |  | +          id: this.item.id
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .then(() => {
 | 
	
		
			
				|  |  | +          this.$message({
 | 
	
		
			
				|  |  | +            type: 'success',
 | 
	
		
			
				|  |  | +            message: '取消成功!'
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |      }
 |