hwb0 пре 3 година
родитељ
комит
f14a4d31d6
1 измењених фајлова са 19 додато и 11 уклоњено
  1. 19 11
      src/views/business/ticket/create.vue

+ 19 - 11
src/views/business/ticket/create.vue

@@ -173,7 +173,7 @@
       </div>
       <!-- 保存 -->
       <div class="save-btn">
-        <el-button size="small"> 取 消 </el-button>
+        <el-button size="small" @click="back"> 取 消 </el-button>
         <div class="ge"></div>
         <el-button type="primary" size="small" @click="submitForm">
           保 存
@@ -581,13 +581,15 @@ export default {
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          let prizeIndex = this.awardsList.findIndex(item=>{
-            return !item.prizeList.length
-          })
+          let prizeIndex = this.awardsList.findIndex((item) => {
+            return !item.prizeList.length;
+          });
           // 判断没有设置奖品的奖级
-          if(prizeIndex != -1){
-            this.$message.error(`请设置${ this.awardsList[prizeIndex].name }的奖品!`);
-            return
+          if (prizeIndex != -1) {
+            this.$message.error(
+              `请设置${this.awardsList[prizeIndex].name}的奖品!`
+            );
+            return;
           }
           this.awardsList.forEach((item) => {
             item.prizeList = item.prizeList.map((ele) => {
@@ -615,10 +617,10 @@ export default {
             background: "rgba(0, 0, 0, 0.4)",
           });
           ticketBoxCreate(data).then((res) => {
-            if(res.code == 0){
-              this.msgSuccess('保存成功')
-              this.$store.dispatch('tagsView/delView', this.$route)
-              this.$router.go(-1)
+            if (res.code == 0) {
+              this.msgSuccess("保存成功");
+              this.$store.dispatch("tagsView/delView", this.$route);
+              this.$router.go(-1);
               loading.close();
             }
           });
@@ -743,6 +745,12 @@ export default {
       });
       this.awardsList[this.prizeIndex].quantity = num;
     },
+
+    // 取消
+    back() {
+      this.$store.dispatch("tagsView/delView", this.$route);
+      this.$router.go(-1);
+    },
   },
 };
 </script>