Browse Source

添加学员缴费必选一个班级

wolyshaw 4 years ago
parent
commit
b49d5f6c68
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/views/teamDetail/components/modals/create-user-pay.vue

+ 8 - 1
src/views/teamDetail/components/modals/create-user-pay.vue

@@ -258,9 +258,12 @@ export default {
       this.organizationCourseUnitPriceSettingsByType = _
       this.organizationCourseUnitPriceSettingsByType = _
       return _
       return _
     },
     },
+    getAllIds() {
+      return [this.form.signClass, this.form.mixClass, this.form.highClass, ...this.form.snapClass].filter(item => !!item)
+    },
     async classChange() {
     async classChange() {
       try {
       try {
-        const ids = [this.form.signClass, this.form.mixClass, this.form.highClass, ...this.form.snapClass].filter(item => !!item).join(',')
+        const ids = this.getAllIds().join(',')
         if (ids) {
         if (ids) {
           const res = await queryRemainCourseTypeDuration({
           const res = await queryRemainCourseTypeDuration({
             classGroupIdList: ids
             classGroupIdList: ids
@@ -316,6 +319,10 @@ export default {
           }
           }
         });
         });
       }
       }
+      if (!this.getAllIds().length) {
+        this.$message.error('请至少选择一个班级')
+        return
+      }
       if (forms.length === valided.length) {
       if (forms.length === valided.length) {
         const cyclelist = this.payment.paymentPattern == 0 ? this.cycles : [this.cycle]
         const cyclelist = this.payment.paymentPattern == 0 ? this.cycles : [this.cycle]
         const data = {
         const data = {