|
@@ -1,10 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-alert
|
|
|
- title="课程信息设置"
|
|
|
- :closable="false"
|
|
|
- class="alert"
|
|
|
- type="info">
|
|
|
+ <el-alert title="课程信息设置" :closable="false" class="alert" type="info">
|
|
|
</el-alert>
|
|
|
<userBaseinfo
|
|
|
:form.sync="form"
|
|
@@ -21,7 +17,8 @@
|
|
|
title="加课信息设置"
|
|
|
:closable="false"
|
|
|
class="alert"
|
|
|
- type="info">
|
|
|
+ type="info"
|
|
|
+ >
|
|
|
</el-alert>
|
|
|
<extraClass
|
|
|
:form="eclass"
|
|
@@ -43,11 +40,7 @@
|
|
|
:isDisabled="form.leixing === '1' || paymentType == '0'"
|
|
|
/>
|
|
|
<template>
|
|
|
- <el-alert
|
|
|
- title="缴费设置"
|
|
|
- :closable="false"
|
|
|
- class="alert"
|
|
|
- type="info">
|
|
|
+ <el-alert title="缴费设置" :closable="false" class="alert" type="info">
|
|
|
</el-alert>
|
|
|
<paymentCycle
|
|
|
ref="cycle"
|
|
@@ -57,22 +50,12 @@
|
|
|
:isDisabled="form.leixing === '1' || paymentType == '0'"
|
|
|
/>
|
|
|
</template>
|
|
|
- <el-alert
|
|
|
- title="其它"
|
|
|
- :closable="false"
|
|
|
- class="alert"
|
|
|
- type="info">
|
|
|
+ <el-alert title="其它" :closable="false" class="alert" type="info">
|
|
|
</el-alert>
|
|
|
- <otherform
|
|
|
- :form="other"
|
|
|
- ref="other"
|
|
|
- />
|
|
|
+ <otherform :form="other" ref="other" />
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="$listeners.close">取 消</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="submit"
|
|
|
- >下一步</el-button>
|
|
|
+ <el-button type="primary" @click="submit">下一步</el-button>
|
|
|
</div>
|
|
|
<el-dialog
|
|
|
:title="nextTitle"
|
|
@@ -80,46 +63,49 @@
|
|
|
width="600px"
|
|
|
append-to-body
|
|
|
>
|
|
|
- <classrooms
|
|
|
- @close="closeNext"
|
|
|
- />
|
|
|
+ <classrooms @close="closeNext" />
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { chargeTypeList, musicGroupOrganizationCourseSettingsQueryPage } from '@/api/specialSetting'
|
|
|
-import { musicGroupPaymentCalenderAdd } from '../api'
|
|
|
-import { getTimes } from '@/utils'
|
|
|
-import userBaseinfo from './user-baseinfo'
|
|
|
-import paymentCycle from './payment-cycle'
|
|
|
-import extraClass from './extra-class'
|
|
|
-import classrooms from './classrooms'
|
|
|
-import otherform from './other'
|
|
|
+import {
|
|
|
+ chargeTypeList,
|
|
|
+ musicGroupOrganizationCourseSettingsQueryPage,
|
|
|
+} from "@/api/specialSetting";
|
|
|
+import {
|
|
|
+ musicGroupPaymentCalenderAdd,
|
|
|
+ musicGroupPaymentCalenderDetailBatchUpdate,
|
|
|
+} from "../api";
|
|
|
+import { getTimes } from "@/utils";
|
|
|
+import userBaseinfo from "./user-baseinfo";
|
|
|
+import paymentCycle from "./payment-cycle";
|
|
|
+import extraClass from "./extra-class";
|
|
|
+import classrooms from "./classrooms";
|
|
|
+import otherform from "./other";
|
|
|
|
|
|
const paymentTypeFormat = {
|
|
|
- 0: 'MUSIC_APPLY',
|
|
|
- 1: 'MUSIC_RENEW',
|
|
|
- 2: 'ADD_COURSE',
|
|
|
- 3: 'ADD_STUDENT',
|
|
|
-}
|
|
|
+ 0: "MUSIC_APPLY",
|
|
|
+ 1: "MUSIC_RENEW",
|
|
|
+ 2: "ADD_COURSE",
|
|
|
+ 3: "ADD_STUDENT",
|
|
|
+};
|
|
|
|
|
|
export default {
|
|
|
- props: ['type', 'musicGroupId', 'baseInfo', 'paymentType','rowDetail'],
|
|
|
+ props: ["type", "musicGroupId", "baseInfo", "paymentType", "rowDetail"],
|
|
|
components: {
|
|
|
userBaseinfo,
|
|
|
paymentCycle,
|
|
|
extraClass,
|
|
|
classrooms,
|
|
|
- otherform
|
|
|
-
|
|
|
+ otherform,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
options: [],
|
|
|
form: {
|
|
|
- payUserType: this.type === 'user' ? 'STUDENT' : 'SCHOOL',
|
|
|
- leixing: '1',
|
|
|
- musicGroupOrganizationCourseSettingId:null
|
|
|
+ payUserType: this.type === "user" ? "STUDENT" : "SCHOOL",
|
|
|
+ leixing: "1",
|
|
|
+ musicGroupOrganizationCourseSettingId: null,
|
|
|
},
|
|
|
other: {},
|
|
|
cycles: [{}],
|
|
@@ -129,176 +115,214 @@ export default {
|
|
|
nextVisible: false,
|
|
|
typeList: [],
|
|
|
charges: [],
|
|
|
- }
|
|
|
- },
|
|
|
- mounted(){
|
|
|
- this.init()
|
|
|
- },
|
|
|
- activated(){
|
|
|
- this.init()
|
|
|
- },
|
|
|
- methods:{
|
|
|
- init(){
|
|
|
- if(this.rowDetail){
|
|
|
- this.form.musicGroupOrganizationCourseSettingId = this.rowDetail.musicGroupOrganizationCourseSettingId
|
|
|
- console.log(this.form.musicGroupOrganizationCourseSettingId)
|
|
|
- }
|
|
|
- },
|
|
|
+ };
|
|
|
},
|
|
|
computed: {
|
|
|
isCommon() {
|
|
|
- return this.form.leixing === '1'
|
|
|
+ return this.form.leixing === "1";
|
|
|
},
|
|
|
isDisabled() {
|
|
|
- console.log(this.form.leixing === '1' || String(this.paymentType) === '0')
|
|
|
- return this.form.leixing === '1' || String(this.paymentType) === '0'
|
|
|
+ return this.form.leixing === "1" || String(this.paymentType) === "0";
|
|
|
},
|
|
|
isUserType() {
|
|
|
- return this.type === 'user'
|
|
|
+ return this.type === "user";
|
|
|
},
|
|
|
nextTitle() {
|
|
|
- return this.isCommon ? '乐团课程-班级选择' : '临时加课-班级选择'
|
|
|
+ return this.isCommon ? "乐团课程-班级选择" : "临时加课-班级选择";
|
|
|
},
|
|
|
chargesById() {
|
|
|
- const data = {}
|
|
|
+ const data = {};
|
|
|
for (const item of this.charges) {
|
|
|
- data[item.id] = item
|
|
|
+ data[item.id] = item;
|
|
|
}
|
|
|
- return data
|
|
|
+ return data;
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
type() {
|
|
|
- this.$set(this.form, 'payUserType', this.type === 'user' ? 'STUDENT' : 'SCHOOL')
|
|
|
+ this.$set(
|
|
|
+ this.form,
|
|
|
+ "payUserType",
|
|
|
+ this.type === "user" ? "STUDENT" : "SCHOOL"
|
|
|
+ );
|
|
|
},
|
|
|
- baseInfo() {
|
|
|
- this.getCharges()
|
|
|
+ baseInfo(val) {
|
|
|
+ this.getCharges();
|
|
|
},
|
|
|
- 'form.leixing'() {
|
|
|
- this.cycles = [{}]
|
|
|
- this.collapse = [0]
|
|
|
- this.cycle = {}
|
|
|
- this.cycle.paymentAmount = ''
|
|
|
- if (this.form.leixing === '1') {
|
|
|
- this.eclass = []
|
|
|
- } else if (this.form.leixing === '2') {
|
|
|
- this.eclass = [{}]
|
|
|
- this.$set(this.form, 'musicGroupOrganizationCourseSettingId', '')
|
|
|
+ "form.leixing"() {
|
|
|
+ this.cycles = [{}];
|
|
|
+ this.collapse = [0];
|
|
|
+ this.cycle = {};
|
|
|
+ this.cycle.paymentAmount = "";
|
|
|
+ if (this.form.leixing === "1") {
|
|
|
+ this.eclass = [];
|
|
|
+ } else if (this.form.leixing === "2") {
|
|
|
+ this.eclass = [{}];
|
|
|
+ this.$set(this.form, "musicGroupOrganizationCourseSettingId", "");
|
|
|
}
|
|
|
},
|
|
|
- 'form.musicGroupOrganizationCourseSettingId'() {
|
|
|
- const eclas = this.chargesById[this.form.musicGroupOrganizationCourseSettingId]
|
|
|
- this.eclass = eclas?.details || []
|
|
|
- this.syncAllMoney()
|
|
|
- }
|
|
|
+ "form.musicGroupOrganizationCourseSettingId"(val) {
|
|
|
+ this.getCharges();
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getCharges()
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ console.log(this.rowDetail);
|
|
|
+ if (this.rowDetail) {
|
|
|
+ this.form.musicGroupOrganizationCourseSettingId = this.rowDetail.musicGroupOrganizationCourseSettingId;
|
|
|
+ this.$set(
|
|
|
+ this.other,
|
|
|
+ "isGiveMusicNetwork",
|
|
|
+ this.rowDetail.isGiveMusicNetwork
|
|
|
+ );
|
|
|
+ this.$set(this.other, "memo", this.rowDetail.memo);
|
|
|
+ }
|
|
|
+ },
|
|
|
syncAllMoney() {
|
|
|
- let money = 0
|
|
|
+ let money = 0;
|
|
|
for (const item of this.eclass) {
|
|
|
- money += item.courseCurrentPrice
|
|
|
+ money += item.courseCurrentPrice;
|
|
|
}
|
|
|
- this.$set(this.cycle, 'paymentAmount', money)
|
|
|
- return money
|
|
|
+ this.$set(this.cycle, "paymentAmount", money);
|
|
|
+ this.$set(
|
|
|
+ this.cycle,
|
|
|
+ "paymentPattern",
|
|
|
+ this.rowDetail?.paymentPattern + ""
|
|
|
+ );
|
|
|
+ let arr = [
|
|
|
+ this.rowDetail?.paymentValidStartDate,
|
|
|
+ this.rowDetail?.paymentValidEndDate,
|
|
|
+ ];
|
|
|
+ this.$set(this.cycle, "paymentValid", arr);
|
|
|
+ return money;
|
|
|
},
|
|
|
async getChargeTypeList() {
|
|
|
try {
|
|
|
const res = await chargeTypeList({
|
|
|
- row: 9999
|
|
|
- })
|
|
|
- this.typeList = res.data.rows
|
|
|
+ row: 9999,
|
|
|
+ });
|
|
|
+ this.typeList = res.data.rows;
|
|
|
} catch (error) {}
|
|
|
},
|
|
|
async getCharges() {
|
|
|
- const chargeTypeId = this.baseInfo?.musicGroup?.chargeTypeId
|
|
|
+ const chargeTypeId = this.baseInfo?.musicGroup?.chargeTypeId;
|
|
|
try {
|
|
|
const res = await musicGroupOrganizationCourseSettingsQueryPage({
|
|
|
row: 9999,
|
|
|
- chargeTypeId
|
|
|
- })
|
|
|
- this.charges = res.data.rows
|
|
|
+ chargeTypeId,
|
|
|
+ });
|
|
|
+ this.charges = res.data.rows;
|
|
|
+ const eclas = this.chargesById[
|
|
|
+ this.form.musicGroupOrganizationCourseSettingId
|
|
|
+ ];
|
|
|
+ this.eclass = eclas?.details || [];
|
|
|
+
|
|
|
+ this.syncAllMoney();
|
|
|
} catch (error) {}
|
|
|
},
|
|
|
addExtraClass() {
|
|
|
- this.eclass.push({})
|
|
|
+ this.eclass.push({});
|
|
|
},
|
|
|
removeExtraClass(index) {
|
|
|
- this.eclass[index] = null
|
|
|
- this.eclass = this.eclass.filter(item => !!item)
|
|
|
+ this.eclass[index] = null;
|
|
|
+ this.eclass = this.eclass.filter((item) => !!item);
|
|
|
},
|
|
|
addCycle() {
|
|
|
- this.cycles.push({})
|
|
|
- this.collapse.push(this.collapse.length)
|
|
|
+ this.cycles.push({});
|
|
|
+ this.collapse.push(this.collapse.length);
|
|
|
},
|
|
|
removeCycle(index) {
|
|
|
- this.cycles[index] = null
|
|
|
- this.cycles = this.cycles.filter(item => !!item)
|
|
|
- this.collapse.pop()
|
|
|
+ this.cycles[index] = null;
|
|
|
+ this.cycles = this.cycles.filter((item) => !!item);
|
|
|
+ this.collapse.pop();
|
|
|
},
|
|
|
collapseChange(val) {
|
|
|
- this.collapse = val
|
|
|
+ this.collapse = val;
|
|
|
},
|
|
|
closeNext() {
|
|
|
- this.nextVisible = false
|
|
|
+ this.nextVisible = false;
|
|
|
},
|
|
|
getForms() {
|
|
|
- const { $refs: refs } = this
|
|
|
+ const { $refs: refs } = this;
|
|
|
return [refs.base, refs.eclass, refs.cycle, refs.other]
|
|
|
- .filter(item => !!item)
|
|
|
- .map(item => item.$refs.form)
|
|
|
+ .filter((item) => !!item)
|
|
|
+ .map((item) => item.$refs.form);
|
|
|
},
|
|
|
async submit() {
|
|
|
- const forms = this.getForms()
|
|
|
- const valided = []
|
|
|
+ const forms = this.getForms();
|
|
|
+ const valided = [];
|
|
|
for (const form of forms) {
|
|
|
- form.validate(valid => {
|
|
|
+ form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- valided.push(form)
|
|
|
+ valided.push(form);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
if (valided.length === forms.length) {
|
|
|
- const { paymentDate, paymentValid, leixing, ...rest } = {...this.form, ...this.other, ...this.cycle, musicGroupPaymentCalenderCourseSettingsList: this.eclass}
|
|
|
+ const { paymentDate, paymentValid, leixing, ...rest } = {
|
|
|
+ ...this.form,
|
|
|
+ ...this.other,
|
|
|
+ ...this.cycle,
|
|
|
+ musicGroupPaymentCalenderCourseSettingsList: this.eclass,
|
|
|
+ };
|
|
|
const data = {
|
|
|
...rest,
|
|
|
- paymentType: paymentTypeFormat[(this.paymentType == 0 ? this.paymentType : leixing)],
|
|
|
+ paymentType:
|
|
|
+ paymentTypeFormat[
|
|
|
+ this.paymentType == 0 ? this.paymentType : leixing
|
|
|
+ ],
|
|
|
musicGroupId: this.musicGroupId,
|
|
|
- ...getTimes(paymentDate, ['startPaymentDate', 'deadlinePaymentDate']),
|
|
|
- ...getTimes(paymentValid, ['paymentValidStartDate', 'paymentValidEndDate']),
|
|
|
+ ...getTimes(paymentDate, ["startPaymentDate", "deadlinePaymentDate"]),
|
|
|
+ ...getTimes(paymentValid, [
|
|
|
+ "paymentValidStartDate",
|
|
|
+ "paymentValidEndDate",
|
|
|
+ ]),
|
|
|
+ };
|
|
|
+ if (!this.rowDetail?.id) {
|
|
|
+ try {
|
|
|
+ const res = await musicGroupPaymentCalenderAdd(data);
|
|
|
+ this.$listeners.close();
|
|
|
+ this.$listeners.submited(res.data);
|
|
|
+ } catch (error) {}
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ data.id = this.rowDetail.id
|
|
|
+ const res = await musicGroupPaymentCalenderDetailBatchUpdate(data);
|
|
|
+ this.$listeners.close();
|
|
|
+ this.$listeners.submited(res.data);
|
|
|
+ } catch (error) {}
|
|
|
}
|
|
|
- try {
|
|
|
- const res = await musicGroupPaymentCalenderAdd(data)
|
|
|
- this.$listeners.close()
|
|
|
- this.$listeners.submited(res.data)
|
|
|
- } catch (error) {}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
- .dialog-footer{
|
|
|
- margin-top: 20px;
|
|
|
- display: block;
|
|
|
- text-align: right;
|
|
|
- }
|
|
|
- .alert{
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
- .collapse-title{
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- width: 100%;
|
|
|
- .el-icon-circle-close{
|
|
|
- font-size: 16px;
|
|
|
- margin-right: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
- /deep/ .el-collapse-item__wrap{
|
|
|
- padding-top: 20px;
|
|
|
+.dialog-footer {
|
|
|
+ margin-top: 20px;
|
|
|
+ display: block;
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+.alert {
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+.collapse-title {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ .el-icon-circle-close {
|
|
|
+ font-size: 16px;
|
|
|
+ margin-right: 10px;
|
|
|
}
|
|
|
+}
|
|
|
+/deep/ .el-collapse-item__wrap {
|
|
|
+ padding-top: 20px;
|
|
|
+}
|
|
|
</style>
|