xiongzhu 4 tahun lalu
induk
melakukan
4385799ad1
1 mengubah file dengan 18 tambahan dan 3 penghapusan
  1. 18 3
      src/main/resources/templates/PayOrderPC.ftlh

+ 18 - 3
src/main/resources/templates/PayOrderPC.ftlh

@@ -38,24 +38,39 @@
     payParams.success = function (res) {
         showDialog({
             title: '支付成功',
+            message: '',
             confirm: function () {
                 window.close();
             }
         });
     };
     payParams.fail = function (e) {
+        console.log(e);
         showDialog({
             title: '支付取消',
+            message: '',
             confirm: function () {
                 window.close();
             }
         });
     }
     console.log(payParams);
-    document.onload = function () {
-        setTimeout(function () {
+    window.onload = function () {
+        $.get('/wx/jsapiSign', {url: encodeURI(window.location.href.split('#')[0]),}, function (res) {
+            res.debug = true;
+            res.jsApiList = [
+                'chooseWXPay',
+                'updateAppMessageShareData',
+                'updateTimelineShareData',
+                'hideAllNonBaseMenuItem',
+                'scanQRCode',
+            ];
+            wx.config(res);
+        });
+        wx.ready(function (res) {
+            console.log('jssdk ready', res);
             wx.chooseWXPay(payParams);
-        }, 300);
+        });
     }
 
     function showDialog(options) {