|
@@ -48,7 +48,23 @@
|
|
|
class="alert"
|
|
|
type="info">
|
|
|
</el-alert>
|
|
|
- <template v-if="isUserType">
|
|
|
+ <template v-if="isUserType && paymentType == '0'">
|
|
|
+ <el-form ref="payment" :model="payment">
|
|
|
+ <el-form-item
|
|
|
+ label="缴费方式"
|
|
|
+ prop="paymentPattern"
|
|
|
+ :rules="[{required: true, message: '请选择缴费方式', trigger: 'change'}]"
|
|
|
+ >
|
|
|
+ <el-select style="width: 100%!important;" v-model="payment.paymentPattern" placeholder="请选择缴费方式">
|
|
|
+ <el-option
|
|
|
+ v-for="item in paymentPatternTypeOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<el-collapse :value="collapse" @change="collapseChange" >
|
|
|
<el-collapse-item
|
|
|
v-for="(item, index) in cycles"
|
|
@@ -64,6 +80,7 @@
|
|
|
<paymentCycle
|
|
|
ref="cycles"
|
|
|
:form="item"
|
|
|
+ :hidePaymentPattern="true"
|
|
|
:isCommon="isCommon"
|
|
|
:isUserType="isUserType"
|
|
|
:isDisabled="form.leixing === '1' || paymentType == '0'"
|
|
@@ -120,7 +137,8 @@ import {
|
|
|
musicGroupPaymentCalenderDetailBatchUpdate,
|
|
|
queryByMusicGroupOrganizationCourseSettingsId,
|
|
|
} from "../api";
|
|
|
-import { getTimes } from "@/utils";
|
|
|
+import { paymentPatternType } from '@/constant'
|
|
|
+import { getTimes, objectToOptions } from "@/utils";
|
|
|
import userBaseinfo from "./user-baseinfo";
|
|
|
import paymentCycle from "./payment-cycle";
|
|
|
import extraClass from "./extra-class";
|
|
@@ -162,7 +180,11 @@ export default {
|
|
|
nextVisible: false,
|
|
|
typeList: [],
|
|
|
charges: [],
|
|
|
+ payment: {
|
|
|
+ paymentPattern: null,
|
|
|
+ },
|
|
|
organizationCourseUnitPriceSettingsByType: {},
|
|
|
+ paymentPatternTypeOptions: objectToOptions(paymentPatternType),
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -295,7 +317,7 @@ export default {
|
|
|
for (const item of this.eclass) {
|
|
|
money += item.courseCurrentPrice;
|
|
|
}
|
|
|
- if (this.cycles.length) {
|
|
|
+ if (this.cycles && this.cycles.length) {
|
|
|
const floorMoney = Math.floor(money / this.cycles.length)
|
|
|
const remainder = money % this.cycles.length
|
|
|
if (this.paymentAmountDisabled) {
|
|
@@ -317,7 +339,7 @@ export default {
|
|
|
// if (!money) {
|
|
|
// this.$set(this.cycle, "paymentAmount", undefined);
|
|
|
// } else {
|
|
|
- // this.$set(this.cycle, "paymentAmount", money);
|
|
|
+ this.$set(this.cycle, "paymentAmount", money);
|
|
|
// }
|
|
|
if (this.rowDetail) {
|
|
|
this.$set(
|
|
@@ -387,9 +409,10 @@ export default {
|
|
|
},
|
|
|
getForms () {
|
|
|
const { $refs: refs } = this;
|
|
|
- return [refs.base, refs.eclass, refs.cycle, ...refs.cycles, refs.other]
|
|
|
+
|
|
|
+ return [refs.base, refs.eclass, refs.cycle, ...(refs.cycles || []), refs.other, refs.payment]
|
|
|
.filter((item) => !!item)
|
|
|
- .map((item) => item.$refs.form);
|
|
|
+ .map((item) => item.$refs.form || item);
|
|
|
},
|
|
|
changeActive(val) {
|
|
|
if (this.$listeners.changeActive) {
|
|
@@ -399,6 +422,7 @@ export default {
|
|
|
async submit() {
|
|
|
const forms = this.getForms();
|
|
|
const valided = [];
|
|
|
+ console.log(forms)
|
|
|
for (const form of forms) {
|
|
|
form.validate((valid) => {
|
|
|
if (valid) {
|
|
@@ -410,10 +434,11 @@ export default {
|
|
|
return this.$message.error('请至少选择一条加课信息')
|
|
|
}
|
|
|
if (valided.length === forms.length) {
|
|
|
- const { paymentDate, paymentValid, leixing, ...rest } = {
|
|
|
+ const { leixing, ...rest } = {
|
|
|
...this.form,
|
|
|
...this.other,
|
|
|
- cycles: [...this.cycles.map(item => {
|
|
|
+ paymentPattern: this.payment.paymentPattern,
|
|
|
+ musicGroupPaymentDateRangeList: [...this.cycles.map(item => {
|
|
|
const { paymentDate, paymentValid, ...other } = item
|
|
|
return {
|
|
|
...other,
|
|
@@ -426,6 +451,18 @@ export default {
|
|
|
})],
|
|
|
musicGroupPaymentCalenderCourseSettingsList: this.eclass,
|
|
|
};
|
|
|
+ if (this.$refs.cycle) {
|
|
|
+ const { paymentDate, paymentValid, paymentPattern, ...other } = this.cycle
|
|
|
+ rest.paymentPattern = paymentPattern
|
|
|
+ rest.musicGroupPaymentDateRangeList = [{
|
|
|
+ ...other,
|
|
|
+ ...getTimes(paymentDate, ["startPaymentDate", "deadlinePaymentDate"]),
|
|
|
+ ...getTimes(paymentValid, [
|
|
|
+ "paymentValidStartDate",
|
|
|
+ "paymentValidEndDate",
|
|
|
+ ]),
|
|
|
+ }]
|
|
|
+ }
|
|
|
const data = {
|
|
|
...rest,
|
|
|
isGiveMusicNetwork: false,
|
|
@@ -434,12 +471,9 @@ export default {
|
|
|
this.paymentType == 0 ? this.paymentType : leixing
|
|
|
],
|
|
|
musicGroupId: this.musicGroupId,
|
|
|
- ...getTimes(paymentDate, ["startPaymentDate", "deadlinePaymentDate"]),
|
|
|
- ...getTimes(paymentValid, [
|
|
|
- "paymentValidStartDate",
|
|
|
- "paymentValidEndDate",
|
|
|
- ]),
|
|
|
};
|
|
|
+ // console.log(data)
|
|
|
+ // return
|
|
|
if (!this.rowDetail?.id) {
|
|
|
try {
|
|
|
const res = await musicGroupPaymentCalenderAdd(data);
|