Browse Source

新建vip活动准备限制

1
mo 4 years ago
parent
commit
1f69e8c218
1 changed files with 46 additions and 30 deletions
  1. 46 30
      src/views/buildVip/index.vue

+ 46 - 30
src/views/buildVip/index.vue

@@ -138,13 +138,18 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="活动方案" prop="activeType" v-else :rules=' [
-          {
-            required: true,
-            message: "请选择活动方案",
-            trigger: "change",
-          },
-        ]'>
+          <el-form-item
+            label="活动方案"
+            prop="activeType"
+            v-else
+            :rules="[
+              {
+                required: true,
+                message: '请选择活动方案',
+                trigger: 'change',
+              },
+            ]"
+          >
             <el-select
               v-model.trim="leftForm.activeType"
               filterable
@@ -684,6 +689,8 @@ export default {
       attribute1: "",
       attribute2: "",
       attribute3: "",
+      maxCourseNum: 0,
+      minCourseNum: 0,
       salaryReadonlyFlag: "", // 老师课酬是否可配
       paymentReadonlyFlag: "", // 课程单价是否可配
       lookList: [],
@@ -865,18 +872,22 @@ export default {
       this.courseOption = this.coursesDate();
     },
     onCourseNumChange(type) {
-      let centerForm = this.centerForm
+      let centerForm = this.centerForm;
       // 折扣类型,并且设置的排课数有值
-      if(this.hotType == 'DISCOUNT' && this.attribute3 && this.attribute3 > 0) {
+      if (
+        this.hotType == "DISCOUNT" &&
+        this.attribute3 &&
+        this.attribute3 > 0
+      ) {
         // 判断线上或线下总和等于排课次数
         // console.log((parseInt(centerForm.onlineCourseNum) + parseInt(centerForm.offlineCourseNum)), this.attribute3)
-        let onlineNum = centerForm.onlineCourseNum || 0
-        let offlineNum = centerForm.offlineCourseNum || 0
-        if((parseInt(onlineNum) + parseInt(offlineNum)) > this.attribute3) {
-          if(type == 'online') {
-            this.$message.error('线上课数加线下课数必须等于待排课数')
-          } else if(type == 'offline') {
-            this.$message.error('线上课数加线下课数必须等于待排课数')
+        let onlineNum = centerForm.onlineCourseNum || 0;
+        let offlineNum = centerForm.offlineCourseNum || 0;
+        if (parseInt(onlineNum) + parseInt(offlineNum) > this.attribute3) {
+          if (type == "online") {
+            this.$message.error("线上课数加线下课数必须等于待排课数");
+          } else if (type == "offline") {
+            this.$message.error("线上课数加线下课数必须等于待排课数");
           }
         }
       }
@@ -983,7 +994,7 @@ export default {
     },
     // 选择活动方案
     chioseActive(val) {
-      console.log(val)
+      console.log(val);
       this.rightForm.offlineCourse = "";
       this.rightForm.onlineCourse = "";
       // this.rightForm.onlinePrice = '';
@@ -992,7 +1003,9 @@ export default {
       this.timeTable = [];
       this.attribute1 = "";
       this.attribute2 = "";
-      this.attribute3 = ""
+      this.attribute3 = "";
+      this.maxCourseNum = val.maxCourseNum || 0;
+      this.minCourseNum = val.minCourseNum || 0;
       this.giveNum = 0;
       this.isGiveClass = false;
       this.leftForm.courseStart = "";
@@ -1023,7 +1036,7 @@ export default {
         // 根须活动id获取 相应的值
         for (let i in this.activeList) {
           if (this.activeList[i].id == val) {
-            console.log(this.activeList[i])
+            console.log(this.activeList[i]);
             // 如果是买赠就必须选择赠课类型
             // 报名开始 报名结束 课程开始 课程结束 // 判断是否有线上,线下课 并同步状态
             // this.leftForm.signUpStart = this.activeList[i].startTime;
@@ -1513,7 +1526,7 @@ export default {
                 //   message: '提交成功!'
                 // });
                 this.$message.success("提交成功");
-                this.$store.dispatch('delVisitedViews', this.$route)
+                this.$store.dispatch("delVisitedViews", this.$route);
                 this.$router.push({
                   path: "/vipManager/vipList",
                   query: {
@@ -1524,7 +1537,7 @@ export default {
               });
             } else {
               this.$message.success("恭喜您创建成功");
-              this.$store.dispatch('delVisitedViews', this.$route)
+              this.$store.dispatch("delVisitedViews", this.$route);
               this.$router.push({
                 path: "/vipManager/vipList",
                 query: {
@@ -1634,7 +1647,7 @@ export default {
       }
     },
     onCancel() {
-      this.$store.dispatch('delVisitedViews', this.$route)
+      this.$store.dispatch("delVisitedViews", this.$route);
       this.$router.push({
         path: "/vipManager/vipList",
         query: {
@@ -1655,15 +1668,18 @@ export default {
 
       this.$refs["leftForm"].validate((vali) => {
         if (vali) {
-
-          let centerForm = this.centerForm
-          if(this.hotType == 'DISCOUNT' && this.attribute3 && this.attribute3 > 0) {
+          let centerForm = this.centerForm;
+          if (
+            this.hotType == "DISCOUNT" &&
+            this.attribute3 &&
+            this.attribute3 > 0
+          ) {
             // 判断线上或线下总和大于排课次数
-            let onlineNum = centerForm.onlineCourseNum || 0
-            let offlineNum = centerForm.offlineCourseNum || 0
-            if((parseInt(onlineNum) + parseInt(offlineNum)) != this.attribute3) {
-              this.$message.error('线上课数加线下课数必须等于待排课数')
-              return
+            let onlineNum = centerForm.onlineCourseNum || 0;
+            let offlineNum = centerForm.offlineCourseNum || 0;
+            if (parseInt(onlineNum) + parseInt(offlineNum) != this.attribute3) {
+              this.$message.error("线上课数加线下课数必须等于待排课数");
+              return;
             }
           }
           this.dialogFormVisible = true;