zhouhao
2022-01-07 e057091389829d697e5373fbef41c97c383c14c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
 
<template>
  <div class='text-main'>
    <!-- <van-nav-bar title="审核结果" /> -->
    <div style="  text-align: center;">
      <img  height="180" src="../../assets/img/loading.png"  v-if="!ResultIs" />
      <img  height="180" src="../../assets/img/img_fail.png" v-if="ResultIs" />
    </div>
    <div class="content">
      <p class="content-text"  v-if="!ResultIs"> {{datastr}}</p>
        <p class="content-text" v-if="ResultIs"> 活体校验失败,请重试</p>
      <!-- <p class="content-text" v-if="isActive">{{examineStr}}</p> -->
      <div class="btn-content">
      <van-button  color="#6cc3bb" @click="refreshBtn" round v-if="!ResultIs">刷新</van-button>
      <van-button  color="#6cc3bb" @click="checkBtn" round v-if="ResultIs">重新校验</van-button>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  components: {},
  data() {
    //这里存放数据
    return {
      datastr: '活体校验中,请稍等....',
      examineStr:'正在审核订单,请稍后...',
      isActive: false,
      orderNo:0,
      ResultIs:false,
      examineIs:true,
      dataInfo:{},
      bizId:this.$route.query.bizId,   //订单编号 
      bizType:this.$route.query.bizType,  //订单类型
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    bankCardNoInit() {
      var slfe = this
      let  objForm ={bizId:this.bizId,bizType:this.bizType}
      var t2 = window.setInterval(function () {
        slfe.$api.getBizStatus({bizId:slfe.bizId,bizType:slfe.bizType}).then(res => {
            if(res.body.status==1 &&  Number(slfe.bizType)==0 || res.body.status==1 && Number(slfe.bizType)==1 || res.body.status==4 && Number(slfe.bizType)==1){   //人脸识别未出结果
                 slfe.$api.getApplyStatus({bizId:slfe.bizId,bizType:slfe.bizType,status:res.body.status}).then(res=>{
                     if(res.body.faceResult==0 || res.body.faceResult==3){  //人脸识别失败
                         slfe.dataInfo =res.body
                         slfe.ResultIs =true
                          window.clearInterval(t2)  // 去除定时器
                     }else if(res.body.faceResult==1) {  //人脸识别成功
                          window.clearInterval(t2)  // 去除定时器
                         slfe.$router.push({path:'/main/bancardsucces',query:{bizId:slfe.bizId,bizType:slfe.bizType}})     
                     }else if(res.body.faceResult==2){  //人脸识别中
                          
                     }
                 })        
            }else if(res.body.status==2 &&  Number(slfe.bizType)==0  || res.body.status==6 &&  Number(slfe.bizType)==1){  //人脸识别成功 最后一步
             window.clearInterval(t2)  // 去除定时器
             slfe.$router.push({path:'/main/bancardsucces',query:{bizId:slfe.bizId,bizType:slfe.bizType}})  
            }else if(res.body.status==3 &&  Number(slfe.bizType)==1 ){ //人脸识别成功  完成保理付款服务合同签署,待进行分销主体人脸认证
                  window.clearInterval(t2)  // 去除定时器
                  slfe.$router.push({path:'/',query:{bizId:slfe.bizId,bizType:slfe.bizType}})       
            }else if(res.body.status==99 &&  Number(slfe.bizType)==0 || res.body.status==88 &&  Number(slfe.bizType)==1  || res.body.status==99 &&  Number(slfe.bizType)==1){   //人脸识别失败
                       window.clearInterval(t2)  // 去除定时器  
                        slfe.dataInfo =res.body
                        slfe.ResultIs =true    //重试
            }    
        })
      }, 5000)
    },
    getQueryVariable(variable) {  //获取url参数
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) { return pair[1]; }
      }
      return (false);
    },
    checkBtn(){  //重新校验
           let objUrl
            if (process.env.NODE_ENV === "development") {  //开发环境
             objUrl = `https://t.finlean.com/comn_business/#/main/queryres?bizId=${this.bizId}&bizType=${this.bizType}`
            }  else{  //生产
              objUrl = `${window.location.origin}/comn_business/#/main/queryres?bizId=${this.bizId}&bizType=${this.bizType}`
            }
           this.$api.refreshFaceStatus({bizId:this.bizId,bizType:this.bizType,callbackUrl:objUrl}).then(res => {
               window.location.href =res.body.faceUrl               
            })      
    },
    refreshBtn(){
        this.bankCardNoInit()
    }
  },
  //生命周期 - 创建完成(可以访问当前this实例)
  created() {
     this.$api.getBizStatus({bizId:this.bizId,bizType:this.bizType}).then(res=>{
       if(res.body.status==99 &&  Number(this.bizType)==0 || res.body.status==88 &&  Number(this.bizType)==1  || res.body.status==99 &&  Number(this.bizType)==1){
             return this.ResultIs =true   
       }else{
             this.bankCardNoInit()
       }
     })
    // if(this.getQueryVariable('orderNo')){
    //       this.orderNo=this.getQueryVariable('orderNo')
    // }else{
    //         this.orderNo=this.$route.query.orderNo 
    // }
 
    // let  orderStatus =this.$route.query.orderStatus   
    // if(orderStatus && orderStatus==3){
    //         this.datastr='正在审核订单,请稍后...'
    //       //  this.bankCardNoInit()
    //          window.location.href ="https://www.shouxinshibai.com/"    
    // }else{
 
    // this.datastr='正在审核订单,请稍后...'
    // // this.bankCardNoInit()
    // }
  },
  //生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {
 
  },
}
</script>
<style   lang="less"  scoped>
img {
  margin: 10px auto;
}
.content {
  text-align: center;
  .content-text {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
  }
  .content-main {
    font-weight: 500;
    color: #999999;
  }
  .btn-content{
    display: flex;
    margin-top: 20px;
   justify-content:space-around;
  }
  .van-button{
    width: 150px;
  }
}
</style>