Преглед изворни кода

提现前,添加人脸认证

martin.ma пре 4 година
родитељ
комит
23b2aa549b
1 измењених фајлова са 70 додато и 1 уклоњено
  1. 70 1
      pages/wo/cash.vue

+ 70 - 1
pages/wo/cash.vue

@@ -55,6 +55,14 @@
       </div>
     </el-dialog>
     <SuccessToast :isShowToast="isShowToastSuccess" @close="isShowToastSuccess=false"/>
+
+    <el-dialog title="温馨提示" :visible.sync="centerDialogVisible" width="350px" center>
+        <p class="qrcode-tips">请打开支付宝扫码以下二维码</p>
+        <div class="qrcode-img">
+            <img :src="qrcodeBase64" />
+        </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -64,6 +72,7 @@ import InnerHeader from "@/components/inner_header";
 import SuccessToast from "@/components/wo/successToast";
 const Max_Money = 30000
 const Min_Money = 10
+import QRCode from "qrcode";
 
 export default {
   components: {
@@ -83,6 +92,8 @@ export default {
       rate: "",
       isIdCard: false, //是否是提现到银行卡
       isShowToastSuccess: false, //是否展示成功后的提示
+      qrcodeBase64: "",
+      centerDialogVisible:false
     };
   },
   computed: {
@@ -183,6 +194,16 @@ export default {
         this.$message("可提现余额不足");
         return;
       }
+
+      // 判断是否已过人脸
+      let isFace = await this.checkIsFace()
+
+      if(!isFace) {
+        this.$message.info("为了您的资金安全,本次操作需要进行人脸认证。")
+        await this.callFaceQrcode()
+        return 
+      }
+      
       this.dialogShow = true;
       let res = await this.$axios.$post("/api/user/send_mobile_auth_code", {
         mobile: this.userinfo.mobile,
@@ -190,6 +211,50 @@ export default {
       });
     },
     /**
+     * 检查是否完成人脸认证
+     */
+    async checkIsFace(){
+      try{
+        let res = await this.$axios.$post("/uapi/user/realName/check");
+        if(res.status == 1 && res.data.is_face === 1){
+          return true
+        }else{
+          return false
+        }
+
+      }catch(e){
+        return false
+      }
+    },
+  /**
+     * 检查是否完成人脸认证
+     */
+     async callFaceQrcode(){
+      try{
+        
+        // let res = await this.$axios.$post("/uapi/user/realName/face");
+        // console.log(res);
+
+        let qrcode = 'http://www.baidu.com'
+        let that = this;
+        QRCode.toDataURL(
+            qrcode, {
+                errorCorrectionLevel: "H",
+                margin: 1,
+                width: 300
+            },
+            function (err, url) {
+                that.qrcodeBase64 = url;
+                that.centerDialogVisible = true
+            }
+        );
+
+      }catch(e){
+        return false
+      }
+    },
+
+    /**
      * 点击验证码
      */
     doDialogConfirm() {
@@ -244,8 +309,9 @@ export default {
   display: flex;
   flex-direction: column;
   align-items: center;
-  height: 590px;
+  /* height: 590px; */
   background: white;
+  padding-bottom: 20px;
 }
 h2 {
   margin: 64px 0 8px;
@@ -306,4 +372,7 @@ h2 {
   margin: 10px 0;
   text-align: center;
 }
+.qrcode-tips{
+  text-align: center;
+}
 </style>