|  | @@ -48,7 +48,7 @@
 | 
											
												
													
														|  |  				</el-row>
 |  |  				</el-row>
 | 
											
												
													
														|  |  				<el-row class="option-row" v-for="(item, index) in instrumentRepair" :key="index" @click.native="onCheckItem(item)">
 |  |  				<el-row class="option-row" v-for="(item, index) in instrumentRepair" :key="index" @click.native="onCheckItem(item)">
 | 
											
												
													
														|  |  					<el-col :span="12">
 |  |  					<el-col :span="12">
 | 
											
												
													
														|  | -						<i class="check_default" :class="[item.isStatus ? 'check_active' : '', !item.optionalFlag ? 'disabled' : '']"></i>
 |  | 
 | 
											
												
													
														|  | 
 |  | +						<i class="check_default" :class="[item.isStatus ? 'check_active' : '', item.optionalFlag ? 'disabled' : '', item.noSelect ? 'noSelect' : '']"></i>
 | 
											
												
													
														|  |              {{ item.name }}
 |  |              {{ item.name }}
 | 
											
												
													
														|  |  					</el-col>
 |  |  					</el-col>
 | 
											
												
													
														|  |  					<el-col :span="6">
 |  |  					<el-col :span="6">
 | 
											
										
											
												
													
														|  | @@ -75,7 +75,7 @@
 | 
											
												
													
														|  |      />
 |  |      />
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    <div class="buy">
 |  | 
 | 
											
												
													
														|  | 
 |  | +    <!-- <div class="buy">
 | 
											
												
													
														|  |        <div class="price">
 |  |        <div class="price">
 | 
											
												
													
														|  |          <p class="oldprice">
 |  |          <p class="oldprice">
 | 
											
												
													
														|  |            <del class="text">原价</del>
 |  |            <del class="text">原价</del>
 | 
											
										
											
												
													
														|  | @@ -90,7 +90,7 @@
 | 
											
												
													
														|  |        </div>
 |  |        </div>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |        <a class="btn-submit">购买</a>
 |  |        <a class="btn-submit">购买</a>
 | 
											
												
													
														|  | -    </div>
 |  | 
 | 
											
												
													
														|  | 
 |  | +    </div> -->
 | 
											
												
													
														|  |    </div>
 |  |    </div>
 | 
											
												
													
														|  |  </template>
 |  |  </template>
 | 
											
												
													
														|  |  <script>
 |  |  <script>
 | 
											
										
											
												
													
														|  | @@ -184,165 +184,134 @@ export default {
 | 
											
												
													
														|  |          subjectId: this.subjectId,
 |  |          subjectId: this.subjectId,
 | 
											
												
													
														|  |          calenderId: this.calenderId,
 |  |          calenderId: this.calenderId,
 | 
											
												
													
														|  |        };
 |  |        };
 | 
											
												
													
														|  | -      await getType().then((res) => {
 |  | 
 | 
											
												
													
														|  | -        let result = res.data;
 |  | 
 | 
											
												
													
														|  | -        if (res.code == 200) {
 |  | 
 | 
											
												
													
														|  | -          this.chargeTypeList = result.rows || [];
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -      });
 |  | 
 | 
											
												
													
														|  | 
 |  | +      // await getType().then((res) => {
 | 
											
												
													
														|  | 
 |  | +      //   let result = res.data;
 | 
											
												
													
														|  | 
 |  | +      //   if (res.code == 200) {
 | 
											
												
													
														|  | 
 |  | +      //     this.chargeTypeList = result.rows || [];
 | 
											
												
													
														|  | 
 |  | +      //   }
 | 
											
												
													
														|  | 
 |  | +      // });
 | 
											
												
													
														|  |        await getSubjectGoodsAndInfoPreview(params).then((res) => {
 |  |        await getSubjectGoodsAndInfoPreview(params).then((res) => {
 | 
											
												
													
														|  |          let result = res;
 |  |          let result = res;
 | 
											
												
													
														|  |          if (result.code == 200) {
 |  |          if (result.code == 200) {
 | 
											
												
													
														|  |            let tempResult = result.data;
 |  |            let tempResult = result.data;
 | 
											
												
													
														|  | -          this.courseViewType = tempResult.musicGroup.courseViewType || 0;
 |  | 
 | 
											
												
													
														|  | -          this.organId = tempResult.musicGroup.organId;
 |  | 
 | 
											
												
													
														|  | -          this.cloudTeacherFee = tempResult.cloudTeacherFee || 0;
 |  | 
 | 
											
												
													
														|  | -          this.cloudTeacherPlusFee = tempResult.cloudTeacherPlusFee || 0;
 |  | 
 | 
											
												
													
														|  | 
 |  | +          this.__dataFormat(tempResult)
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        // 初始化计算金额
 | 
											
												
													
														|  | 
 |  | +        this.calcPrice();
 | 
											
												
													
														|  | 
 |  | +      });
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    __dataFormat(tempResult) {
 | 
											
												
													
														|  | 
 |  | +      console.log(this.preViewData, 'sffwef')
 | 
											
												
													
														|  | 
 |  | +      console.log(tempResult, 'tempResult')
 | 
											
												
													
														|  | 
 |  | +      this.courseViewType = tempResult.musicGroup.courseViewType || 0;
 | 
											
												
													
														|  | 
 |  | +      this.organId = tempResult.musicGroup.organId;
 | 
											
												
													
														|  | 
 |  | +      this.cloudTeacherFee = tempResult.cloudTeacherFee || 0;
 | 
											
												
													
														|  | 
 |  | +      this.cloudTeacherPlusFee = tempResult.cloudTeacherPlusFee || 0;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -          let memberCoursePrice = tempResult.memberCoursePrice || {};
 |  | 
 | 
											
												
													
														|  | -          for (let i in memberCoursePrice) {
 |  | 
 | 
											
												
													
														|  | -            this.memberCoursePrice.push({
 |  | 
 | 
											
												
													
														|  | -              name: coursesType[i],
 |  | 
 | 
											
												
													
														|  | -              price: memberCoursePrice[i],
 |  | 
 | 
											
												
													
														|  | -            });
 |  | 
 | 
											
												
													
														|  | -          }
 |  | 
 | 
											
												
													
														|  | -          this.memberCourseShowFlag =
 |  | 
 | 
											
												
													
														|  | -            tempResult.musicGroup.memberCourseShowFlag || false;
 |  | 
 | 
											
												
													
														|  | 
 |  | +      let memberCoursePrice = tempResult.memberCoursePrice || {};
 | 
											
												
													
														|  | 
 |  | +      for (let i in memberCoursePrice) {
 | 
											
												
													
														|  | 
 |  | +        this.memberCoursePrice.push({
 | 
											
												
													
														|  | 
 |  | +          name: coursesType[i],
 | 
											
												
													
														|  | 
 |  | +          price: memberCoursePrice[i],
 | 
											
												
													
														|  | 
 |  | +        });
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      this.memberCourseShowFlag =
 | 
											
												
													
														|  | 
 |  | +        tempResult.musicGroup.memberCourseShowFlag || false;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -          this.paymentPattern = 2;
 |  | 
 | 
											
												
													
														|  | -          if (tempResult.musicGroupPaymentCalender) {
 |  | 
 | 
											
												
													
														|  | -            this.paymentPattern =
 |  | 
 | 
											
												
													
														|  | -              tempResult.musicGroupPaymentCalender.paymentPattern;
 |  | 
 | 
											
												
													
														|  | -            this.serviceValidDate =
 |  | 
 | 
											
												
													
														|  | -              dayjs(
 |  | 
 | 
											
												
													
														|  | -                tempResult.musicGroupPaymentCalender.paymentValidStartDate
 |  | 
 | 
											
												
													
														|  | -              ).format("YYYY/MM/DD") +
 |  | 
 | 
											
												
													
														|  | -              "~" +
 |  | 
 | 
											
												
													
														|  | -              dayjs(
 |  | 
 | 
											
												
													
														|  | -                tempResult.musicGroupPaymentCalender.paymentValidEndDate
 |  | 
 | 
											
												
													
														|  | -              ).format("YYYY/MM/DD");
 |  | 
 | 
											
												
													
														|  | -          }
 |  | 
 | 
											
												
													
														|  | -          const paymentCalender = tempResult.paymentCalender || null
 |  | 
 | 
											
												
													
														|  | -          let tempInfo = paymentCalender && paymentCalender.course ? paymentCalender.course : [];
 |  | 
 | 
											
												
													
														|  | 
 |  | +      this.paymentPattern = 2;
 | 
											
												
													
														|  | 
 |  | +      if (tempResult.musicGroupPaymentCalender) {
 | 
											
												
													
														|  | 
 |  | +        this.paymentPattern =
 | 
											
												
													
														|  | 
 |  | +          tempResult.musicGroupPaymentCalender.paymentPattern;
 | 
											
												
													
														|  | 
 |  | +        this.serviceValidDate =
 | 
											
												
													
														|  | 
 |  | +          dayjs(
 | 
											
												
													
														|  | 
 |  | +            tempResult.musicGroupPaymentCalender.paymentValidStartDate
 | 
											
												
													
														|  | 
 |  | +          ).format("YYYY/MM/DD") +
 | 
											
												
													
														|  | 
 |  | +          "~" +
 | 
											
												
													
														|  | 
 |  | +          dayjs(
 | 
											
												
													
														|  | 
 |  | +            tempResult.musicGroupPaymentCalender.paymentValidEndDate
 | 
											
												
													
														|  | 
 |  | +          ).format("YYYY/MM/DD");
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      const paymentCalender =  this.preViewData ? this.preViewData.paymentCalender : (tempResult.paymentCalender || null)
 | 
											
												
													
														|  | 
 |  | +      console.log(paymentCalender, 'paymentCalender')
 | 
											
												
													
														|  | 
 |  | +      let tempInfo = paymentCalender && paymentCalender.course ? paymentCalender.course : [];
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -          let memberPrivilegesItemList = tempResult.memberPrivilegesItemList
 |  | 
 | 
											
												
													
														|  | -            ? tempResult.memberPrivilegesItemList
 |  | 
 | 
											
												
													
														|  | -            : [];
 |  | 
 | 
											
												
													
														|  | -          let tempMember = [];
 |  | 
 | 
											
												
													
														|  | -          memberPrivilegesItemList.forEach((member) => {
 |  | 
 | 
											
												
													
														|  | -            if (
 |  | 
 | 
											
												
													
														|  | -              member.memberPrivilegesItems &&
 |  | 
 | 
											
												
													
														|  | -              member.memberPrivilegesItems.length > 0
 |  | 
 | 
											
												
													
														|  | -            ) {
 |  | 
 | 
											
												
													
														|  | -              member.memberPrivilegesItems.forEach((item) => {
 |  | 
 | 
											
												
													
														|  | -                tempMember.push(item.name);
 |  | 
 | 
											
												
													
														|  | -              });
 |  | 
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | 
 |  | +      let memberPrivilegesItemList = tempResult.memberPrivilegesItemList
 | 
											
												
													
														|  | 
 |  | +        ? tempResult.memberPrivilegesItemList
 | 
											
												
													
														|  | 
 |  | +        : [];
 | 
											
												
													
														|  | 
 |  | +      let tempMember = [];
 | 
											
												
													
														|  | 
 |  | +      memberPrivilegesItemList.forEach((member) => {
 | 
											
												
													
														|  | 
 |  | +        if (
 | 
											
												
													
														|  | 
 |  | +          member.memberPrivilegesItems &&
 | 
											
												
													
														|  | 
 |  | +          member.memberPrivilegesItems.length > 0
 | 
											
												
													
														|  | 
 |  | +        ) {
 | 
											
												
													
														|  | 
 |  | +          member.memberPrivilegesItems.forEach((item) => {
 | 
											
												
													
														|  | 
 |  | +            tempMember.push(item.name);
 | 
											
												
													
														|  |            });
 |  |            });
 | 
											
												
													
														|  | -          // 团练宝
 |  | 
 | 
											
												
													
														|  | -          const member = paymentCalender && paymentCalender.member ? paymentCalender.member : {}
 |  | 
 | 
											
												
													
														|  | -          member.isStatus = member.optionalFlag ? true : false
 |  | 
 | 
											
												
													
														|  | -          this.toolsPackage = [member]
 |  | 
 | 
											
												
													
														|  | -          // 乐器保养
 |  | 
 | 
											
												
													
														|  | -          const repair = paymentCalender && paymentCalender.repair ? paymentCalender.repair : {}
 |  | 
 | 
											
												
													
														|  | -          repair.name = '乐器保养'
 |  | 
 | 
											
												
													
														|  | -          repair.isStatus = repair.optionalFlag ? true : false // 默认不选择乐器保养
 |  | 
 | 
											
												
													
														|  | -          this.instrumentRepair = [repair]
 |  | 
 | 
											
												
													
														|  | -          // 小班课
 |  | 
 | 
											
												
													
														|  | -          const activity = paymentCalender && paymentCalender.activity ? paymentCalender.activity : []
 |  | 
 | 
											
												
													
														|  | -          activity.map(i => {
 |  | 
 | 
											
												
													
														|  | -            if(i.optionalFlag) {
 |  | 
 | 
											
												
													
														|  | -              i.isStatus = true
 |  | 
 | 
											
												
													
														|  | -            } else {
 |  | 
 | 
											
												
													
														|  | -              i.isStatus = false
 |  | 
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | -          })
 |  | 
 | 
											
												
													
														|  | -          this.activityList = [...activity]
 |  | 
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      });
 | 
											
												
													
														|  | 
 |  | +      // 团练宝
 | 
											
												
													
														|  | 
 |  | +      const member = paymentCalender && paymentCalender.member ? paymentCalender.member : {}
 | 
											
												
													
														|  | 
 |  | +      member.isStatus = member.optionalFlag ? true : false
 | 
											
												
													
														|  | 
 |  | +      this.toolsPackage = [member]
 | 
											
												
													
														|  | 
 |  | +      // 乐器保养
 | 
											
												
													
														|  | 
 |  | +      const repair = paymentCalender && paymentCalender.repair ? paymentCalender.repair : {}
 | 
											
												
													
														|  | 
 |  | +      repair.name = '乐器保养'
 | 
											
												
													
														|  | 
 |  | +      repair.isStatus = repair.optionalFlag ? true : false // 默认不选择乐器保养
 | 
											
												
													
														|  | 
 |  | +      this.instrumentRepair = [repair]
 | 
											
												
													
														|  | 
 |  | +      // 小班课
 | 
											
												
													
														|  | 
 |  | +      const activity = paymentCalender && paymentCalender.activity ? paymentCalender.activity : []
 | 
											
												
													
														|  | 
 |  | +      activity.map(i => {
 | 
											
												
													
														|  | 
 |  | +        if(i.optionalFlag) {
 | 
											
												
													
														|  | 
 |  | +          i.isStatus = true
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +          i.isStatus = false
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      })
 | 
											
												
													
														|  | 
 |  | +      this.activityList = [...activity]
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -          // 判断是否有课程
 |  | 
 | 
											
												
													
														|  | -          if (tempInfo && tempInfo.length > 0) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +      // 判断是否有课程
 | 
											
												
													
														|  | 
 |  | +      if (tempInfo && tempInfo.length > 0) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -            // 默认课程都选中
 |  | 
 | 
											
												
													
														|  | -            tempInfo.forEach((item) => {
 |  | 
 | 
											
												
													
														|  | -              if (item && item.isStudentOptional) {
 |  | 
 | 
											
												
													
														|  | -                item.isStatus = false;
 |  | 
 | 
											
												
													
														|  | -              } else {
 |  | 
 | 
											
												
													
														|  | -                item.isStatus = true;
 |  | 
 | 
											
												
													
														|  | -              }
 |  | 
 | 
											
												
													
														|  | -            });
 |  | 
 | 
											
												
													
														|  | -            this.courseInfo = tempInfo;
 |  | 
 | 
											
												
													
														|  | -          }
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // 默认课程都选中
 | 
											
												
													
														|  | 
 |  | +        tempInfo.forEach((item) => {
 | 
											
												
													
														|  | 
 |  | +          // if (item && item.isStudentOptional) {
 | 
											
												
													
														|  | 
 |  | +            // item.isStatus = false;
 | 
											
												
													
														|  | 
 |  | +          // } else {
 | 
											
												
													
														|  | 
 |  | +            item.isStatus = true;
 | 
											
												
													
														|  | 
 |  | +          // }
 | 
											
												
													
														|  | 
 |  | +        });
 | 
											
												
													
														|  | 
 |  | +        this.courseInfo = tempInfo;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -          this.musicGroupSubject = tempResult.musicGroupSubjectPlan;
 |  | 
 | 
											
												
													
														|  | -          let instrumentInfo = {};
 |  | 
 | 
											
												
													
														|  | -          let tempInstrument = [];
 |  | 
 | 
											
												
													
														|  | -          tempResult.musicGroupSubjectGoodsGroupList.forEach((item) => {
 |  | 
 | 
											
												
													
														|  | -            if (item.type == "INSTRUMENT") {
 |  | 
 | 
											
												
													
														|  | -              // 获取乐器所有提供方式
 |  | 
 | 
											
												
													
														|  | -              let KGPTJ = item.kitGroupPurchaseTypeJson
 |  | 
 | 
											
												
													
														|  | -                ? JSON.parse(item.kitGroupPurchaseTypeJson)
 |  | 
 | 
											
												
													
														|  | -                : {};
 |  | 
 | 
											
												
													
														|  | -              for (let single in KGPTJ) {
 |  | 
 | 
											
												
													
														|  | -                let tempItem = Object.assign({}, item); // 深拷贝
 |  | 
 | 
											
												
													
														|  | -                tempItem.marketPrice = tempItem.goodsList[0].marketPrice;
 |  | 
 | 
											
												
													
														|  | -                tempItem.kitType = single; // 优惠模式
 |  | 
 | 
											
												
													
														|  | -                tempItem.coupon = KGPTJ[single]; // 优惠金额
 |  | 
 | 
											
												
													
														|  | -                tempItem.discountPrice = tempItem.goodsList[0].discountPrice
 |  | 
 | 
											
												
													
														|  | -                if (instrumentInfo.id) {
 |  | 
 | 
											
												
													
														|  | -                  tempItem.isStatus = false;
 |  | 
 | 
											
												
													
														|  | -                  if (single == "GROUP") {
 |  | 
 | 
											
												
													
														|  | -                    // 团购
 |  | 
 | 
											
												
													
														|  | -                    if (
 |  | 
 | 
											
												
													
														|  | -                      (instrumentInfo.kitType == "GROUP" &&
 |  | 
 | 
											
												
													
														|  | -                        instrumentInfo.price < tempItem.price) ||
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo.kitType == "LEASE" ||
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo.kitType == "FREE"
 |  | 
 | 
											
												
													
														|  | -                    ) {
 |  | 
 | 
											
												
													
														|  | -                      this.instrumentResult.forEach((instrRes) => {
 |  | 
 | 
											
												
													
														|  | -                        instrRes.isStatus = false;
 |  | 
 | 
											
												
													
														|  | -                      });
 |  | 
 | 
											
												
													
														|  | -                      tempItem.isStatus = true;
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo = {
 |  | 
 | 
											
												
													
														|  | -                        id: tempItem.id,
 |  | 
 | 
											
												
													
														|  | -                        price: tempItem.price,
 |  | 
 | 
											
												
													
														|  | -                        kitType: single,
 |  | 
 | 
											
												
													
														|  | -                      };
 |  | 
 | 
											
												
													
														|  | -                    }
 |  | 
 | 
											
												
													
														|  | -                  } else if (single == "LEASE") {
 |  | 
 | 
											
												
													
														|  | -                    // 租赁
 |  | 
 | 
											
												
													
														|  | -                    if (
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo.kitType == "LEASE" &&
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo.price < tempItem.price
 |  | 
 | 
											
												
													
														|  | -                    ) {
 |  | 
 | 
											
												
													
														|  | -                      this.instrumentResult.forEach((instrRes) => {
 |  | 
 | 
											
												
													
														|  | -                        instrRes.isStatus = false;
 |  | 
 | 
											
												
													
														|  | -                      });
 |  | 
 | 
											
												
													
														|  | -                      tempItem.isStatus = true;
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo = {
 |  | 
 | 
											
												
													
														|  | -                        id: tempItem.id,
 |  | 
 | 
											
												
													
														|  | -                        price: tempItem.price,
 |  | 
 | 
											
												
													
														|  | -                        kitType: single,
 |  | 
 | 
											
												
													
														|  | -                      };
 |  | 
 | 
											
												
													
														|  | -                    }
 |  | 
 | 
											
												
													
														|  | -                  } else if (single == "FREE") {
 |  | 
 | 
											
												
													
														|  | -                    // 免费
 |  | 
 | 
											
												
													
														|  | -                    if (
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo.kitType == "FREE" &&
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo.price < tempItem.price
 |  | 
 | 
											
												
													
														|  | -                    ) {
 |  | 
 | 
											
												
													
														|  | -                      this.instrumentResult.forEach((instrRes) => {
 |  | 
 | 
											
												
													
														|  | -                        instrRes.isStatus = false;
 |  | 
 | 
											
												
													
														|  | -                      });
 |  | 
 | 
											
												
													
														|  | -                      tempItem.isStatus = true;
 |  | 
 | 
											
												
													
														|  | -                      instrumentInfo = {
 |  | 
 | 
											
												
													
														|  | -                        id: tempItem.id,
 |  | 
 | 
											
												
													
														|  | -                        price: tempItem.price,
 |  | 
 | 
											
												
													
														|  | -                        kitType: single,
 |  | 
 | 
											
												
													
														|  | -                      };
 |  | 
 | 
											
												
													
														|  | -                    }
 |  | 
 | 
											
												
													
														|  | -                  }
 |  | 
 | 
											
												
													
														|  | -                } else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +      this.musicGroupSubject = tempResult.musicGroupSubjectPlan || [];
 | 
											
												
													
														|  | 
 |  | +      let instrumentInfo = {};
 | 
											
												
													
														|  | 
 |  | +      let tempInstrument = [];
 | 
											
												
													
														|  | 
 |  | +      tempResult.musicGroupSubjectGoodsGroupList?.forEach((item) => {
 | 
											
												
													
														|  | 
 |  | +        if (item.type == "INSTRUMENT") {
 | 
											
												
													
														|  | 
 |  | +          // 获取乐器所有提供方式
 | 
											
												
													
														|  | 
 |  | +          let KGPTJ = item.kitGroupPurchaseTypeJson
 | 
											
												
													
														|  | 
 |  | +            ? JSON.parse(item.kitGroupPurchaseTypeJson)
 | 
											
												
													
														|  | 
 |  | +            : {};
 | 
											
												
													
														|  | 
 |  | +          for (let single in KGPTJ) {
 | 
											
												
													
														|  | 
 |  | +            let tempItem = Object.assign({}, item); // 深拷贝
 | 
											
												
													
														|  | 
 |  | +            tempItem.marketPrice = tempItem.goodsList[0].marketPrice;
 | 
											
												
													
														|  | 
 |  | +            tempItem.kitType = single; // 优惠模式
 | 
											
												
													
														|  | 
 |  | +            tempItem.coupon = KGPTJ[single]; // 优惠金额
 | 
											
												
													
														|  | 
 |  | +            tempItem.discountPrice = tempItem.goodsList[0].discountPrice
 | 
											
												
													
														|  | 
 |  | +            if (instrumentInfo.id) {
 | 
											
												
													
														|  | 
 |  | +              tempItem.isStatus = false;
 | 
											
												
													
														|  | 
 |  | +              if (single == "GROUP") {
 | 
											
												
													
														|  | 
 |  | +                // 团购
 | 
											
												
													
														|  | 
 |  | +                if (
 | 
											
												
													
														|  | 
 |  | +                  (instrumentInfo.kitType == "GROUP" &&
 | 
											
												
													
														|  | 
 |  | +                    instrumentInfo.price < tempItem.price) ||
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo.kitType == "LEASE" ||
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo.kitType == "FREE"
 | 
											
												
													
														|  | 
 |  | +                ) {
 | 
											
												
													
														|  | 
 |  | +                  this.instrumentResult.forEach((instrRes) => {
 | 
											
												
													
														|  | 
 |  | +                    instrRes.isStatus = false;
 | 
											
												
													
														|  | 
 |  | +                  });
 | 
											
												
													
														|  |                    tempItem.isStatus = true;
 |  |                    tempItem.isStatus = true;
 | 
											
												
													
														|  |                    instrumentInfo = {
 |  |                    instrumentInfo = {
 | 
											
												
													
														|  |                      id: tempItem.id,
 |  |                      id: tempItem.id,
 | 
											
										
											
												
													
														|  | @@ -350,41 +319,79 @@ export default {
 | 
											
												
													
														|  |                      kitType: single,
 |  |                      kitType: single,
 | 
											
												
													
														|  |                    };
 |  |                    };
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -                let childGoodsNameList = [];
 |  | 
 | 
											
												
													
														|  | 
 |  | +              } else if (single == "LEASE") {
 | 
											
												
													
														|  | 
 |  | +                // 租赁
 | 
											
												
													
														|  |                  if (
 |  |                  if (
 | 
											
												
													
														|  | -                  tempItem.childGoodsList &&
 |  | 
 | 
											
												
													
														|  | -                  tempItem.childGoodsList.length > 0
 |  | 
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo.kitType == "LEASE" &&
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo.price < tempItem.price
 | 
											
												
													
														|  |                  ) {
 |  |                  ) {
 | 
											
												
													
														|  | -                  tempItem.childGoodsList.forEach((child) => {
 |  | 
 | 
											
												
													
														|  | -                    if (child.type != "INSTRUMENT" && child.type != "OTHER") {
 |  | 
 | 
											
												
													
														|  | -                      childGoodsNameList.push(child.name);
 |  | 
 | 
											
												
													
														|  | -                    }
 |  | 
 | 
											
												
													
														|  | 
 |  | +                  this.instrumentResult.forEach((instrRes) => {
 | 
											
												
													
														|  | 
 |  | +                    instrRes.isStatus = false;
 | 
											
												
													
														|  |                    });
 |  |                    });
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -                  tempItem.childGoodsNames = childGoodsNameList.join("、");
 |  | 
 | 
											
												
													
														|  | 
 |  | +                  tempItem.isStatus = true;
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo = {
 | 
											
												
													
														|  | 
 |  | +                    id: tempItem.id,
 | 
											
												
													
														|  | 
 |  | +                    price: tempItem.price,
 | 
											
												
													
														|  | 
 |  | +                    kitType: single,
 | 
											
												
													
														|  | 
 |  | +                  };
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +              } else if (single == "FREE") {
 | 
											
												
													
														|  | 
 |  | +                // 免费
 | 
											
												
													
														|  | 
 |  | +                if (
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo.kitType == "FREE" &&
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo.price < tempItem.price
 | 
											
												
													
														|  | 
 |  | +                ) {
 | 
											
												
													
														|  | 
 |  | +                  this.instrumentResult.forEach((instrRes) => {
 | 
											
												
													
														|  | 
 |  | +                    instrRes.isStatus = false;
 | 
											
												
													
														|  | 
 |  | +                  });
 | 
											
												
													
														|  | 
 |  | +                  tempItem.isStatus = true;
 | 
											
												
													
														|  | 
 |  | +                  instrumentInfo = {
 | 
											
												
													
														|  | 
 |  | +                    id: tempItem.id,
 | 
											
												
													
														|  | 
 |  | +                    price: tempItem.price,
 | 
											
												
													
														|  | 
 |  | +                    kitType: single,
 | 
											
												
													
														|  | 
 |  | +                  };
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -                this.instrumentResult.push(tempItem);
 |  | 
 | 
											
												
													
														|  | -                tempInstrument.push(tempItem);
 |  | 
 | 
											
												
													
														|  |                }
 |  |                }
 | 
											
												
													
														|  | -            } else if (item.type == "ACCESSORIES") {
 |  | 
 | 
											
												
													
														|  | -              item.isStatus = true;
 |  | 
 | 
											
												
													
														|  | -              this.accessOries.push(item);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  | 
 |  | +              tempItem.isStatus = true;
 | 
											
												
													
														|  | 
 |  | +              instrumentInfo = {
 | 
											
												
													
														|  | 
 |  | +                id: tempItem.id,
 | 
											
												
													
														|  | 
 |  | +                price: tempItem.price,
 | 
											
												
													
														|  | 
 |  | +                kitType: single,
 | 
											
												
													
														|  | 
 |  | +              };
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | -          });
 |  | 
 | 
											
												
													
														|  | -          // 添加自备选项
 |  | 
 | 
											
												
													
														|  | -          if (this.instrumentResult.length > 0) {
 |  | 
 | 
											
												
													
														|  | -            let sorted = this.groupBy(tempInstrument, (item) => {
 |  | 
 | 
											
												
													
														|  | -              return [item.kitType];
 |  | 
 | 
											
												
													
														|  | -            });
 |  | 
 | 
											
												
													
														|  | -            this.instrumentResultList = sorted;
 |  | 
 | 
											
												
													
														|  | 
 |  | +            let childGoodsNameList = [];
 | 
											
												
													
														|  | 
 |  | +            if (
 | 
											
												
													
														|  | 
 |  | +              tempItem.childGoodsList &&
 | 
											
												
													
														|  | 
 |  | +              tempItem.childGoodsList.length > 0
 | 
											
												
													
														|  | 
 |  | +            ) {
 | 
											
												
													
														|  | 
 |  | +              tempItem.childGoodsList.forEach((child) => {
 | 
											
												
													
														|  | 
 |  | +                if (child.type != "INSTRUMENT" && child.type != "OTHER") {
 | 
											
												
													
														|  | 
 |  | +                  childGoodsNameList.push(child.name);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +              });
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +              tempItem.childGoodsNames = childGoodsNameList.join("、");
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            this.instrumentResult.push(tempItem);
 | 
											
												
													
														|  | 
 |  | +            tempInstrument.push(tempItem);
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  | 
 |  | +        } else if (item.type == "ACCESSORIES") {
 | 
											
												
													
														|  | 
 |  | +          item.isStatus = true;
 | 
											
												
													
														|  | 
 |  | +          this.accessOries.push(item);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // 初始化计算金额
 |  | 
 | 
											
												
													
														|  | -        this.calcPrice();
 |  | 
 | 
											
												
													
														|  |        });
 |  |        });
 | 
											
												
													
														|  | -    },
 |  | 
 | 
											
												
													
														|  | -    onLeBao() {
 |  | 
 | 
											
												
													
														|  | -      this.buyMaintenance = !this.buyMaintenance;
 |  | 
 | 
											
												
													
														|  | 
 |  | +      // 添加自备选项
 | 
											
												
													
														|  | 
 |  | +      if (this.instrumentResult.length > 0) {
 | 
											
												
													
														|  | 
 |  | +        let sorted = this.groupBy(tempInstrument, (item) => {
 | 
											
												
													
														|  | 
 |  | +          return [item.kitType];
 | 
											
												
													
														|  | 
 |  | +        });
 | 
											
												
													
														|  | 
 |  | +        this.instrumentResultList = sorted;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        this.setLeBaoStatus()
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +      // 初始化计算金额
 | 
											
												
													
														|  |        this.calcPrice();
 |  |        this.calcPrice();
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  |      groupBy(array, f) {
 |  |      groupBy(array, f) {
 | 
											
										
											
												
													
														|  | @@ -421,13 +428,45 @@ export default {
 | 
											
												
													
														|  |          );
 |  |          );
 | 
											
												
													
														|  |        }
 |  |        }
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  | -    onCheckItem(item) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    onCheckItem(item,type) {
 | 
											
												
													
														|  |        // 默认选中不可改
 |  |        // 默认选中不可改
 | 
											
												
													
														|  |        if(item.optionalFlag) return
 |  |        if(item.optionalFlag) return
 | 
											
												
													
														|  | 
 |  | +      // 判断乐保是否可选
 | 
											
												
													
														|  | 
 |  | +      if(item.noSelect) return
 | 
											
												
													
														|  | 
 |  | +      // 如果选择的是乐器先把所有选中的取消
 | 
											
												
													
														|  | 
 |  | +      if(type == 'INSTRUMENT') {
 | 
											
												
													
														|  | 
 |  | +        this.instrumentResultList.forEach(group => {
 | 
											
												
													
														|  | 
 |  | +          group.forEach(child => {
 | 
											
												
													
														|  | 
 |  | +            if(child.id != item.id) {
 | 
											
												
													
														|  | 
 |  | +              child.isStatus = false
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +          })
 | 
											
												
													
														|  | 
 |  | +        })
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  |        item.isStatus = !item.isStatus;
 |  |        item.isStatus = !item.isStatus;
 | 
											
												
													
														|  | 
 |  | +      // 重新设置乐保状态
 | 
											
												
													
														|  | 
 |  | +      this.setLeBaoStatus()
 | 
											
												
													
														|  |        // 重新计算金额
 |  |        // 重新计算金额
 | 
											
												
													
														|  |        this.calcPrice();
 |  |        this.calcPrice();
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  | 
 |  | +    setLeBaoStatus() { // 设置乐保状态
 | 
											
												
													
														|  | 
 |  | +      let status = false // 是否有选中乐器
 | 
											
												
													
														|  | 
 |  | +      this.instrumentResultList.forEach(group => {
 | 
											
												
													
														|  | 
 |  | +        group.forEach(item => {
 | 
											
												
													
														|  | 
 |  | +          if(item.isStatus) {
 | 
											
												
													
														|  | 
 |  | +            status = true
 | 
											
												
													
														|  | 
 |  | +          }
 | 
											
												
													
														|  | 
 |  | +        })
 | 
											
												
													
														|  | 
 |  | +      })
 | 
											
												
													
														|  | 
 |  | +      this.instrumentRepair.forEach(repair => {
 | 
											
												
													
														|  | 
 |  | +        if(status) {
 | 
											
												
													
														|  | 
 |  | +          repair.noSelect = false
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +          repair.noSelect = true
 | 
											
												
													
														|  | 
 |  | +          repair.isStatus = false
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      })
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  |      calcPrice() {
 |  |      calcPrice() {
 | 
											
												
													
														|  |        let ids = []
 |  |        let ids = []
 | 
											
												
													
														|  |        let amount = 0,
 |  |        let amount = 0,
 |