Browse Source

进行中加学员修改

1
mo 3 years ago
parent
commit
22d3ddac48

+ 1 - 1
src/views/resetTeaming/api.js

@@ -140,4 +140,4 @@ export const cloudPayCheck = (data) => request2({
   method: 'get',
   hideLoading: true,
   params: data
-})
+})

+ 216 - 22
src/views/resetTeaming/modals/member-setting.vue

@@ -23,7 +23,7 @@
         style="width: 620px !important"
         clearable
         filterable
-        @change="memberRankSettingIdChange"
+        @change="changeMember"
         v-model.trim="form.memberRankSettingId"
       >
         <el-option
@@ -34,29 +34,56 @@
         ></el-option>
       </el-select>
     </el-form-item>
+
     <el-form-item
-      label="会员有效期"
-      prop="memberValidDate"
-      v-if="isUserType && radio"
+       v-if="isUserType && radio"
+      label="会员周期"
+      prop="num"
       :rules="[
-        { required: true, message: '请选择会员有效期', trigger: 'blur' },
+        {
+          required: true,
+          message: '请选择会员周期',
+          trigger: 'blur',
+        },
       ]"
     >
-      <el-input
-        :disabled="true"
-        style="width: 596px"
-        v-model="form.memberValidDate"
+      <el-input-number
+        style="width: 223px"
+        class="number-input"
+        v-model="form.num"
+        :controls="false"
+        :precision="0"
+        :min="0"
+        @change="changeMemberperiodEnum(form.period)"
+        placeholder="会员周期"
+        :disabled="!form.memberRankSettingId"
+      />
+    </el-form-item>
+    <el-form-item
+       v-if="isUserType && radio"
+      label="周期单位"
+      prop="period"
+      :rules="[
+        {
+          required: true,
+          message: '请选择周期单位',
+          trigger: 'blur',
+        },
+      ]"
+    >
+      <el-select
+        style="width: 223px !important"
+        v-model="form.period"
+        @change="changeMemberperiodEnum"
+        :disabled="!form.memberRankSettingId"
       >
-        <template slot="append">个月</template>
-      </el-input>
-      <el-tooltip placement="top" popper-class="mTooltip">
-        <div slot="content">自开课之日起6个月有效。</div>
-        <i
-          class="el-icon-question micon el-tooltip"
-          style="font-size: 18px; color: #f56c6c"
-          v-permission="'export/teacherSalary'"
-        ></i>
-      </el-tooltip>
+        <el-option
+          :label="item.label"
+          :value="item.value"
+          v-for="item in memberEnumList"
+          :key="item.value"
+        ></el-option>
+      </el-select>
     </el-form-item>
     <el-form-item
       label="团购价"
@@ -69,6 +96,7 @@
           message: '请输入正确的金额',
         },
         { required: true, message: '请输入现价', trigger: 'blur' },
+        { validator: validateMember, trigger: 'blur' },
       ]"
     >
       <el-input style="width: 223px" v-model="form.memberPaymentAmount">
@@ -111,6 +139,8 @@
 <script>
 import { objectToOptions } from "@/utils";
 import { getAllmemberRank, getMemberFee } from "../api";
