Browse Source

Update kyc.vue

test 7 months ago
parent
commit
02b8ca8d40
1 changed files with 20 additions and 12 deletions
  1. 20 12
      src/views/kyc.vue

+ 20 - 12
src/views/kyc.vue

@@ -7,11 +7,15 @@
         </el-steps>
         <first v-if="level === 1" :orderNo="orderNo" :customer-id="customerId" :out-user-id="outUserId"
             @update-customer-id="onUpdateCustomerId"></first>
-        <second v-if="level === 2 && level <= levelEnd" :customer-id="customerId" @update-customer-id="onUpdateCustomerId"></second>
-        <third v-if="level === 3 && level <= levelEnd" :customer-id="customerId" @update-customer-id="onUpdateCustomerId"></third>
-        <el-result v-if="level > levelEnd && customerId" icon="success" title="Congratulations!" sub-title="You have completed the necessary KYC certification. .">
+        <second v-if="level === 2 && level <= levelEnd" :customer-id="customerId"
+            @update-customer-id="onUpdateCustomerId"></second>
+        <third v-if="level === 3 && level <= levelEnd" :customer-id="customerId"
+            @update-customer-id="onUpdateCustomerId"></third>
+        <el-result v-if="level > levelEnd && customerId" icon="success" title="Congratulations!"
+            sub-title="You have completed the necessary KYC certification. .">
             <template #extra>
-                <el-button :disabled="!canToPay" @click="clickToPay" type="primary">{{ canToPay ? 'Click To Pay' : 'Please Wait!'}}</el-button>
+                <el-button :disabled="!canToPay" @click="clickToPay" type="primary">{{ canToPay ? 'Click To Pay' :
+                    'Please Wait!'}}</el-button>
             </template>
         </el-result>
     </div>
@@ -46,24 +50,28 @@ const getKycLevel = async function () {
     customerId.value = data.customerId;
     outUserId.value = data.outUserId;
     levelEnd = +data.levelEnd;
+    payUrl = data.payUrl;
+    
     gotoPay();
 }
 
 const gotoPay = async function () {
     if (level.value > levelEnd && customerId.value) {
-        const data = await toPay({
-            customerId: customerId.value,
-            orderNo
-        });
+        if (!payUrl) {
+            const data = await toPay({
+                customerId: customerId.value,
+                orderNo
+            });
+            payUrl = data.payUrl;
+        }
         canToPay.value = true;
-        payUrl = data.payUrl;
-        setTimeout(function() {
+        setTimeout(function () {
             clickToPay();
-        }, 2000)
+        }, 800)
     }
 }
 
-const clickToPay = function() {
+const clickToPay = function () {
     window.location.href = payUrl;
 }