user-pay-form.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. <template>
  2. <div>
  3. <el-alert
  4. title="课程信息设置"
  5. :closable="false"
  6. class="alert"
  7. v-if="paymentTypeString !== 'SPAN_GROUP_CLASS_ADJUST'"
  8. type="info"
  9. >
  10. </el-alert>
  11. <userBaseinfo
  12. :form.sync="form"
  13. :isCommon="isCommon"
  14. v-if="paymentTypeString !== 'SPAN_GROUP_CLASS_ADJUST'"
  15. :isUserType="isUserType"
  16. @getCharges="getCharges"
  17. @changeActive="changeActive"
  18. :typeList="typeList"
  19. :charges="charges"
  20. :rowDetail="rowDetail"
  21. :chargeTypeName="chargeTypeName"
  22. :paymentType="paymentType"
  23. :courseViewType="courseViewType"
  24. ref="base"
  25. />
  26. <template v-if="paymentTypeString === 'SPAN_GROUP_CLASS_ADJUST'">
  27. <el-alert
  28. title="加课信息设置"
  29. :closable="false"
  30. class="alert"
  31. type="info"
  32. >
  33. </el-alert>
  34. <extraClassUser
  35. :form.sync="eclassuser"
  36. ref="eclass"
  37. :isUserType="isUserType"
  38. :courseUnitPriceSettingsByType="
  39. organizationCourseUnitPriceSettingsByType
  40. "
  41. @priceChange="priceChange"
  42. :clearable="true"
  43. @moneyChange="syncAllMoney"
  44. />
  45. </template>
  46. <template v-else-if="!isCommon">
  47. <el-alert
  48. title="加课信息设置"
  49. :closable="false"
  50. class="alert"
  51. type="info"
  52. >
  53. </el-alert>
  54. <extraClass
  55. :form.sync="eclass"
  56. ref="eclass"
  57. @create="addExtraClass"
  58. @remove="removeExtraClass"
  59. :isUserType="isUserType"
  60. :courseUnitPriceSettingsByType="
  61. organizationCourseUnitPriceSettingsByType
  62. "
  63. @priceChange="priceChange"
  64. :clearable="true"
  65. @moneyChange="syncAllMoney"
  66. />
  67. </template>
  68. <extraClass
  69. v-else-if="(!isCommon && eclass.length) || isCommon"
  70. :form="eclass"
  71. ref="eclass"
  72. :isCommon="isCommon"
  73. @create="addExtraClass"
  74. @remove="removeExtraClass"
  75. @moneyChange="syncAllMoney"
  76. :courseUnitPriceSettingsByType="organizationCourseUnitPriceSettingsByType"
  77. :isUserType="isUserType"
  78. :isDisabled="
  79. form.leixing === '1' || form.leixing === '2' || paymentType == '0'
  80. "
  81. />
  82. <template>
  83. <el-alert
  84. title="会员设置"
  85. :closable="false"
  86. class="alert"
  87. style="margin-top: 20px"
  88. type="info"
  89. v-if="courseViewType == 1"
  90. >
  91. </el-alert>
  92. <memberSetting
  93. v-if="courseViewType == 1"
  94. :form="memberForm"
  95. :isUserType="isUserType"
  96. :organId="baseInfo.organId"
  97. :showTime="false"
  98. />
  99. <el-alert title="缴费设置" :closable="false" class="alert" type="info">
  100. </el-alert>
  101. <el-form ref="payment" :model="payment">
  102. <el-form-item
  103. label-width="160px"
  104. label="系统缴费金额"
  105. v-if="
  106. !paymentType &&
  107. type == 'user' &&
  108. (courseViewType == 2 || courseViewType == 3)
  109. "
  110. >
  111. <el-input :disabled="true" v-model="cloudFee"></el-input>
  112. </el-form-item>
  113. <el-form-item
  114. label-width="160px"
  115. label="缴费方式"
  116. prop="paymentPattern"
  117. :rules="[
  118. { required: true, message: '请选择缴费方式', trigger: 'change' },
  119. ]"
  120. >
  121. <el-select
  122. style="width: 100% !important"
  123. v-model="payment.paymentPattern"
  124. placeholder="请选择缴费方式"
  125. :disabled="courseViewType == 1"
  126. >
  127. <el-option
  128. v-for="item in paymentPatternTypeOptions"
  129. :key="item.value"
  130. :label="item.label"
  131. :value="item.value"
  132. >
  133. </el-option>
  134. </el-select>
  135. </el-form-item>
  136. </el-form>
  137. <template
  138. v-if="isMulticycle && paymentTypeString !== 'SPAN_GROUP_CLASS_ADJUST'"
  139. >
  140. <el-collapse :value="collapse" @change="collapseChange">
  141. <el-collapse-item
  142. v-for="(item, index) in cycles"
  143. :key="index"
  144. :name="index"
  145. >
  146. <template slot="title">
  147. <div class="collapse-title">
  148. <span>缴费周期 {{ index + 1 }}</span>
  149. <i
  150. v-if="cycles.length > 1"
  151. class="el-icon-circle-close"
  152. @click.stop="removeCycle(index)"
  153. ></i>
  154. </div>
  155. </template>
  156. <paymentCycle
  157. ref="cycles"
  158. :form="item"
  159. :hidePaymentPattern="true"
  160. :isCommon="isCommon"
  161. :isUserType="isUserType"
  162. :isDisabled="
  163. form.leixing === '1' ||
  164. form.leixing === '2' ||
  165. paymentType == '0'
  166. "
  167. />
  168. </el-collapse-item>
  169. </el-collapse>
  170. <el-button
  171. icon="el-icon-circle-plus-outline"
  172. plain
  173. type="info"
  174. size="small"
  175. style="width: 100%; margin: 20px 0"
  176. @click="addCycle"
  177. >新增缴费周期</el-button
  178. >
  179. </template>
  180. <paymentCycle
  181. ref="cycle"
  182. :form.sync="cycle"
  183. :isCommon="isCommon"
  184. :hidePaymentPattern="true"
  185. :isUserType="isUserType"
  186. :isDisabled="
  187. form.leixing === '1' || form.leixing === '2' || paymentType == '0'
  188. "
  189. :courseViewType="courseViewType"
  190. v-else
  191. />
  192. </template>
  193. <el-alert title="其它" :closable="false" class="alert" type="info">
  194. </el-alert>
  195. <otherform :form="other" ref="other" />
  196. <div slot="footer" class="dialog-footer">
  197. <el-button @click="$listeners.close">取 消</el-button>
  198. <el-button type="primary" @click="submit">确认</el-button>
  199. </div>
  200. <el-dialog
  201. :title="nextTitle"
  202. :visible.sync="nextVisible"
  203. width="600px"
  204. append-to-body
  205. >
  206. <classrooms @close="closeNext" />
  207. </el-dialog>
  208. </div>
  209. </template>
  210. <script>
  211. import {
  212. chargeTypeList,
  213. musicGroupOrganizationCourseSettingsQueryPage,
  214. } from "@/api/specialSetting";
  215. import { getMusicGroupPaymentCalenderDetail } from "@/api/buildTeam";
  216. import {
  217. musicGroupPaymentCalenderAdd,
  218. musicGroupPaymentCalenderDetailBatchUpdate,
  219. queryByMusicGroupOrganizationCourseSettingsId,
  220. musicGroupPaymentCalenderView,
  221. } from "../api";
  222. import { paymentPatternType } from "@/constant";
  223. import { getTimes, objectToOptions } from "@/utils";
  224. import userBaseinfo from "./user-baseinfo";
  225. import paymentCycle from "./payment-cycle";
  226. import extraClass from "./extra-class";
  227. import extraClassUser from "./extra-class-user";
  228. import classrooms from "./classrooms";
  229. import otherform from "./other";
  230. import memberSetting from "./member-setting";
  231. import baseInfoVue from "../../teamDetail/components/baseInfo.vue";
  232. import merge from "webpack-merge";
  233. import numeral from "numeral";
  234. import { organizationCloudTeacherFeeQueryPage } from "@/api/specialSetting";
  235. const paymentTypeFormat = {
  236. 0: "MUSIC_APPLY",
  237. 1: "MUSIC_RENEW",
  238. 2: "ADD_COURSE",
  239. 3: "ADD_STUDENT",
  240. 4: "SPAN_GROUP_CLASS_ADJUST",
  241. };
  242. export default {
  243. props: [
  244. "type",
  245. "musicGroupId",
  246. "baseInfo",
  247. "paymentType",
  248. "rowDetail",
  249. "organizationCourseUnitPriceSettings",
  250. ],
  251. components: {
  252. userBaseinfo,
  253. paymentCycle,
  254. extraClass,
  255. extraClassUser,
  256. classrooms,
  257. otherform,
  258. memberSetting,
  259. },
  260. data() {
  261. return {
  262. options: [],
  263. form: {
  264. payUserType: this.type === "user" ? "STUDENT" : "SCHOOL",
  265. leixing: "1",
  266. musicGroupOrganizationCourseSettingId: null,
  267. },
  268. chargeTypeName: "",
  269. other: {},
  270. cycles: [{}],
  271. cycle: {},
  272. eclass: [],
  273. eclassuser: [],
  274. collapse: [0],
  275. nextVisible: false,
  276. typeList: [],
  277. charges: [],
  278. studentIds: "",
  279. payment: {
  280. paymentPattern: null,
  281. },
  282. viewDetail: null,
  283. organizationCourseUnitPriceSettingsByType: {},
  284. paymentPatternTypeOptions: objectToOptions(paymentPatternType),
  285. cloudFee: "",
  286. courseViewType: "",
  287. memberForm: {
  288. memberRankSettingId: "",
  289. memberValidDate: 6,
  290. memberPaymentAmount: "",
  291. originalMemberPaymentAmount: "",
  292. paymentDate: [],
  293. },
  294. };
  295. },
  296. computed: {
  297. musicGroup() {
  298. return this.baseInfo?.musicGroup;
  299. },
  300. isCommon() {
  301. return this.form.leixing === "1";
  302. },
  303. isDisabled() {
  304. return this.form.leixing === "1" || String(this.paymentType) === "0";
  305. },
  306. isUserType() {
  307. return this.type === "user";
  308. },
  309. nextTitle() {
  310. return this.isCommon ? "乐团课程-班级选择" : "临时加课-班级选择";
  311. },
  312. chargesById() {
  313. const data = {};
  314. for (const item of this.charges) {
  315. data[item.id] = item;
  316. }
  317. return data;
  318. },
  319. paymentAmountDisabled() {
  320. return (
  321. (this.isUserType || (this.isCommon && this.isUserType)) &&
  322. this.isDisabled
  323. );
  324. },
  325. isMulticycle() {
  326. let editMulticycle = false;
  327. let paymentType = "";
  328. if (this.viewDetail) {
  329. const { musicGroupPaymentCalenders, auditDto } = this.viewDetail;
  330. paymentType = musicGroupPaymentCalenders[0]?.paymentType;
  331. editMulticycle =
  332. musicGroupPaymentCalenders.length > 1 || paymentType != "ADD_COURSE";
  333. if (editMulticycle) {
  334. this.cycles = musicGroupPaymentCalenders.map((item) => ({
  335. paymentAmount: item.paymentAmount,
  336. paymentDate: [item?.startPaymentDate, item?.deadlinePaymentDate],
  337. paymentValid: [
  338. item?.paymentValidStartDate,
  339. item?.paymentValidEndDate,
  340. ],
  341. }));
  342. }
  343. }
  344. return (
  345. (this.payment.paymentPattern == 0 &&
  346. this.form.leixing !== "2" &&
  347. paymentType !== "ADD_COURSE") ||
  348. (this.payment.paymentPattern == 0 && editMulticycle)
  349. );
  350. },
  351. paymentTypeString() {
  352. let paymentType = "";
  353. if (this.viewDetail) {
  354. const { musicGroupPaymentCalenders } = this.viewDetail;
  355. paymentType = musicGroupPaymentCalenders[0]?.paymentType;
  356. }
  357. return paymentType;
  358. },
  359. },
  360. watch: {
  361. type() {
  362. this.$set(
  363. this.form,
  364. "payUserType",
  365. this.type === "user" ? "STUDENT" : "SCHOOL"
  366. );
  367. },
  368. baseInfo(val) {
  369. this.formatCourse();
  370. this.getCharges();
  371. },
  372. organizationCourseUnitPriceSettings() {
  373. this.formatCourse();
  374. },
  375. "form.leixing"(val) {
  376. this.cycles = [{}];
  377. this.collapse = [0];
  378. this.cycle = {};
  379. this.$set(this.form, "musicGroupOrganizationCourseSettingId", undefined);
  380. this.$set(this.cycle, "paymentAmount", undefined);
  381. if (val === "1") {
  382. this.eclass = [];
  383. } else if (val === "2") {
  384. this.eclass = [{}];
  385. }
  386. },
  387. async "form.musicGroupOrganizationCourseSettingId"(val) {
  388. if (val && !this.rowDetail) {
  389. try {
  390. const res = await queryByMusicGroupOrganizationCourseSettingsId({
  391. id: val,
  392. });
  393. this.eclass = res.data.filter((item) => {
  394. return !item.isStudentOptional || this.paymentType !== undefined;
  395. }) || [{}];
  396. this.syncAllMoney();
  397. } catch (error) {}
  398. }
  399. },
  400. "payment.paymentPattern"() {
  401. this.syncAllMoney();
  402. },
  403. },
  404. mounted() {
  405. this.formatCourse();
  406. this.init();
  407. },
  408. activated() {
  409. this.formatCourse();
  410. this.init();
  411. },
  412. methods: {
  413. async init() {
  414. let organId = this.baseInfo?.musicGroup?.organId;
  415. this.courseViewType = this.baseInfo?.musicGroup?.courseViewType;
  416. // 如果为学员缴费且是乐团缴费则显示云教练的价格
  417. if (
  418. !this.paymentType &&
  419. this.type == "user" &&
  420. organId &&
  421. (this.courseViewType == 2 || this.courseViewType == 3)
  422. ) {
  423. try {
  424. const res = await organizationCloudTeacherFeeQueryPage({ organId });
  425. this.courseViewType == 2
  426. ? (this.cloudFee = res.data.rows[0].price)
  427. : (this.cloudFee = res.data.rows[0].plusPrice);
  428. } catch (e) {
  429. console.log(e);
  430. }
  431. // 获取乐团云教练费用
  432. // this.cloudFee
  433. }
  434. this.getCharges();
  435. if (this.rowDetail) {
  436. console.log("this.rowDetail", this.rowDetail);
  437. for (const key in paymentTypeFormat) {
  438. if (paymentTypeFormat.hasOwnProperty(key)) {
  439. const item = paymentTypeFormat[key];
  440. if (item === this.rowDetail.paymentType) {
  441. this.paymentType = key;
  442. }
  443. }
  444. }
  445. this.$set(
  446. this.other,
  447. "isGiveMusicNetwork",
  448. this.rowDetail.isGiveMusicNetwork
  449. );
  450. this.$set(this.other, "memo", this.rowDetail.memo);
  451. try {
  452. const res = await musicGroupPaymentCalenderView({
  453. musicGroupId: this.musicGroupId,
  454. batchNo: this.rowDetail.batchNo,
  455. });
  456. this.viewDetail = res.data;
  457. const firstPayment = res.data.musicGroupPaymentCalenders[0] || {};
  458. this.eclass = (
  459. res.data.musicGroupPaymentCalenderCourseSettings || []
  460. ).filter((item) => {
  461. return !item.isStudentOptional || this.paymentType !== undefined;
  462. });
  463. this.eclassuser =
  464. res.data.musicGroupPaymentCalenderStudentDetails.map((item) => {
  465. if (this.paymentTypeString === "SPAN_GROUP_CLASS_ADJUST") {
  466. return {
  467. ...item,
  468. courseOriginalPrice: item.masterSubCoursePrice,
  469. };
  470. }
  471. return item;
  472. });
  473. this.$set(
  474. this.payment,
  475. "paymentPattern",
  476. String(this.viewDetail.auditDto?.paymentPattern)
  477. );
  478. // 添加会员缴费信息
  479. this.$set(
  480. this.memberForm,
  481. "memberRankSettingId",
  482. this.viewDetail.musicGroupPaymentCalenders[0].memberRankSettingId
  483. );
  484. this.$set(
  485. this.memberForm,
  486. "memberValidDate",
  487. this.viewDetail.musicGroupPaymentCalenders[0].memberValidDate
  488. );
  489. this.$set(
  490. this.memberForm,
  491. "memberPaymentAmount",
  492. this.viewDetail.musicGroupPaymentCalenders[0].memberPaymentAmount
  493. );
  494. this.$set(
  495. this.memberForm,
  496. "originalMemberPaymentAmount",
  497. this.viewDetail.musicGroupPaymentCalenders[0]
  498. .originalMemberPaymentAmount
  499. );
  500. if (this.$refs.cycle) {
  501. this.$set(
  502. this.cycle,
  503. "paymentPattern",
  504. firstPayment.paymentPattern + ""
  505. );
  506. let arr = [
  507. firstPayment.paymentValidStartDate,
  508. firstPayment.paymentValidEndDate,
  509. ];
  510. // paymentDate startPaymentDate deadlinePaymentDate
  511. this.$set(this.cycle, "paymentDate", [
  512. firstPayment.startPaymentDate,
  513. firstPayment.deadlinePaymentDate,
  514. ]);
  515. this.$set(this.cycle, "paymentValid", arr);
  516. }
  517. this.studentIds = firstPayment.studentIds;
  518. this.$set(
  519. this.form,
  520. "musicGroupOrganizationCourseSettingId",
  521. res.data.auditDto?.musicGroupOrganizationCourseSettingsId
  522. );
  523. this.syncAllMoney();
  524. } catch (error) {}
  525. }
  526. },
  527. formatCourse() {
  528. const organId = this.musicGroup?.organId;
  529. const chargeTypeId = this.musicGroup?.chargeTypeId;
  530. const _ = {};
  531. const list = (this.organizationCourseUnitPriceSettings || []).filter(
  532. (item) =>
  533. organId &&
  534. organId == item.organId &&
  535. chargeTypeId &&
  536. chargeTypeId == item.chargeTypeId
  537. );
  538. for (const item of list) {
  539. _[item.courseType] = item;
  540. }
  541. this.organizationCourseUnitPriceSettingsByType = _;
  542. return _;
  543. },
  544. priceChange(item, index) {
  545. const _ = [...this.eclass];
  546. const active =
  547. this.organizationCourseUnitPriceSettingsByType[item.courseType] || {};
  548. const price = Math.round(
  549. numeral(active.unitPrice || 1)
  550. .multiply(item.courseTotalMinuties || 1)
  551. .value()
  552. );
  553. item.courseCurrentPrice = price;
  554. item.courseOriginalPrice = price;
  555. _[index] = item;
  556. this.eclass = [..._];
  557. this.syncAllMoney();
  558. },
  559. syncAllMoney() {
  560. if (this.paymentTypeString === "SPAN_GROUP_CLASS_ADJUST") {
  561. const money =
  562. this.viewDetail?.musicGroupPaymentCalenders[0].paymentAmount;
  563. this.$set(this.cycle, "paymentAmount", money);
  564. return money;
  565. }
  566. let money = 0;
  567. let first = 0;
  568. let other = 0;
  569. let classs =
  570. this.paymentTypeString === "SPAN_GROUP_CLASS_ADJUST"
  571. ? this.eclassuser
  572. : this.eclass;
  573. for (const item of classs) {
  574. money += item.courseCurrentPrice;
  575. if (this.cycles && this.cycles.length) {
  576. if (item.isStudentOptional) {
  577. first += item.courseCurrentPrice;
  578. } else {
  579. const floorMoney = Math.floor(
  580. item.courseCurrentPrice / this.cycles.length
  581. );
  582. const remainder = item.courseCurrentPrice % this.cycles.length;
  583. first += floorMoney + remainder;
  584. other += floorMoney;
  585. }
  586. }
  587. }
  588. if (this.cycles && this.cycles.length) {
  589. this.cycles = this.cycles.map((item, index) => {
  590. return {
  591. ...item,
  592. paymentAmount: index === 0 ? first : other,
  593. };
  594. });
  595. }
  596. // if (!money) {
  597. // this.$set(this.cycle, "paymentAmount", undefined);
  598. // } else {
  599. this.$set(this.cycle, "paymentAmount", money);
  600. // }
  601. return money;
  602. },
  603. async getChargeTypeList() {
  604. try {
  605. const res = await chargeTypeList({
  606. row: 9999,
  607. });
  608. this.typeList = res.data.rows;
  609. } catch (error) {}
  610. },
  611. async getCharges() {
  612. const organId = this.musicGroup?.organId;
  613. const chargeTypeId = this.musicGroup?.chargeTypeId;
  614. this.chargeTypeName = this.musicGroup?.chargeTypeName;
  615. try {
  616. const res = await musicGroupOrganizationCourseSettingsQueryPage({
  617. row: 9999,
  618. chargeTypeId,
  619. organId,
  620. });
  621. const ids = res.data.rows.map((item) => item.id);
  622. if (!ids.includes(this.form.musicGroupOrganizationCourseSettingId)) {
  623. this.$set(this.form, "musicGroupOrganizationCourseSettingId", null);
  624. }
  625. this.charges = res.data.rows;
  626. } catch (error) {}
  627. },
  628. addExtraClass() {
  629. this.eclass.push({});
  630. },
  631. removeExtraClass(index) {
  632. this.eclass[index] = null;
  633. this.eclass = this.eclass.filter((item) => !!item);
  634. },
  635. addCycle() {
  636. this.cycles.push({});
  637. this.collapse.push(this.cycles.length - 1);
  638. this.syncAllMoney();
  639. },
  640. removeCycle(index) {
  641. this.cycles[index] = null;
  642. this.cycles = this.cycles.filter((item) => !!item);
  643. if (this.collapse.includes(index)) {
  644. this.collapse.splice(index, 1);
  645. this.collapse = this.collapse.map((item, _index) =>
  646. _index - 1 >= index ? item-- : item
  647. );
  648. }
  649. this.syncAllMoney();
  650. },
  651. collapseChange(val) {
  652. this.collapse = val;
  653. },
  654. closeNext() {
  655. this.nextVisible = false;
  656. },
  657. getForms() {
  658. const { $refs: refs } = this;
  659. return [
  660. refs.base,
  661. refs.eclass,
  662. refs.cycle,
  663. ...(refs.cycles || []),
  664. refs.other,
  665. refs.payment,
  666. ]
  667. .filter((item) => !!item)
  668. .map((item) => item.$refs.form || item);
  669. },
  670. changeActive(val) {
  671. if (this.$listeners.changeActive) {
  672. this.$listeners.changeActive(val);
  673. }
  674. },
  675. async submit() {
  676. const forms = this.getForms();
  677. const valided = [];
  678. for (const form of forms) {
  679. form.validate((valid) => {
  680. if (valid) {
  681. valided.push(form);
  682. }
  683. });
  684. }
  685. if (this.eclass.length < 1 && this.eclassuser.length < 1&&this.courseViewType !=1) {
  686. return this.$message.error("请至少选择一条加课信息");
  687. }
  688. if (valided.length === forms.length) {
  689. const { leixing, ...rest } = {
  690. ...this.form,
  691. ...this.other,
  692. paymentPattern: this.payment.paymentPattern,
  693. musicGroupPaymentDateRangeList: [
  694. ...this.cycles.map((item) => {
  695. const { paymentDate, paymentValid, ...other } = item;
  696. return {
  697. ...other,
  698. ...getTimes(paymentDate, [
  699. "startPaymentDate",
  700. "deadlinePaymentDate",
  701. ]),
  702. ...getTimes(paymentValid, [
  703. "paymentValidStartDate",
  704. "paymentValidEndDate",
  705. ]),
  706. };
  707. }),
  708. ],
  709. musicGroupPaymentCalenderCourseSettingsList: this.eclass,
  710. musicGroupPaymentCalenderStudentDetails: this.eclassuser,
  711. };
  712. if (this.$refs.cycle) {
  713. const { paymentDate, paymentValid, ...other } = this.cycle;
  714. rest.musicGroupPaymentDateRangeList = [
  715. {
  716. ...other,
  717. ...getTimes(paymentDate, [
  718. "startPaymentDate",
  719. "deadlinePaymentDate",
  720. ]),
  721. ...getTimes(paymentValid, [
  722. "paymentValidStartDate",
  723. "paymentValidEndDate",
  724. ]),
  725. },
  726. ];
  727. }
  728. const data = {
  729. ...rest,
  730. ...this.memberForm,
  731. isGiveMusicNetwork: false,
  732. studentIds: this.studentIds,
  733. paymentType:
  734. paymentTypeFormat[
  735. this.paymentType == 0 ? this.paymentType : leixing
  736. ],
  737. musicGroupId: this.musicGroupId,
  738. };
  739. const info = this.viewDetail?.musicGroupPaymentCalenders[0];
  740. if (info && this.viewDetail?.auditDto.paymentType === "ADD_STUDENT") {
  741. data.attribute1 = info.attribute1;
  742. }
  743. let hasCourseFee = false;
  744. for (const item of data.musicGroupPaymentCalenderCourseSettingsList) {
  745. if (item.courseCurrentPrice > 0 || item.isStudentOptional == true) {
  746. hasCourseFee = true;
  747. break;
  748. }
  749. }
  750. // console.log(this.baseInfo?.musicGroup?.courseViewType, this.paymentType, hasCourseFee, this.type)
  751. if (
  752. (this.baseInfo?.musicGroup?.courseViewType == 2 ||
  753. this.baseInfo?.musicGroup?.courseViewType == 3) &&
  754. this.paymentType == 0 &&
  755. hasCourseFee &&
  756. this.type === "user"
  757. ) {
  758. this.$message.error(
  759. "报名缴费云教练收费模式课程费用不得大于0且不可选"
  760. );
  761. return;
  762. }
  763. if (!this.rowDetail?.batchNo) {
  764. try {
  765. const res = await musicGroupPaymentCalenderAdd(data);
  766. if (this.$route.query.team_status == "PRE_BUILD_FEE") {
  767. this.$message.success("创建成功");
  768. this.$store.dispatch("delVisitedViews", this.$route);
  769. this.$router.push({
  770. path: "/teamList",
  771. });
  772. }
  773. this.$listeners.close();
  774. this.$listeners.submited(res.data);
  775. // 在这里
  776. } catch (error) {}
  777. } else {
  778. try {
  779. data.batchNo = this.rowDetail.batchNo;
  780. // 缴费类型无法修改,按照之前覆盖
  781. data.paymentType =
  782. this.viewDetail.musicGroupPaymentCalenders[0]?.paymentType;
  783. const res = await musicGroupPaymentCalenderDetailBatchUpdate(data);
  784. this.$listeners.close();
  785. this.$listeners.submited(res.data);
  786. if (this.$route.query.type == "teamDraft") {
  787. this.$router.push({
  788. query: merge(this.$route.query, { type: "feeAudit" }),
  789. });
  790. }
  791. } catch (error) {}
  792. }
  793. }
  794. },
  795. },
  796. };
  797. </script>
  798. <style lang="less" scoped>
  799. .dialog-footer {
  800. margin-top: 20px;
  801. display: block;
  802. text-align: right;
  803. }
  804. .alert {
  805. margin-bottom: 10px;
  806. }
  807. .collapse-title {
  808. display: flex;
  809. justify-content: space-between;
  810. align-items: center;
  811. width: 100%;
  812. .el-icon-circle-close {
  813. font-size: 16px;
  814. margin-right: 10px;
  815. }
  816. }
  817. /deep/ .el-collapse-item__wrap {
  818. padding-top: 20px;
  819. }
  820. </style>