|  | @@ -1,6 +1,6 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  | -    <el-form :model="form" :rules="rules" ref="form" label-width="100px">
 | 
	
		
			
				|  |  | +    <el-form :model="form" :rules="rules" ref="form" label-width="110px">
 | 
	
		
			
				|  |  |        <el-form-item label="原乐器" prop="name">
 | 
	
		
			
				|  |  |          <span>{{originalMusicalGoods}}</span>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
	
		
			
				|  | @@ -55,6 +55,21 @@
 | 
	
		
			
				|  |  |          </el-select>
 | 
	
		
			
				|  |  |          <span v-else-if="changeInfo && changeInfo.changeMusicalGoods">{{changeInfo.changeMusicalGoods.name}}</span>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  | +      <el-form-item
 | 
	
		
			
				|  |  | +        v-if="changeInfo || (form.musicalGoods && musicalGoodsById[form.musicalGoods] && musicalGoodsById[form.musicalGoods].kitGroupPurchaseTypeJsonParse)" label="乐器提供方式" prop="type"
 | 
	
		
			
				|  |  | +        :rules="[
 | 
	
		
			
				|  |  | +          { required: true, message: '请选择乐器提供方式', trigger: 'change' }
 | 
	
		
			
				|  |  | +        ]"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +        <el-radio-group v-if="!changeInfo" v-model="form.type">
 | 
	
		
			
				|  |  | +          <el-radio
 | 
	
		
			
				|  |  | +            :label="key"
 | 
	
		
			
				|  |  | +            v-for="(item, key) in musicalGoodsById[form.musicalGoods].kitGroupPurchaseTypeJsonParse"
 | 
	
		
			
				|  |  | +            :key="key"
 | 
	
		
			
				|  |  | +          >{{`${kitGroupPurchaseTypeFormater[key]}-${item > 0 ? item + '元' : '免费'}`}}</el-radio>
 | 
	
		
			
				|  |  | +        </el-radio-group>
 | 
	
		
			
				|  |  | +        <span v-else-if="changeInfo && changeInfo.kitGroupPurchaseType">{{kitGroupPurchaseTypeFormater[changeInfo.kitGroupPurchaseType]}}</span>
 | 
	
		
			
				|  |  | +      </el-form-item>
 | 
	
		
			
				|  |  |        <el-form-item v-if="(activeAccessories.length || groupList.length) || changeInfo" label="更换教辅" prop="name">
 | 
	
		
			
				|  |  |          <accessories
 | 
	
		
			
				|  |  |            :list.sync="activeAccessories"
 | 
	
	
		
			
				|  | @@ -127,6 +142,7 @@ import numeral from 'numeral'
 | 
	
		
			
				|  |  |  import { getStudentOriginal, getSubjectGoodsAndInfo, subjectChangeAdd, subjectChangeCancel, getChangeInfo } from '@/api/buildTeam'
 | 
	
		
			
				|  |  |  import { vaildStudentUrl } from '@/utils/validate'
 | 
	
		
			
				|  |  |  import accessories from './accessories'
 | 
	
		
			
				|  |  | +import { kitGroupPurchaseType } from '@/constant'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -164,9 +180,10 @@ const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
		
			
				|  |  |            try {
 | 
	
		
			
				|  |  |              courseJson = JSON.parse(item.coursePurchaseTypeJson)
 | 
	
		
			
				|  |  |            } catch (error) {}
 | 
	
		
			
				|  |  | -          if (json[kitGroupPurchaseType] !== undefined) {
 | 
	
		
			
				|  |  | +          // if (json[kitGroupPurchaseType] !== undefined) {
 | 
	
		
			
				|  |  |              const _item = {
 | 
	
		
			
				|  |  |                ...item,
 | 
	
		
			
				|  |  | +              kitGroupPurchaseTypeJsonParse: json,
 | 
	
		
			
				|  |  |                kitGroupPurchaseTypePrice: json[kitGroupPurchaseType] || 0,
 | 
	
		
			
				|  |  |                coursePurchaseTypeJsonTypePrice: courseJson[kitGroupPurchaseType] || 0,
 | 
	
		
			
				|  |  |                _calculated_price: (kitGroupPurchaseType === 'FREE' ? 0 : (kitGroupPurchaseType === 'LEASE' ? item.depositFee : item.price))
 | 
	
	
		
			
				|  | @@ -183,7 +200,7 @@ const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
		
			
				|  |  |                  accessoriesById[goods.id] = goods
 | 
	
		
			
				|  |  |                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +          // }
 | 
	
		
			
				|  |  |          } else if (item.type === 'ACCESSORIES') {
 | 
	
		
			
				|  |  |            groupList.push(item)
 | 
	
		
			
				|  |  |            groupListById[item.id] = item
 | 
	
	
		
			
				|  | @@ -210,6 +227,7 @@ export default {
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | +      kitGroupPurchaseTypeFormater: kitGroupPurchaseType,
 | 
	
		
			
				|  |  |        changeInfo: null,
 | 
	
		
			
				|  |  |        oldAllMoney: 0,
 | 
	
		
			
				|  |  |        accessories: [],
 | 
	
	
		
			
				|  | @@ -227,6 +245,7 @@ export default {
 | 
	
		
			
				|  |  |          subjectId: '',
 | 
	
		
			
				|  |  |          accessories: '',
 | 
	
		
			
				|  |  |          musicalGoods: '',
 | 
	
		
			
				|  |  | +        type: '',
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        rules: {},
 | 
	
		
			
				|  |  |        item: {},
 | 
	
	
		
			
				|  | @@ -242,10 +261,13 @@ export default {
 | 
	
		
			
				|  |  |    watch: {
 | 
	
		
			
				|  |  |      detail() {
 | 
	
		
			
				|  |  |        if (this.detail) {
 | 
	
		
			
				|  |  | -        console.log(this.detail, this.voiceList)
 | 
	
		
			
				|  |  |          this.fetchDetail()
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    'form.type'() {
 | 
	
		
			
				|  |  | +      this.musicalGoodsChange(this.form.musicalGoods)
 | 
	
		
			
				|  |  | +      console.log(this.form.type)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
		
			
				|  |  |      copyLink() {
 | 
	
	
		
			
				|  | @@ -327,6 +349,7 @@ export default {
 | 
	
		
			
				|  |  |          const { data } = res
 | 
	
		
			
				|  |  |          this.item = data || {}
 | 
	
		
			
				|  |  |          if (data) {
 | 
	
		
			
				|  |  | +          this.$set(this.form, 'type', this.item.kitGroupPurchaseType)
 | 
	
		
			
				|  |  |            this.originalAccessoriesPrice = data.originalAccessoriesPrice
 | 
	
		
			
				|  |  |            this.originalMusicalPrice = data.originalMusicalPrice
 | 
	
		
			
				|  |  |            this.originalCourseFee = data.originalCourseFee
 | 
	
	
		
			
				|  | @@ -379,12 +402,14 @@ export default {
 | 
	
		
			
				|  |  |        const item = this.musicalGoodsById[val]
 | 
	
		
			
				|  |  |        if (item) {
 | 
	
		
			
				|  |  |          this.musicalPrice = this.numFormat(item._calculated_price)
 | 
	
		
			
				|  |  | -        this.kitGroupPurchaseTypePrice = this.numFormat(item.kitGroupPurchaseTypePrice)
 | 
	
		
			
				|  |  | +        this.kitGroupPurchaseTypePrice = this.numFormat(item.kitGroupPurchaseTypeJsonParse[this.form.type] || 0)
 | 
	
		
			
				|  |  |          this.coursePurchaseTypeJsonTypePrice = this.numFormat(item.coursePurchaseTypeJsonTypePrice)
 | 
	
		
			
				|  |  | +        this.types = item.kitGroupPurchaseTypeJsonParse
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  |          this.musicalPrice = 0
 | 
	
		
			
				|  |  |          this.kitGroupPurchaseTypePrice = 0
 | 
	
		
			
				|  |  |          this.coursePurchaseTypeJsonTypePrice = 0
 | 
	
		
			
				|  |  | +        this.$set(this.form, 'type', '')
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      accessoriesChange(ids, money) {
 | 
	
	
		
			
				|  | @@ -426,7 +451,7 @@ export default {
 | 
	
		
			
				|  |  |              originalAccessories: this.item.originalAccessories,
 | 
	
		
			
				|  |  |              originalAccessoriesPrice: this.originalAccessoriesPrice,
 | 
	
		
			
				|  |  |              cooperationOrganId: this.item.cooperationOrganId,
 | 
	
		
			
				|  |  | -            kitGroupPurchaseType: this.item.kitGroupPurchaseType,
 | 
	
		
			
				|  |  | +            kitGroupPurchaseType: this.form.type,
 | 
	
		
			
				|  |  |              musicGroupId: this.musicGroupId,
 | 
	
		
			
				|  |  |              studentId: this.detail.studentId,
 | 
	
		
			
				|  |  |              changeMusical: this.form.musicalGoods,
 |