bzkf3 2 years ago
parent
commit
4a8c610466
1 changed files with 50 additions and 9 deletions
  1. 50 9
      src/pages/stxk/jz/kcxq.vue

+ 50 - 9
src/pages/stxk/jz/kcxq.vue

@@ -149,14 +149,55 @@ if (code) {
       }
     })
     .then((res) => {
-      location.search = "";
-      if (res) {
-        /* todo: 支付成功 */
-        orderStatus = 2;
-        // router.replace('/stsk/jz/wd')
-      } else {
+      return new Promise((resolve, reject) => {
+        if (res) {
+          location.search = "";
+
+          /* todo: 支付成功 */
+          orderStatus = 1;
+          // router.replace('/stsk/jz/wd')
+          const t1 = Date.now()
+
+          let timer = setInterval(() => {
+            if (Date.now() - t1 > 5000) {
+              clearInterval(timer)
+              timer = null
+              resolve(0)
+            } else {
+              request({
+                url: "/khfw/kcgl/detail",
+                data: {
+                  token: child.token,
+                  kk_id: props.id,
+                },
+              }).then(res => {
+                if (res.code === "1") {
+                  const _detailInfo = res.data.one_info;
+
+                  if (detailInfo.khfw_kcbmxx.kkbm_id === "0") {
+                    orderStatus = 0;
+                    resolve(0)
+                  }
+                  else if (detailInfo.khfw_kcbmxx.kjf_zfzt === "1") {
+                    orderStatus = 1;
+                  } else if (_detailInfo.khfw_kcbmxx.kjf_zfzt === "2") {
+                    orderStatus = 2;
+                    resolve(2)
+                  }
+                }
+              })
+            }
+          }, 1000)
+
+        } else {
+          resolve(0)
+        }
+      });
+    }).then(res => {
+      if (res === 0) {
+        orderStatus = 0;
       }
-    });
+    })
 }
 
 const orderStatusText = computed(() => {
@@ -236,8 +277,8 @@ const orderStatusText = computed(() => {
             </div>
             <div>{{ item.intro }}</div>
             <!-- <ul class="list-disc list-inside">
-                  <li>{{ detailInfo.kk_teacher.intro }}</li>
-                </ul> -->
+                                  <li>{{ detailInfo.kk_teacher.intro }}</li>
+                                </ul> -->
           </div>
         </div>
         <div v-else>暂无数据</div>