lushuncheng 6 years ago
parent
commit
ea1779ac45
1 changed files with 63 additions and 60 deletions
  1. 63 60
      pages/main/index/vip_setting.vue

+ 63 - 60
pages/main/index/vip_setting.vue

@@ -119,18 +119,20 @@
         </el-form-item>
       </el-form>
       <el-form-item :label="ruleForm.name+'整包减免费率'" prop="project_reduction_rate">
-        &#12288;<el-input style="width: 30%" v-model="ruleForm.project_reduction_rate"></el-input>%
+        &#12288;
+        <el-input style="width: 30%" v-model="ruleForm.project_reduction_rate"></el-input>%
       </el-form-item>
       <br />
       <el-form-item :label="ruleForm.name+'云端减免费率'" prop="job_reduction_rate">
-        &#12288;<el-input style="width: 30%" v-model="ruleForm.job_reduction_rate"></el-input>%
+        &#12288;
+        <el-input style="width: 30%" v-model="ruleForm.job_reduction_rate"></el-input>%
       </el-form-item>
       <br />
       <el-form-item>
         <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
       </el-form-item>
     </el-form>
-    <el-form v-else="shows" :model="ruleForm"  ref="commonRights">
+    <el-form v-else :model="ruleForm" ref="commonRights">
       <h3 style="padding-top: 1%;">普通开发者用户权益设置</h3>
       <el-form-item style="padding: 4%">
         <el-form-item label="普通用户每月可接单次数" prop="project_reduction_rate">
@@ -142,7 +144,8 @@
         <el-form-item label="普通用户每天可聊一聊次数" prop="project_reduction_rate">
           <el-input style="width: 30%" v-model="commonRights.limit2"></el-input>次
         </el-form-item>
-        <br /><br />
+        <br />
+        <br />
         <el-form-item label="普通用户每天可发布雇佣数" prop="job_reduction_rate">
           <el-input style="width: 30%" v-model="commonRights.limit3"></el-input>个
         </el-form-item>
@@ -156,7 +159,7 @@
 </template>
 
 <script>
-import {validAlphabets} from "../../../utils/validate";
+import { validAlphabets } from "../../../utils/validate";
 
 export default {
   data() {
@@ -180,10 +183,10 @@ export default {
       list: [],
       // 设备类型, iOS/其他
       device: "其他",
-        rights1:'',
-        rights2:'',
-        shows:true,
-        commonRights:{}
+      rights1: "",
+      rights2: "",
+      shows: true,
+      commonRights: {}
     };
   },
   mounted() {
@@ -202,38 +205,38 @@ export default {
      * 重置
      */
     resetForm(formName = "ruleForm") {
-        if(this.shows){
-            this.$refs[formName].resetFields();
-        }
+      if (this.shows) {
+        this.$refs[formName].resetFields();
+      }
     },
     /**
      * 保存或更新
      */
     async update() {
-        let res;
-        if (this.shows){
-            const ruleForm = this.ruleForm;
+      let res;
+      if (this.shows) {
+        const ruleForm = this.ruleForm;
 
-            const can_buy_monthly = ruleForm.can_buy_monthly ? "1" : "0";
-            const can_buy_quarterly = ruleForm.can_buy_quarterly ? "1" : "0";
-            const can_buy_half_yearly = ruleForm.can_buy_half_yearly ? "1" : "0";
-            const can_buy_yearly = ruleForm.can_buy_yearly ? "1" : "0";
-            res = await this.$post("/api/admin/vip/update", {
-                ...ruleForm,
-                can_buy_monthly,
-                can_buy_quarterly,
-                can_buy_half_yearly,
-                can_buy_yearly
-            });
-        }else{
-            const rights = {
-                'id':4,
-                'limit1':this.commonRights.limit1,
-                'limit2':this.commonRights.limit2,
-                'limit3':this.commonRights.limit3,
-            };
-            res = await this.$post("/api/admin/vip/set_rights", rights);
-        }
+        const can_buy_monthly = ruleForm.can_buy_monthly ? "1" : "0";
+        const can_buy_quarterly = ruleForm.can_buy_quarterly ? "1" : "0";
+        const can_buy_half_yearly = ruleForm.can_buy_half_yearly ? "1" : "0";
+        const can_buy_yearly = ruleForm.can_buy_yearly ? "1" : "0";
+        res = await this.$post("/api/admin/vip/update", {
+          ...ruleForm,
+          can_buy_monthly,
+          can_buy_quarterly,
+          can_buy_half_yearly,
+          can_buy_yearly
+        });
+      } else {
+        const rights = {
+          id: 4,
+          limit1: this.commonRights.limit1,
+          limit2: this.commonRights.limit2,
+          limit3: this.commonRights.limit3
+        };
+        res = await this.$post("/api/admin/vip/set_rights", rights);
+      }
 
       if (res)
         this.$message({
@@ -260,23 +263,23 @@ export default {
      */
     async getDetail({ id }) {
       switch ({ id }.id) {
-          case '2':
-              this.shows = true;
-              this.rights1 = '每月可接单次数';
-              this.rights2 = '可同时接单数量';
-              break;
-          case '1':
-          case '3':
-              this.shows = true;
-              this.rights1 = '每月可雇佣次数';
-              this.rights2 = '每天聊一聊次数';
-              break;
-          case '4':
-              this.shows = false;
-              const res = await this.$post("/api/admin/vip/get_rights", { id });
-              this.commonRights = res.data;
-              return ;
-              break;
+        case "2":
+          this.shows = true;
+          this.rights1 = "每月可接单次数";
+          this.rights2 = "可同时接单数量";
+          break;
+        case "1":
+        case "3":
+          this.shows = true;
+          this.rights1 = "每天聊一聊次数";
+          this.rights2 = "每月可雇佣次数";
+          break;
+        case "4":
+          this.shows = false;
+          const res = await this.$post("/api/admin/vip/get_rights", { id });
+          this.commonRights = res.data;
+          return;
+          break;
       }
       const res = await this.$post("/api/admin/vip/getDetail", { id });
       const data = res.data;
@@ -300,15 +303,15 @@ export default {
     async getList() {
       const res = await this.$post("/api/admin/vip/getList");
       // console.log(res)
-        //更改显示顺序
+      //更改显示顺序
       this.list = res.data;
-        let temp = this.list[0];
-        this.list[0] = this.list[1];
-        this.list[1] = temp;
-        this.list.push({
-            id :'4',
-            name: "普通用户权益",
-        });
+      let temp = this.list[0];
+      this.list[0] = this.list[1];
+      this.list[1] = temp;
+      this.list.push({
+        id: "4",
+        name: "普通用户权益"
+      });
       this.titles = this.list.map(i => i.name);
       // console.log(this.titles);
       // 模拟点击一次