wolyshaw 4 年之前
父节点
当前提交
7d1bf3d600
共有 1 个文件被更改,包括 30 次插入25 次删除
  1. 30 25
      src/views/resetTeaming/modals/user-pay-form.vue

+ 30 - 25
src/views/resetTeaming/modals/user-pay-form.vue

@@ -259,16 +259,18 @@ export default {
       }
       }
     },
     },
     async "form.musicGroupOrganizationCourseSettingId" (val) {
     async "form.musicGroupOrganizationCourseSettingId" (val) {
-      try {
-        const res = await queryByMusicGroupOrganizationCourseSettingsId({
-          id: val
-        })
-        this.eclass = res.data.filter(item => {
-          return !item.isStudentOptional || this.paymentType !== undefined
-        }) || [{}];
+      if (val) {
+        try {
+          const res = await queryByMusicGroupOrganizationCourseSettingsId({
+            id: val
+          })
+          this.eclass = res.data.filter(item => {
+            return !item.isStudentOptional || this.paymentType !== undefined
+          }) || [{}];
 
 
-        this.syncAllMoney();
-      } catch (error) { }
+          this.syncAllMoney();
+        } catch (error) { }
+      }
     },
     },
   },
   },
   mounted () {
   mounted () {
@@ -297,19 +299,19 @@ export default {
           this.rowDetail.isGiveMusicNetwork
           this.rowDetail.isGiveMusicNetwork
         );
         );
         this.$set(this.other, "memo", this.rowDetail.memo);
         this.$set(this.other, "memo", this.rowDetail.memo);
-        if (this.rowDetail.musicGroupOrganizationCourseSettingId) {
-          this.form.musicGroupOrganizationCourseSettingId = this.rowDetail.musicGroupOrganizationCourseSettingId;
-        } else {
-          try {
-            const res = await musicGroupPaymentCalenderView({
-              musicGroupId: this.musicGroupId,
-              batchNo: this.rowDetail.batchNo,
-            })
-            this.viewDetail = res.data
-            this.eclass = res.data.musicGroupPaymentCalenderCourseSettings
-            this.syncAllMoney()
-          } catch (error) {}
-        }
+        try {
+          const res = await musicGroupPaymentCalenderView({
+            musicGroupId: this.musicGroupId,
+            batchNo: this.rowDetail.batchNo,
+          })
+          this.viewDetail = res.data
+          this.eclass = (res.data.musicGroupPaymentCalenderCourseSettings || []).filter(item => {
+            return !item.isStudentOptional || this.paymentType !== undefined
+          })
+          console.log(res.data.auditDto)
+          this.$set(this.form, 'musicGroupOrganizationCourseSettingId', res.data.auditDto?.musicGroupOrganizationCourseSettingsId)
+          this.syncAllMoney()
+        } catch (error) {}
       }
       }
     },
     },
     formatCourse() {
     formatCourse() {
@@ -346,7 +348,6 @@ export default {
           } else {
           } else {
             const floorMoney = Math.floor((item.courseCurrentPrice * 100) / this.cycles.length)
             const floorMoney = Math.floor((item.courseCurrentPrice * 100) / this.cycles.length)
             const remainder = (item.courseCurrentPrice * 100) % this.cycles.length
             const remainder = (item.courseCurrentPrice * 100) % this.cycles.length
-            console.log(remainder, item.courseCurrentPrice, this.cycles.length)
             first += floorMoney + remainder
             first += floorMoney + remainder
             other += floorMoney
             other += floorMoney
           }
           }
@@ -425,13 +426,17 @@ export default {
     },
     },
     addCycle () {
     addCycle () {
       this.cycles.push({});
       this.cycles.push({});
-      this.collapse.push(this.collapse.length);
+      this.collapse.push(this.cycles.length - 1);
       this.syncAllMoney()
       this.syncAllMoney()
     },
     },
     removeCycle (index) {
     removeCycle (index) {
       this.cycles[index] = null;
       this.cycles[index] = null;
       this.cycles = this.cycles.filter((item) => !!item);
       this.cycles = this.cycles.filter((item) => !!item);
-      this.collapse.pop();
+      if (this.collapse.includes(index)) {
+        this.collapse.splice(index, 1);
+        this.collapse = this.collapse.map((item, _index) => _index - 1 >= index ? item -- : item)
+        console.log(this.collapse)
+      }
       this.syncAllMoney()
       this.syncAllMoney()
     },
     },
     collapseChange (val) {
     collapseChange (val) {