Blame view

js/wxpayResult.js 2.41 KB
d68fc748   liuqimichale   多笔缴纳费用
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  
  window.onload = function () {
      var tmpParams = getQueryString(window.location);
      if (tmpParams != null) {
          console.log(JSON.stringify(tmpParams));
          if (tmpParams.trade_no == "success") {
              getResponse("success");
          } else {
              getResponse("fail");
          }
          //alertMsg("支付返回参数:" + JSON.stringify(tmpParams));
      } else {
          console.log("支付返回参数" + tmpParams);
      }
  }
  
  //type[fail、sucesss]
  function getResponse(type) {
      var img = document.getElementById("stateImg");
      var label = document.getElementById("stateLable");
      if (type == "fail") {
          img.src = "img/no.png";
          label.innerHTML = "支付失败,尝试重新扫码";
          setTimeout(function () {
              alert('1')
  
              if (navigator.userAgent.indexOf("MSIE") > 0) {
                  if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
                      window.opener = null;
                      window.close();
                  }
                  else {
                      window.open('', '_top');
                      window.top.close();
                  }
              }
              else if (navigator.userAgent.indexOf("Firefox") > 0) {
                  window.location.href = 'about:blank '; //火狐默认状态非window.open的页面window.close是无效的
                  //window.history.go(-2);
              }
              else {
                  window.opener = null;
                  window.open('', '_self', '');
                  window.close();
              }
          }, 2000)
      } else {
          img.src = "img/ok.png";
          label.innerHTML = "订单支付成功";
          setTimeout(function () {
              if (navigator.userAgent.indexOf("MSIE") > 0) {
                  if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
                      window.opener = null;
                      window.close();
                  }
                  else {
                      window.open('', '_top');
                      window.top.close();
                  }
              }
              else if (navigator.userAgent.indexOf("Firefox") > 0) {
                  window.location.href = 'about:blank '; //火狐默认状态非window.open的页面window.close是无效的
                  //window.history.go(-2);
              }
              else {
                  window.opener = null;
                  window.open('', '_self', '');
                  window.close();
              }
          }, 2000)
      }
  }