123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992 |
- <template>
- <div style="background: #f3f4f8; overflow: hidden;">
- <tips />
- <course-model
- v-if="mypreViewData && mypreViewData.isShowMusicCourseForPay"
- :isShowSalePrice="isShowSalePrice"
- :courseViewType="courseViewType"
- :courseShowInfo="courseShowInfo"
- :remissionCourseFeeStatus="remissionCourseFeeStatus"
- :courseInfo="courseInfo"
- :trainSmallBg="trainSmallBg"
- :serviceValidDate="serviceValidDate"
- :cloudTeacherFee="cloudTeacherFee"
- :chargeTypeName="chargeTypeName"
- :memberCoursePrice="memberCoursePrice"
- :memberCourseShowFlag="memberCourseShowFlag"
- @onCourseChange="onCheckItem"
- @onQuestions="onQuestions"
- />
- <member
- v-if="
- toolsPackage &&
- toolsPackage.length > 0 &&
- mypreViewData &&
- mypreViewData.isShowMemberForPay
- "
- :isShowSalePrice="isShowSalePrice"
- :toolsPackage="toolsPackage"
- :isGiveAccessories="isGiveAccessories"
- :accessStatus="accessOries.length > 0"
- @onCheckItem="onCheckItem"
- >
- <template v-if="toolsPackage.length > 0">
- <div v-for="(item, index) in toolsPackage" :key="index">
- <div class="yunTrain">
- <img :src="trainBg" />
- <div class="toolText">
- <p class="toolTitle">
- <span class="title-name">{{ item.name }}</span>
- <span class="lookVideo"
- >查看视频<i class="icon_video" @click="videoStatus = true"></i
- ></span>
- </p>
- <p class="toolDate">
- 购买后根据教学情况激活使用,详情咨询机构老师
- </p>
- </div>
- </div>
- <div class="section" >
- <el-row class="title-row">
- <el-col :span="12"
- >学练宝版本{{
- isGiveAccessories && accessStatus ? "(赠送辅件一套)" : null
- }}</el-col
- >
- <el-col :span="5" style="text-align: right;">时长</el-col>
- <el-col :span="7" style="text-align: right;">原价</el-col>
- <!-- <el-col :span="5" style="text-align: right;" v-if="isShowSalePrice"
- >售价</el-col
- > -->
- </el-row>
- <div>
- <el-row class="option-row" style="cursor: default;" :key="index">
- <el-col :span="12" style="padding-left: 0.05rem">
- <span style="display: flex; align-items: center;">
- {{ item.name }}
- </span>
- </el-col>
- <el-col :span="5">
- <span style="color: #AAA; font-size: 12px;"
- >{{ item.num }}{{ item.period | unitFormat }}</span
- >
- </el-col>
- <el-col :span="7" style="text-align: right;">
- <del style="color: #1A1A1A; font-size: 14px;width: 100%"
- >¥{{
- item.originalAmount | moneyFormat
- }}</del
- >
- </el-col>
- </el-row>
- <el-row class="option-intro">
- <el-col :span="24" style="padding-left: 0.05rem">
- {{ item.intro }}
- </el-col>
- </el-row>
- <div class="paymentSection" @click="onCheckItem(item, 'train')">
- <i
- class="check_default"
- :class="[
- item.isStatus ? 'check_active' : '',
- item.optionalFlag ? 'disabled' : ''
- ]"
- ></i>
- <div class="paymentPrice">
- <span>优惠价:¥{{ item.actualAmount | moneyFormat }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- </member>
- <instrument-model
- :isShowSalePrice="isShowSalePrice"
- :instrumentResultList="instrumentResultList"
- :buyMaintenance="buyMaintenance"
- :trainSmallBg="trainSmallBg"
- :courseViewType="courseViewType"
- :toolsPackage="toolsPackage"
- :organId="organId"
- @instrumentF="onCheckItem"
- @onQuestions="onQuestions"
- />
- <div
- class="courseModel"
- style="margin-top: 12px;"
- v-if="
- instrumentRepair &&
- instrumentRepair.length > 0 &&
- mypreViewData &&
- mypreViewData.isShowMusicInsuranceForPay
- "
- >
- <h2 class="titles">
- <img :src="trainSmallBg" />
- <span>乐器保养</span>
- </h2>
- <!-- 可选课程信息集合 -->
- <div class="section">
- <el-row class="title-row">
- <el-col :span="isShowSalePrice ? 9 : 14">服务项目</el-col>
- <!-- 原价 -->
- <el-col :span="5" style="text-align: right;">时间</el-col>
- <el-col :span="5" style="text-align: right;">原价</el-col>
- <el-col :span="5" style="text-align: right;" v-if="isShowSalePrice"
- >售价</el-col
- >
- </el-row>
- <el-row
- class="option-row"
- v-for="(item, index) in instrumentRepair"
- :key="index"
- @click.native="onCheckItem(item)"
- >
- <el-col :span="isShowSalePrice ? 9 : 14">
- <i
- class="check_default"
- :class="[
- item.isStatus ? 'check_active' : '',
- item.optionalFlag ? 'disabled' : '',
- item.noSelect ? 'noSelect' : ''
- ]"
- ></i>
- {{ item.name }}
- </el-col>
- <el-col :span="5">
- <span style="color: #AAA; font-size: 12px;"
- >{{ item.num }}(年)</span
- >
- </el-col>
- <el-col :span="5">
- <del style="color: #AAA; font-size: 12px;"
- >¥{{ item.originalAmount | moneyFormat }}</del
- >
- </el-col>
- <el-col :span="5" v-if="isShowSalePrice">
- <span style="color: #1A1A1A"
- >¥{{ item.actualAmount | moneyFormat }}</span
- >
- </el-col>
- </el-row>
- </div>
- </div>
- <accessories
- :isShowSalePrice="isShowSalePrice"
- :trainSmallBg="trainSmallBg"
- :accessOries="accessOries"
- :isGiveAccessories="giveAccessoriesStatus"
- @onAuxiliarie="onCheckItem"
- />
- <activity
- v-if="
- activityList &&
- activityList.length > 0 &&
- mypreViewData &&
- mypreViewData.isShowVipCourseForPay
- "
- :isShowSalePrice="isShowSalePrice"
- :trainSmallBg="trainSmallBg"
- :activityList="activityList"
- @onCheckItem="onCheckItem"
- />
- <!-- <div class="buy">
- <div class="price">
- <p class="oldprice">
- <del class="text">原价</del>
- <del style="font-size: 13px"
- >¥{{ orderInfo.marketPrice | moneyFormat }}</del
- >
- </p>
- <p class="now_price">
- <span class="text">仅需支付</span>
- <span style="font-weight: bold">¥{{ needPrice | moneyFormat }}</span>
- </p>
- </div>
- <a class="btn-submit">购买</a>
- </div> -->
- <el-dialog
- title="视频"
- :visible.sync="videoStatus"
- :modal-append-to-body="false"
- :append-to-body="true"
- class="videoDialog"
- width="576px"
- >
- <videoTcplayer
- v-if="videoStatus"
- style="width: 100%"
- controls="controls"
- class="ql-video"
- :src="'https://oss.dayaedu.com/daya/202105/SWmqmvW.mp4'"
- :poster="require('../../../assets/images/musicGroup/video_bg.png')"
- />
- </el-dialog>
- </div>
- </template>
- <script>
- import videoTcplayer from "@/components/video-tcplayer";
- import { permission } from "@/utils/directivePage";
- import { getSubjectGoodsAndInfoPreview, getType } from "@/api/buildTeam";
- import dayjs from "dayjs";
- import numeral from "numeral";
- const paymentPatternType = {
- 0: "按月",
- 1: "按学期",
- 2: "一次性"
- };
- import Tips from "./tips";
- import courseModel from "@/views/resetTeaming/modals/courseModel";
- import InstrumentModel from "./instrumentModel";
- import accessories from "./accessories";
- import activity from "./activity";
- import member from "./member";
- export default {
- props: ["subjectId", "calenderId", "preViewData"],
- components: {
- Tips,
- courseModel,
- InstrumentModel,
- accessories,
- activity,
- member,
- videoTcplayer
- },
- data() {
- const query = this.$route.query;
- return {
- videoStatus: false,
- trainBg: require("../../../assets/images/musicGroup/yunTrain_bg.png"),
- trainSmallBg: require("../../../assets/images/musicGroup/yunTrain_small_bg.png"),
- musicGroupId: query.id,
- organId: null,
- result: {}, // 返回结果
- instrument: {}, // 乐器类型
- baseInfo: {}, // 其它类
- money: 580,
- balance: 0, // 余额
- needPrice: 0, // 还需支付
- payType: false, // 是否余额支付
- cloudTeacherFee: 0, // 学练宝费用
- cloudTeacherPlusFee: 0, // 学练宝+
- orderInfo: {
- marketPrice: 0,
- amount: 0, // 现价总金额
- groupPurchasePrice: 0, // 现价
- goodsGroupIds: null,
- goodsIds: null,
- contractGoodsIds: null, // 选中所有商品ID
- couponPrice: 0, //
- musicClassFee: 0, // 课程现价
- musicMarketClassFee: 0, // 课程原价
- accessPrice: 0, // 辅件现价
- accessMarketPrice: 0, // 辅件原价
- goodsPrice: 0, // 乐器现价
- goodsMarketPrice: 0 // 乐器原价
- }, // 金额列表,金额计算
- toolsPackage: [], // 学习工具包
- instrumentRepair: [], // 乐保信息
- activityList: [], // 小班课信息
- courseInfo: [], // 课程信息
- courseShowInfo: [], // 课程信息显示用
- musicGroupSubject: null, // 基本信息
- instrumentResult: [], //乐器
- accessOries: [], // 辅件(打包)
- agreeStatus: true,
- authStatus: false,
- ids: [],
- instrumentResultList: [],
- paymentStatus: null,
- paymentPattern: null,
- serviceValidDate: null, // 服务时间
- courseShowStatus: false,
- chargeTypeList: [],
- chargeTypeName: null,
- courseViewType: 0, // 收费模式,0 课程显示,1 AMR系统 2会员 3免费
- leBaoStatus: false,
- buyMaintenance: false, // 是否开启乐保
- isClickStatus: false,
- accessStatus: false, // 是否有辅件乐保
- accessIsShowStatus: false, // 是否显示辅件 true 显示, false 不显示
- memberCoursePrice: [], // 学练宝,显示赠送的课程
- memberCourseShowFlag: false, // 是否显示赠送课程
- buyCloudTeacher: false, // 是否购买学练宝
- remissionCourseFeeStatus: false,
- isGiveAccessories: false, // 是否赠送辅件
- giveAccessoriesStatus: false,
- mypreViewData: {
- isShowMemberForPay: true,
- isShowMusicInsuranceForPay: true,
- isShowVipCourseForPay: true,
- isShowMusicCourseForPay: true
- },
- isShowSalePrice: true, // 是否显示原价
- formatList: [
- {
- title: "双师云教程",
- monthPrice: 330,
- halfYearPrice: 1980,
- },
- {
- title: "基础云练",
- monthPrice: 114,
- halfYearPrice: 680,
- },
- {
- title: "合奏云练",
- monthPrice: 114,
- halfYearPrice: 680,
- },
- {
- title: "独奏云练",
- monthPrice: 114,
- halfYearPrice: 680,
- },
- ],
- tempNum: {
- YEAR: 12,
- MONTH: 1,
- QUARTERLY: 3,
- YEAR_HALF: 6
- }
- };
- },
- mounted() {
- this.__init();
- },
- methods: {
- async __init() {
- // 获取数据
- let params = {
- musicGroupId: this.musicGroupId,
- subjectId: this.subjectId,
- calenderId: this.calenderId
- };
- await getSubjectGoodsAndInfoPreview(params).then(res => {
- let result = res;
- if (result.code == 200) {
- let tempResult = result.data;
- this.__dataFormat(tempResult);
- }
- // 初始化计算金额
- this.calcPrice();
- });
- },
- __dataFormat(tempResult) {
- this.mypreViewData =
- this.preViewData && this.preViewData.paymentCalender
- ? JSON.parse(JSON.stringify(this.preViewData))
- : {
- isShowMemberForPay: true,
- isShowMusicInsuranceForPay: true,
- isShowVipCourseForPay: true,
- isShowMusicCourseForPay: true
- };
- console.log(this.preViewData)
- this.courseViewType = tempResult.musicGroup.courseViewType || 0;
- this.isGiveAccessories =
- (tempResult.musicGroup && tempResult.musicGroup.isGiveAccessories) ||
- false; // 是否赠送辅件
- this.organId = tempResult.musicGroup.organId;
- const musicGroupStatus = tempResult.musicGroup.status;
- 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;
- 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.mypreViewData && this.mypreViewData.paymentCalender
- ? this.mypreViewData.paymentCalender
- : tempResult.paymentCalender || null;
- if (paymentCalender && paymentCalender.calender) {
- this.isShowSalePrice =
- paymentCalender.calender.isShowSalePrice || false;
- if (paymentCalender.calender.paymentItemShowState) {
- let obj = JSON.parse(paymentCalender.calender.paymentItemShowState);
- for (let key in obj) {
- this.mypreViewData[key] = obj[key];
- }
- }
- }
- let tempInfo =
- paymentCalender && paymentCalender.course ? paymentCalender.course : [];
- // 学练宝
- console.log(paymentCalender, "paymentCalender")
- const member =
- paymentCalender && paymentCalender.member ? paymentCalender.member : [];
- member.forEach((item) => {
- item.isStatus = true;
- })
- this.toolsPackage = member;
- // 乐器保养
- const repair =
- paymentCalender && paymentCalender.repair ? paymentCalender.repair : {};
- repair.name = "乐器保养";
- repair.isStatus = true; // 默认不选择乐器保养
- this.instrumentRepair = Number(repair.actualAmount) ? [repair] : [];
- // 小班课
- const activity =
- paymentCalender && paymentCalender.activity
- ? paymentCalender.activity
- : [];
- activity.map(i => {
- i.isStatus = true;
- });
- this.activityList = [...activity];
- // 判断是否有课程
- if (tempInfo && tempInfo.length > 0) {
- // 默认课程都选中
- 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 = [];
- let musicGroupSubjectGoodsGroupList =
- this.preViewData?.payUserType == "SCHOOL" ||
- musicGroupStatus == "PROGRESS"
- ? []
- : tempResult.musicGroupSubjectGoodsGroupList;
- 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,
- groupRemissionCourseFee: tempItem.groupRemissionCourseFee
- };
- }
- } 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,
- groupRemissionCourseFee: tempItem.groupRemissionCourseFee
- };
- }
- } 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,
- groupRemissionCourseFee: tempItem.groupRemissionCourseFee
- };
- }
- }
- } else {
- tempItem.isStatus = true;
- instrumentInfo = {
- id: tempItem.id,
- price: tempItem.price,
- kitType: single,
- groupRemissionCourseFee: tempItem.groupRemissionCourseFee
- };
- }
- 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);
- }
- });
- // 添加自备选项
- if (this.instrumentResult.length > 0) {
- let sorted = this.groupBy(tempInstrument, item => {
- return [item.kitType];
- });
- this.instrumentResultList = sorted;
- // 设置是否有减免金额
- this.instrumentGetStatus();
- this.setLeBaoStatus();
- }
- // 如果选择的是乐保,则把所有辅件价格设置为0
- this.giveAccessoriesSetStatus();
- // 初始化计算金额
- this.calcPrice();
- console.log({
- toolsPackage: this.toolsPackage,
- instrumentRepair: this.instrumentRepair,
- activityList: this.activityList,
- courseInfo: this.courseInfo,
- instrumentResult: this.instrumentResult,
- accessOries: this.accessOries,
- musicGroupSubject: this.musicGroupSubject
- });
- this.$forceUpdate();
- },
- groupBy(array, f) {
- var groups = {};
- array.forEach(function(o) {
- var group = JSON.stringify(f(o));
- groups[group] = groups[group] || [];
- groups[group].push(o);
- });
- return Object.keys(groups).map(function(group) {
- return groups[group];
- });
- },
- onQuestions(type) {
- if (type == "amr") {
- this.$alert(
- `<b>革命性的“AMR器乐练习系统”</b><br />它的诞生是基于世界上最优秀的华人管乐指导专家唐嘉宏先生的教育理念,创新开发的一种新型“音乐感官植入程序”,这个程序抛弃了传统的“数线式识谱、机械式节奏、死记式乐理”,它营造出沉浸式可变速演奏过程,采用画面与音乐刺激序列组合而成的特定场景,在趣味性挑战的反复刺激中逐步促进器乐演奏的三核心:“音质→音准→音型”,从而达成演奏各环节水准的均匀提高,产生永久性条件反射式大脑记忆,将多板块知识融会贯通,让抽象的音乐知识刻入脑海里!<br /><br /><b>本练习系统的特点:</b><br /> 1.轻松快速掌握要点,让练习者沉浸其中,远离枯燥!<br /> 2.不假思索就能瞬间唤起反射式记忆,演奏识谱不再慢吞吞!<br /> 3.真正的实践记忆,摆脱纸上谈兵,与实际演奏紧密结合!<br />4.思维+肌肉的双重强化!无缝整合复习系统!<br /> 5.每条练习都经过严谨的编曲,你以为你只是在练习旋律线?其实是整个乐团在为你伴奏!`,
- "AMR器乐练习系统",
- {
- confirmButtonText: "确定",
- dangerouslyUseHTMLString: true,
- callback: action => {}
- }
- );
- } else if (type == "instrument") {
- this.$alert(
- `<p style="text-align: justify">1.乐器保养是管乐迷针对乐团学员提供的乐器检查、保养及维修优惠特权;<br />2.该特权为包年制,从开通特权之日起365天内有效;<br />3.特权用户可享受管乐迷提供专业的高级乐器维修技师一年不低于两次下校检查乐器使用情况;<br />4.特权有效期内凭该特权绑定的乐器编号可享受保养人工费减免、非返厂维修人工费优惠等特权;<br />感谢您的信任和支持!</p>`,
- "乐器保养特权",
- {
- confirmButtonText: "确定",
- dangerouslyUseHTMLString: true,
- callback: action => {}
- }
- );
- }
- },
- // onTrainChange(item) {
- // // 学练宝点击时
- // // this.$emit("onCheckItem", item, "train");
- // },
- onCheckItem(item, type) {
- // 默认选中不可改
- if (item.optionalFlag) return;
- // 判断乐保是否可选
- if (item.noSelect) return;
- // 如果选择的是乐器先把所有选中的取消
- if (type == "INSTRUMENT") {
- this.instrumentResultList.forEach(group => {
- group.forEach(child => {
- if (
- child.id != item.id ||
- (child.id == item.id && child.kitType != item.kitType)
- ) {
- child.isStatus = false;
- }
- });
- });
- }
- item.isStatus = !item.isStatus;
- console.log(item.isStatus, "onCheckItem");
- if (type == "train") {
- // 如果选择的是乐保,则把所有辅件价格设置为0
- this.giveAccessoriesSetStatus();
- }
- // 设置是否有减免金额
- this.instrumentGetStatus();
- // 重新设置乐保状态
- this.setLeBaoStatus();
- // 重新计算金额
- this.calcPrice();
- this.$forceUpdate();
- },
- giveAccessoriesSetStatus() {
- let status = false; // 是否有选中学练宝
- this.toolsPackage.forEach(item => {
- if (item.isStatus) {
- status = true;
- } else {
- status = false;
- }
- });
- this.giveAccessoriesStatus = this.isGiveAccessories && status;
- this.$forceUpdate();
- },
- instrumentGetStatus() {
- let childItem = {};
- this.instrumentResultList.forEach(group => {
- group.forEach(child => {
- if (child.isStatus) {
- childItem = child;
- }
- });
- });
- this.remissionCourseFeeStatus =
- childItem.kitType == "GROUP" && childItem.groupRemissionCourseFee == 1
- ? true
- : false;
- },
- 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;
- }
- });
- this.$forceUpdate();
- },
- calcPrice() {
- let ids = [];
- let amount = 0,
- marketPrice = 0,
- goodsPrice = 0, // 乐器两现价
- goodsMarketPrice = 0, // 乐器原价
- goodsGroupIds = {},
- courseKeys = [],
- couponPrice = 0, // 优惠金额
- goodsIds = [],
- buyCalenderActivityId = [], // 小班课
- tempCourseFee = 0,
- musicClassFee = 0,
- tempAccessPrice = 0,
- tempAccessMarketPrice = 0,
- tempGroupRemissionCourseFee = 0, // 乐团减免费用
- contractGoodsIds = ""; // 合同所需要的商品Id (只需要乐器编号)
- // 课程
- let mgs = this.musicGroupSubject;
- let csi = this.courseInfo;
- // 加上判断是否有课程信息
- if (mgs) {
- csi.forEach(item => {
- if (item.isStatus) {
- musicClassFee += parseFloat(item.courseCurrentPrice);
- // if (this.courseViewType != 2) {
- // }
- if (item.id > 0) {
- courseKeys.push(item.id);
- }
- // 不可选的课程才会减免课程费用
- if (!item.isStudentOptional) {
- tempGroupRemissionCourseFee += parseFloat(
- item.courseCurrentPrice
- );
- }
- marketPrice += parseFloat(item.courseOriginalPrice);
- // else {
- // marketPrice += parseFloat(item.courseCurrentPrice);
- // }
- // if (this.courseViewType == 0 && !item.isStudentOptional) {
- // marketPrice += parseFloat(item.courseCurrentPrice);
- // }
- }
- });
- }
- // 学练宝
- const toolsPackage = this.toolsPackage;
- if (toolsPackage.length > 0) {
- toolsPackage.forEach(item => {
- if (item.isStatus) {
- this.buyCloudTeacher = true; // 临时处理,原因一条数据事要使用,如果多条数据会有问题
- const num = (this.tempNum[item.period] || 1) * item.num;
- let price = 0;
- if (num % 6 === 0) {
- const halfYearNum = Number(num / 6);
- this.formatList.forEach((format) => {
- price += Number(format.halfYearPrice * halfYearNum);
- });
- } else {
- this.formatList.forEach((format) => {
- price += Number(format.monthPrice * num);
- });
- }
- marketPrice += parseFloat(price);
- amount += parseFloat(item.actualAmount);
- } else {
- this.buyCloudTeacher = false;
- }
- });
- }
- // 乐器
- let ir = this.instrumentResult;
- if (ir.length > 0) {
- ir.forEach(item => {
- if (item.isStatus) {
- if (item.name != "自备乐器") {
- contractGoodsIds += item.goodsIdList;
- }
- if (item.kitType == "FREE") {
- amount += 0;
- couponPrice = 0; // 优惠金额
- } else if (item.kitType == "LEASE") {
- couponPrice = item.coupon; // 优惠金额
- if (item.name != "自备乐器") {
- amount += item.depositFee;
- goodsPrice += item.depositFee;
- } else {
- amount += 0;
- }
- } else if (item.kitType == "GROUP") {
- // 团购
- let isToolStatus = false
- this.toolsPackage.forEach(item => {
- if(item.isStatus) {
- isToolStatus = true
- }
- })
- if (
- this.courseViewType == 2 &&
- this.organId == 55 &&
- !isToolStatus
- ) {
- amount += parseFloat(item.discountPrice);
- goodsPrice += parseFloat(item.discountPrice);
- couponPrice = item.coupon ? item.coupon : 0;
- } else {
- amount += parseFloat(item.price);
- goodsPrice += parseFloat(item.price);
- couponPrice = item.coupon ? item.coupon : 0;
- }
- }
- if (item.kitType == "LEASE") {
- if (item.name != "自备乐器") {
- marketPrice += parseFloat(item.marketPrice);
- goodsMarketPrice += item.depositFee;
- }
- } else {
- marketPrice += parseFloat(item.marketPrice);
- goodsMarketPrice += parseFloat(item.marketPrice);
- }
- // item.id ? goodsGroupIds[item.id] : null
- if (item.id) {
- goodsGroupIds[item.id] = item.kitType;
- }
- // 是否减免课程费用,必须团购,并且开启了减免课程费用
- if (item.kitType == "GROUP" && item.groupRemissionCourseFee == 1) {
- musicClassFee = parseFloat(
- musicClassFee - tempGroupRemissionCourseFee
- );
- }
- }
- });
- }
- // 乐器保养
- const instrumentRepair = this.instrumentRepair;
- if (instrumentRepair.length > 0) {
- instrumentRepair.forEach(item => {
- if (item.isStatus) {
- this.buyMaintenance = true;
- marketPrice += item.originalAmount;
- amount += parseFloat(item.actualAmount);
- } else {
- this.buyMaintenance = false;
- }
- });
- }
- amount += parseFloat(tempCourseFee + musicClassFee);
- // 辅件
- if (this.accessOries.length > 0) {
- this.accessOries.forEach(item => {
- // && this.accessIsShowStatus
- if (item.isStatus) {
- tempAccessPrice += this.giveAccessoriesStatus
- ? 0
- : parseFloat(item.price);
- amount += this.giveAccessoriesStatus ? 0 : parseFloat(item.price);
- if (item.goodsList && item.goodsList.length > 0) {
- item.goodsList.forEach(childGoods => {
- tempAccessMarketPrice += parseFloat(childGoods.marketPrice);
- marketPrice += parseFloat(childGoods.marketPrice);
- });
- }
- goodsGroupIds[item.id] = "ACCESSORIES";
- }
- });
- }
- // 小班课
- const activityList = this.activityList;
- if (activityList.length > 0) {
- activityList.forEach(item => {
- if (item.isStatus) {
- buyCalenderActivityId.push(item.id);
- marketPrice += item.originalAmount;
- amount += parseFloat(item.actualAmount);
- }
- });
- }
- let tempGroupPurchasePrice = amount;
- this.payCountMoney = amount;
- // 判断减去优惠金额,是否大于0(这里有可能出现负数)
- this.ids = ids;
- this.needPrice = Number(amount.toFixed(2));
- this.orderInfo = {
- amount: Number(amount.toFixed(2)),
- marketPrice: Number(marketPrice.toFixed(2)),
- groupPurchasePrice: tempGroupPurchasePrice,
- couponPrice: couponPrice,
- goodsGroupIds: goodsGroupIds,
- goodsIds: goodsIds.join(","),
- contractGoodsIds: contractGoodsIds,
- buyCalenderActivityId,
- courseKeys: courseKeys,
- musicClassFee: musicClassFee,
- accessMarketPrice: tempAccessMarketPrice,
- accessPrice: tempAccessPrice,
- goodsPrice: goodsPrice,
- goodsMarketPrice: goodsMarketPrice
- };
- },
- permission(str) {
- return permission(str);
- }
- },
- filters: {
- unitFormat(val) {
- let template = {
- YEAR: "(年)",
- MONTH: "(月)",
- // QUARTERLY: "(季度)",
- YEAR_HALF: "(半年)"
- };
- return template[val];
- }
- }
- };
- </script>
- <style lang="less" scoped>
- @import url("./signUpPayment.less");
- .paymentSection {
- display: flex;
- align-items: center;
- margin-top: 13px;
- background: #f7f7f7;
- border-radius: 6px;
- padding: 10px 6px;
- cursor: pointer;
- .paymentPrice {
- span {
- font-size: 15px;
- font-weight: 500;
- color: #f10100;
- line-height: 21px;
- }
- del {
- padding-left: 8px;
- font-size: 13px;
- color: #777777;
- }
- }
- }
- </style>
|