|
@@ -48,11 +48,35 @@
|
|
|
class="alert"
|
|
|
type="info">
|
|
|
</el-alert>
|
|
|
- <paymentCycle ref="cycle"
|
|
|
- :isUserType="isUserType"
|
|
|
- :form.sync="cycle"
|
|
|
- :isCommon="isCommon"
|
|
|
- :isDisabled="true" />
|
|
|
+ <el-collapse :value="collapse" @change="collapseChange" >
|
|
|
+ <el-collapse-item
|
|
|
+ v-for="(item, index) in cycles"
|
|
|
+ :key="index"
|
|
|
+ :name="index"
|
|
|
+ >
|
|
|
+ <template slot="title">
|
|
|
+ <div class="collapse-title">
|
|
|
+ <span>缴费周期 {{index + 1}}</span>
|
|
|
+ <i v-if="cycles.length > 1" class="el-icon-circle-close" @click.stop="removeCycle(index)"></i>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <paymentCycle
|
|
|
+ ref="cycles"
|
|
|
+ :form="item"
|
|
|
+ :isCommon="isCommon"
|
|
|
+ :isUserType="isUserType"
|
|
|
+ :isDisabled="form.leixing === '1' || paymentType == '0'"
|
|
|
+ />
|
|
|
+ </el-collapse-item>
|
|
|
+ </el-collapse>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
+ plain
|
|
|
+ type="info"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%;margin: 20px 0;"
|
|
|
+ @click="addCycle"
|
|
|
+ >新增缴费周期</el-button>
|
|
|
</template>
|
|
|
<el-alert title="其它"
|
|
|
:closable="false"
|
|
@@ -124,7 +148,7 @@ export default {
|
|
|
cycles: [{}],
|
|
|
cycle: {},
|
|
|
eclass: [],
|
|
|
- collapse: [],
|
|
|
+ collapse: [0],
|
|
|
nextVisible: false,
|
|
|
typeList: [],
|
|
|
charges: [],
|
|
@@ -151,6 +175,9 @@ export default {
|
|
|
}
|
|
|
return data;
|
|
|
},
|
|
|
+ paymentAmountDisabled() {
|
|
|
+ return (this.isUserType || (this.isCommon && this.isUserType)) && this.isDisabled
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
type () {
|
|
@@ -258,10 +285,29 @@ export default {
|
|
|
for (const item of this.eclass) {
|
|
|
money += item.courseCurrentPrice;
|
|
|
}
|
|
|
+ if (this.cycles.length) {
|
|
|
+ const floorMoney = Math.floor(money / this.cycles.length)
|
|
|
+ const remainder = money % this.cycles.length
|
|
|
+ if (this.paymentAmountDisabled) {
|
|
|
+ this.cycles = this.cycles.map((item, index) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ paymentAmount: (index === 0 ? floorMoney + remainder : floorMoney)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.cycles = this.cycles.map((item, index) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ paymentAmount: (index === 0 && !item.changeed ? money : item.paymentAmount)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
// 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(
|
|
@@ -315,11 +361,13 @@ export default {
|
|
|
addCycle () {
|
|
|
this.cycles.push({});
|
|
|
this.collapse.push(this.collapse.length);
|
|
|
+ this.syncAllMoney()
|
|
|
},
|
|
|
removeCycle (index) {
|
|
|
this.cycles[index] = null;
|
|
|
this.cycles = this.cycles.filter((item) => !!item);
|
|
|
this.collapse.pop();
|
|
|
+ this.syncAllMoney()
|
|
|
},
|
|
|
collapseChange (val) {
|
|
|
this.collapse = val;
|
|
@@ -329,7 +377,7 @@ export default {
|
|
|
},
|
|
|
getForms () {
|
|
|
const { $refs: refs } = this;
|
|
|
- return [refs.base, refs.eclass, refs.cycle, refs.other]
|
|
|
+ return [refs.base, refs.eclass, refs.cycle, ...refs.cycles, refs.other]
|
|
|
.filter((item) => !!item)
|
|
|
.map((item) => item.$refs.form);
|
|
|
},
|
|
@@ -355,7 +403,17 @@ export default {
|
|
|
const { paymentDate, paymentValid, leixing, ...rest } = {
|
|
|
...this.form,
|
|
|
...this.other,
|
|
|
- ...this.cycle,
|
|
|
+ cycles: [...this.cycles.map(item => {
|
|
|
+ const { paymentDate, paymentValid, ...other } = item
|
|
|
+ return {
|
|
|
+ ...other,
|
|
|
+ ...getTimes(paymentDate, ["startPaymentDate", "deadlinePaymentDate"]),
|
|
|
+ ...getTimes(paymentValid, [
|
|
|
+ "paymentValidStartDate",
|
|
|
+ "paymentValidEndDate",
|
|
|
+ ]),
|
|
|
+ }
|
|
|
+ })],
|
|
|
musicGroupPaymentCalenderCourseSettingsList: this.eclass,
|
|
|
};
|
|
|
const data = {
|