12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001 |
- <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"
- >
- <div class="section" v-if="toolsPackage.length > 0" key="toolsPackage">
- <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 v-for="(item, index) in toolsPackage" :key="index">
- <template v-for="(child, index) in formatList">
- <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;">
- {{ child.title }}
- </span>
- </el-col>
- <el-col :span="5">
- <span style="color: #AAA; font-size: 12px;"
- >{{ item.num | unitFormatMonth(item.period) }}个月</span
- >
- </el-col>
- <el-col :span="7" style="text-align: right;">
- <del style="color: #1A1A1A; font-size: 14px;width: 100%"
- >¥{{
- child.monthPrice
- | unitFormatPrice(
- item.period,
- item.num,
- child.halfYearPrice
- )
- }}</del
- >
- </el-col>
- </el-row>
- </template>
- <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>
- <del>原价:¥ {{ onCalcSinglePrice(item) }}</del>
- </div>
- </div>
- </div>
- </div>
- </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> -->
- </div>
- </template>
- <script>
- 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
- },
- 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: 240,
- halfYearPrice: 980
- },
- {
- title: "合奏云练",
- monthPrice: 160,
- halfYearPrice: 580
- },
- {
- title: "独奏云练",
- monthPrice: 160,
- halfYearPrice: 580
- },
- {
- title: "考级云练",
- monthPrice: 160,
- halfYearPrice: 580
- },
- {
- title: "云课程",
- monthPrice: 240,
- halfYearPrice: 980
- }
- ],
- 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
- };
- 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 : [];
- 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 = true;
- this.toolsPackage = member && !member.memberRankSettingId ? [] : [member];
- console.log(this.toolsPackage, "this.toolsPackage");
- // 乐器保养
- 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; // 临时处理,原因一条数据事要使用,如果多条数据会有问题
- marketPrice += parseFloat(item.originalAmount);
- 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") {
- // 团购
- if (
- this.courseViewType == 2 &&
- this.organId == 55 &&
- !this.toolsPackage[0].isStatus
- ) {
- 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);
- },
- onCalcSinglePrice(item) {
- const tempNum = {
- YEAR: 12,
- MONTH: 1,
- QUARTERLY: 3,
- YEAR_HALF: 6
- };
- const num = (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);
- });
- }
- return numeral(Number(price)).format("0,0.00");
- }
- },
- filters: {
- unitFormat(val) {
- let template = {
- YEAR: "年",
- MONTH: "月",
- QUARTERLY: "季度",
- YEAR_HALF: "半年"
- };
- return template[val];
- },
- unitFormatMonth(val, period) {
- const tempNum = {
- YEAR: 12,
- MONTH: 1,
- QUARTERLY: 3,
- YEAR_HALF: 6
- };
- return val * (tempNum[period] || 1);
- },
- unitFormatPrice(val, type, nums, halfYearPrice) {
- const tempNum = {
- YEAR: 12,
- MONTH: 1,
- QUARTERLY: 3,
- YEAR_HALF: 6
- };
- const num = (tempNum[type] || 1) * nums;
- let price = 0;
- if (num % 6 === 0) {
- const halfYearNum = Number(num / 6);
- price += Number(halfYearPrice * halfYearNum);
- } else {
- price += Number(val * num);
- }
- return numeral(price).format("0,0.00");
- }
- }
- };
- </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>
|