1
zhaoxiaoqiang
2022-11-28 912aeddb56e0514dd9fd0b0db10319b81d9976fc
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!--
 * @Author: 小明丶
 * @Date: 2020-05-20 20:29:47
 * @LastEditors: zxq
 * @LastEditTime: 2022-11-28 11:05:10
 * @Description:
-->
<template>
  <div class="home-index-page">
    <div class="top-bg-box">
      <!-- <div class="sweep-box" @click="goOrderHandling">
        <div class="sweep-top">
          <i class="iconfont iconsaoyisao"></i>
        </div>
        <div class="sweep-bottom">
          <p>扫一扫</p>
        </div>
      </div> -->
      <div class="btn-box">
        <button @click="goOrderHandling">办理分期</button>
      </div>
      <!-- <div class="text-box">
        <p>客服电话:028-86043722</p>
        <p>联系邮箱:kefu@finlean.com</p>
      </div> -->
    </div>
    <van-dialog v-model="show" title="错误提示">
      <div class="dialog-box">
        <!-- <p>由于系统问题,暂时无法申请订单,请稍候再试。</p> -->
        <p>{{errText}}</p>
      </div>
    </van-dialog>
  </div>
</template>
<script>
import Vue from 'vue';
import { Dialog } from 'vant';
 
// 全局注册
Vue.use(Dialog);
export default {
  data() {
    return {
      show:false,
      errText:'',
      businessInfo: {}, //扫码获取商户信息
      str: "" //二维码获取的字符串
    };
  },
  created() {
    this.getWXToken();
    // 判断微信接口是否支持
    wx.checkJsApi({
      jsApiList: ["checkJsApi", "scanQRCode"], // 需要检测的JS接口列表
      success: function(res) {
        console.log(res)
      }
    });
 
  },
  methods: {
    /**
     * 获取当前账号订单进行步骤
     *
     *  NO_SCAN(0,"待扫码"),调用扫码
     *  NO_ID(1,"待上传身份证"),跳转上传身份证页面
     *  NO_FACE(2,"待人脸识别"),跳转第三方人脸识别
     *  NO_USER_INFO(3,"待填写个人信息"),跳转个人信息填写页面
     *  NO_CONT_INFO(4,"待签署合同"),跳转合同签署页面
     *  NO_IMG_INFO(5,"待上传影像资料"),跳转图片上传页面
     *  AUDIT(6,"待审核");跳转审核结果页面
     * **/
    orderCreateStep() {
      this.$api.orderCreateStep().then(res => {
        localStorage.setItem('projId',res.body.projId?res.body.projId:100000);
        // res.body.createStep = 4;
        if (res.body.createStep == 0) {
          //调用摄像头
          this.getCamera();
        }
        if (res.body.createStep == 1) {
          this.$router.push("/order-handling/upload-IDcard");
        }
        if (res.body.createStep == 2) {
            //重新人脸识别,先去协议页面;
            this.$router.push({
              path: "/order-handling/face-recognition",
              query: {isFaceBack:'1'}
            });
          // let str = location.host
          // this.$api
          //   .getFaceUrl({
          //     callbackUrl:
          //       `https://${str}/aic_cus/#/order-handling/face-recognition`
          //   })
          //   .then(res => {
          //     window.location.href = res.body.faceUrl;
          //   });
          //this.$router.push('/order-handling/upload-IDcard')
        }
        if (res.body.createStep == 3) {
          this.$router.push("/order-handling/upload-userInfo");
        }
        if (res.body.createStep == 4) {
          window.sessionStorage.backUrl = '/home/index'
          this.$router.push("/order-handling/contract-signing");
        }
        if (res.body.createStep == 5) {
          this.$router.push(res.body.projId=='100000'?"/order-handling/approval-results":"/order-handling/image-upload");
        }
        if (res.body.createStep == 6) {
          this.$router.push("/order-handling/approval-results");
        }
      }).catch(err=>{
        this.errText = err.errMsg
        this.show = true
      })
    },
    // 点击获取当前账号在第几步直接跳转到对应步骤
    goOrderHandling() {
      this.orderCreateStep();
    },
    // 异步准备微信环境
    checkIsReady() {
      return new Promise((resolve, reject) => {
        wx.ready(() => resolve());
        wx.error(err => reject(console.log(res + "wx.error")));
      });
    },
    // 调取微信jssdk,需要获取token
    getWXToken() {
      //let url = window.location.origin + window.location.pathname;
      let url = location.href.split('#')[0]
      this.$api.wechatgetSign({ url }).then(
        res => {
          
          // 第二步骤   只需要首页地址分享 ,需要在每次变化时调用
          wx.config({
            debug: false, // 开启调试模式
            appId: res.body.appId,
            timestamp: res.body.timestamp, // 必填,生成签名的时间戳
            nonceStr: res.body.nonceStr, // 必填,生成签名的随机串
            signature: res.body.signature, // 必填,签名,见附录1
            jsApiList: ["checkJsApi", "scanQRCode"] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
          });
          wx.error(function (res) {
            console.log(res)
            // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错
          });
        },
        error => {
          console.log(error);
        }
      );
    },
    //调用摄像头扫码
    getCamera() {
      let _this = this;
      this.checkIsReady().then(() => {
        if (window.android && window.android.fetchQrCode) {
          window.android.fetchQrCode();
        } else {
 
          wx.scanQRCode({
            needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
            scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
            success: function(res) {
              var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
              console.log(result);
              _this.str = res.resultStr;
              _this.$router.push({
                path: "/order-handling",
                query: {
                  url: _this.str
                }
              });
            }
          });
        }
      });
    }
  }
};
</script>
<style lang="less" scoped>
.home-index-page {
  & {
    background: #fff;
    height:calc(100vh - 52px);
  }
  .top-bg-box{
    &{
      width: 100%;
      height:calc(100vh - 52px);
      background: url('../../../static/img/homeBack.jpg');
      background-size: 100% 100%;
      position: relative;
    }
    .btn-box{
      position: absolute;
      text-align: center;
      bottom: 147px;
      width: 100%;
      button{
        width:210px;
        height:40px;
        background:rgba(255,255,255,1);
        box-shadow:0px 0px 10px 0px rgba(23,154,198,0.26), 0px -2px 5px 0px rgba(46,150,238,0.3) inset;
        border-radius:20px;
        outline: none;
        border: 0;
        color: #5194FE;
      }
    }
    .text-box{
      text-align: center;
      width: 100%;
      position: absolute;
      bottom: 66px;
      p{
        font-size:12px;
        font-family:PingFang SC;
        font-weight:500;
        color:rgba(255,255,255,1);
      }
      p:nth-of-type(1){
        margin-bottom: 6px;
      }
    }
  }
  // .top-bg-box {
  //   position: relative;
  //   width: 100vw;
  //   height: 130px;
  //   background-image: url("../../../static/img/bg.png");
  //   background-size: cover;
  //   .sweep-box {
  //     width: 120px;
  //     height: 90px;
  //     background: rgba(255, 255, 255, 1);
  //     box-shadow: 0px 0px 15px 0px rgba(26, 100, 225, 0.12);
  //     border-radius: 8px;
  //     position: absolute;
  //     left: 50%;
  //     top: 78px;
  //     transform: translateX(-50%);
  //     text-align: center;
  //     .sweep-top {
  //       height: 52px;
  //       color: #5e9cff;
  //       line-height: 52px;
  //       i {
  //         font-size: 35px;
  //       }
  //     }
  //     .sweep-bottom {
  //       height: 38px;
  //       line-height: 38px;
  //       p {
  //         font-size: 16px;
  //         font-family: PingFang SC;
  //         font-weight: 500;
  //         color: rgba(51, 51, 51, 1);
  //       }
  //     }
  //   }
  // }
  .dialog-box{
    height: 100px;
    box-sizing: border-box;
    padding: 25px 25px ;
    text-align: left;
    p{
      line-height: 20px;
      color: #666666;
      font-size: 14px;
    }
  }
}
</style>