+import { memberEnumList } from "@/utils/searchArray";
+import { sysConfigList } from "@/api/generalSettings";
 export default {
   props: [
     "form",
@@ -122,7 +152,6 @@ export default {
   ],
   data() {
     return {
-
       pickerOptions: {
         firstDayOfWeek: 1,
         disabledDate(time) {
@@ -130,8 +159,21 @@ export default {
         },
       },
       dataTime: ["2021-05-14", "2021-05-19"],
+      memberEnumList,
       memberRankList: [],
       radio: true,
+      memberPrice: {},
+      getMemberFeeFlag: true,
+      rulesForm: {
+        minMonthFee: null,
+        maxMonthFee: null,
+        minQuarterlyFee: null,
+        maxQuarterlyFee: null,
+        minHalfYearFee: null,
+        maxHalfYearFee: null,
+        minYearFee: null,
+        maxYearFee: null,
+      },
     };
   },
   async mounted() {
@@ -142,7 +184,8 @@ export default {
     } catch (e) {
       console.log(e);
     }
-    this.$set(this.form, "memberValidDate", 6);
+    this.getMemberRules()
+    // this.$set(this.form, "memberValidDate", 6);
   },
   beforeDestroy() {
     this.$set(this.form, "memo", null);
@@ -153,6 +196,113 @@ export default {
     this.$set(this.form, "paymentDate", []);
   },
   methods: {
+    async getMemberRules() {
+      try {
+        const res = await sysConfigList({ group: "DEFAULT" });
+        const paramName = "cloud_price_range";
+        res.data.forEach((item) => {
+          if (item.paramName == paramName) {
+            const itemValue = item.paranValue
+              ? JSON.parse(item.paranValue)
+              : null;
+            if (itemValue) {
+              this.rulesForm = itemValue;
+            }
+          }
+        });
+      } catch (e) {
+        console.log(e);
+      }
+    },
+    changeMemberperiodEnum(val) {
+      console.log(val, this.memberPrice);
+      if (val == "DAY") {
+        this.$set(
+          this.form,
+          "memberPaymentAmount",
+          this.memberPrice.groupPurchaseDayFee * this.form.num
+        );
+        this.$set(
+          this.form,
+          "originalMemberPaymentAmount",
+          this.memberPrice.originalDayFee * this.form.num
+        );
+      }
+      if (val == "MONTH") {
+        this.$set(
+          this.form,
+          "memberPaymentAmount",
+          this.memberPrice.groupPurchaseMonthFee * this.form.num
+        );
+        this.$set(
+          this.form,
+          "originalMemberPaymentAmount",
+          this.memberPrice.originalMonthFee * this.form.num
+        );
+      }
+      if (val == "QUARTERLY") {
+        this.$set(
+          this.form,
+          "memberPaymentAmount",
+          this.memberPrice.groupPurchaseQuarterlyFee * this.form.num
+        );
+        this.$set(
+          this.form,
+          "originalMemberPaymentAmount",
+          this.memberPrice.originalQuarterlyFee * this.form.num
+        );
+      }
+      if (val == "YEAR_HALF") {
+        this.$set(
+          this.form,
+          "memberPaymentAmount",
+          this.memberPrice.groupPurchaseHalfYearFee * this.form.num
+        );
+        this.$set(
+          this.form,
+          "originalMemberPaymentAmount",
+          this.memberPrice.originalHalfYearFee * this.form.num
+        );
+      }
+      if (val == "YEAR") {
+        this.$set(
+          this.form,
+          "memberPaymentAmount",
+          this.memberPrice.groupPurchaseYearFee * this.form.num
+        );
+        this.$set(
+          this.form,
+          "originalMemberPaymentAmount",
+          this.memberPrice.originalYearFee * this.form.num
+        );
+      }
+    },
+    async changeMember(val) {
+      this.$set(this.form, "memberPaymentAmount", null);
+      this.$set(this.form, "originalMemberPaymentAmount", null);
+      this.$set(this.form, "num", null);
+      this.$set(this.form, "period", null);
+      if (val) {
+        if (this.getMemberFeeFlag) {
+          this.getMemberFeeFlag = false;
+          try {
+            const res = await getMemberFee({
+              rankId: val,
+              organId: this.organId,
+            });
+            this.memberPrice = res.data;
+            this.getMemberFeeFlag = true;
+            if (!res.data) {
+              this.$bus.$emit("showguide", ["memberList"]);
+              return;
+            }
+          } catch (e) {
+            console.log(e);
+            this.getMemberFeeFlag = true;
+          }
+        }
+      }
+    },
     async memberRankSettingIdChange(val) {
       if (val) {
         try {
@@ -186,6 +336,40 @@ export default {
         }
       }
     },
+    validateMember(rule, value, callback) {
+      const one = Number(value);
+      let min = 0;
+      let max = 0;
+      console.log(this.rulesForm)
+      switch (this.form.period) {
+        case "MONTH": {
+          min = Number(this.rulesForm.minMonthFee) * this.form.num;
+          max = Number(this.rulesForm.maxMonthFee) * this.form.num;
+          break;
+        }
+        case "QUARTERLY": {
+          min = Number(this.rulesForm.minQuarterlyFee) * this.form.num;
+          max = Number(this.rulesForm.maxQuarterlyFee) * this.form.num;
+          console.log(this.form.period, min, max, this.rulesForm);
+          break;
+        }
+        case "YEAR_HALF": {
+          min = Number(this.rulesForm.minHalfYearFee) * this.form.num;
+          max = Number(this.rulesForm.maxHalfYearFee) * this.form.num;
+          break;
+        }
+        case "YEAR": {
+          min = Number(this.rulesForm.minYearFee) * this.form.num;
+          max = Number(this.rulesForm.maxYearFee) * this.form.num;
+          break;
+        }
+      }
+
+      if (one >= min && one <= max) {
+        return callback();
+      }
+      return callback(new Error(`定价应在${min}-${max}之间`));
+    },
   },
   watch: {
     radio(val) {
@@ -194,6 +378,8 @@ export default {
         this.$set(this.form, "memberValidDate", null);
         this.$set(this.form, "memberPaymentAmount", null);
         this.$set(this.form, "originalMemberPaymentAmount", null);
+        this.$set(this.form, "num", null);
+        this.$set(this.form, "period", null);
         this.$set(this.form, "paymentDate", []);
       } else {
         this.$set(this.form, "memberValidDate", 6);
@@ -202,13 +388,21 @@ export default {
     viewDetail: {
       deep: true,
       handler(val) {
-        if (val.musicGroupPaymentCalenders[0]?.memberRankSettingId) {
+        if (val.member?.memberRankSettingId) {
           this.radio = true;
         } else {
           this.radio = false;
         }
       },
     },
+    "form.memberRankSettingId"(val) {
+      if (!val) {
+        this.$set(this.form, "memberPaymentAmount", null);
+        this.$set(this.form, "originalMemberPaymentAmount", null);
+        this.$set(this.form, "num", null);
+        this.$set(this.form, "period", null);
+      }
+    },
   },
 };
 </script>

+ 1 - 4
src/views/resetTeaming/modals/payMember.vue

@@ -82,9 +82,6 @@
               },
             ]"
           >
-            <!--    @change="
-                            $listeners.priceChange(scope.row, scope.$index)
-                          " -->
             <el-input-number
               style="width: 90% !important"
               class="number-input"
@@ -95,7 +92,7 @@
               @change="
                 changeMemberperiodEnum(form.memberList[scope.$index].period)
               "
-              placeholder="会员数量"
+              placeholder="会员周期"
               :disabled="!form.memberList[scope.$index].memberRankSettingId"
             />
           </el-form-item>

+ 315 - 226
src/views/resetTeaming/modals/user-pay-form.vue

@@ -101,12 +101,22 @@
         class="alert"
         style="margin-top: 20px"
         type="info"
-        v-if="courseViewType == 2 && paymentType && paymentType != 2&&form.leixing !=2"
+        v-if="
+          courseViewType == 2 &&
+          paymentType &&
+          paymentType != 2 &&
+          form.leixing != 2
+        "
       >
       </el-alert>
       <memberSetting
         ref="memberSetting"
-        v-if="courseViewType == 2 && paymentType && paymentType != 2&&form.leixing !=2"
+        v-if="
+          courseViewType == 2 &&
+          paymentType &&
+          paymentType != 2 &&
+          form.leixing != 2
+        "
         :form="memberForm"
         :viewDetail="nowDetail"
         :isUserType="isUserType"
@@ -114,7 +124,9 @@
         :addStudent="showMember"
         :showTime="paymentType == 1"
       />
-      <div v-if="!(courseViewType == 2 && paymentType == 1&&form.leixing !=2)">
+      <div
+        v-if="!(courseViewType == 2 && paymentType == 1 && form.leixing != 2)"
+      >
         <el-alert title="缴费设置" :closable="false" class="alert" type="info">
         </el-alert>
         <!-- 缴费设置的  不是会员团切不是续费 续费{{form.leixing}} -->
@@ -192,7 +204,6 @@
             icon="el-icon-circle-plus-outline"
             plain
             type="info"
-
             style="width: 100%; margin: 20px 0"
             @click="addCycle"
             >新增缴费周期</el-button
@@ -205,7 +216,10 @@
           :hidePaymentPattern="true"
           :isUserType="isUserType"
           :isDisabled="
-            form.leixing === '1' || form.leixing === '2' || paymentType === '0' || form.leixing === '3'
+            form.leixing === '1' ||
+            form.leixing === '2' ||
+            paymentType === '0' ||
+            form.leixing === '3'
           "
           :courseViewType="courseViewType"
           v-else
@@ -245,7 +259,8 @@ import {
   musicGroupPaymentCalenderDetailBatchUpdate,
   queryByMusicGroupOrganizationCourseSettingsId,
   musicGroupPaymentCalenderView,
-  musicGroupPaymentAuditListDetail
+  musicGroupPaymentAuditListDetail,
+  musicGroupresetCalender
 } from "../api";
 import { paymentPatternType } from "@/constant";
 import { getTimes, objectToOptions } from "@/utils";
@@ -320,6 +335,8 @@ export default {
         memberPaymentAmount: "",
         originalMemberPaymentAmount: "",
         paymentDate: [],
+        num: "",
+        period: "",
       },
       money: "",
       isSetCourseSettingsId: false,
@@ -336,7 +353,11 @@ export default {
       return this.viewDetail;
     },
     isCommon() {
-      return this.form.leixing === "1" || this.form.leixing === "3" || (this.courseViewType !=2&&this.form.leixing === "0");
+      return (
+        this.form.leixing === "1" ||
+        this.form.leixing === "3" ||
+        (this.courseViewType != 2 && this.form.leixing === "0")
+      );
     },
     isDisabled() {
       return this.form.leixing === "1" || String(this.paymentType) === "0";
@@ -361,36 +382,37 @@ export default {
       );
     },
     isMulticycle() {
-      let editMulticycle = false;
-      let paymentType = "";
-      if (this.viewDetail) {
-        const { musicGroupPaymentCalenders, auditDto } = this.viewDetail;
-        paymentType = musicGroupPaymentCalenders[0]?.paymentType;
-        editMulticycle =
-          musicGroupPaymentCalenders.length > 1 || paymentType != "ADD_COURSE";
-        if (editMulticycle) {
-          this.cycles = musicGroupPaymentCalenders.map((item) => ({
-            paymentAmount: item.paymentAmount,
-            paymentDate: [item?.startPaymentDate, item?.deadlinePaymentDate],
-            paymentValid: [
-              item?.paymentValidStartDate,
-              item?.paymentValidEndDate,
-            ],
-          }));
-        }
-      }
-      return (
-        (this.payment.paymentPattern == 0 &&
-          this.form.leixing !== "2" &&
-          paymentType !== "ADD_COURSE") ||
-        (this.payment.paymentPattern == 0 && editMulticycle)
-      );
+      // let editMulticycle = false;
+      // let paymentType = "";
+      // if (this.viewDetail) {
+      //   const { musicGroupPaymentCalenders, auditDto } = this.viewDetail;
+      //   paymentType = musicGroupPaymentCalenders[0]?.paymentType;
+      //   editMulticycle =
+      //     musicGroupPaymentCalenders.length > 1 || paymentType != "ADD_COURSE";
+      //   if (editMulticycle) {
+      //     this.cycles = musicGroupPaymentCalenders.map((item) => ({
+      //       paymentAmount: item.paymentAmount,
+      //       paymentDate: [item?.startPaymentDate, item?.deadlinePaymentDate],
+      //       paymentValid: [
+      //         item?.paymentValidStartDate,
+      //         item?.paymentValidEndDate,
+      //       ],
+      //     }));
+      //   }
+      // }
+      //  (
+      //   (this.payment.paymentPattern == 0 &&
+      //     this.form.leixing !== "2" &&
+      //     paymentType !== "ADD_COURSE") ||
+      //   (this.payment.paymentPattern == 0 && editMulticycle)
+      // );
+      return false;
     },
     paymentTypeString() {
       let paymentType = "";
       if (this.viewDetail) {
         const { musicGroupPaymentCalenders } = this.viewDetail;
-        paymentType = musicGroupPaymentCalenders[0]?.paymentType;
+        paymentType = this.viewDetail?.calender?.paymentType;
       }
       return paymentType;
     },
@@ -416,7 +438,7 @@ export default {
       this.cycle = {};
       this.$set(this.form, "musicGroupOrganizationCourseSettingId", undefined);
       this.$set(this.cycle, "paymentAmount", undefined);
-         this.$set(this.other, "memo", null);
+      this.$set(this.other, "memo", null);
       if (val === "1") {
         this.eclass = [];
       } else if (val === "2") {
@@ -475,8 +497,8 @@ export default {
           if (paymentTypeFormat.hasOwnProperty(key)) {
             const item = paymentTypeFormat[key];
             if (item === this.rowDetail.paymentType) {
-              this.$emit('changePaymentType',key)
-              this.$set(this.form, "leixing", key+'');
+              this.$emit("changePaymentType", key);
+              this.$set(this.form, "leixing", key + "");
               // this.paymentType = key;
             }
           }
@@ -487,94 +509,125 @@ export default {
           "isGiveMusicNetwork",
           this.rowDetail.isGiveMusicNetwork
         );
-        this.$set(this.other, "memo", this.rowDetail.memo);
-        try {
-          const res = await musicGroupPaymentAuditListDetail({
-            musicGroupId: this.musicGroupId,
-            batchNo: this.rowDetail.batchNo,
-          });
-          this.viewDetail = res.data;
-          const firstPayment = res.data.musicGroupPaymentCalenders[0] || {};
-          this.eclass = (
-            res.data.musicGroupPaymentCalenderCourseSettings || []
-          ).filter((item) => {
-            return !item.isStudentOptional || this.paymentType !== undefined;
-          });
-          this.eclassuser =
-            res.data.musicGroupPaymentCalenderStudentDetails.map((item) => {
-              if (this.paymentTypeString === "SPAN_GROUP_CLASS_ADJUST") {
-                return {
-                  ...item,
-                  courseOriginalPrice: item.masterSubCoursePrice,
-                };
-              }
-              return item;
-            });
-          this.$set(
-            this.payment,
-            "paymentPattern",
-            String(this.viewDetail.auditDto?.paymentPattern)
-          );
-          // 添加会员缴费信息
-          this.$set(
-            this.memberForm,
-            "memberRankSettingId",
-            this.viewDetail.musicGroupPaymentCalenders[0].memberRankSettingId ||
-              null
-          );
 
-          this.$set(
-            this.memberForm,
-            "memberValidDate",
-            this.viewDetail.musicGroupPaymentCalenders[0].memberValidDate ||
-              null
-          );
-          this.$set(
-            this.memberForm,
-            "memberPaymentAmount",
-            this.viewDetail.musicGroupPaymentCalenders[0].memberPaymentAmount
-          );
-          this.$set(
-            this.memberForm,
-            "originalMemberPaymentAmount",
-            this.viewDetail.musicGroupPaymentCalenders[0]
-              .originalMemberPaymentAmount
-          );
-
-          if (this.$refs.cycle) {
+        if (this.rowDetail.paymentType == "ADD_STUDENT") {
+          try {
+            const res = await getMusicGroupPaymentCalenderDetail({
+              id: this.rowDetail.id,
+            });
+            this.viewDetail = res.data;
+            this.eclass = res.data.course || [];
             this.$set(
-              this.cycle,
-              "paymentPattern",
-              firstPayment.paymentPattern + ""
+              this.memberForm,
+              "memberRankSettingId",
+              this.viewDetail.member.memberRankSettingId || null
             );
-            let arr = [
-              firstPayment.paymentValidStartDate,
-              firstPayment.paymentValidEndDate,
-            ];
-            // paymentDate startPaymentDate deadlinePaymentDate
+            this.$set(
+              this.memberForm,
+              "num",
+              this.viewDetail.member.num || null
+            );
+            this.$set(
+              this.memberForm,
+              "period",
+              this.viewDetail.member.period || null
+            );
+            this.$set(
+              this.memberForm,
+              "memberPaymentAmount",
+              this.viewDetail.member.actualAmount || null
+            );
+            this.$set(
+              this.memberForm,
+              "originalMemberPaymentAmount",
+              this.viewDetail.member.originalAmount || null
+            );
+            console.log(
+              this.viewDetail.member.originalAmount,
+              this.viewDetail.member.actualAmount
+            );
+            this.$set(this.memberForm, "memberValidDate", [
+              this.viewDetail.calender.startPaymentDate,
+              this.viewDetail.calender.deadlinePaymentDate,
+            ]);
             this.$set(this.cycle, "paymentDate", [
-              firstPayment.startPaymentDate,
-              firstPayment.deadlinePaymentDate,
+              this.viewDetail.calender.startPaymentDate,
+              this.viewDetail.calender.deadlinePaymentDate,
             ]);
-            this.$set(this.cycle, "paymentValid", arr);
-          }
-          this.studentIds = firstPayment.studentIds;
-          if (res.data.auditDto?.musicGroupOrganizationCourseSettingsId) {
-            this.isSetCourseSettingsId = true;
-          }
-          this.$set(
-            this.form,
-            "musicGroupOrganizationCourseSettingId",
-            res.data.auditDto?.musicGroupOrganizationCourseSettingsId
-          );
-          if (this.courseViewType == 2 && this.form.leixing == 1) {
-            // 会员团续费
 
-            this.$set(this.memberForm, "paymentDate", [dayjs(firstPayment.startPaymentDate).format("YYYY-MM-DD"),dayjs(firstPayment.deadlinePaymentDate).format("YYYY-MM-DD")
-            ]);
+                  this.$set(this.other, "memo", this.viewDetail.calender.memo);
+            this.syncAllMoney();
+          } catch (e) {
+            console.log(e);
           }
-          this.syncAllMoney();
-        } catch (error) {}
+        } else {
+          try {
+            const res = await musicGroupPaymentAuditListDetail({
+              musicGroupId: this.musicGroupId,
+              batchNo: this.rowDetail.batchNo,
+            });
+            this.viewDetail = res.data;
+            const firstPayment = res.data.musicGroupPaymentCalenders[0] || {};
+            this.eclass = (
+              res.data.musicGroupPaymentCalenderCourseSettings || []
+            ).filter((item) => {
+              return !item.isStudentOptional || this.paymentType !== undefined;
+            });
+            this.eclassuser =
+              res.data.musicGroupPaymentCalenderStudentDetails.map((item) => {
+                if (this.paymentTypeString === "SPAN_GROUP_CLASS_ADJUST") {
+                  return {
+                    ...item,
+                    courseOriginalPrice: item.masterSubCoursePrice,
+                  };
+                }
+                return item;
+              });
+            this.$set(
+              this.payment,
+              "paymentPattern",
+              String(this.viewDetail.auditDto?.paymentPattern)
+            );
+
+            // 添加会员缴费信息
+
+            if (this.$refs.cycle) {
+              this.$set(
+                this.cycle,
+                "paymentPattern",
+                firstPayment.paymentPattern + ""
+              );
+              let arr = [
+                firstPayment.paymentValidStartDate,
+                firstPayment.paymentValidEndDate,
+              ];
+              // paymentDate startPaymentDate deadlinePaymentDate
+              this.$set(this.cycle, "paymentDate", [
+                firstPayment.startPaymentDate,
+                firstPayment.deadlinePaymentDate,
+              ]);
+              this.$set(this.cycle, "paymentValid", arr);
+            }
+            this.studentIds = firstPayment.studentIds;
+            if (res.data.auditDto?.musicGroupOrganizationCourseSettingsId) {
+              this.isSetCourseSettingsId = true;
+            }
+            this.$set(
+              this.form,
+              "musicGroupOrganizationCourseSettingId",
+              res.data.auditDto?.musicGroupOrganizationCourseSettingsId
+            );
+            if (this.courseViewType == 2 && this.form.leixing == 1) {
+              // 会员团续费
+
+              this.$set(this.memberForm, "paymentDate", [
+                dayjs(firstPayment.startPaymentDate).format("YYYY-MM-DD"),
+                dayjs(firstPayment.deadlinePaymentDate).format("YYYY-MM-DD"),
+              ]);
+            }
+            this.syncAllMoney();
+          } catch (error) {}
+        }
       }
     },
     formatCourse() {
@@ -679,10 +732,10 @@ export default {
         }
         this.charges = res.data.rows;
         // this.charges =[];
-           if(this.charges.length<=0){
-          this.$bus.$emit("showguide", ['teamCourseFee']);
-          return
-      }
+        if (this.charges.length <= 0) {
+          this.$bus.$emit("showguide", ["teamCourseFee"]);
+          return;
+        }
       } catch (error) {}
     },
     addExtraClass() {
@@ -754,16 +807,80 @@ export default {
       }
 
       if (valided.length === forms.length) {
-        // 验证通过
-        const { leixing, ...rest } = {
-          ...this.form,
-          ...this.other,
+        if (this.rowDetail.paymentType == "ADD_STUDENT") {
+          const data = {
+            calenderId:this.viewDetail.calender.id,
+            calenderMember: {
+              ...this.memberForm,
+              actualAmount: this.memberForm.memberPaymentAmount,
+              originalAmount: this.memberForm.originalMemberPaymentAmount,
+            },
+            calenderAddStudent: {
+              classGroupIds: this.viewDetail.calender.attribute1,
+              studentIds: this.viewDetail.calender.studentIds,
+            },
+            ...getTimes(this.cycle.paymentDate, [
+              "startPaymentDate",
+              "deadlinePaymentDate",
+            ]),
+            // paymentPattern: this.payment.paymentPattern,
+            musicGroupId: this.musicGroupId,
+            paymentType: "ADD_STUDENT",
+            payUserType: "STUDENT",
 
-          // paymentPattern: this.payment.paymentPattern,
-          musicGroupPaymentDateRangeList: [
-            ...this.cycles.map((item) => {
-              const { paymentDate, paymentValid, ...other } = item;
-              return {
+            musicGroupPaymentCalenderCourseSettingsList: this.eclass,
+            ...this.other,
+          };
+          try {
+            await musicGroupresetCalender(data);
+            this.$message.success("提交成功");
+            this.$listeners.submited();
+            this.$listeners.close();
+          } catch (error) {
+            console.log(error);
+          }
+        } else {
+          // 验证通过
+          const { leixing, ...rest } = {
+            ...this.form,
+            ...this.other,
+
+            // paymentPattern: this.payment.paymentPattern,
+            musicGroupPaymentDateRangeList: [
+              ...this.cycles.map((item) => {
+                const { paymentDate, paymentValid, ...other } = item;
+                return {
+                  ...other,
+                  ...getTimes(paymentDate, [
+                    "startPaymentDate",
+                    "deadlinePaymentDate",
+                  ]),
+                  ...getTimes(paymentValid, [
+                    "paymentValidStartDate",
+                    "paymentValidEndDate",
+                  ]),
+                };
+              }),
+            ],
+
+            musicGroupPaymentCalenderCourseSettingsList: this.eclass,
+            musicGroupPaymentCalenderStudentDetails: this.eclassuser,
+          };
+          // 如果是会员团续费 则添加缴费开始时间 缴费结束时间
+          const { paymentDate, ...some } = this.memberForm;
+          if (this.courseViewType == 2 && this.form.leixing == 1) {
+            rest.musicGroupPaymentDateRangeList[0] = {
+              ...getTimes(paymentDate, [
+                "startPaymentDate",
+                "deadlinePaymentDate",
+              ]),
+            };
+          }
+
+          if (this.$refs.cycle) {
+            const { paymentDate, paymentValid, ...other } = this.cycle;
+            rest.musicGroupPaymentDateRangeList = [
+              {
                 ...other,
                 ...getTimes(paymentDate, [
                   "startPaymentDate",
@@ -773,109 +890,81 @@ export default {
                   "paymentValidStartDate",
                   "paymentValidEndDate",
                 ]),
-              };
-            }),
-          ],
+              },
+            ];
+          }
 
-          musicGroupPaymentCalenderCourseSettingsList: this.eclass,
-          musicGroupPaymentCalenderStudentDetails: this.eclassuser,
-        };
-        // 如果是会员团续费 则添加缴费开始时间 缴费结束时间
-        const { paymentDate, ...some } = this.memberForm;
-        if (this.courseViewType == 2 && this.form.leixing == 1) {
-          rest.musicGroupPaymentDateRangeList[0] = {
-            ...getTimes(paymentDate, [
-              "startPaymentDate",
-              "deadlinePaymentDate",
-            ]),
+          const data = {
+            ...rest,
+            ...some,
+            isGiveMusicNetwork: false,
+            studentIds: this.studentIds,
+            paymentType:
+              paymentTypeFormat[
+                this.paymentType == 0 ? this.paymentType : leixing
+              ],
+            musicGroupId: this.musicGroupId,
           };
-        }
-
-        if (this.$refs.cycle) {
-          const { paymentDate, paymentValid, ...other } = this.cycle;
-          rest.musicGroupPaymentDateRangeList = [
-            {
-              ...other,
-              ...getTimes(paymentDate, [
-                "startPaymentDate",
-                "deadlinePaymentDate",
-              ]),
-              ...getTimes(paymentValid, [
-                "paymentValidStartDate",
-                "paymentValidEndDate",
-              ]),
-            },
-          ];
-        }
-
-        const data = {
-          ...rest,
-          ...some,
-          isGiveMusicNetwork: false,
-          studentIds: this.studentIds,
-          paymentType:
-            paymentTypeFormat[
-              this.paymentType == 0 ? this.paymentType : leixing
-            ],
-          musicGroupId: this.musicGroupId,
-        };
-        const info = this.viewDetail?.musicGroupPaymentCalenders[0];
-        if (info && this.viewDetail?.auditDto.paymentType === "ADD_STUDENT") {
-          data.attribute1 = info.attribute1;
-        }
-        // courseViewType == 1&&paymentType !== undefined
-        let hasCourseFee = false;
-
-        for (const item of data.musicGroupPaymentCalenderCourseSettingsList) {
-          if (item.courseCurrentPrice > 0 || item.isStudentOptional == true) {
-            hasCourseFee = true;
-            break;
+          const info = this.viewDetail?.musicGroupPaymentCalenders[0];
+          if (info && this.viewDetail?.auditDto.paymentType === "ADD_STUDENT") {
+            data.attribute1 = info.attribute1;
           }
-        }
-        // console.log(this.baseInfo?.musicGroup?.courseViewType, this.paymentType, hasCourseFee, this.type)
-        if (
-          (this.baseInfo?.musicGroup?.courseViewType == 2 ||
-            this.baseInfo?.musicGroup?.courseViewType == 3) &&
-          this.paymentType == 0 &&
-          hasCourseFee &&
-          this.type === "user"
-        ) {
-          this.$message.error(
-            "会员收费模式报名缴费项目课程费用不得大于0且不可选"
-          );
-          return;
-        }
-        if (!this.rowDetail?.batchNo) {
-          try {
-            const res = await musicGroupPaymentCalenderAdd(data);
-            if (this.$route.query.team_status == "PRE_BUILD_FEE") {
-              this.$message.success("创建成功");
-              this.$store.dispatch("delVisitedViews", this.$route);
-              this.$router.push({
-                path: "/teamList",
-              });
+          // courseViewType == 1&&paymentType !== undefined
+          let hasCourseFee = false;
+
+          for (const item of data.musicGroupPaymentCalenderCourseSettingsList) {
+            if (item.courseCurrentPrice > 0 || item.isStudentOptional == true) {
+              hasCourseFee = true;
+              break;
             }
+          }
+          // console.log(this.baseInfo?.musicGroup?.courseViewType, this.paymentType, hasCourseFee, this.type)
+          if (
+            (this.baseInfo?.musicGroup?.courseViewType == 2 ||
+              this.baseInfo?.musicGroup?.courseViewType == 3) &&
+            this.paymentType == 0 &&
+            hasCourseFee &&
+            this.type === "user"
+          ) {
+            this.$message.error(
+              "会员收费模式报名缴费项目课程费用不得大于0且不可选"
+            );
+            return;
+          }
+          if (!this.rowDetail?.batchNo) {
+            try {
+              const res = await musicGroupPaymentCalenderAdd(data);
+              if (this.$route.query.team_status == "PRE_BUILD_FEE") {
+                this.$message.success("创建成功");
+                this.$store.dispatch("delVisitedViews", this.$route);
+                this.$router.push({
+                  path: "/teamList",
+                });
+              }
 
-            this.$listeners.close();
-            this.$listeners.submited(res.data);
+              this.$listeners.close();
+              this.$listeners.submited(res.data);
 
-            // 在这里
-          } catch (error) {}
-        } else {
-          try {
-            data.batchNo = this.rowDetail.batchNo;
-            // 缴费类型无法修改,按照之前覆盖
-            data.paymentType =
-              this.viewDetail.musicGroupPaymentCalenders[0]?.paymentType;
-            const res = await musicGroupPaymentCalenderDetailBatchUpdate(data);
-            this.$listeners.close();
-            this.$listeners.submited(res.data);
-            if (this.$route.query.type == "teamDraft") {
-              this.$router.push({
-                query: merge(this.$route.query, { type: "feeAudit" }),
-              });
-            }
-          } catch (error) {}
+              // 在这里
+            } catch (error) {}
+          } else {
+            try {
+              data.batchNo = this.rowDetail.batchNo;
+              // 缴费类型无法修改,按照之前覆盖
+              data.paymentType =
+                this.viewDetail.musicGroupPaymentCalenders[0]?.paymentType;
+              const res = await musicGroupPaymentCalenderDetailBatchUpdate(
+                data
+              );
+              this.$listeners.close();
+              this.$listeners.submited(res.data);
+              if (this.$route.query.type == "teamDraft") {
+                this.$router.push({
+                  query: merge(this.$route.query, { type: "feeAudit" }),
+                });
+              }
+            } catch (error) {}
+          }
         }
       }
     },

+ 16 - 28
src/views/teamDetail/components/modals/create-user-pay.vue

@@ -49,7 +49,7 @@
         <el-col :span="12">
           <el-form-item label="临时班">
             <select-all
-              style="width:230px!important"
+              style="width: 230px !important"
               v-model.trim="form.snapClass"
               filterable
               clearable
@@ -141,7 +141,6 @@
     </el-form>
 
     <paymentCycle
-
       ref="cycle"
       :isUserType="true"
       :hidePaymentPattern="true"
@@ -168,7 +167,7 @@ import numeral from "numeral";
 import paymentCycle from "../../../resetTeaming/modals/payment-cycle";
 import otherform from "../../../resetTeaming/modals/other";
 import extraClass from "../../../resetTeaming/modals/extra-class";
-import { musicGroupPaymentCalenderAdd } from "../../../resetTeaming/api";
+import { musicGroupcreateCalender } from "../../../resetTeaming/api";
 import { queryRemainCourseTypeDuration } from "../../api";
 import { courseType } from "@/constant";
 import { getTimes, objectToOptions } from "@/utils";
@@ -314,7 +313,7 @@ export default {
       if (this.$refs.cycle) {
         this.$set(this.cycle, "paymentAmount", money);
       }
-      money += parseFloat(this.memberForm.memberPaymentAmount||0);
+      money += parseFloat(this.memberForm.memberPaymentAmount || 0);
       this.money = money;
       return money;
     },
@@ -374,7 +373,7 @@ export default {
           });
           this.eclass = [..._];
           this.syncAllMoney();
-          console.log('更换班级')
+          console.log("更换班级");
         }
       } catch (error) {
         console.log(error);
@@ -426,39 +425,28 @@ export default {
         this.$message.error("请至少选择一个班级");
         return;
       }
-
       if (forms.length === valided.length) {
-        const cyclelist =
-          this.payment.paymentPattern == 0 ? this.cycles : [this.cycle];
         const data = {
-          attribute1: this.ids,
-                ...this.memberForm,
-          musicGroupPaymentDateRangeList: cyclelist.map((item) => {
-            const { paymentDate, paymentValid, ...other } = item;
-            return {
-
-              ...other,
-              ...getTimes(paymentDate, [
-                "startPaymentDate",
-                "deadlinePaymentDate",
-              ]),
-              ...getTimes(paymentValid, [
-                "paymentValidStartDate",
-                "paymentValidEndDate",
-              ]),
-              // paymentPattern: this.payment.paymentPattern,
-            };
-          }),
+          calenderMember:{
+             ...this.memberForm,
+             actualAmount:this.memberForm.memberPaymentAmount,
+             originalAmount:this.memberForm.originalMemberPaymentAmount
+          },
+          calenderAddStudent:{
+            classGroupIds: this.ids,
+             studentIds: this.createdUserId,
+          },
+          ...getTimes(this.cycle.paymentDate, ["startPaymentDate", "deadlinePaymentDate"]),
           // paymentPattern: this.payment.paymentPattern,
           musicGroupId: this.musicGroupId,
           paymentType: "ADD_STUDENT",
           payUserType: "STUDENT",
-          studentIds: this.createdUserId,
+
           musicGroupPaymentCalenderCourseSettingsList: this.eclass,
           ...this.other,
         };
         try {
-          await musicGroupPaymentCalenderAdd(data);
+          await musicGroupcreateCalender(data);
           this.$message.success("提交成功");
           this.$listeners.submited();
           this.$listeners.close();