Browse Source

点击确权打开文件

xuefy 4 years ago
parent
commit
d38a3d1c75

+ 52 - 13
front-vue/src/views/service/credit/confirmationAudit.vue

@@ -196,7 +196,7 @@
             <div class="footer" style="float: right;
                 margin-bottom:1px;">
                 <el-button type="info" @click="submitForm('01')">拒绝</el-button>
-                <el-button type="primary" @click="submitForm('00')" v-if="isHas">通过</el-button>
+                <el-button type="primary" @click="submitForm('00')" v-if="isHas">内部审批</el-button>
                 <el-button type="primary" @click="confirmApproval()" v-if="!isHas">确权</el-button>
                 <el-button @click="cancel">取 消</el-button>
             </div>
@@ -269,13 +269,20 @@
                 <img :src="wordUrl" v-if="show" width='450px' height='500px'/>
                 <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid"/>
             </el-dialog>
+            <el-dialog
+            :visible.sync="pdfShowDialog"
+            width="70%">
+                <pdf-show :pdfFileList="pdfFileList" :zfiId="this.form.zfiId" :parent="parent">
+                </pdf-show>
+            </el-dialog>
+           
         </el-tab-pane>
         <!-- 签署合同-->
         <el-tab-pane label="签署合同">
-            <el-table :data="otherFileList"  style="width: 100%">
+            <el-table :data="creditSealList"  style="width: 100%">
                 <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip>
                     <template slot-scope="scope">
-                        <img    style="width:50px;height:50px;"
+                        <img    style="width:30px;height:30px;"
                             src="../../../assets/images/pdf.png"  
                         />
                         <span>{{scope.row.pfiFileName}}
@@ -305,15 +312,15 @@
 </template>
 <script>
 import {listCreditLine,getCreditDetail,getAccountsCollection,getAvailableBalance,getFile} from "@/api/service/credit/credit";
-import {approveCredit,getCreditSealFile} from "@/api/service/credit/creditHandle";
+import {approveCredit,getCreditSealFile,getContractFile} from "@/api/service/credit/creditHandle";
 import {accAdd} from "@/utils/calculation";
 import {isOpenApproval} from "@/api/service/credit/approvalRelatedCredit";
 import {listCompanyHandler} from "@/api/common/companyHandler";
 import {getToken} from "@/utils/auth";
