Bläddra i källkod

承诺书新架构

y595705120 4 månader sedan
förälder
incheckning
53821fa5df
1 ändrade filer med 52 tillägg och 51 borttagningar
  1. 52 51
      src/containers/center/market/index.vue

+ 52 - 51
src/containers/center/market/index.vue

@@ -205,49 +205,19 @@
     </el-dialog>
 
 
-    <el-dialog :title="hasNotice()?'温馨提示':'承诺书'" class="fc tc" :visible.sync="commitmentDialog">
-        <div v-if="hasNotice()" class="p10">
-          <div class="tl commitment">
-              {{promise.notice_hangong}}
-          </div>
-          <div slot="footer" class="dialog-footer mt20">
-            <el-button @click="commitmentDialog = false">取 消</el-button>
-            <el-button type="primary"  @click="buyCourseDialog=true">继续购买</el-button>
-          </div>
-        </div>
-
-        <div v-else>
-          <div v-if="hasPromise(type)">
-            <div class="commitment-header"> 致:三明市城市建设项目服务中心 </div>
+    <el-dialog :title="promise.showType==1?'温馨提示':'承诺书'" class="fc tc" :visible.sync="commitmentDialog">
+        <div>
+          <div>
+            <div class="commitment-header"> {{promise.title}} </div>
             <div class="tl commitment">
-                {{promise.promise_edu}}
+                {{promise.content}}
             </div>
             <div class="commitment-footer">
-              特此诺书!
-            </div>
-          </div>
-          <div v-else-if="type=='建筑施工企业特种作业人员'">
-            <div class="tl commitment">
-              {{promise.promise_special}}
-            </div>
-
-          </div>
-
-
-          <div v-else-if="type=='园林绿化技术工人'">
-            <div class="tl commitment">
-              {{promise.promise_plant}}
-            </div>
-          </div>
-
-          <div v-else>
-            <div class="tl commitment">
-              {{promise.promise_other}}
+              {{promise.footer}}
             </div>
           </div>
 
-
-          <div class="tl commitment-content mt20">
+          <div class="tl commitment-content mt20" v-if="promise.showType==2">
             <el-radio-group v-model="isCommitment">
               <el-row class="mt10">
                 <el-radio :label="true">本人作出上述承诺</el-radio>
@@ -258,12 +228,16 @@
             </el-radio-group>
           </div>
 
-          <span slot="footer" class="dialog-footer">
+          <span slot="footer" class="dialog-footer" v-if="promise.showType==2">
             <el-button @click="commitmentDialog = false">取 消</el-button>
             <el-button type="primary" :disabled="isCommitment?false:true" @click="buyCourseDialog=true">确 定</el-button>
           </span>
-        </div>
 
+          <div slot="footer" class="dialog-footer mt20" v-else>
+            <el-button @click="commitmentDialog = false">取 消</el-button>
+            <el-button type="primary"  @click="buyCourseDialog=true">继续购买</el-button>
+          </div>
+        </div>
     </el-dialog>
 
     <el-dialog append-to-body close-on-click-modal :visible.sync="showImgDialog" style="margin-top: 0px;" :width="width">
@@ -292,7 +266,6 @@
     httpServer
   } from "@/components/httpServer/httpServer.js";
 
-  import promise from "./promise.js";
   import {
     MessageBox
   } from "element-ui";
@@ -340,7 +313,8 @@
           courseName: '',
           list:[]
         },
-        promise,
+        promise:{status:0,showType:1},
+        promiseList: [],
         imgUrl: '',
         qrcodeUrl: "",
         outTradeNo: "",
@@ -407,6 +381,13 @@
         return parseTime(val, '{y}-{m}-{d}')
       }
     },
+    created(){
+      // 获取所有承诺书
+      httpServer("course.GetAllCoursePromise", {}).then((res) => {
+        if (res.code != 200) return;
+        this.promiseList = res.data.list;
+      });
+    },
     watch: {
       type(val) {
         this.page = 1
@@ -457,8 +438,22 @@
         }
         this.width = width + "px";
       },
+      matchPromise( name ){
+        let type = this.type;
+        let isMatch = false
+        for( let i in this.promiseList){
+          let item = this.promiseList[i];
+          if( name == item.type || item.type == type ){
+            this.promise = Object.assign( this.promise, item);
+            isMatch = true
+          } else if( !isMatch && item.type == '默认类型'){
+            this.promise = Object.assign( this.promise, item);
+          }
+        }
+      },
       getData() {
         if (!this.type) return;
+        // 匹配承诺书
         let param = {
           size: 100,
           type: this.type,
@@ -485,9 +480,9 @@
       cancelBuyCourse(){
         this.$refs["elForm"].resetFields();
         this.buyCourseDialog=false
+        this.commitmentDialog = false;
       },
       openShowAllRzcodeDialog(){
-        console.log("openShowAllRzcodeDialog")
         this.showAllRzcodeDialog = true;
       },
       selectRzcode( row ){
@@ -502,8 +497,6 @@
             this.$message.errorMsg("报考岗位有误", 1)
             return;
           }
-          this.buyCourseDialog = false;
-          this.commitmentDialog = false;
           let param = { marks, payNo, company,courseId: course_id, courseName,rzCode,email,buyImg }
           httpServer("course.buyCourse", param).then((res) => {
             if (res.code == 200) {
@@ -512,6 +505,8 @@
               Object.assign( this.buyForm.temp, param);
               this.$refs["elForm"].resetFields();
               this.buyForm.temp.is_pay = 0
+              this.buyCourseDialog = false;
+              this.commitmentDialog = false;
             }
           });
         })
@@ -535,22 +530,28 @@
         this.buyForm.rzCode = item.rzCode;
         this.buyForm.company = 'ssss';
         this.buyForm.name = item.courseName;
-        let isEdu = this.hasPromise(item.type);
-        if( isEdu || this.hasNotice() ){
-          this.buyCourseDialog = false;
+        // let isEdu = this.hasPromise(item.type);
+        if( this.promise.status ==1){
           this.commitmentDialog = true;
+          this.buyCourseDialog = false;
         }else{
           this.buyCourseDialog = true;
           this.commitmentDialog = false;
         }
+        // if( isEdu || this.hasNotice() ){
+        //   this.buyCourseDialog = false;
+        //   this.commitmentDialog = true;
+        // }else{
+        //   this.buyCourseDialog = true;
+        //   this.commitmentDialog = false;
+        // }
       },
       goPay( item ) {
         this.buyForm = Object.assign(this.buyForm, item)
         this.buyForm.company = this.userInfo.company;
         this.buyForm.temp = item;
         this.buyForm.courseName = item.name;
-        // console.log("goPay", item);
-        let isEdu = this.hasPromise(item.type);
+        this.matchPromise( item.name );
         // this.testBuyOK(item)
         // return;
         // 检查
@@ -563,9 +564,9 @@
             this.isCompanyPay = 0;
             this.isCommitment=''
             Object.assign( this.buyForm, res.data);
-            if( isEdu || this.hasNotice()){
-              this.buyCourseDialog = false;
+            if( this.promise.status ==1){
               this.commitmentDialog = true;
+              this.buyCourseDialog = false;
             }else{
               this.buyCourseDialog = true;
               this.commitmentDialog = false;