Authored by 郝肖肖

alert openid

@@ -29,7 +29,7 @@ if (window.wx) { @@ -29,7 +29,7 @@ if (window.wx) {
29 } 29 }
30 30
31 function onBridgeReady() { 31 function onBridgeReady() {
32 - document.addEventListener('WeixinJSBridgeReady', function () { 32 + document.addEventListener('WeixinJSBridgeReady', function() {
33 window.WeixinJSBridge && window.WeixinJSBridge.call('hideOptionMenu'); 33 window.WeixinJSBridge && window.WeixinJSBridge.call('hideOptionMenu');
34 }); 34 });
35 } 35 }
@@ -54,7 +54,7 @@ function jsApiCall(orderCode, jsApiParameters) { @@ -54,7 +54,7 @@ function jsApiCall(orderCode, jsApiParameters) {
54 window.WeixinJSBridge && window.WeixinJSBridge.invoke( 54 window.WeixinJSBridge && window.WeixinJSBridge.invoke(
55 'getBrandWCPayRequest', 55 'getBrandWCPayRequest',
56 jsApiParameters, 56 jsApiParameters,
57 - function (res) { 57 + function(res) {
58 window.location.href = '/home/orders/detail?order_code=' + orderCode + '&openId=' + openId; 58 window.location.href = '/home/orders/detail?order_code=' + orderCode + '&openId=' + openId;
59 } 59 }
60 ); 60 );
@@ -73,6 +73,7 @@ function callpay(orderCode) { @@ -73,6 +73,7 @@ function callpay(orderCode) {
73 document.attachEvent('onWeixinJSBridgeReady', jsApiCall); 73 document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
74 } 74 }
75 } else { 75 } else {
  76 + console.log(openId, '=====');
76 $.ajax({ 77 $.ajax({
77 type: 'GET', 78 type: 'GET',
78 url: '/shopping/pay/wechatwapapi', 79 url: '/shopping/pay/wechatwapapi',
@@ -81,7 +82,7 @@ function callpay(orderCode) { @@ -81,7 +82,7 @@ function callpay(orderCode) {
81 'openId': openId, 82 'openId': openId,
82 }, 83 },
83 dataType: 'json', 84 dataType: 'json',
84 - success: function (res) { 85 + success: function(res) {
85 if (res.code === 200) { 86 if (res.code === 200) {
86 jsApiParameters = res.data.jsApiParameters; 87 jsApiParameters = res.data.jsApiParameters;
87 jsApiCall(orderCode, jsApiParameters); 88 jsApiCall(orderCode, jsApiParameters);
@@ -89,10 +90,10 @@ function callpay(orderCode) { @@ -89,10 +90,10 @@ function callpay(orderCode) {
89 tip.show('微信支付调取失败'); 90 tip.show('微信支付调取失败');
90 } 91 }
91 }, 92 },
92 - error: function () { 93 + error: function() {
93 tip.show('请刷新本页面,完成微信支付'); 94 tip.show('请刷新本页面,完成微信支付');
94 }, 95 },
95 - complete: function () { 96 + complete: function() {
96 $loadingToast.addClass("hide"); 97 $loadingToast.addClass("hide");
97 } 98 }
98 }); 99 });
@@ -109,7 +110,7 @@ function isWXOpen() { @@ -109,7 +110,7 @@ function isWXOpen() {
109 function hideWeChatPay() { 110 function hideWeChatPay() {
110 var $payApps = $('.app'); 111 var $payApps = $('.app');
111 112
112 - $payApps.each(function (idx, app) { 113 + $payApps.each(function(idx, app) {
113 if ($(app).parent().attr('id') === 'weixin') { 114 if ($(app).parent().attr('id') === 'weixin') {
114 $(app).parent().css('display', 'none'); 115 $(app).parent().css('display', 'none');
115 return false; 116 return false;
@@ -133,7 +134,7 @@ function loadIcon() { @@ -133,7 +134,7 @@ function loadIcon() {
133 var $div = null; 134 var $div = null;
134 var appid = null; 135 var appid = null;
135 136
136 - $boxs.each(function (idx, box) { 137 + $boxs.each(function(idx, box) {
137 $div = $(box).find('.icon').find('div'); 138 $div = $(box).find('.icon').find('div');
138 if ($div.length > 0) { 139 if ($div.length > 0) {
139 appid = $(box).attr('id'); 140 appid = $(box).attr('id');
@@ -151,15 +152,15 @@ function showPage() { @@ -151,15 +152,15 @@ function showPage() {
151 function bindTouchedEvent() { 152 function bindTouchedEvent() {
152 var $boxs = $('.box'); 153 var $boxs = $('.box');
153 154
154 - $boxs.on('touchstart', function (e) { 155 + $boxs.on('touchstart', function(e) {
155 $(this).addClass('bytouch'); 156 $(this).addClass('bytouch');
156 - }).on('touchend touchcancel', function () { 157 + }).on('touchend touchcancel', function() {
157 $boxs.removeClass('bytouch'); 158 $boxs.removeClass('bytouch');
158 }); 159 });
159 } 160 }
160 161
161 if (wxHammer) { 162 if (wxHammer) {
162 - wxHammer.on('tap', function () { 163 + wxHammer.on('tap', function() {
163 callpay(theOrderCode); 164 callpay(theOrderCode);
164 }); 165 });
165 } 166 }