Przeglądaj źródła

购物车地址

zhangdehua 1 rok temu
rodzic
commit
5a67ba2771
1 zmienionych plików z 14 dodań i 4 usunięć
  1. 14 4
      app/index/view/cart/shoppingCart.html

+ 14 - 4
app/index/view/cart/shoppingCart.html

@@ -677,14 +677,12 @@
                 "delivery": 10,
                 "address_id": addressId
             }
-            console.log(params)
             const res = await orderPayment(params)
-            console.log(res)
             const {status, message, data} = res || {}
             if (status === 200 || status === "200") {
                 window.open(data.payment.approval_link, "_blank");
-                setInterval(function (){
-                    console.log('hahaha');
+                var interId =  setInterval(function (){
+                    fetchOrder(data.orderId, interId);
                 },2000)
             } else if (status === 401 || status === "401") {
                 window.location.replace('../passport/logIn.html')
@@ -693,6 +691,18 @@
             }
         });
 
+        function fetchOrder(orderId, interId){
+            $.get('/index/order/detail?orderId='+ orderId,function (res){
+                console.log(res.data.order.pay_status);
+                if (res.status == 200 && res.data.order.pay_status == 20){
+                    clearInterval(interId);
+                    $("#loadingModel").hide(0);
+                    window.location.replace('/index/user/orderDetails.html?orderDetails=' + orderId)
+                }
+            })
+        }
+
+
         //支付
         $(".checkoutButton").on(tap, async function () {
             console.log("points")