-import Cookies from 'js-cookie'
+import pdfShow from "./pdfShow";
 export default {
     name: "addCredit",
-    components: {},
+    components: {pdfShow},
     data() {
         return {
             // 总条数
@@ -428,7 +435,10 @@ export default {
             //融信编号
             zfiId:"",
             //核心审批状态
-            zfiCoreStatus:""
+            zfiCoreStatus:"",
+            pdfFileList : [],
+            pdfShowDialog : false,
+            parent : this,
         };
     },
     watch:{
@@ -893,11 +903,11 @@ export default {
                         loading.close();
                         //通过
                         if("00" == param){
-                            this.msgSuccess("融信资料已提交企业内部审核");
+                            this.msgSuccess("融信资料已提交内部审批");
                             this.$store.dispatch("tagsView/delView", this.$route);
                             this.$router.go(-1);
                         }else if("01" == param){//拒绝
-                            this.msgSuccess("拒绝后,该笔融信业务将作废");
+                            this.msgSuccess("该笔融信将作废");
                             this.$store.dispatch("tagsView/delView", this.$route);
                             this.$router.go(-1);
                         }
@@ -982,7 +992,7 @@ export default {
              var result = response.data.isOpen;
             //有确权内部审批
             if(true == result){
-                //获取核心审批状态(拒绝或者状态为空时显示通过按钮)
+                //获取核心审批状态(拒绝或者状态为空时显示内部审批按钮)
                 if(this.zfiCoreStatus == "02" || this.zfiCoreStatus == "" || this.zfiCoreStatus == "null" || this.zfiCoreStatus == null ){
                     this.isHas = true;
                 }else{
@@ -997,7 +1007,7 @@ export default {
     confirmApproval(){
         if(this.zfiCoreStatus != "01"){
                 this.$message({
-                  message: "请内部审核通过后,再合同签署",
+                  message: "请内部审批通过后,再确权",
                   type: 'warning'
                 });
                 return false;
@@ -1012,11 +1022,40 @@ export default {
               });
               return false;
             }else{
-              Cookies.set("/credit/creditSeal/"+this.zfiId + "/", this.$route.fullPath)
-              this.$router.push({ path: "/credit/creditSeal/"+this.zfiId + "/" });
+              //预览文件
+              this.getContractFile();
            }
 
         }); 
+    },
+    //获取合同文件
+    getContractFile(){
+        const loading = this.$loading({
+                    lock: true,
+                    text: 'Loading',
+                    background: 'rgba(0, 0, 0,0)'
+                });
+         getContractFile(this.form).then((response) => {
+                loading.close();
+                if(response.data.list){
+                    this.pdfFileList = response.data.list;
+                }
+                 //文件存在
+                if(this.pdfFileList.length > 0 ){
+                    this.pdfShowDialog = true;
+
+                }else{
+                      this.$message({
+                        message: '文件不存在!',
+                        type: 'warning'
+                      });
+                }
+            }).catch((response)=>{
+                        loading.close();
+            });
+    },
+    closePdfShow(){
+        this.pdfShowDialog = false;
     }
        
     }

+ 475 - 5
front-vue/src/views/service/credit/pdfShow.vue

@@ -43,19 +43,80 @@
                     因此,经双方协商一致,签订本协议,约定如下:</el-tab-pane> -->
 
             </el-tabs>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="dialogVisible = false">取 消</el-button>
-              <!--   <el-button type="primary" @click="selectChildType">确 定</el-button> -->
+            <span slot="footer" class="dialog-footer" style="float: right;">
+                    <el-button type="primary" @click="selectType" size="mini">签署</el-button>
+                    <el-button @click="closePdfShow" size="mini">取 消</el-button>
             </span>
+            
+            <!-- <span slot="footer" class="dialog-footer">
+                <el-button @click="dialogVisible = false">取 消</el-button>
+            </span> -->
         <!-- </el-dialog> -->
+        <div>
+             <!--选择签署意愿类型-->
+            <el-dialog  :visible.sync="confirmIsShow" width="600px"  append-to-body :before-close = "cancelUpdate" center>
+                <el-form ref="updateForm"  :disabled="false" :model="updateForm"  v-if="confirmIsShow" label-width="150px"  class="demo-form-inline" :inline="true">
+                    <el-radio-group v-model="updateForm.radio">
+                        <el-radio label="01">人脸</el-radio>
+                        <el-radio label="02">短信</el-radio>
+                    </el-radio-group>
+                </el-form>
+
+                <div slot="footer" class="dialog-footer">
+                    <el-button type="primary" @click="confirmSelect">确 定</el-button>
+                    <el-button @click="cancelUpdate">取 消</el-button>
+                </div>
+            </el-dialog>
+            <!--短信-->
+            <el-dialog  :visible.sync="messageIsShow" width="800px"  append-to-body :before-close = "cancelMessage" center>
+                <el-form ref="messageForm"  :disabled="false" :model="messageForm"  v-if="messageIsShow" label-width="150px"  class="demo-form-inline" :inline="true" @submit.native.prevent>
+                        <el-form-item label="验证码" prop="validCode">
+                            <el-input v-model="messageForm.validCode" style="width: 200px" maxlength="6"  oninput="value=value.replace(/[^\d]/g,'')"/>
+                        </el-form-item>
+                        <el-form-item>
+                            <el-button  v-show="messShow"  type="success" @click="send">点击获取验证码</el-button>
+                            <el-button v-show="!messShow" type="success" disabled><span>{{timer}}</span>秒后重新获取</el-button>
+                        </el-form-item>
+
+                </el-form>
+                <div slot="footer" class="dialog-footer">
+                    <el-button type="primary" @click="checkCode">确定</el-button>
+                    <el-button @click="cancelMessage">取 消</el-button>
+                </div>
+            </el-dialog>
+            <!--授权编号的短信框-->
+            <el-dialog  :visible.sync="projectIsShow" width="800px"  append-to-body :before-close = "cancelProject" center>
+                <el-form ref="projectForm"  :disabled="false" :model="projectForm"  v-if="projectIsShow" label-width="150px"  class="demo-form-inline" :inline="true">
+                        <el-form-item label="验证码" prop="code">
+                            <el-input v-model="projectForm.code" style="width: 200px" maxlength="6"  oninput="value=value.replace(/[^\d]/g,'')"/>
+                        </el-form-item>
+                        <el-form-item>
+                            <el-button  v-show="proShow"  type="success" @click="proSend">点击获取验证码</el-button>
+                            <el-button v-show="!proShow" type="success" disabled><span>{{proTimer}}</span>秒后重新获取</el-button>
+                        </el-form-item>
+
+                </el-form>
+                <div slot="footer" class="dialog-footer">
+                    <el-button type="primary" @click="checkProCode">确定</el-button>
+                    <el-button @click="cancelProject">取 消</el-button>
+                </div>
+            </el-dialog>
+            <!--人脸二维码-->
+            <el-dialog  :visible.sync="faceIsShow" width="500px"  append-to-body :before-close = "cancelFace" center>
+                <img :src="'data:image/jpeg;base64,' + this.fileUrl" style="overflow: auto; width: 100%; height: 100%;"/>
+            </el-dialog>
+        </div>
     </div>
+    
 </template>
 
 
 <script>
-//import PDFObject from 'pdfobject'
+import {sendMessage,checkCode,faceAuth,checkFaceAuth,contractSigning} from "@/api/service/credit/message";
+import {cfcaProjectNo,projectSendMessage,checkProCode} from "@/api/service/credit/cfcaProject";
+import {getCreditDetail} from "@/api/service/credit/credit";
 export default {
-    props : ['pdfFileList'],
+    props : ['pdfFileList','zfiId', 'parent'],
     data() {
         return {
             activeName: "first",
@@ -73,9 +134,79 @@ export default {
                 desc: "",
             },
             formLabelWidth: "120px",
+             //展示选择意愿
+            confirmIsShow:false,
+            //意愿
+            updateForm:{},
+            //意愿类型
+            zfpAuthTypeInit:'',
+            zfpAuthType:'',
+            //短信展示
+            messageIsShow:false,
+            //短信
+            messageForm:{validCode:""},
+            //人脸二维码
+            fileUrl:"",
+            //控制人脸二维码是否展示
+            faceIsShow:false,
+            //人脸验证结果
+            faceResult:"",
+            //人脸识别结果传参
+            authForm:{},
+            //控制短信验证码倒计时是否展示
+            messShow:true,
+            timer:60,
+            openFile:false,
+            wordUrl: "",
+            show:false,
+            heid:false,
+            auth_timer : null,
+            //融资方审批状态
+            zfiSupplierStatus:'',
+            //核心审批状态
+            zfiCoreStatus:'',
+            //平台审批状态
+            zfiPlatformStatus:'',
+            //融信状态
+            zfiStatus:'',
+            //盖章文件
+            creditSealList:[],
+            //生成授权编号的短信框
+            projectIsShow:false,
+            //短信
+            projectForm:{code:""},
+            //控制倒计时是否展示
+            proShow:true,
+            //时间
+            proTimer:60,
+            //项目编号
+            projectCode:"",
+            //融信信息
+            financeData:{},
+            //接收方
+            receiveName:""
         };
     },
     created() {
+         getCreditDetail(this.zfiId).then((response) => {
+             if(response.data){
+                //融信状态
+                 this.zfiStatus = response.data.financeInf.zfiStatus;
+                 //融资方审批状态
+                 this.zfiSupplierStatus =  response.data.financeInf.zfiSupplierStatus;
+                 //平台审批状态
+                 this.zfiPlatformStatus =  response.data.financeInf.zfiPlatformStatus;
+                 //核心审批状态
+                 this.zfiCoreStatus = response.data.financeInf.zfiCoreStatus;
+                //意愿类型
+                this.zfpAuthType = response.data.zfpAuthType;
+                this.zfpAuthTypeInit = response.data.zfpAuthType;
+                //融信信息
+                this.financeData = response.data.financeInf;
+                //接收方
+                this.form.receiveName = response.data.receiveName;
+             }
+        })
         this.dialogVisible = true;
         for(var i = 0 ; i < this.pdfFileList.length; i++){
             var base64 = this.pdfFileList[i].base64;
@@ -92,7 +223,346 @@ export default {
         },
         selectChildType(){
             this.$parent.selectType();
+        },
+            //取消选择意愿
+    cancelUpdate(){
+        this.confirmIsShow = false;
+        this.resetUpdate();
+    },
+    //关闭短信
+    cancelMessage(){
+        this.messageIsShow = false;
+        this.resetMessage();
+    },
+    //关闭短信
+    cancelProject(){
+        this.projectIsShow = false;
+        this.resetProject();
+    },
+    //关闭二维码
+    cancelFace(){
+        this.faceIsShow = false;
+    },
+    resetUpdate() {
+        this.updateForm = {
+            radio:""
+        };
+        //意愿类型还原为全部
+        this.zfpAuthType = this.zfpAuthTypeInit;
+        this.resetForm("updateForm");
+
+        this.messShow = true;
+        clearInterval(this.auth_timer);
+        this.timer = 60;
+
+        this.proShow = true;
+        clearInterval(this.auth_pro_timer);
+        this.proTimer = 60;
+    },
+    resetMessage() {
+        this.messageForm = {
+            validCode:""
+        };
+        this.resetForm("messageForm");
+    },
+    resetProject(){
+         this.projectForm = {
+            code:""
+        };
+        this.resetForm("projectForm");
+    },
+    //选择类型
+    selectType(){
+        //查询当前企业是否存在企业授权编号
+        cfcaProjectNo().then((response) => {
+            //存在授权编号
+            if(response.data.scyCfcaAuthNumber){
+                 /**
+                 * 申请确权:融资审批通过+核心通过+平台通过+融信待确权||
+                 * 核心开立:核心审批通过+其余状态为空
+                 * 融资开立:融资通过+平台通过+其余状态为空
+                 * 
+                 */
+                this.resetUpdate();
+                //调用人脸
+                if( (this.zfiSupplierStatus == '01' && this.zfiCoreStatus == '01' && this.zfiPlatformStatus == '01' && this.zfiStatus == '00') ||
+                    (this.zfiCoreStatus == '01' && (this.zfiSupplierStatus == '' || this.zfiSupplierStatus == null || this.zfiSupplierStatus == 'null') && (this.zfiPlatformStatus == '' || this.zfiPlatformStatus == null || this.zfiPlatformStatus == 'null') && (this.zfiStatus == '' || this.zfiStatus == null || this.zfiStatus == 'null'))||
+                    (this.zfiSupplierStatus == '01' && this.zfiPlatformStatus == '01' && (this.zfiCoreStatus == '' || this.zfiCoreStatus == null || this.zfiCoreStatus == 'null') && (this.zfiStatus == '' || this.zfiStatus == null || this.zfiStatus == 'null'))){
+                    //选择签署意愿
+                    if(this.zfpAuthType == "00"){
+                            this.confirmIsShow = true;
+                        }else{
+                            this.checking();
+                        }
+
+                }else{
+                    //直接盖章
+                    this.contractSigning();     
+                }
+            }else{
+               //不存在授权编号
+               //发送短信验证码认证
+                this.projectIsShow = true;
+
+            }
+        });
+       
+    },
+    //确认选择
+    confirmSelect(){
+            if(!this.updateForm.radio){
+                this.$message({
+                    message: '请选择签署意愿类型',
+                    type: 'warning'
+                });
+                return;
+            }
+
+            this.confirmIsShow = false;
+            this.zfpAuthType = this.updateForm.radio;
+            //调用人脸识别或者短信验证
+            this.checking();
+    },
+    //去签署
+    checking(){
+        //人脸
+        if(this.zfpAuthType == '01'){
+          //调用人脸识别生成二维码
+          faceAuth().then((response) => {
+                if(response.data){
+                    //获取二维码
+                    this.fileUrl = response.data.fileUrl;
+                    //获取源流水号
+                    var originalTxSN = response.data.originalTxSN;
+                    this.faceIsShow = true;
+                    //每10秒查证人脸识别结果
+                    var timeInterval = window.setInterval(() => {
+                            setTimeout(() => {
+                               //源流水不为空并且结果为空
+                               if(originalTxSN && !this.faceResult){
+                                    this.authForm.originalTxSN = originalTxSN;
+                                    //调用查证方法
+                                    checkFaceAuth(this.authForm).then((res) => {
+                                        //认证结果
+                                        this.faceResult = res.data.Verification;
+                                        //成功
+                                        if(this.faceResult == '20'){
+                                            this.msgSuccess("验证成功");
+                                            //关闭验证码
+                                            this.faceIsShow = false;
+                                            //关闭定时
+                                            window.clearInterval(timeInterval);
+                                            //调用盖章
+                                            this.contractSigning();
+                                        }else if(this.faceResult == '30'){
+                                            this.$message({
+                                                message: "验证失败",
+                                                type: 'warning'
+                                            });
+                                            //关闭验证码
+                                            this.faceIsShow = false;
+                                            window.clearInterval(timeInterval);
+                                        }
+                                    });
+                               }
+                            }, 0)
+                         },10000)
+                }
+            });
+
+        }else if(this.zfpAuthType == '02'){//短信
+            this.messageIsShow = true;
         }
+
+    },
+    //发送短信验证码
+    send(){
+
+            //发送
+            sendMessage().then((response) => {
+                if(response.data){
+                    //手机号
+                    var newIphone = response.data.newIphone;
+                    //结果
+                    var result = response.data.result;
+                    this.messShow = false;
+                    this.auth_timer = window.setInterval(() => {
+                        this.messShow = false;
+                        setTimeout(() => {
+                                this.timer--;
+                                if(this.timer <= 0 ){
+                                    this.messShow = true;
+                                    clearInterval(this.auth_timer);
+                                }
+                            }, 0)
+                        },1000)
+                    //成功
+                    if("20" == result){
+                        this.$message({
+                            message: "已向经办人手机号为"+newIphone+"发送短信验证码,请注意查收",
+                            type: 'warning'
+                        });
+                    }else if("10" == result){//失败
+                        this.$message({
+                            message: "短信发送失败",
+                            type: 'warning'
+                        });
+                    }
+
+                }
+            });
+
+    },
+
+    //生成项目授权编号发送短信
+    proSend(){
+        //发送
+        projectSendMessage().then((response) => {
+            if(response.data){
+                //手机号
+                var newIphone = response.data.newIphone;
+                //结果
+                var result = response.data.result;
+                //项目编号
+                this.projectCode = response.data.projectCode;
+                this.proShow = false;
+                this.auth_pro_timer = window.setInterval(() => {
+                    this.proShow = false;
+                    setTimeout(() => {
+                            this.timer--;
+                            if(this.timer <= 0 ){
+                                this.proShow = true;
+                                clearInterval(this.auth_pro_timer);
+                            }
+                        }, 0)
+                    },1000)
+                //成功
+                if("60000000" == result){
+                    this.$message({
+                        message: "已向经办人手机号为"+newIphone+"发送短信验证码,请注意查收",
+                        type: 'warning'
+                    });
+                }else{//失败
+                    this.$message({
+                        message: "短信发送失败",
+                        type: 'warning'
+                    });
+                }
+
+            }
+        });
+    },
+    //校验验证码是否正确
+    checkCode(){
+            if(!this.messageForm.validCode){
+                     this.$message({
+                        message: "请输入验证码",
+                        type: 'warning'
+                    });
+                    return;
+            }
+            //校验验证码
+            checkCode(this.messageForm).then((response) => {
+                if(response.data){
+                    //结果
+                    var verification = response.data.verification;
+                    //匹配
+                    if("20" == verification){
+                        //进行下一步-- 盖章
+                         this.contractSigning();
+                    }else if("30" == verification){//不匹配
+                         this.$message({
+                            message: "验证有误,请重新输入",
+                            type: 'warning'
+                        });
+                    }
+
+                }
+        });
+    },
+    //盖章
+    contractSigning(){
+            const loading = this.$loading({
+                        lock: true,
+                        text: 'Loading',
+                        background: 'rgba(0, 0, 0,0)'
+                    });
+            contractSigning(this.financeData).then((response) => {
+                loading.close();
+                //确权:状态为待确权或者核心开立并且核心审批通过
+                if(this.zfiStatus == '00' || (this.financeData.zfiCreateType == '1' && this.financeData.zfiCoreStatus == '01')){
+                     this.msgSuccess("确权成功,融信已提交,"+this.receiveName+"签收");
+                }
+                if(this.zfpAuthType == '02'){
+                    //关闭短信验证
+                    this.messageIsShow = false;
+                }else if(this.zfpAuthType == '01'){
+                    //关闭人脸二维码
+                    this.faceIsShow = false;
+                }
+                this.$store.dispatch(
+                    "tagsView/delView",
+                    this.$route
+                );
+                this.$router.go(-1);
+            }).catch((response) => {
+                loading.close();
+            });
+    },
+    //校验授权编号验证码
+    checkProCode(){
+            if(!this.projectForm.code){
+                     this.$message({
+                        message: "请输入验证码",
+                        type: 'warning'
+                    });
+                    return;
+            }
+            //项目编号
+            this.projectForm.projectCode = this.projectCode;
+            //校验验证码
+            checkProCode(this.projectForm).then((response) => {
+                if(response.data){
+                    //结果
+                    var verification = response.data.verification;
+                    //匹配
+                    if("60000000" == verification){
+                        /**
+                         * 申请确权:融资审批通过+核心通过+平台通过+融信待确权||
+                         * 核心开立:核心审批通过+其余状态为空
+                         * 融资开立:融资通过+平台通过+其余状态为空
+                         * 
+                         */
+                        this.resetUpdate();
+                        //调用人脸
+                        if( (this.zfiSupplierStatus == '01' && this.zfiCoreStatus == '01' && this.zfiPlatformStatus == '01' && this.zfiStatus == '00') ||
+                            (this.zfiCoreStatus == '01' && (this.zfiSupplierStatus == '' || this.zfiSupplierStatus == null || this.zfiSupplierStatus == 'null') && (this.zfiPlatformStatus == '' || this.zfiPlatformStatus == null || this.zfiPlatformStatus == 'null') && (this.zfiStatus == '' || this.zfiStatus == null || this.zfiStatus == 'null'))||
+                            (this.zfiSupplierStatus == '01' && this.zfiPlatformStatus == '01' && (this.zfiCoreStatus == '' || this.zfiCoreStatus == null || this.zfiCoreStatus == 'null') && (this.zfiStatus == '' || this.zfiStatus == null || this.zfiStatus == 'null'))){
+                            //选择签署意愿
+                            if(this.zfpAuthType == "00"){
+                                    this.confirmIsShow = true;
+                                }else{
+                                    this.checking();
+                                }
+
+                        }else{
+                            //直接盖章
+                            this.contractSigning();     
+                        }
+                    }else {//不匹配
+                         this.$message({
+                            message: "验证有误,请重新输入",
+                            type: 'warning'
+                        });
+                    }
+
+                }
+        });
+    },
+    closePdfShow(){
+        this.parent.closePdfShow();
+    }
+
     },
 };
 </script>