Commit c334155877549d803b6a0fa17b649abfd1178577
1 parent
6d697968
格式化
Showing
1 changed file
with
200 additions
and
181 deletions
js/pay.js
... | ... | @@ -27,12 +27,12 @@ window.onload = function () { |
27 | 27 | wx.onclick = webAppClass.wxClick; |
28 | 28 | //$btnObj.onclick = webAppClass.okClick; |
29 | 29 | |
30 | - $btnObj.onclick = webAppClass.okPay; | |
30 | + $btnObj.onclick = webAppClass.okPay; | |
31 | 31 | |
32 | 32 | document.getElementById("payTip").innerHTML = ""; |
33 | 33 | //参数 |
34 | 34 | webAppParams = getQueryString(window.location); |
35 | - if (webAppParams!=null) { | |
35 | + if (webAppParams != null) { | |
36 | 36 | //设置UI参数 |
37 | 37 | webAppClass.setUI(webAppParams); |
38 | 38 | } else { |
... | ... | @@ -50,111 +50,112 @@ window.onload = function () { |
50 | 50 | /**/ |
51 | 51 | var webAppClass = { |
52 | 52 | //优惠券兑换 |
53 | - codediscountClick:function(tmpObj){ | |
54 | - discountVal = document.getElementById("discountBox").value; | |
55 | - // console.log(discountVal) | |
56 | - // console.log(discountVal.length) | |
57 | - if(discountVal.length > 0){ | |
58 | - $btnObj.style.display = "none"; | |
59 | - $btnLoad.style.display = "block"; | |
60 | - $discountBtn.disabled = true | |
61 | - console.log(webAppParams.orderId) | |
62 | - var url = webAppRoot + window.webAppH5.discountServer; | |
63 | - var discountParams = { | |
64 | - app_id:'1', | |
65 | - salt:'1', | |
66 | - deviceInfo:'1', | |
67 | - sign_type:'1', | |
68 | - sign:'1', | |
69 | - token:'1', | |
70 | - terminalSource:7, | |
71 | - orderId:webAppParams.orderId, | |
72 | - cardNo:discountVal, | |
73 | - codeType:0 | |
74 | - } | |
75 | - postRequest(url, discountParams, function (res) { | |
76 | - console.log(res) | |
77 | - if(res.code==0){ | |
78 | - | |
79 | - document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) | |
80 | - document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
81 | - document.getElementById("discountFee").innerHTML = (res.data.discountFee/100) | |
82 | - document.getElementById("discountDesc").style.display="none" | |
83 | - $btnLoad.style.display = "none"; | |
84 | - $btnObj.style.display = "block"; | |
85 | - flag = 1; | |
86 | - webAppClass.okPay(tmpObj);//唤醒支付 | |
87 | - }else{ | |
88 | - $btnLoad.style.display = "none"; | |
89 | - $btnObj.style.display = "block"; | |
90 | - $discountBtn.disabled = false; | |
91 | - document.getElementById("discountTip").innerHTML = res.message | |
92 | - } | |
93 | - }) | |
53 | + codediscountClick: function (tmpObj) { | |
54 | + discountVal = document.getElementById("discountBox").value; | |
55 | + // console.log(discountVal) | |
56 | + // console.log(discountVal.length) | |
57 | + if (discountVal.length > 0) { | |
58 | + $btnObj.style.display = "none"; | |
59 | + $btnLoad.style.display = "block"; | |
60 | + $discountBtn.disabled = true | |
61 | + console.log(webAppParams.orderId) | |
62 | + var url = webAppRoot + window.webAppH5.discountServer; | |
63 | + var discountParams = { | |
64 | + app_id: '1', | |
65 | + salt: '1', | |
66 | + deviceInfo: '1', | |
67 | + sign_type: '1', | |
68 | + sign: '1', | |
69 | + token: '1', | |
70 | + terminalSource: 7, | |
71 | + orderId: webAppParams.orderId, | |
72 | + cardNo: discountVal, | |
73 | + codeType: 0 | |
74 | + } | |
75 | + postRequest(url, discountParams, function (res) { | |
76 | + console.log(res) | |
77 | + if (res.code == 0) { | |
78 | + | |
79 | + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | |
80 | + document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
81 | + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | |
82 | + document.getElementById("discountDesc").style.display = "none" | |
83 | + $btnLoad.style.display = "none"; | |
84 | + $btnObj.style.display = "block"; | |
85 | + flag = 1; | |
86 | + webAppClass.okPay(tmpObj);//唤醒支付 | |
87 | + } else { | |
88 | + $btnLoad.style.display = "none"; | |
89 | + $btnObj.style.display = "block"; | |
90 | + $discountBtn.disabled = false; | |
91 | + document.getElementById("discountTip").innerHTML = res.message | |
92 | + } | |
93 | + }) | |
94 | 94 | |
95 | - }else{ | |
96 | - return | |
97 | - } | |
98 | - }, | |
99 | - discountClick: function(){ | |
100 | - discountVal = document.getElementById("discountBox").value; | |
101 | - // console.log(discountVal) | |
102 | - // console.log(discountVal.length) | |
103 | - if(discountVal.length > 0){ | |
104 | - $btnObj.style.display = "none"; | |
105 | - $btnLoad.style.display = "block"; | |
106 | - $discountBtn.disabled = true | |
107 | - // console.log(webAppParams.orderId); | |
108 | - if(webAppParams===null ||webAppParams==='null'||webAppParams===undefined){ | |
109 | - document.getElementById("discountTip").innerHTML = '缺少参数'; | |
110 | - $btnLoad.style.display = "none"; | |
111 | - $btnObj.style.display = "block"; | |
112 | - return false; | |
113 | - } | |
114 | - var url = webAppRoot + window.webAppH5.discountServer; | |
115 | - var discountParams = { | |
116 | - app_id:'1', | |
117 | - salt:'1', | |
118 | - deviceInfo:'1', | |
119 | - sign_type:'1', | |
120 | - sign:'1', | |
121 | - token:'1', | |
122 | - terminalSource:7, | |
123 | - orderId:webAppParams.orderId, | |
124 | - cardNo:discountVal, | |
125 | - codeType:0 | |
95 | + } else { | |
96 | + return | |
126 | 97 | } |
127 | - postRequest(url, discountParams, function (res) { | |
128 | - console.log(res) | |
129 | - if(res.code==0){ | |
130 | - | |
131 | - document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) | |
132 | - document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
133 | - document.getElementById("discountFee").innerHTML = (res.data.discountFee/100) | |
134 | - document.getElementById("discountDesc").style.display="none" | |
98 | + }, | |
99 | + discountClick: function () { | |
100 | + discountVal = document.getElementById("discountBox").value; | |
101 | + // console.log(discountVal) | |
102 | + // console.log(discountVal.length) | |
103 | + if (discountVal.length > 0) { | |
104 | + $btnObj.style.display = "none"; | |
105 | + $btnLoad.style.display = "block"; | |
106 | + $discountBtn.disabled = true | |
107 | + // console.log(webAppParams.orderId); | |
108 | + if (webAppParams === null || webAppParams === 'null' || webAppParams === undefined) { | |
109 | + document.getElementById("discountTip").innerHTML = '缺少参数'; | |
110 | + $btnLoad.style.display = "none"; | |
111 | + $btnObj.style.display = "block"; | |
112 | + return false; | |
113 | + } | |
114 | + var url = webAppRoot + window.webAppH5.discountServer; | |
115 | + var discountParams = { | |
116 | + app_id: '1', | |
117 | + salt: '1', | |
118 | + deviceInfo: '1', | |
119 | + sign_type: '1', | |
120 | + sign: '1', | |
121 | + token: '1', | |
122 | + terminalSource: 7, | |
123 | + orderId: webAppParams.orderId, | |
124 | + cardNo: discountVal, | |
125 | + codeType: 0 | |
126 | + } | |
127 | + postRequest(url, discountParams, function (res) { | |
128 | + console.log(res) | |
129 | + if (res.code == 0) { | |
130 | + | |
131 | + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | |
132 | + document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
133 | + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | |
134 | + document.getElementById("discountDesc").style.display = "none" | |
135 | + $btnLoad.style.display = "none"; | |
136 | + $btnObj.style.display = "block"; | |
137 | + document.getElementById("discountBox").setAttribute('readonly', 'readonly'); | |
138 | + flag = 1 | |
139 | + } else { | |
140 | + $btnLoad.style.display = "none"; | |
141 | + $btnObj.style.display = "block"; | |
142 | + $discountBtn.disabled = false; | |
143 | + document.getElementById("discountTip").innerHTML = res.message | |
144 | + } | |
145 | + }) | |
146 | + | |
147 | + } else { | |
135 | 148 | $btnLoad.style.display = "none"; |
136 | 149 | $btnObj.style.display = "block"; |
137 | - document.getElementById("discountBox").setAttribute('readonly','readonly'); | |
138 | - flag = 1 | |
139 | - }else{ | |
140 | - $btnLoad.style.display = "none"; | |
141 | - $btnObj.style.display = "block"; | |
142 | - $discountBtn.disabled = false; | |
143 | - document.getElementById("discountTip").innerHTML = res.message | |
144 | - } | |
145 | - }) | |
146 | - | |
147 | - }else{ | |
148 | - $btnLoad.style.display = "none"; | |
149 | - $btnObj.style.display = "block"; | |
150 | - return false; | |
151 | - } | |
150 | + return false; | |
151 | + } | |
152 | 152 | }, |
153 | 153 | //OK |
154 | 154 | okClick: function (ev) { |
155 | 155 | document.getElementById("payTip").innerHTML = ""; |
156 | 156 | if (webAppParams == null) { |
157 | - alertMsg("暂无订单信息");return; | |
157 | + alertMsg("暂无订单信息"); | |
158 | + return; | |
158 | 159 | } |
159 | 160 | //先校验停车费用后缴费提交 |
160 | 161 | webAppClass.checkParkCost(); |
... | ... | @@ -163,7 +164,7 @@ var webAppClass = { |
163 | 164 | checkParkCost: function () { |
164 | 165 | $btnObj.style.display = "none"; |
165 | 166 | $btnLoad.style.display = "block"; |
166 | - if (typeof(webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 | |
167 | + if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 | |
167 | 168 | window.history.back(-1); |
168 | 169 | } |
169 | 170 | var tmpParams = JSON.parse(webAppParams.queryOrderInfo); |
... | ... | @@ -174,23 +175,24 @@ var webAppClass = { |
174 | 175 | if (res.code == 0) {//进场 |
175 | 176 | var tmpObj = res.data; |
176 | 177 | if (tmpObj) { |
177 | - if(flag == 1){ | |
178 | - webAppClass.codediscountClick(tmpObj); | |
179 | - }else{ | |
180 | - webAppClass.setUI(tmpObj); | |
181 | - webAppParams = tmpObj;//重新赋值 | |
182 | - webAppClass.okPay(tmpObj);//唤醒支付 | |
178 | + if (flag == 1) { | |
179 | + webAppClass.codediscountClick(tmpObj); | |
180 | + } else { | |
181 | + webAppClass.setUI(tmpObj); | |
182 | + webAppParams = tmpObj;//重新赋值 | |
183 | + webAppClass.okPay(tmpObj);//唤醒支付 | |
183 | 184 | } |
184 | 185 | |
185 | - console.log(tmpObj) | |
186 | - // webAppClass.okPay(tmpObj);//唤醒支付 | |
186 | + console.log(tmpObj) | |
187 | + // webAppClass.okPay(tmpObj);//唤醒支付 | |
187 | 188 | } else { |
188 | 189 | alertMsg("没有找到相应订单"); |
189 | 190 | } |
190 | 191 | } else {//其他情况如【该卡号场内已存在】 |
191 | 192 | $btnLoad.style.display = "none"; |
192 | 193 | $btnObj.style.display = "block"; |
193 | - console.log(res.message); alertMsg(res.message); | |
194 | + console.log(res.message); | |
195 | + alertMsg(res.message); | |
194 | 196 | } |
195 | 197 | }, function (err) { |
196 | 198 | console.log("网络服务超时..." + url); |
... | ... | @@ -204,18 +206,22 @@ var webAppClass = { |
204 | 206 | //确定支付 |
205 | 207 | okPay: function (params) { |
206 | 208 | var orderID = webAppParams.orderId;//订单号 |
207 | - // alert(orderID) | |
209 | + // alert(orderID) | |
208 | 210 | //var moneyID = document.getElementById("sumMoney").innerHTML = webAppParams.orderId;//订单号 |
209 | 211 | var val = document.getElementById("sumMoney").innerText; |
210 | 212 | //var couponPersonId = document.getElementById("discountBox").value; |
211 | 213 | var url = webAppRoot + window.webAppH5.zeroPayServer; |
212 | - var _paySrcType = getQueryString(window.location)._paySrcType | |
214 | + var _paySrcType = getQueryString(window.location)._paySrcType | |
213 | 215 | var _mon = document.getElementById("sumMoney").innerText |
214 | 216 | |
215 | 217 | var discountParams = { |
216 | - payOrderType : _paySrcType, | |
217 | - recordArreaInfos:JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]), | |
218 | - terminalSource:7, | |
218 | + payOrderType: _paySrcType, | |
219 | + recordArreaInfos: JSON.stringify([{ | |
220 | + "orderId": webAppParams.orderId, | |
221 | + "orderNotPayFee": _mon * 100, | |
222 | + "parkId": getQueryString(window.location).parkCode | |
223 | + }]), | |
224 | + terminalSource: 7, | |
219 | 225 | orderId: webAppParams.orderId, |
220 | 226 | //couponPersonId:couponPersonId, |
221 | 227 | app_id: '123', |
... | ... | @@ -224,10 +230,10 @@ var webAppClass = { |
224 | 230 | deviceInfo: '123', |
225 | 231 | sign: '123', |
226 | 232 | } |
227 | - if(val == '0.00' || val=='0'){ | |
233 | + if (val == '0.00' || val == '0') { | |
228 | 234 | postRequest(url, discountParams, function (res) { |
229 | 235 | console.log(res) |
230 | - if(res.code==0){ | |
236 | + if (res.code == 0) { | |
231 | 237 | document.getElementById("paySuccess").style.display = 'block' |
232 | 238 | // |
233 | 239 | // document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) |
... | ... | @@ -238,13 +244,13 @@ var webAppClass = { |
238 | 244 | // $btnObj.style.display = "block"; |
239 | 245 | // document.getElementById("discountBox").setAttribute('readonly','readonly'); |
240 | 246 | // flag = 1 |
241 | - }else{ | |
247 | + } else { | |
242 | 248 | alert(res.message) |
243 | 249 | // $discountBtn.disabled = false |
244 | 250 | // document.getElementById("discountTip").innerHTML = res.message |
245 | 251 | } |
246 | 252 | }) |
247 | - }else { | |
253 | + } else { | |
248 | 254 | var root = webAppRoot; |
249 | 255 | //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] |
250 | 256 | var clientType = clientBrowserEx(); |
... | ... | @@ -259,24 +265,22 @@ var webAppClass = { |
259 | 265 | //debugger; |
260 | 266 | |
261 | 267 | |
262 | - | |
263 | - | |
264 | - // //新增start | |
265 | - // | |
266 | - // var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | |
267 | - // //window.location.href = url; | |
268 | - // var wxPay = webAppH5.wxPayServer; | |
269 | - // var wxParams = webAppH5.comParams; | |
270 | - // wxParams.carNumber = getQueryString(window.location).carnum; | |
271 | - // wxParams.orderId = orderID; | |
272 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
273 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
274 | - // | |
275 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
276 | - // | |
277 | - // wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
278 | - // | |
279 | - // //新增end | |
268 | + // //新增start | |
269 | + // | |
270 | + // var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | |
271 | + // //window.location.href = url; | |
272 | + // var wxPay = webAppH5.wxPayServer; | |
273 | + // var wxParams = webAppH5.comParams; | |
274 | + // wxParams.carNumber = getQueryString(window.location).carnum; | |
275 | + // wxParams.orderId = orderID; | |
276 | + // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
277 | + // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
278 | + // | |
279 | + // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
280 | + // | |
281 | + // wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
282 | + // | |
283 | + // //新增end | |
280 | 284 | |
281 | 285 | // if (webAppCode == null || webAppCode == "") {//code检测 |
282 | 286 | // alertMsg(appState.codeNullTip); |
... | ... | @@ -300,7 +304,11 @@ var webAppClass = { |
300 | 304 | aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 |
301 | 305 | aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 |
302 | 306 | |
303 | - aliParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
307 | + aliParams.recordArreaInfos = JSON.stringify([{ | |
308 | + "orderId": webAppParams.orderId, | |
309 | + "orderNotPayFee": _mon * 100, | |
310 | + "parkId": getQueryString(window.location).parkCode | |
311 | + }]); | |
304 | 312 | webAppClass.payAliAjax(root + aliPay, aliParams); |
305 | 313 | break; |
306 | 314 | default://第三方浏览器other |
... | ... | @@ -313,12 +321,16 @@ var webAppClass = { |
313 | 321 | var aliPay = webAppH5.aliPayServer; |
314 | 322 | var aliParams = webAppH5.comParams; |
315 | 323 | aliParams.orderId = orderID; |
316 | - aliParams.carNumber = getQueryString(window.location).carnum; | |
324 | + aliParams.carNumber = getQueryString(window.location).carnum; | |
317 | 325 | aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 |
318 | 326 | aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 |
319 | - aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
327 | + aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
320 | 328 | |
321 | - aliParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
329 | + aliParams.recordArreaInfos = JSON.stringify([{ | |
330 | + "orderId": webAppParams.orderId, | |
331 | + "orderNotPayFee": _mon * 100, | |
332 | + "parkId": getQueryString(window.location).parkCode | |
333 | + }]); | |
322 | 334 | |
323 | 335 | webAppClass.payAliAjax(root + aliPay, aliParams); |
324 | 336 | } else {//微信页面支付 |
... | ... | @@ -331,9 +343,13 @@ var webAppClass = { |
331 | 343 | wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 |
332 | 344 | wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 |
333 | 345 | |
334 | - wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
346 | + wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
335 | 347 | |
336 | - wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
348 | + wxParams.recordArreaInfos = JSON.stringify([{ | |
349 | + "orderId": webAppParams.orderId, | |
350 | + "orderNotPayFee": _mon * 100, | |
351 | + "parkId": getQueryString(window.location).parkCode | |
352 | + }]); | |
337 | 353 | webAppClass.payAjax(root + wxPay, wxParams); |
338 | 354 | console.log("wxPay"); |
339 | 355 | } |
... | ... | @@ -428,7 +444,7 @@ var webAppClass = { |
428 | 444 | //alertMsg("出场成功"); |
429 | 445 | if (res.data) { |
430 | 446 | var tmpObj = res.data; |
431 | - if (typeof (tmpObj.mwebUrl)!="undefined") { | |
447 | + if (typeof (tmpObj.mwebUrl) != "undefined") { | |
432 | 448 | window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult; |
433 | 449 | } else { |
434 | 450 | alertMsg("没有返回支付地址mwebUrl"); |
... | ... | @@ -452,7 +468,7 @@ var webAppClass = { |
452 | 468 | payAjaxJDK: function (orderID) { |
453 | 469 | var btnOBj = $btnObj; |
454 | 470 | //0:页面初始化获取code[webAppCode] |
455 | - var codeParams = { code: webAppCode, appId: appWxID }; | |
471 | + var codeParams = {code: webAppCode, appId: appWxID}; | |
456 | 472 | var openIdUrl = webAppRoot + window.webAppH5.wxGetOpenIdServer; |
457 | 473 | |
458 | 474 | //1:有code获取OpenId |
... | ... | @@ -461,15 +477,13 @@ var webAppClass = { |
461 | 477 | if (res.code == 0) { |
462 | 478 | //alert(res.data); |
463 | 479 | webAppClass.getPayParams(res.data, orderID); |
464 | - } | |
465 | - else if (res.code == 40163) {//code been used, hints[重复code问题] | |
480 | + } else if (res.code == 40163) {//code been used, hints[重复code问题] | |
466 | 481 | |
467 | 482 | alertMsg(appState.codeNullTip); |
468 | 483 | console.log(res.message); |
469 | 484 | $btnObj.style.display = "block"; |
470 | 485 | $btnLoad.style.display = "none"; |
471 | - } | |
472 | - else { | |
486 | + } else { | |
473 | 487 | alertMsg(res.message); |
474 | 488 | $btnObj.style.display = "block"; |
475 | 489 | $btnLoad.style.display = "none"; |
... | ... | @@ -494,16 +508,20 @@ var webAppClass = { |
494 | 508 | //webAppClass.payAjax(root + wxPay, wxParams); |
495 | 509 | |
496 | 510 | |
497 | - //新增start | |
511 | + //新增start | |
498 | 512 | |
499 | 513 | |
500 | - wxParams.carNumber = getQueryString(window.location).carnum; | |
514 | + wxParams.carNumber = getQueryString(window.location).carnum; | |
501 | 515 | |
502 | - wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
516 | + wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
503 | 517 | |
504 | - wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
518 | + wxParams.recordArreaInfos = JSON.stringify([{ | |
519 | + "orderId": webAppParams.orderId, | |
520 | + "orderNotPayFee": _mon * 100, | |
521 | + "parkId": getQueryString(window.location).parkCode | |
522 | + }]); | |
505 | 523 | |
506 | - //新增end | |
524 | + //新增end | |
507 | 525 | |
508 | 526 | |
509 | 527 | wxParams.openId = openId; |
... | ... | @@ -511,10 +529,10 @@ var webAppClass = { |
511 | 529 | var payParamsUrl = webAppRoot + window.webAppH5.wxPayServer; |
512 | 530 | alert('调接口之前') |
513 | 531 | alert(payParamsUrl) |
514 | - alert(JSON.stringify(wxParams)) | |
532 | + alert(JSON.stringify(wxParams)) | |
515 | 533 | //alert(payParamsUrl);alert(orderID); |
516 | 534 | postRequest(payParamsUrl, wxParams, function (res) { |
517 | - alert('走了微信支付接口') | |
535 | + alert('走了微信支付接口') | |
518 | 536 | $btnObj.style.display = "block"; |
519 | 537 | $btnLoad.style.display = "none"; |
520 | 538 | //debugger; |
... | ... | @@ -531,7 +549,8 @@ var webAppClass = { |
531 | 549 | } else { |
532 | 550 | $btnLoad.style.display = "none"; |
533 | 551 | $btnObj.style.display = "block"; |
534 | - console.log(res.message); alertMsg(res.message); | |
552 | + console.log(res.message); | |
553 | + alertMsg(res.message); | |
535 | 554 | } |
536 | 555 | }, function (err) { |
537 | 556 | console.log("网络地址出错..."); |
... | ... | @@ -546,30 +565,29 @@ var webAppClass = { |
546 | 565 | function onBridgeReady() { |
547 | 566 | WeixinJSBridge.invoke( |
548 | 567 | 'getBrandWCPayRequest', params, |
549 | - //'getBrandWCPayRequest', { | |
550 | - // "appId": appWxID, //公众号名称,由商户传入 | |
551 | - // "timeStamp": "1395712654", //时间戳,自1970年以来的秒数 | |
552 | - // "nonceStr": "e61463f8efa94090b1f366cccfbbb444", //随机串 | |
553 | - // "package": "prepay_id=u802345jgfjsdfgsdg888", | |
554 | - // "signType": "MD5", //微信签名方式: | |
555 | - // "paySign": "70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名 | |
556 | - //}, | |
557 | - function (res) { | |
558 | - //alert(res.err_msg); | |
559 | - if (res.err_msg == "get_brand_wcpay_request:ok") { | |
560 | - // 使用以上方式判断前端返回,微信团队郑重提示: | |
561 | - //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | |
562 | - window.location.href = webAppPayResult+"?trade_no=" + "success"; | |
563 | - } | |
564 | - else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | |
565 | - window.location.href = webAppPayResult + "?trade_no=" + "fail"; | |
566 | - } | |
567 | - else { | |
568 | - alertMsg(JSON.stringify(res)); | |
569 | - //alert(res.err_msg); | |
570 | - } | |
571 | - }); | |
568 | + //'getBrandWCPayRequest', { | |
569 | + // "appId": appWxID, //公众号名称,由商户传入 | |
570 | + // "timeStamp": "1395712654", //时间戳,自1970年以来的秒数 | |
571 | + // "nonceStr": "e61463f8efa94090b1f366cccfbbb444", //随机串 | |
572 | + // "package": "prepay_id=u802345jgfjsdfgsdg888", | |
573 | + // "signType": "MD5", //微信签名方式: | |
574 | + // "paySign": "70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名 | |
575 | + //}, | |
576 | + function (res) { | |
577 | + //alert(res.err_msg); | |
578 | + if (res.err_msg == "get_brand_wcpay_request:ok") { | |
579 | + // 使用以上方式判断前端返回,微信团队郑重提示: | |
580 | + //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | |
581 | + window.location.href = webAppPayResult + "?trade_no=" + "success"; | |
582 | + } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | |
583 | + window.location.href = webAppPayResult + "?trade_no=" + "fail"; | |
584 | + } else { | |
585 | + alertMsg(JSON.stringify(res)); | |
586 | + //alert(res.err_msg); | |
587 | + } | |
588 | + }); | |
572 | 589 | } |
590 | + | |
573 | 591 | if (typeof WeixinJSBridge == "undefined") { |
574 | 592 | if (document.addEventListener) { |
575 | 593 | document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); |
... | ... | @@ -595,7 +613,8 @@ var webAppClass = { |
595 | 613 | alertMsg(res.message); |
596 | 614 | } |
597 | 615 | }, function (err) { |
598 | - console.log("网络地址出错...");alertMsg("网络地址出错..."); | |
616 | + console.log("网络地址出错..."); | |
617 | + alertMsg("网络地址出错..."); | |
599 | 618 | $btnLoad.style.display = "none"; |
600 | 619 | btnOBj.style.display = "block"; |
601 | 620 | }); |
... | ... | @@ -619,7 +638,7 @@ var webAppClass = { |
619 | 638 | $discountDesc = getObjectByID("discountDesc"),//8折优惠折扣费用 |
620 | 639 | $discountFee = getObjectByID("discountFee");//优惠金额 |
621 | 640 | |
622 | - if (params != null && params!="") { | |
641 | + if (params != null && params != "") { | |
623 | 642 | var price = keepTwoDecimalFull((params.orderFee / 100));//(params.orderFee / 100); |
624 | 643 | $carNum.innerHTML = params.carnum;//手机号 |
625 | 644 | $orderNum.innerHTML = params.orderId;//订单号 |
... | ... | @@ -633,7 +652,7 @@ var webAppClass = { |
633 | 652 | $staytime.innerHTML = formatSeconds(params.staytime); |
634 | 653 | |
635 | 654 | $due.innerHTML = keepTwoDecimalFull((params.due / 100));//停车总费用 |
636 | - $paid.innerHTML = keepTwoDecimalFull(params.paid/100); | |
655 | + $paid.innerHTML = keepTwoDecimalFull(params.paid / 100); | |
637 | 656 | $discountFee.innerHTML = params.discountFee;//优惠金额 |
638 | 657 | // $discountDesc.innerHTML = params.discountDesc; |
639 | 658 | } else { | ... | ... |