subject-preview.vue 33 KB

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