ソースを参照

Merge branch '03/03GRADE' into test

mo 3 年 前
コミット
26705ebdf7

+ 16 - 10
src/views/categroyManager/modals/baseInfo.vue

@@ -221,7 +221,6 @@ export default {
   name: "vipNewActive",
   data() {
     return {
-      balanceDis: false,
       vipResetTypeList,
       pageType: "",
       labelPosition: "right",
@@ -255,16 +254,24 @@ export default {
         ],
         studentMaxUsedTimes: [
           { required: false, message: "请输入购买次数", trigger: "blur" },
-          { pattern: /^[1-9]d*$/, message: '请输入大于0的正整数'  }
+          { pattern: /^[1-9]d*$/, message: "请输入大于0的正整数" },
+        ],
+        organ: [
+          { required: true, message: "请选择适用分部", trigger: "change" },
         ],
-        organ: [{ required: true, message: "请选择适用分部", trigger: "change" }],
         stauts: [
           { required: true, message: "请选择活动形式", trigger: "change" },
         ],
         applyToStudentType: [
           { required: false, message: "请选择是否新生专享" },
         ],
-        isPayToBalance: [{ required: true, message: "请选择是否支付到余额", trigger: "change" }],
+        isPayToBalance: [
+          {
+            required: true,
+            message: "请选择是否支付到余额",
+            trigger: "change",
+          },
+        ],
         allowOnlineToOffline: [
           { required: true, message: "请选择课程调整方式", trigger: "change" },
         ],
@@ -583,14 +590,13 @@ export default {
       // this.$refs.vipform.resetFields();
     },
   },
-  watch: {
-    "baseForm.activityType"(val) {
-      if (val) {
-        // 会员活动
+  computed: {
+    balanceDis() {
+      if (this.baseForm.activityType) {
         this.baseForm.isPayToBalance = 0;
-        this.balanceDis = true;
+        return true;
       } else {
-        this.balanceDis = false;
+        return false;
       }
     },
   },

+ 14 - 11
src/views/categroyManager/vipNewActive.vue

@@ -281,12 +281,17 @@ export default {
       this.$set(this.payForm, "minCourseNum", null);
     },
     async submit() {
-      this.$refs.salaryInfo.$refs.salaryForm.validate((flag) => {
-        if (flag) {
-          this.baseForm.status = "PROGRESS";
-          this.submitDataFormat("PROGRESS");
-        }
-      });
+      if (this.$refs?.salaryInfo?.$refs?.salaryForm) {
+        this.$refs.salaryInfo.$refs.salaryForm.validate((flag) => {
+          if (flag) {
+            this.baseForm.status = "PROGRESS";
+            this.submitDataFormat("PROGRESS");
+          }
+        });
+      } else {
+        this.baseForm.status = "PROGRESS";
+        this.submitDataFormat("PROGRESS");
+      }
     },
     save() {
       this.baseForm.status = "DRAFT";
@@ -364,15 +369,14 @@ export default {
             if (status == "DRAFT") {
               this.$message.success("恭喜你,保存草稿成功");
               this.baseForm.id = res.data.id;
-              this.$nextTick(()=>{
-                 this.formatDetail(res.data);
-              })
+              this.$nextTick(() => {
+                this.formatDetail(res.data);
+              });
               this.$router.push({
                 query: merge(this.$route.query, {
                   id: res.data.id,
                 }),
               });
-
             } else {
               this.$message.success("活动创建成功");
               this.$store.dispatch("delVisitedViews", this.$route);
@@ -406,7 +410,6 @@ export default {
         ? data.applyToStudentType.split(",")
         : [];
       // 格式化 baseForm
-      console.log(data.studentMaxUsedTimes);
       this.$set(this, "baseForm", {
         name: data.name,
         description: data.description,