subject-preview.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <template>
  2. <div style="background: #f3f4f8; overflow: hidden;">
  3. <tips />
  4. <course-model
  5. v-if="mypreViewData && mypreViewData.isShowMusicCourseForPay"
  6. :isShowSalePrice="isShowSalePrice"
  7. :courseViewType="courseViewType"
  8. :courseShowInfo="courseShowInfo"
  9. :remissionCourseFeeStatus="remissionCourseFeeStatus"
  10. :courseInfo="courseInfo"
  11. :trainSmallBg="trainSmallBg"
  12. :serviceValidDate="serviceValidDate"
  13. :cloudTeacherFee="cloudTeacherFee"
  14. :chargeTypeName="chargeTypeName"
  15. :memberCoursePrice="memberCoursePrice"
  16. :memberCourseShowFlag="memberCourseShowFlag"
  17. @onCourseChange="onCheckItem"
  18. @onQuestions="onQuestions"
  19. />
  20. <member
  21. v-if="
  22. toolsPackage &&
  23. toolsPackage.length > 0 &&
  24. mypreViewData &&
  25. mypreViewData.isShowMemberForPay
  26. "
  27. :isShowSalePrice="isShowSalePrice"
  28. :toolsPackage="toolsPackage"
  29. :isGiveAccessories="isGiveAccessories"
  30. :accessStatus="accessOries.length > 0"
  31. @onCheckItem="onCheckItem"
  32. />
  33. <instrument-model
  34. :isShowSalePrice="isShowSalePrice"
  35. :instrumentResultList="instrumentResultList"
  36. :buyMaintenance="buyMaintenance"
  37. :trainSmallBg="trainSmallBg"
  38. :courseViewType="courseViewType"
  39. :toolsPackage="toolsPackage"
  40. :organId="organId"
  41. @instrumentF="onCheckItem"
  42. @onQuestions="onQuestions"
  43. />
  44. <div
  45. class="courseModel"
  46. style="margin-top: 12px;"
  47. v-if="
  48. instrumentRepair &&
  49. instrumentRepair.length > 0 &&
  50. mypreViewData &&
  51. mypreViewData.isShowMusicInsuranceForPay
  52. "
  53. >
  54. <h2 class="titles">
  55. <img :src="trainSmallBg" />
  56. <span>乐器保养</span>
  57. </h2>
  58. <!-- 可选课程信息集合 -->
  59. <div class="section">
  60. <el-row class="title-row">
  61. <el-col :span="isShowSalePrice ? 9 : 14">服务项目</el-col>
  62. <!-- 原价 -->
  63. <el-col :span="5" style="text-align: right;">时间</el-col>
  64. <el-col :span="5" style="text-align: right;">原价</el-col>
  65. <el-col :span="5" style="text-align: right;" v-if="isShowSalePrice"
  66. >售价</el-col
  67. >
  68. </el-row>
  69. <el-row
  70. class="option-row"
  71. v-for="(item, index) in instrumentRepair"
  72. :key="index"
  73. @click.native="onCheckItem(item)"
  74. >
  75. <el-col :span="isShowSalePrice ? 9 : 14">
  76. <i
  77. class="check_default"
  78. :class="[
  79. item.isStatus ? 'check_active' : '',
  80. item.optionalFlag ? 'disabled' : '',
  81. item.noSelect ? 'noSelect' : ''
  82. ]"
  83. ></i>
  84. {{ item.name }}
  85. </el-col>
  86. <el-col :span="5">
  87. <span style="color: #AAA; font-size: 12px;"
  88. >{{ item.num }}(年)</span
  89. >
  90. </el-col>
  91. <el-col :span="5">
  92. <del style="color: #AAA; font-size: 12px;"
  93. >¥{{ item.originalAmount | moneyFormat }}</del
  94. >
  95. </el-col>
  96. <el-col :span="5" v-if="isShowSalePrice">
  97. <span style="color: #1A1A1A"
  98. >¥{{ item.actualAmount | moneyFormat }}</span
  99. >
  100. </el-col>
  101. </el-row>
  102. </div>
  103. </div>
  104. <accessories
  105. :isShowSalePrice="isShowSalePrice"
  106. :trainSmallBg="trainSmallBg"
  107. :accessOries="accessOries"
  108. :isGiveAccessories="giveAccessoriesStatus"
  109. @onAuxiliarie="onCheckItem"
  110. />
  111. <activity
  112. v-if="
  113. activityList &&
  114. activityList.length > 0 &&
  115. mypreViewData &&
  116. mypreViewData.isShowVipCourseForPay
  117. "
  118. :isShowSalePrice="isShowSalePrice"
  119. :trainSmallBg="trainSmallBg"
  120. :activityList="activityList"
  121. @onCheckItem="onCheckItem"
  122. />
  123. <!-- <div class="buy">
  124. <div class="price">
  125. <p class="oldprice">
  126. <del class="text">原价</del>
  127. <del style="font-size: 13px"
  128. >¥{{ orderInfo.marketPrice | moneyFormat }}</del
  129. >
  130. </p>
  131. <p class="now_price">
  132. <span class="text">仅需支付</span>
  133. <span style="font-weight: bold">¥{{ needPrice | moneyFormat }}</span>
  134. </p>
  135. </div>
  136. <a class="btn-submit">购买</a>
  137. </div> -->
  138. </div>
  139. </template>
  140. <script>
  141. import { permission } from "@/utils/directivePage";
  142. import { getSubjectGoodsAndInfoPreview, getType } from "@/api/buildTeam";
  143. import dayjs from "dayjs";
  144. const paymentPatternType = {
  145. 0: "按月",
  146. 1: "按学期",
  147. 2: "一次性"
  148. };
  149. import Tips from "./tips";
  150. import courseModel from "@/views/resetTeaming/modals/courseModel";
  151. import InstrumentModel from "./instrumentModel";
  152. import accessories from "./accessories";
  153. import activity from "./activity";
  154. import member from "./member";
  155. export default {
  156. props: ["subjectId", "calenderId", "preViewData"],
  157. components: {
  158. Tips,
  159. courseModel,
  160. InstrumentModel,
  161. accessories,
  162. activity,
  163. member
  164. },
  165. data() {
  166. const query = this.$route.query;
  167. return {
  168. videoStatus: false,
  169. trainBg: require("../../../assets/images/musicGroup/yunTrain_bg.png"),
  170. trainSmallBg: require("../../../assets/images/musicGroup/yunTrain_small_bg.png"),
  171. musicGroupId: query.id,
  172. organId: null,
  173. result: {}, // 返回结果
  174. instrument: {}, // 乐器类型
  175. baseInfo: {}, // 其它类
  176. money: 580,
  177. balance: 0, // 余额
  178. needPrice: 0, // 还需支付
  179. payType: false, // 是否余额支付
  180. cloudTeacherFee: 0, // 云教练费用
  181. cloudTeacherPlusFee: 0, // 云教练+
  182. orderInfo: {
  183. marketPrice: 0,
  184. amount: 0, // 现价总金额
  185. groupPurchasePrice: 0, // 现价
  186. goodsGroupIds: null,
  187. goodsIds: null,
  188. contractGoodsIds: null, // 选中所有商品ID
  189. couponPrice: 0, //
  190. musicClassFee: 0, // 课程现价
  191. musicMarketClassFee: 0, // 课程原价
  192. accessPrice: 0, // 辅件现价
  193. accessMarketPrice: 0, // 辅件原价
  194. goodsPrice: 0, // 乐器现价
  195. goodsMarketPrice: 0 // 乐器原价
  196. }, // 金额列表,金额计算
  197. toolsPackage: [], // 学习工具包
  198. instrumentRepair: [], // 乐保信息
  199. activityList: [], // 小班课信息
  200. courseInfo: [], // 课程信息
  201. courseShowInfo: [], // 课程信息显示用
  202. musicGroupSubject: null, // 基本信息
  203. instrumentResult: [], //乐器
  204. accessOries: [], // 辅件(打包)
  205. agreeStatus: true,
  206. authStatus: false,
  207. ids: [],
  208. instrumentResultList: [],
  209. chargeTypeId: null,
  210. paymentStatus: null,
  211. paymentPattern: null,
  212. serviceValidDate: null, // 服务时间
  213. courseShowStatus: false,
  214. chargeTypeList: [],
  215. chargeTypeName: null,
  216. courseViewType: 0, // 收费模式,0 课程显示,1 AMR系统 2会员
  217. leBaoStatus: false,
  218. buyMaintenance: false, // 是否开启乐保
  219. isClickStatus: false,
  220. accessStatus: false, // 是否有辅件乐保
  221. accessIsShowStatus: false, // 是否显示辅件 true 显示, false 不显示
  222. memberCoursePrice: [], // 云教练,显示赠送的课程
  223. memberCourseShowFlag: false, // 是否显示赠送课程
  224. buyCloudTeacher: false, // 是否购买云教练
  225. remissionCourseFeeStatus: false,
  226. isGiveAccessories: false, // 是否赠送辅件
  227. giveAccessoriesStatus: false,
  228. mypreViewData: {
  229. isShowMemberForPay: true,
  230. isShowMusicInsuranceForPay: true,
  231. isShowVipCourseForPay: true,
  232. isShowMusicCourseForPay: true
  233. },
  234. isShowSalePrice: true // 是否显示原价
  235. };
  236. },
  237. mounted() {
  238. this.__init();
  239. },
  240. methods: {
  241. async __init() {
  242. // 获取数据
  243. let params = {
  244. musicGroupId: this.musicGroupId,
  245. subjectId: this.subjectId,
  246. calenderId: this.calenderId
  247. };
  248. await getSubjectGoodsAndInfoPreview(params).then(res => {
  249. let result = res;
  250. if (result.code == 200) {
  251. let tempResult = result.data;
  252. this.__dataFormat(tempResult);
  253. }
  254. // 初始化计算金额
  255. this.calcPrice();
  256. });
  257. },
  258. __dataFormat(tempResult) {
  259. this.mypreViewData =
  260. this.preViewData && this.preViewData.paymentCalender
  261. ? JSON.parse(JSON.stringify(this.preViewData))
  262. : {
  263. isShowMemberForPay: true,
  264. isShowMusicInsuranceForPay: true,
  265. isShowVipCourseForPay: true,
  266. isShowMusicCourseForPay: true
  267. };
  268. this.courseViewType = tempResult.musicGroup.courseViewType || 0;
  269. this.isGiveAccessories =
  270. (tempResult.musicGroup && tempResult.musicGroup.isGiveAccessories) ||
  271. false; // 是否赠送辅件
  272. this.organId = tempResult.musicGroup.organId;
  273. const musicGroupStatus = tempResult.musicGroup.status;
  274. this.cloudTeacherFee = tempResult.cloudTeacherFee || 0;
  275. this.cloudTeacherPlusFee = tempResult.cloudTeacherPlusFee || 0;
  276. let memberCoursePrice = tempResult.memberCoursePrice || {};
  277. for (let i in memberCoursePrice) {
  278. this.memberCoursePrice.push({
  279. name: coursesType[i],
  280. price: memberCoursePrice[i]
  281. });
  282. }
  283. this.memberCourseShowFlag =
  284. tempResult.musicGroup.memberCourseShowFlag || false;
  285. this.paymentPattern = 2;
  286. if (tempResult.musicGroupPaymentCalender) {
  287. this.paymentPattern =
  288. tempResult.musicGroupPaymentCalender.paymentPattern;
  289. this.serviceValidDate =
  290. dayjs(
  291. tempResult.musicGroupPaymentCalender.paymentValidStartDate
  292. ).format("YYYY/MM/DD") +
  293. "~" +
  294. dayjs(
  295. tempResult.musicGroupPaymentCalender.paymentValidEndDate
  296. ).format("YYYY/MM/DD");
  297. }
  298. const paymentCalender =
  299. this.mypreViewData && this.mypreViewData.paymentCalender
  300. ? this.mypreViewData.paymentCalender
  301. : tempResult.paymentCalender || null;
  302. if (paymentCalender && paymentCalender.calender) {
  303. this.isShowSalePrice =
  304. paymentCalender.calender.isShowSalePrice || false;
  305. if (paymentCalender.calender.paymentItemShowState) {
  306. let obj = JSON.parse(paymentCalender.calender.paymentItemShowState);
  307. for (let key in obj) {
  308. this.mypreViewData[key] = obj[key];
  309. }
  310. }
  311. }
  312. let tempInfo =
  313. paymentCalender && paymentCalender.course ? paymentCalender.course : [];
  314. let memberPrivilegesItemList = tempResult.memberPrivilegesItemList
  315. ? tempResult.memberPrivilegesItemList
  316. : [];
  317. let tempMember = [];
  318. memberPrivilegesItemList.forEach(member => {
  319. if (
  320. member.memberPrivilegesItems &&
  321. member.memberPrivilegesItems.length > 0
  322. ) {
  323. member.memberPrivilegesItems.forEach(item => {
  324. tempMember.push(item.name);
  325. });
  326. }
  327. });
  328. // 云教练
  329. const member =
  330. paymentCalender && paymentCalender.member ? paymentCalender.member : {};
  331. member.isStatus = true;
  332. this.toolsPackage = member && !member.memberRankSettingId ? [] : [member];
  333. // 乐器保养
  334. const repair =
  335. paymentCalender && paymentCalender.repair ? paymentCalender.repair : {};
  336. repair.name = "乐器保养";
  337. repair.isStatus = true; // 默认不选择乐器保养
  338. this.instrumentRepair = Number(repair.actualAmount) ? [repair] : [];
  339. // 小班课
  340. const activity =
  341. paymentCalender && paymentCalender.activity
  342. ? paymentCalender.activity
  343. : [];
  344. activity.map(i => {
  345. i.isStatus = true;
  346. });
  347. this.activityList = [...activity];
  348. // 判断是否有课程
  349. if (tempInfo && tempInfo.length > 0) {
  350. // 默认课程都选中
  351. tempInfo.forEach(item => {
  352. // if (item && item.isStudentOptional) {
  353. // item.isStatus = false;
  354. // } else {
  355. item.isStatus = true;
  356. // }
  357. });
  358. this.courseInfo = tempInfo;
  359. }
  360. this.musicGroupSubject = tempResult.musicGroupSubjectPlan || [];
  361. let instrumentInfo = {};
  362. let tempInstrument = [];
  363. let musicGroupSubjectGoodsGroupList =
  364. this.preViewData?.payUserType == "SCHOOL" ||
  365. musicGroupStatus == "PROGRESS"
  366. ? []
  367. : tempResult.musicGroupSubjectGoodsGroupList;
  368. musicGroupSubjectGoodsGroupList?.forEach(item => {
  369. if (item.type == "INSTRUMENT") {
  370. // 获取乐器所有提供方式
  371. let KGPTJ = item.kitGroupPurchaseTypeJson
  372. ? JSON.parse(item.kitGroupPurchaseTypeJson)
  373. : {};
  374. for (let single in KGPTJ) {
  375. let tempItem = Object.assign({}, item); // 深拷贝
  376. tempItem.marketPrice = tempItem.goodsList[0].marketPrice;
  377. tempItem.kitType = single; // 优惠模式
  378. tempItem.coupon = KGPTJ[single]; // 优惠金额
  379. tempItem.discountPrice = tempItem.goodsList[0].discountPrice;
  380. if (instrumentInfo.id) {
  381. tempItem.isStatus = false;
  382. if (single == "GROUP") {
  383. // 团购
  384. if (
  385. (instrumentInfo.kitType == "GROUP" &&
  386. instrumentInfo.price < tempItem.price) ||
  387. instrumentInfo.kitType == "LEASE" ||
  388. instrumentInfo.kitType == "FREE"
  389. ) {
  390. this.instrumentResult.forEach(instrRes => {
  391. instrRes.isStatus = false;
  392. });
  393. tempItem.isStatus = true;
  394. instrumentInfo = {
  395. id: tempItem.id,
  396. price: tempItem.price,
  397. kitType: single,
  398. groupRemissionCourseFee: tempItem.groupRemissionCourseFee
  399. };
  400. }
  401. } else if (single == "LEASE") {
  402. // 租赁
  403. if (
  404. instrumentInfo.kitType == "LEASE" &&
  405. instrumentInfo.price < tempItem.price
  406. ) {
  407. this.instrumentResult.forEach(instrRes => {
  408. instrRes.isStatus = false;
  409. });
  410. tempItem.isStatus = true;
  411. instrumentInfo = {
  412. id: tempItem.id,
  413. price: tempItem.price,
  414. kitType: single,
  415. groupRemissionCourseFee: tempItem.groupRemissionCourseFee
  416. };
  417. }
  418. } else if (single == "FREE") {
  419. // 免费
  420. if (
  421. instrumentInfo.kitType == "FREE" &&
  422. instrumentInfo.price < tempItem.price
  423. ) {
  424. this.instrumentResult.forEach(instrRes => {
  425. instrRes.isStatus = false;
  426. });
  427. tempItem.isStatus = true;
  428. instrumentInfo = {
  429. id: tempItem.id,
  430. price: tempItem.price,
  431. kitType: single,
  432. groupRemissionCourseFee: tempItem.groupRemissionCourseFee
  433. };
  434. }
  435. }
  436. } else {
  437. tempItem.isStatus = true;
  438. instrumentInfo = {
  439. id: tempItem.id,
  440. price: tempItem.price,
  441. kitType: single,
  442. groupRemissionCourseFee: tempItem.groupRemissionCourseFee
  443. };
  444. }
  445. let childGoodsNameList = [];
  446. if (tempItem.childGoodsList && tempItem.childGoodsList.length > 0) {
  447. tempItem.childGoodsList.forEach(child => {
  448. if (child.type != "INSTRUMENT" && child.type != "OTHER") {
  449. childGoodsNameList.push(child.name);
  450. }
  451. });
  452. tempItem.childGoodsNames = childGoodsNameList.join("、");
  453. }
  454. this.instrumentResult.push(tempItem);
  455. tempInstrument.push(tempItem);
  456. }
  457. } else if (item.type == "ACCESSORIES") {
  458. item.isStatus = true;
  459. this.accessOries.push(item);
  460. }
  461. });
  462. // 添加自备选项
  463. if (this.instrumentResult.length > 0) {
  464. let sorted = this.groupBy(tempInstrument, item => {
  465. return [item.kitType];
  466. });
  467. this.instrumentResultList = sorted;
  468. // 设置是否有减免金额
  469. this.instrumentGetStatus();
  470. this.setLeBaoStatus();
  471. }
  472. // 如果选择的是乐保,则把所有辅件价格设置为0
  473. this.giveAccessoriesSetStatus();
  474. // 初始化计算金额
  475. this.calcPrice();
  476. },
  477. groupBy(array, f) {
  478. var groups = {};
  479. array.forEach(function(o) {
  480. var group = JSON.stringify(f(o));
  481. groups[group] = groups[group] || [];
  482. groups[group].push(o);
  483. });
  484. return Object.keys(groups).map(function(group) {
  485. return groups[group];
  486. });
  487. },
  488. onQuestions(type) {
  489. if (type == "amr") {
  490. this.$alert(
  491. `<b>革命性的“AMR器乐练习系统”</b><br />它的诞生是基于世界上最优秀的华人管乐指导专家唐嘉宏先生的教育理念,创新开发的一种新型“音乐感官植入程序”,这个程序抛弃了传统的“数线式识谱、机械式节奏、死记式乐理”,它营造出沉浸式可变速演奏过程,采用画面与音乐刺激序列组合而成的特定场景,在趣味性挑战的反复刺激中逐步促进器乐演奏的三核心:“音质→音准→音型”,从而达成演奏各环节水准的均匀提高,产生永久性条件反射式大脑记忆,将多板块知识融会贯通,让抽象的音乐知识刻入脑海里!<br /><br /><b>本练习系统的特点:</b><br /> 1.轻松快速掌握要点,让练习者沉浸其中,远离枯燥!<br /> 2.不假思索就能瞬间唤起反射式记忆,演奏识谱不再慢吞吞!<br /> 3.真正的实践记忆,摆脱纸上谈兵,与实际演奏紧密结合!<br />4.思维+肌肉的双重强化!无缝整合复习系统!<br /> 5.每条练习都经过严谨的编曲,你以为你只是在练习旋律线?其实是整个乐团在为你伴奏!`,
  492. "AMR器乐练习系统",
  493. {
  494. confirmButtonText: "确定",
  495. dangerouslyUseHTMLString: true,
  496. callback: action => {}
  497. }
  498. );
  499. } else if (type == "instrument") {
  500. this.$alert(
  501. `<p style="text-align: justify">1.乐器保养是管乐迷针对乐团学员提供的乐器检查、保养及维修优惠特权;<br />2.该特权为包年制,从开通特权之日起365天内有效;<br />3.特权用户可享受管乐迷提供专业的高级乐器维修技师一年不低于两次下校检查乐器使用情况;<br />4.特权有效期内凭该特权绑定的乐器编号可享受保养人工费减免、非返厂维修人工费优惠等特权;<br />感谢您的信任和支持!</p>`,
  502. "乐器保养特权",
  503. {
  504. confirmButtonText: "确定",
  505. dangerouslyUseHTMLString: true,
  506. callback: action => {}
  507. }
  508. );
  509. }
  510. },
  511. onCheckItem(item, type) {
  512. // 默认选中不可改
  513. if (item.optionalFlag) return;
  514. // 判断乐保是否可选
  515. if (item.noSelect) return;
  516. // 如果选择的是乐器先把所有选中的取消
  517. if (type == "INSTRUMENT") {
  518. this.instrumentResultList.forEach(group => {
  519. group.forEach(child => {
  520. if (
  521. child.id != item.id ||
  522. (child.id == item.id && child.kitType != item.kitType)
  523. ) {
  524. child.isStatus = false;
  525. }
  526. });
  527. });
  528. }
  529. item.isStatus = !item.isStatus;
  530. if (type == "train") {
  531. // 如果选择的是乐保,则把所有辅件价格设置为0
  532. this.giveAccessoriesSetStatus();
  533. }
  534. // 设置是否有减免金额
  535. this.instrumentGetStatus();
  536. // 重新设置乐保状态
  537. this.setLeBaoStatus();
  538. // 重新计算金额
  539. this.calcPrice();
  540. },
  541. giveAccessoriesSetStatus() {
  542. let status = false; // 是否有选中云教练
  543. this.toolsPackage.forEach(item => {
  544. if (item.isStatus) {
  545. status = true;
  546. } else {
  547. status = false;
  548. }
  549. });
  550. this.giveAccessoriesStatus = this.isGiveAccessories && status;
  551. },
  552. instrumentGetStatus() {
  553. let childItem = {};
  554. this.instrumentResultList.forEach(group => {
  555. group.forEach(child => {
  556. if (child.isStatus) {
  557. childItem = child;
  558. }
  559. });
  560. });
  561. this.remissionCourseFeeStatus =
  562. childItem.kitType == "GROUP" && childItem.groupRemissionCourseFee == 1
  563. ? true
  564. : false;
  565. },
  566. setLeBaoStatus() {
  567. // 设置乐保状态
  568. let status = false; // 是否有选中乐器
  569. this.instrumentResultList.forEach(group => {
  570. group.forEach(item => {
  571. if (item.isStatus) {
  572. status = true;
  573. }
  574. });
  575. });
  576. this.instrumentRepair.forEach(repair => {
  577. if (status) {
  578. repair.noSelect = false;
  579. } else {
  580. repair.noSelect = true;
  581. repair.isStatus = false;
  582. }
  583. });
  584. this.$forceUpdate();
  585. },
  586. calcPrice() {
  587. let ids = [];
  588. let amount = 0,
  589. marketPrice = 0,
  590. goodsPrice = 0, // 乐器两现价
  591. goodsMarketPrice = 0, // 乐器原价
  592. goodsGroupIds = {},
  593. courseKeys = [],
  594. couponPrice = 0, // 优惠金额
  595. goodsIds = [],
  596. buyCalenderActivityId = [], // 小班课
  597. tempCourseFee = 0,
  598. musicClassFee = 0,
  599. tempAccessPrice = 0,
  600. tempAccessMarketPrice = 0,
  601. tempGroupRemissionCourseFee = 0, // 乐团减免费用
  602. contractGoodsIds = ""; // 合同所需要的商品Id (只需要乐器编号)
  603. // 课程
  604. let mgs = this.musicGroupSubject;
  605. let csi = this.courseInfo;
  606. // 加上判断是否有课程信息
  607. if (mgs) {
  608. csi.forEach(item => {
  609. if (item.isStatus) {
  610. musicClassFee += parseFloat(item.courseCurrentPrice);
  611. // if (this.courseViewType != 2) {
  612. // }
  613. if (item.id > 0) {
  614. courseKeys.push(item.id);
  615. }
  616. // 不可选的课程才会减免课程费用
  617. if (!item.isStudentOptional) {
  618. tempGroupRemissionCourseFee += parseFloat(
  619. item.courseCurrentPrice
  620. );
  621. }
  622. marketPrice += parseFloat(item.courseOriginalPrice);
  623. // else {
  624. // marketPrice += parseFloat(item.courseCurrentPrice);
  625. // }
  626. // if (this.courseViewType == 0 && !item.isStudentOptional) {
  627. // marketPrice += parseFloat(item.courseCurrentPrice);
  628. // }
  629. }
  630. });
  631. }
  632. // 云教练
  633. const toolsPackage = this.toolsPackage;
  634. if (toolsPackage.length > 0) {
  635. toolsPackage.forEach(item => {
  636. if (item.isStatus) {
  637. this.buyCloudTeacher = true; // 临时处理,原因一条数据事要使用,如果多条数据会有问题
  638. marketPrice += parseFloat(item.originalAmount);
  639. amount += parseFloat(item.actualAmount);
  640. } else {
  641. this.buyCloudTeacher = false;
  642. }
  643. });
  644. }
  645. // 乐器
  646. let ir = this.instrumentResult;
  647. if (ir.length > 0) {
  648. ir.forEach(item => {
  649. if (item.isStatus) {
  650. if (item.name != "自备乐器") {
  651. contractGoodsIds += item.goodsIdList;
  652. }
  653. if (item.kitType == "FREE") {
  654. amount += 0;
  655. couponPrice = 0; // 优惠金额
  656. } else if (item.kitType == "LEASE") {
  657. couponPrice = item.coupon; // 优惠金额
  658. if (item.name != "自备乐器") {
  659. amount += item.depositFee;
  660. goodsPrice += item.depositFee;
  661. } else {
  662. amount += 0;
  663. }
  664. } else if (item.kitType == "GROUP") {
  665. // 团购
  666. if (
  667. this.courseViewType == 2 &&
  668. this.organId == 55 &&
  669. !this.toolsPackage[0].isStatus
  670. ) {
  671. amount += parseFloat(item.discountPrice);
  672. goodsPrice += parseFloat(item.discountPrice);
  673. couponPrice = item.coupon ? item.coupon : 0;
  674. } else {
  675. amount += parseFloat(item.price);
  676. goodsPrice += parseFloat(item.price);
  677. couponPrice = item.coupon ? item.coupon : 0;
  678. }
  679. }
  680. if (item.kitType == "LEASE") {
  681. if (item.name != "自备乐器") {
  682. marketPrice += parseFloat(item.marketPrice);
  683. goodsMarketPrice += item.depositFee;
  684. }
  685. } else {
  686. marketPrice += parseFloat(item.marketPrice);
  687. goodsMarketPrice += parseFloat(item.marketPrice);
  688. }
  689. // item.id ? goodsGroupIds[item.id] : null
  690. if (item.id) {
  691. goodsGroupIds[item.id] = item.kitType;
  692. }
  693. // 是否减免课程费用,必须团购,并且开启了减免课程费用
  694. if (item.kitType == "GROUP" && item.groupRemissionCourseFee == 1) {
  695. musicClassFee = parseFloat(
  696. musicClassFee - tempGroupRemissionCourseFee
  697. );
  698. }
  699. }
  700. });
  701. }
  702. // 乐器保养
  703. const instrumentRepair = this.instrumentRepair;
  704. if (instrumentRepair.length > 0) {
  705. instrumentRepair.forEach(item => {
  706. if (item.isStatus) {
  707. this.buyMaintenance = true;
  708. marketPrice += item.originalAmount;
  709. amount += parseFloat(item.actualAmount);
  710. } else {
  711. this.buyMaintenance = false;
  712. }
  713. });
  714. }
  715. amount += parseFloat(tempCourseFee + musicClassFee);
  716. // 辅件
  717. if (this.accessOries.length > 0) {
  718. this.accessOries.forEach(item => {
  719. // && this.accessIsShowStatus
  720. if (item.isStatus) {
  721. tempAccessPrice += this.giveAccessoriesStatus
  722. ? 0
  723. : parseFloat(item.price);
  724. amount += this.giveAccessoriesStatus ? 0 : parseFloat(item.price);
  725. if (item.goodsList && item.goodsList.length > 0) {
  726. item.goodsList.forEach(childGoods => {
  727. tempAccessMarketPrice += parseFloat(childGoods.marketPrice);
  728. marketPrice += parseFloat(childGoods.marketPrice);
  729. });
  730. }
  731. goodsGroupIds[item.id] = "ACCESSORIES";
  732. }
  733. });
  734. }
  735. // 小班课
  736. const activityList = this.activityList;
  737. if (activityList.length > 0) {
  738. activityList.forEach(item => {
  739. if (item.isStatus) {
  740. buyCalenderActivityId.push(item.id);
  741. marketPrice += item.originalAmount;
  742. amount += parseFloat(item.actualAmount);
  743. }
  744. });
  745. }
  746. let tempGroupPurchasePrice = amount;
  747. this.payCountMoney = amount;
  748. // 判断减去优惠金额,是否大于0(这里有可能出现负数)
  749. this.ids = ids;
  750. this.needPrice = Number(amount.toFixed(2));
  751. this.orderInfo = {
  752. amount: Number(amount.toFixed(2)),
  753. marketPrice: Number(marketPrice.toFixed(2)),
  754. groupPurchasePrice: tempGroupPurchasePrice,
  755. couponPrice: couponPrice,
  756. goodsGroupIds: goodsGroupIds,
  757. goodsIds: goodsIds.join(","),
  758. contractGoodsIds: contractGoodsIds,
  759. buyCalenderActivityId,
  760. courseKeys: courseKeys,
  761. musicClassFee: musicClassFee,
  762. accessMarketPrice: tempAccessMarketPrice,
  763. accessPrice: tempAccessPrice,
  764. goodsPrice: goodsPrice,
  765. goodsMarketPrice: goodsMarketPrice
  766. };
  767. },
  768. permission(str) {
  769. return permission(str);
  770. }
  771. }
  772. };
  773. </script>
  774. <style lang="less" scoped>
  775. @import url("./signUpPayment.less");
  776. </style>