subject-preview.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. <template>
  2. <div style="background: #F3F4F8;">
  3. <div class="noticeInfo">
  4. <h2>缴费说明</h2>
  5. 1、为确保声部平衡,请家长确认 注册声部为孩子的最终录取声部。<br />
  6. 2、为保障每个声部人数达标,我们都进行了超员20%的录取,系统将按照提交注册的先后顺序安排名额。超员后 有可能出现无法注册的情况,请您理解。如果其他声部仍有名额,我们将优先调配您的孩子;
  7. </div>
  8. <div class="section">
  9. <h2 class="title">{{ chargeTypeName }}</h2>
  10. <p style="font-size: 14px; padding: 2px 0; color: #a1a1a1" v-if="serviceValidDate">服务有效期:{{ serviceValidDate }}</p>
  11. <el-row class="title-row">
  12. <el-col :span="12">服务项目</el-col>
  13. <el-col :span="5" :offset="1" style="text-align: right;">现价</el-col>
  14. <el-col :span="5" :offset="1" style="text-align: right;">原价</el-col>
  15. </el-row>
  16. <!-- 所有不可选的课程合集 -->
  17. <template v-if="courseShowStatus">
  18. <el-row class="option-row" v-for="(item, index) in courseShowInfo" :class="[!item.isStudentOptional ? 'disabled' : '']" :key="index" @click.native="onCourseChange(item)">
  19. <el-col :span="12">
  20. <i class="check_default" :class="[item.isStatus ? 'check_active' : '']"></i>
  21. <span style="display: flex; align-items: center;">
  22. <template v-if="item.courseType == 'PROJECT'">{{ item.name }} </template><template v-else>{{ item.courseType | coursesType }}</template>
  23. </span>
  24. <el-icon v-if="item.courseType == 'PROJECT'" class="el-icon-question" @click.native="onQuestions" />
  25. </el-col>
  26. <el-col :span="6">
  27. <span style="color: #1A1A1A">¥{{ item.courseCurrentPrice | moneyFormat }}</span>
  28. </el-col>
  29. <el-col :span="6">
  30. <del style="color: #AAA;">¥{{ item.courseOriginalPrice | moneyFormat }}</del>
  31. </el-col>
  32. </el-row>
  33. </template>
  34. <!-- 可选课程信息集合 -->
  35. <template v-for="(item, index) in courseInfo">
  36. <el-row class="option-row" :class="[!item.isStudentOptional ? 'disabled' : '']" :key="index" @click.native="onCourseChange(item)" v-if="item.isStudentOptional">
  37. <el-col :span="12">
  38. <i class="check_default" :class="[item.isStatus ? 'check_active' : '']"></i><template v-if="item.courseType == 'PROJECT'">{{ item.name }}</template><template v-else>{{ item.courseType | coursesType }}</template>
  39. </el-col>
  40. <el-col :span="6">
  41. <span style="color: #1A1A1A">¥{{ item.courseCurrentPrice | moneyFormat }}</span>
  42. </el-col>
  43. <el-col :span="6">
  44. <del style="color: #AAA;">¥{{ item.courseOriginalPrice | moneyFormat }}</del>
  45. </el-col>
  46. </el-row>
  47. </template>
  48. <el-row class="option-row lines">
  49. <el-col :span="12" class="fontBold">
  50. 仅需支付
  51. </el-col>
  52. <el-col :span="6">
  53. <span class="fontBold" style="color: #f85043;">¥{{ orderInfo.musicClassFee | moneyFormat }}</span>
  54. </el-col>
  55. <el-col :span="6">
  56. <del class="fontBold" style="color: #f85043;">¥{{ orderInfo.musicMarketClassFee | moneyFormat }}</del>
  57. </el-col>
  58. </el-row>
  59. </div>
  60. <div class="section" v-if="instrumentResult.length > 0">
  61. <h2 class="title">乐器</h2>
  62. <div v-for="(i, index) in instrumentResultList" :key="index">
  63. <el-row class="title-row">
  64. <el-col :span="12">
  65. <template v-if="i[0]['kitType'] == 'GROUP'">团购乐器</template>
  66. <template v-if="i[0]['kitType'] == 'LEASE'">乐器租赁</template>
  67. <template v-if="i[0]['kitType'] == 'FREE'">免费使用</template>
  68. <template v-if="i[0]['kitType'] == 'owned'">自备乐器</template>
  69. </el-col>
  70. <el-col :span="5" :offset="1" style="text-align: right;">
  71. <template v-if="['GROUP', 'FREE'].includes(i[0]['kitType'])">现价</template>
  72. <template v-if="i[0]['kitType'] == 'LEASE'">租赁押金</template>
  73. </el-col>
  74. <el-col :span="5" :offset="1" style="text-align: right;">
  75. <template v-if="['GROUP', 'LEASE', 'FREE'].includes(i[0]['kitType'])">原价</template>
  76. </el-col>
  77. </el-row>
  78. <el-row class="option-row" v-for="(con, index) in i" :key="index" @click.native="instrumentF(con)">
  79. <el-col :span="12">
  80. <i class="check_default" :class="[ con.checked ? 'check_active' : '' ]"></i>
  81. <div>
  82. {{ con.name }}
  83. <div v-if="con.goodsList" style="font-size: .12rem; color: #aaa">
  84. {{ con.goodsList[0].specification }}
  85. </div>
  86. </div>
  87. </el-col>
  88. <el-col :span="6">
  89. <span style="color: #1A1A1A" v-if="(con.kitType == 'LEASE')">¥{{ Number((con.depositFee - con.coupon).toFixed(2)) | moneyFormat }}</span>
  90. <span style="color: #1A1A1A" v-if="con.price && con.kitType == 'FREE'">¥{{ 0 | moneyFormat }}</span>
  91. <span style="color: #1A1A1A" v-if="con.price && con.kitType == 'GROUP'">¥{{ Number((con.price - con.coupon).toFixed(2)) | moneyFormat }}</span>
  92. </el-col>
  93. <el-col :span="6">
  94. <del style="color: #AAA;" v-if="con.kitType != 'owned'">¥{{ con.marketPrice | moneyFormat }}</del>
  95. </el-col>
  96. </el-row>
  97. </div>
  98. <el-row class="option-row lines">
  99. <el-col :span="12" class="fontBold">
  100. 仅需支付
  101. </el-col>
  102. <el-col :span="6">
  103. <span class="fontBold" style="color: #f85043;">¥{{ orderInfo.goodsPrice | moneyFormat }}</span>
  104. </el-col>
  105. <el-col :span="6">
  106. <del class="fontBold" style="color: #f85043;">¥{{ orderInfo.goodsMarketPrice | moneyFormat }}</del>
  107. </el-col>
  108. </el-row>
  109. </div>
  110. <div class="section" v-if="accessOries.length > 0" key="accessOries">
  111. <h2 class="title">辅件</h2>
  112. <el-row class="title-row">
  113. <el-col :span="12">服务项目</el-col>
  114. <el-col :span="5" :offset="1" style="text-align: right;">现价</el-col>
  115. <el-col :span="5" :offset="1" style="text-align: right;">原价</el-col>
  116. </el-row>
  117. <el-row class="option-row" v-for="(instr, index) in accessOries" :key="index" @click.native="onAuxiliarie(instr)">
  118. <el-col :span="12">
  119. <i class="check_default" :class="[ instr.checked ? 'check_active' : '' ]"></i>{{ instr.name }}
  120. </el-col>
  121. <el-col :span="6">
  122. <span style="color: #1A1A1A" v-if="instr.price == 0">免费</span>
  123. <span style="color: #1A1A1A" v-else>¥{{ instr.price | moneyFormat }}</span>
  124. </el-col>
  125. <el-col :span="6">
  126. <del style="color: #AAA;">¥{{ instr.goodsList[0] ? instr.goodsList[0].marketPrice : 0 | moneyFormat }}</del>
  127. </el-col>
  128. </el-row>
  129. <el-row class="option-row lines">
  130. <el-col :span="12" class="fontBold">
  131. 仅需支付
  132. </el-col>
  133. <el-col :span="6">
  134. <span class="fontBold" style="color: #f85043;">¥{{ orderInfo.accessPrice | moneyFormat }}</span>
  135. </el-col>
  136. <el-col :span="6">
  137. <del class="fontBold" style="color: #f85043;">¥{{ orderInfo.accessMarketPrice | moneyFormat }}</del>
  138. </el-col>
  139. </el-row>
  140. </div>
  141. <!-- 原价现价 -->
  142. <!-- <div class="section">
  143. <div class="needprice markerprice">
  144. <del>原价</del>
  145. <del>¥{{ orderInfo.marketPrice | moneyFormat }}</del>
  146. </div>
  147. <div class="needprice grouopprice">
  148. <span>仅需支付</span>
  149. <span>¥{{ orderInfo.amount | moneyFormat }}</span>
  150. </div>
  151. </div> -->
  152. <div class="buy">
  153. <div class="price">
  154. <p class="use_price">
  155. <img class="logo" src="@/assets/images/mycard.png" alt="">
  156. <span>¥{{ needPrice | moneyFormat }}</span>
  157. </p>
  158. </div>
  159. <a class="btn-submit">购买</a>
  160. </div>
  161. </div>
  162. </template>
  163. <script>
  164. import { permission } from '@/utils/directivePage'
  165. import { getSubjectGoodsAndInfoPreview, getType } from '@/api/buildTeam'
  166. import dayjs from 'dayjs'
  167. const paymentPatternType = {
  168. 0: '按月',
  169. 1: '按学期',
  170. 2: '一次性'
  171. }
  172. export default {
  173. props: ["subjectId", "calenderId"],
  174. data() {
  175. const query = this.$route.query
  176. return {
  177. musicGroupId: query.id,
  178. result: {}, // 返回结果
  179. instrument: {}, // 乐器类型
  180. baseInfo: {}, // 其它类
  181. money: 580,
  182. balance: 0, // 余额
  183. needPrice: 0, // 还需支付
  184. payType: false, // 是否余额支付
  185. orderInfo: {
  186. marketPrice: 0,
  187. amount: 0, // 现价总金额
  188. groupPurchasePrice: 0, // 现价
  189. goodsGroupIds: null,
  190. goodsIds: null,
  191. contractGoodsIds: null, // 选中所有商品ID
  192. couponPrice: 0, //
  193. musicClassFee: 0, // 课程现价
  194. musicMarketClassFee: 0, // 课程原价
  195. accessPrice: 0, // 辅件现价
  196. accessMarketPrice: 0, // 辅件原价
  197. goodsPrice: 0, // 乐器现价
  198. goodsMarketPrice: 0, // 乐器原价
  199. }, // 金额列表,金额计算
  200. courseInfo: null, // 课程信息
  201. musicGroupSubject: null, // 基本信息
  202. instrumentResult: [], //乐器
  203. accessOries: [], // 辅件(打包)
  204. agreeStatus: true,
  205. authStatus: false,
  206. buyList: [], // 信息列表
  207. ids: [],
  208. chargeTypeId: null,
  209. paymentStatus: null,
  210. paymentPattern: null,
  211. serviceValidDate: null, // 服务时间
  212. courseShowStatus: false,
  213. chargeTypeList: [],
  214. chargeTypeName: null,
  215. };
  216. },
  217. mounted() {
  218. this.__init()
  219. },
  220. methods: {
  221. async __init() {
  222. // 获取数据
  223. let params = {
  224. musicGroupId: this.musicGroupId,
  225. subjectId: this.subjectId,
  226. calenderId: this.calenderId
  227. }
  228. await getType().then(res => {
  229. let result = res.data
  230. if(res.code == 200) {
  231. this.chargeTypeList = result.rows || []
  232. }
  233. })
  234. await getSubjectGoodsAndInfoPreview(params).then(res => {
  235. let result = res
  236. if (result.code == 200) {
  237. let tempResult = result.data
  238. this.paymentPattern = 2
  239. if(tempResult.musicGroupPaymentCalender) {
  240. this.paymentPattern = tempResult.musicGroupPaymentCalender.paymentPattern
  241. this.serviceValidDate = dayjs(tempResult.musicGroupPaymentCalender.paymentValidStartDate).format('YYYY/MM/DD') + '~' + dayjs(tempResult.musicGroupPaymentCalender.paymentValidEndDate).format('YYYY/MM/DD')
  242. }
  243. let tempInfo = tempResult.musicGroupPaymentCalender? tempResult.musicGroupPaymentCalender.musicGroupPaymentCalenderCourseSettingsList : null
  244. // 判断是否有课程
  245. if (tempInfo && tempInfo.length > 0) {
  246. let tempCourse = {
  247. courseCurrentPrice: 0,
  248. courseOriginalPrice: 0,
  249. courseType: null,
  250. name: '乐团训练辅助系统'
  251. }
  252. tempInfo.forEach(info => {
  253. if(!info.isStudentOptional) {
  254. this.courseShowStatus = true
  255. tempCourse = {
  256. courseCurrentPrice: (info.courseCurrentPrice + tempCourse.courseCurrentPrice),
  257. courseOriginalPrice: (info.courseOriginalPrice + tempCourse.courseOriginalPrice),
  258. courseType: 'PROJECT',
  259. isStatus: true,
  260. name: '乐团训练辅助系统'
  261. }
  262. }
  263. })
  264. this.courseShowInfo = [tempCourse]
  265. // 默认课程都选中
  266. this.courseInfo = tempInfo
  267. } else {
  268. // 判断是否有课程,如果没有课程则默认显示0
  269. this.courseInfo = [{
  270. id: -1,
  271. courseCurrentPrice: 0,
  272. courseOriginalPrice: 0,
  273. isStudentOptional: false,
  274. courseType: 'MUSIC'
  275. }]
  276. }
  277. this.courseInfo.forEach(item => {
  278. item.isStatus = true
  279. })
  280. this.musicGroupSubject = tempResult.musicGroupSubjectPlan
  281. let instrumentInfo = {}
  282. let tempInstrument = []
  283. tempResult.musicGroupSubjectGoodsGroupList.forEach((item) => {
  284. if (item.type == "INSTRUMENT") {
  285. // 获取乐器所有提供方式
  286. let KGPTJ = item.kitGroupPurchaseTypeJson ? JSON.parse(item.kitGroupPurchaseTypeJson) : {}
  287. for (let single in KGPTJ) {
  288. let tempItem = Object.assign({}, item) // 深拷贝
  289. tempItem.marketPrice = tempItem.goodsList[0].marketPrice
  290. tempItem.kitType = single // 优惠模式
  291. tempItem.coupon = KGPTJ[single] // 优惠金额
  292. if (instrumentInfo.id) {
  293. tempItem.checked = false
  294. if (single == 'GROUP') { // 团购
  295. if ((instrumentInfo.kitType == 'GROUP' && instrumentInfo.price < tempItem.price) || instrumentInfo.kitType ==
  296. 'LEASE' || instrumentInfo.kitType == 'FREE') {
  297. this.instrumentResult.forEach(instrRes => {
  298. instrRes.checked = false
  299. })
  300. tempItem.checked = true
  301. instrumentInfo = {
  302. id: tempItem.id,
  303. price: tempItem.price,
  304. kitType: single
  305. }
  306. }
  307. } else if (single == 'LEASE') { // 租赁
  308. if (instrumentInfo.kitType == 'LEASE' && instrumentInfo.price < tempItem.price) {
  309. this.instrumentResult.forEach(instrRes => {
  310. instrRes.checked = false
  311. })
  312. tempItem.checked = true
  313. instrumentInfo = {
  314. id: tempItem.id,
  315. price: tempItem.price,
  316. kitType: single
  317. }
  318. }
  319. } else if (single == 'FREE') { // 免费
  320. if (instrumentInfo.kitType == 'FREE' && instrumentInfo.price < tempItem.price) {
  321. this.instrumentResult.forEach(instrRes => {
  322. instrRes.checked = false
  323. })
  324. tempItem.checked = true
  325. instrumentInfo = {
  326. id: tempItem.id,
  327. price: tempItem.price,
  328. kitType: single
  329. }
  330. }
  331. }
  332. } else {
  333. tempItem.checked = true
  334. instrumentInfo = {
  335. id: tempItem.id,
  336. price: tempItem.price,
  337. kitType: single
  338. }
  339. }
  340. this.instrumentResult.push(tempItem)
  341. tempInstrument.push(tempItem)
  342. }
  343. } else if (item.type == "ACCESSORIES") {
  344. item.checked = true
  345. this.accessOries.push(item)
  346. }
  347. })
  348. // 添加自备选项
  349. if (this.instrumentResult.length > 0) {
  350. // this.instrumentResult.push({
  351. // id: -1,
  352. // kitType: 'owned',
  353. // name: '自备',
  354. // price: 0,
  355. // marketPrice: 0,
  356. // checked: false
  357. // })
  358. let owned = {
  359. id: -1,
  360. kitType: 'owned',
  361. name: '自备乐器',
  362. price: 0,
  363. marketPrice: 0,
  364. checked: false
  365. }
  366. tempInstrument.push(owned)
  367. this.instrumentResult.push(owned)
  368. let sorted = this.groupBy(tempInstrument, (item) => {
  369. return [item.kitType];
  370. });
  371. this.instrumentResultList = sorted
  372. this.chargeTypeList.forEach(item => {
  373. if(item.id == tempResult.musicGroup.chargeTypeId) {
  374. this.chargeTypeName = item.description
  375. }
  376. })
  377. }
  378. }
  379. // 初始化计算金额
  380. this.calcPrice()
  381. })
  382. },
  383. groupBy(array, f) {
  384. var groups = {};
  385. array.forEach(function (o) {
  386. var group = JSON.stringify(f(o));
  387. groups[group] = groups[group] || [];
  388. groups[group].push(o);
  389. });
  390. return Object.keys(groups).map(function (group) {
  391. return groups[group];
  392. });
  393. },
  394. onQuestions() {
  395. this.$alert('乐团辅助训练系统描述文案--2月3号下班前才会出', '乐团训练辅助系统', {
  396. confirmButtonText: '确定',
  397. callback: action => {
  398. }
  399. });
  400. },
  401. onCourseChange(item) {
  402. // 判断用户是否可以选择
  403. if (item.isStudentOptional) {
  404. item.isStatus = !item.isStatus
  405. this.calcPrice()
  406. }
  407. },
  408. onClickCheckbox() { //是否使用余额支付
  409. if (!this.payType) {
  410. if (this.orderInfo.amount >= this.balance) {
  411. this.needPrice = Number((this.orderInfo.amount - this.balance).toFixed(2))
  412. } else {
  413. this.needPrice = 0
  414. }
  415. } else {
  416. this.needPrice = this.orderInfo.amount
  417. }
  418. this.payType = !this.payType
  419. },
  420. onAuxiliarie(item) {
  421. // 辅件切换状态
  422. item.checked = !item.checked
  423. // 重新计算金额
  424. this.calcPrice()
  425. },
  426. instrumentF(item) {
  427. // 乐器切换状态
  428. this.instrumentResult.forEach(item => {
  429. item.checked = false
  430. })
  431. item.checked = true
  432. // 重新计算金额
  433. this.calcPrice()
  434. },
  435. calcPrice() {
  436. let buyList = [],
  437. ids = []
  438. let amount = 0,
  439. marketPrice = 0,
  440. goodsPrice = 0, // 乐器两现价
  441. goodsMarketPrice = 0, // 乐器原价
  442. goodsGroupIds = {},
  443. courseKeys = [],
  444. couponPrice = 0, // 优惠金额
  445. goodsIds = [],
  446. tempCourseFee = 0,
  447. musicClassFee = 0,
  448. musicMarketClassFee = 0,
  449. tempAccessPrice = 0,
  450. tempAccessMarketPrice = 0,
  451. tempGroupRemissionCourseFee = 0, // 乐团减免费用
  452. contractGoodsIds = '' // 合同所需要的商品Id (只需要乐器编号)
  453. // 课程
  454. let mgs = this.musicGroupSubject
  455. let csi = this.courseInfo
  456. // 加上判断是否有课程信息
  457. if (mgs) {
  458. csi.forEach(item => {
  459. if (item.isStatus) {
  460. musicClassFee += parseFloat(item.courseCurrentPrice)
  461. musicMarketClassFee += parseFloat(item.courseOriginalPrice)
  462. marketPrice += parseFloat(item.courseOriginalPrice)
  463. if (item.id > 0) {
  464. courseKeys.push(item.id)
  465. }
  466. // 不可选的课程才会减免课程费用
  467. if(!item.isStudentOptional) {
  468. tempGroupRemissionCourseFee += parseFloat(item.courseCurrentPrice)
  469. }
  470. }
  471. })
  472. }
  473. // 乐器
  474. let ir = this.instrumentResult
  475. if (ir.length > 0) {
  476. ir.forEach(item => {
  477. if (item.checked) {
  478. if (item.name != '自备') {
  479. contractGoodsIds += item.goodsIdList
  480. }
  481. if (item.kitType == 'FREE') {
  482. amount += 0
  483. couponPrice = 0 // 优惠金额
  484. } else if (item.kitType == 'LEASE') {
  485. couponPrice = item.coupon // 优惠金额
  486. if (item.name != '自备') {
  487. amount += item.depositFee
  488. goodsPrice += item.depositFee
  489. } else {
  490. amount += 0
  491. }
  492. } else {
  493. amount += parseFloat(item.price)
  494. goodsPrice += parseFloat(item.price)
  495. couponPrice = item.coupon ? item.coupon : 0
  496. }
  497. if (item.kitType == 'LEASE') {
  498. if (item.name != '自备') {
  499. marketPrice += item.depositFee
  500. goodsMarketPrice += item.depositFee
  501. }
  502. } else {
  503. marketPrice += parseFloat(item.marketPrice)
  504. goodsMarketPrice += parseFloat(item.marketPrice)
  505. }
  506. // item.id ? goodsGroupIds[item.id] : null
  507. if (item.id) {
  508. goodsGroupIds[item.id] = item.kitType
  509. }
  510. if (item.kitType == 'LEASE') {
  511. buyList.push({
  512. name: item.name,
  513. type: '租赁',
  514. price: item.depositFee
  515. })
  516. } else if (item.kitType == 'GROUP') {
  517. // && parseFloat(item.price - couponPrice) > 0
  518. buyList.push({
  519. name: item.name,
  520. type: '团购',
  521. price: parseFloat(item.price - couponPrice)
  522. })
  523. } else if(item.kitType == 'FREE') {
  524. buyList.push({
  525. name: item.name,
  526. type: '免费',
  527. price: 0
  528. })
  529. }
  530. // 是否减免课程费用,必须团购,并且开启了减免课程费用
  531. if(item.kitType == 'GROUP' && item.groupRemissionCourseFee == 1) {
  532. musicClassFee = parseFloat(musicClassFee - tempGroupRemissionCourseFee)
  533. }
  534. }
  535. })
  536. }
  537. amount += parseFloat(tempCourseFee + musicClassFee)
  538. // if (parseFloat(tempCourseFee + musicClassFee) > 0) {
  539. buyList.unshift({
  540. name: '乐团课',
  541. type: paymentPatternType[this.paymentPattern],
  542. price: Number((tempCourseFee + musicClassFee).toFixed(2))
  543. })
  544. // }
  545. // 辅件
  546. if (this.accessOries.length > 0) {
  547. this.accessOries.forEach(item => {
  548. if (item.checked) {
  549. tempAccessPrice += parseFloat(item.price)
  550. amount += parseFloat(item.price)
  551. if (item.goodsList && item.goodsList.length > 0) {
  552. item.goodsList.forEach(childGoods => {
  553. tempAccessMarketPrice += parseFloat(childGoods.marketPrice)
  554. marketPrice += parseFloat(childGoods.marketPrice)
  555. })
  556. }
  557. goodsGroupIds[item.id] = 'ACCESSORIES'
  558. }
  559. })
  560. // if (tempAccessPrice > 0) {
  561. buyList.push({
  562. name: '辅件',
  563. type: '团购',
  564. price: tempAccessPrice
  565. })
  566. // }
  567. }
  568. let tempGroupPurchasePrice = amount
  569. // 判断减去优惠金额,是否大于0(这里有可能出现负数)
  570. if (amount - couponPrice >= 0) {
  571. amount = Number((amount - couponPrice).toFixed(2))
  572. this.errorPrice = false
  573. } else {
  574. amount = 0
  575. this.errorPrice = true // 订单金额是否异常
  576. }
  577. if (amount - tempCourseFee - musicClassFee > 0) {
  578. ids.push(1, 2)
  579. }
  580. if (parseFloat(tempCourseFee + musicClassFee) > 0) {
  581. ids.push(3, 4, 5)
  582. }
  583. this.ids = ids
  584. // 计算是否使用过余额
  585. if (this.payType) {
  586. let tempPrice = Number((amount - this.balance).toFixed(2))
  587. if (tempPrice > 0) {
  588. this.needPrice = tempPrice
  589. } else {
  590. this.needPrice = 0
  591. }
  592. } else {
  593. this.needPrice = Number(amount.toFixed(2))
  594. }
  595. this.buyList = buyList
  596. this.orderInfo = {
  597. amount: Number(amount.toFixed(2)),
  598. marketPrice: Number(marketPrice.toFixed(2)),
  599. groupPurchasePrice: tempGroupPurchasePrice,
  600. couponPrice: couponPrice,
  601. goodsGroupIds: goodsGroupIds,
  602. goodsIds: goodsIds.join(','),
  603. contractGoodsIds: contractGoodsIds,
  604. courseKeys: courseKeys,
  605. musicClassFee: musicClassFee,
  606. musicMarketClassFee: musicMarketClassFee,
  607. accessMarketPrice: tempAccessMarketPrice,
  608. accessPrice: tempAccessPrice,
  609. goodsPrice: goodsPrice,
  610. goodsMarketPrice: goodsMarketPrice
  611. }
  612. },
  613. permission(str){
  614. return permission(str)
  615. }
  616. },
  617. };
  618. </script>
  619. <style lang="less" scoped>
  620. .noticeInfo {
  621. line-height: 1.8;
  622. h2 {
  623. font-size: 18px;
  624. color: #1a1a1a;
  625. line-height: 28px;
  626. height: 26px !important;
  627. font-weight: bold;
  628. }
  629. position: relative;
  630. background: #fff;
  631. padding: 0 16px 10px;
  632. font-size: 14px;
  633. color: #808080;
  634. margin-bottom: 10px;
  635. }
  636. .section {
  637. padding: 16px 16px 10px;
  638. background: #fff;
  639. margin-bottom: 10px;
  640. >.title {
  641. font-size: 20px;
  642. line-height: 28px;
  643. height: 26px !important;
  644. font-weight: bold;
  645. &::before {
  646. content: " ";
  647. width: 4px;
  648. height: 15px;
  649. background: #14928a;
  650. display: inline-block;
  651. margin-right: 7px;
  652. border-radius: 8px;
  653. }
  654. }
  655. .indate {
  656. font-size: 14px;
  657. padding: 6px 0;
  658. display: flex;
  659. // justify-content: space-between;
  660. justify-content: flex-end;
  661. span {
  662. color: #fa101d;
  663. }
  664. }
  665. }
  666. .disabled {
  667. opacity: 0.7;
  668. }
  669. .buy {
  670. height: 60px;
  671. display: flex;
  672. align-items: center;
  673. padding: 0 20px;
  674. border-top: 1px solid #ffe9e9e9;
  675. color: #000000;
  676. font-size: 12px;
  677. background: #fff;
  678. .price {
  679. flex: 1;
  680. font-size: 16px;
  681. }
  682. font-size: 16px;
  683. span {
  684. color: #fa101d;
  685. }
  686. .text {
  687. font-size: 12px;
  688. width: 60px;
  689. display: inline-block;
  690. color: #000;
  691. }
  692. del {
  693. color: #b5b5b5;
  694. &.text {
  695. color: #b5b5b5;
  696. }
  697. }
  698. .btn-submit {
  699. display: inline-block;
  700. font-size: 18px;
  701. color: #fff;
  702. background: #f85043;
  703. border-radius: 100px;
  704. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.19);
  705. padding: 8px 46px;
  706. }
  707. }
  708. .iframe {
  709. width: 100%;
  710. height: 100%;
  711. -webkit-overflow-scrolling: touch;
  712. overflow-y: scroll;
  713. border-top: none !important;
  714. min-height: calc(100vh - 41px);
  715. }
  716. .countDownContent {
  717. line-height: 40px;
  718. text-align: center;
  719. font-size: 14px;
  720. border-bottom: 1px solid #ccc;
  721. .van-count-down {
  722. display: inline;
  723. color: #f00;
  724. }
  725. }
  726. .loadingOrder {
  727. width: 90%;
  728. height: 180px;
  729. display: flex;
  730. align-items: center;
  731. justify-content: center;
  732. .van-loading__text {
  733. color: #444;
  734. }
  735. }
  736. .pay-section {
  737. margin-bottom: 10px;
  738. padding: 10px 8px;
  739. }
  740. .pay-name {
  741. padding-left: 10px;
  742. flex: 1 auto;
  743. font-weight: bold;
  744. }
  745. .logo {
  746. width: 24px;
  747. height: 24px;
  748. }
  749. .van-checkbox {
  750. float: right;
  751. /deep/.van-checkbox__icon .van-icon {
  752. border-color: #e9eaef;
  753. background-color: #e9eaef;
  754. }
  755. /deep/.van-checkbox__icon--checked .van-icon {
  756. background-color: #2dc7aa;
  757. border-color: #2dc7aa;
  758. }
  759. }
  760. .needprice {
  761. display: flex;
  762. justify-content: space-between;
  763. padding: 2px 0;
  764. del {
  765. font-size: 14px;
  766. color: #aaa;
  767. font-weight: bold;
  768. }
  769. span {
  770. font-size: 18px;
  771. color: #f85043;
  772. font-weight: bold;
  773. }
  774. }
  775. .couponprice {
  776. display: flex;
  777. justify-content: space-between;
  778. }
  779. .use_price {
  780. display: flex;
  781. align-items: center;
  782. font-size: 14px;
  783. font-weight: bold;
  784. img {
  785. padding-right: 8px;
  786. }
  787. span {
  788. font-size: 16px;
  789. }
  790. }
  791. .check_default {
  792. margin-right: 8px;
  793. display: flex;
  794. align-items: center;
  795. height: 26px;
  796. &::before {
  797. display: block;
  798. content: ' ';
  799. width: 18px;
  800. height: 18px;
  801. background-color: #e9eaef;
  802. border-radius: 50%;
  803. }
  804. &.check_active {
  805. &::before {
  806. display: block;
  807. content: ' ';
  808. background: url("../../../assets/images/icon_checkbox.png") no-repeat center;
  809. background-size: contain;
  810. }
  811. }
  812. }
  813. // .check_default {
  814. // margin-right: 8px;
  815. // display: block;
  816. // width: 18px;
  817. // height: 18px;
  818. // background-color: #e9eaef;
  819. // border-radius: 50%;
  820. // &.check_active {
  821. // background: url("../../../assets/images/icon_checkbox.png") no-repeat center;
  822. // background-size: contain;
  823. // }
  824. // }
  825. .title-row {
  826. background: #F3F4F8;
  827. color: #1a1a1a;
  828. padding:5px 0 3px;
  829. border-radius:5px;
  830. font-size: 14px;
  831. }
  832. .option-row {
  833. line-height: 26px;
  834. font-size: 14px;
  835. display: flex;
  836. // align-items: center;
  837. position: relative;
  838. padding: 10px 0 5px;
  839. box-sizing: border-box;
  840. .el-col {
  841. display: flex;
  842. // align-items: center;
  843. }
  844. .el-col-6 {
  845. display: flex;
  846. justify-content: flex-end;
  847. }
  848. &.lines {
  849. margin-top: 5px;
  850. border-top: 1px solid #ededed;
  851. }
  852. }
  853. .el-icon-question {
  854. display: flex;
  855. align-items: center;
  856. font-size: 16px;
  857. color: #4d4d4d;
  858. }
  859. .fontBold {
  860. font-weight: bold;
  861. }
  862. </style>