Commit 9931d3161388e27f0e41f20934b5b04fa0cbab5b
1 parent
afc9e308
格式化代码
Showing
4 changed files
with
910 additions
and
1035 deletions
js/common.js
... | ... | @@ -2,66 +2,70 @@ |
2 | 2 | state |
3 | 3 | */ |
4 | 4 | var appState = { |
5 | - defaultTime: 120,//默认2分钟倒计时 | |
6 | - countDownTime_timer: null,//支付倒计时 | |
7 | - codeNullTip: "微信授权失败,请您尝试重新扫码 !",//code获取失败提示语 | |
8 | - expandField_1: null,//扩展字段1-备用 | |
9 | - expandObj_1: null,//扩展字段1-备用 | |
5 | + defaultTime: 120,//默认2分钟倒计时 | |
6 | + countDownTime_timer: null,//支付倒计时 | |
7 | + codeNullTip: "微信授权失败,请您尝试重新扫码 !",//code获取失败提示语 | |
8 | + expandField_1: null,//扩展字段1-备用 | |
9 | + expandObj_1: null,//扩展字段1-备用 | |
10 | 10 | } |
11 | 11 | |
12 | 12 | /*自定义异步请求*/ |
13 | 13 | function ajax() { |
14 | - var ajaxData = { | |
15 | - type: (arguments[0].type || "GET").toUpperCase(), | |
16 | - url: arguments[0].url || "", | |
17 | - async: arguments[0].async || "true", | |
18 | - data: arguments[0].data || null, | |
19 | - dataType: arguments[0].dataType || "json", | |
20 | - contentType: arguments[0].contentType || "application/json; charset=utf-8", | |
21 | - beforeSend: arguments[0].beforeSend || function () { }, | |
22 | - success: arguments[0].success || function () { }, | |
23 | - error: arguments[0].error || function () { } | |
14 | + var ajaxData = { | |
15 | + type: (arguments[0].type || "GET").toUpperCase(), | |
16 | + url: arguments[0].url || "", | |
17 | + async: arguments[0].async || "true", | |
18 | + data: arguments[0].data || null, | |
19 | + dataType: arguments[0].dataType || "json", | |
20 | + contentType: arguments[0].contentType || "application/json; charset=utf-8", | |
21 | + beforeSend: arguments[0].beforeSend || function () { | |
22 | + }, | |
23 | + success: arguments[0].success || function () { | |
24 | + }, | |
25 | + error: arguments[0].error || function () { | |
24 | 26 | } |
27 | + } | |
25 | 28 | |
26 | - ajaxData.beforeSend() | |
27 | - var xhr = createxmlHttpRequest(); | |
28 | - xhr.responseType = ajaxData.dataType; | |
29 | + ajaxData.beforeSend() | |
30 | + var xhr = createxmlHttpRequest(); | |
31 | + xhr.responseType = ajaxData.dataType; | |
29 | 32 | |
30 | - xhr.open(ajaxData.type, ajaxData.url, ajaxData.async); | |
31 | - xhr.setRequestHeader("Content-Type", ajaxData.contentType); | |
32 | - xhr.send(convertData(ajaxData.data)); | |
33 | + xhr.open(ajaxData.type, ajaxData.url, ajaxData.async); | |
34 | + xhr.setRequestHeader("Content-Type", ajaxData.contentType); | |
35 | + xhr.send(convertData(ajaxData.data)); | |
33 | 36 | |
34 | - xhr.onreadystatechange = function () { | |
35 | - if (xhr.readyState == 4) { | |
36 | - if (xhr.status == 200) { | |
37 | - ajaxData.success(xhr.response) | |
38 | - } else { | |
39 | - ajaxData.error() | |
40 | - } | |
41 | - } | |
37 | + xhr.onreadystatechange = function () { | |
38 | + if (xhr.readyState == 4) { | |
39 | + if (xhr.status == 200) { | |
40 | + ajaxData.success(xhr.response) | |
41 | + } else { | |
42 | + ajaxData.error() | |
43 | + } | |
42 | 44 | } |
45 | + } | |
43 | 46 | } |
44 | 47 | |
45 | 48 | function createxmlHttpRequest() { |
46 | - if (window.ActiveXObject) { | |
47 | - return new ActiveXObject("Microsoft.XMLHTTP"); | |
48 | - } else if (window.XMLHttpRequest) { | |
49 | - return new XMLHttpRequest(); | |
50 | - } | |
49 | + if (window.ActiveXObject) { | |
50 | + return new ActiveXObject("Microsoft.XMLHTTP"); | |
51 | + } else if (window.XMLHttpRequest) { | |
52 | + return new XMLHttpRequest(); | |
53 | + } | |
51 | 54 | } |
52 | 55 | |
53 | 56 | function convertData(data) { |
54 | - if (typeof data === 'object') { | |
55 | - var convertResult = ""; | |
56 | - for (var c in data) { | |
57 | - convertResult += c + "=" + data[c] + "&"; | |
58 | - } | |
59 | - convertResult = convertResult.substring(0, convertResult.length - 1) | |
60 | - return convertResult; | |
61 | - } else { | |
62 | - return data; | |
57 | + if (typeof data === 'object') { | |
58 | + var convertResult = ""; | |
59 | + for (var c in data) { | |
60 | + convertResult += c + "=" + data[c] + "&"; | |
63 | 61 | } |
62 | + convertResult = convertResult.substring(0, convertResult.length - 1) | |
63 | + return convertResult; | |
64 | + } else { | |
65 | + return data; | |
66 | + } | |
64 | 67 | } |
68 | + | |
65 | 69 | ////////////////////////////////demo |
66 | 70 | //ajax({ |
67 | 71 | // type: "POST", |
... | ... | @@ -83,84 +87,85 @@ function convertData(data) { |
83 | 87 | // } |
84 | 88 | //}) |
85 | 89 | /*******common*********/ |
90 | + | |
86 | 91 | /*统一请求接口*/ |
87 | -function postRequest(url,params,successCallback, errorCallback) { | |
88 | - ajax({ | |
89 | - type: "POST", | |
90 | - url: url, | |
91 | - dataType: "json", | |
92 | - data: JSON.stringify(params), | |
93 | - beforeSend: function () { | |
94 | - //some js code | |
95 | - }, | |
96 | - success: function (msg) { | |
97 | - successCallback(msg); | |
98 | - //var res = msg; | |
99 | - //if (res.code == 0) {//进场 | |
92 | +function postRequest(url, params, successCallback, errorCallback) { | |
93 | + ajax({ | |
94 | + type: "POST", | |
95 | + url: url, | |
96 | + dataType: "json", | |
97 | + data: JSON.stringify(params), | |
98 | + beforeSend: function () { | |
99 | + //some js code | |
100 | + }, | |
101 | + success: function (msg) { | |
102 | + successCallback(msg); | |
103 | + //var res = msg; | |
104 | + //if (res.code == 0) {//进场 | |
100 | 105 | |
101 | - //} else {//其他情况如【该卡号场内已存在】 | |
102 | - // console.log(res.message); | |
103 | - //} | |
104 | - }, | |
105 | - error: function (err) { | |
106 | - errorCallback(err); | |
107 | - //console.log("网络地址出错...") | |
108 | - } | |
109 | - }) | |
106 | + //} else {//其他情况如【该卡号场内已存在】 | |
107 | + // console.log(res.message); | |
108 | + //} | |
109 | + }, | |
110 | + error: function (err) { | |
111 | + errorCallback(err); | |
112 | + //console.log("网络地址出错...") | |
113 | + } | |
114 | + }) | |
110 | 115 | } |
111 | 116 | |
112 | 117 | /*获取URL?参数*/ |
113 | 118 | function getQueryString(location) { |
114 | - //var url = location.search; //获取url中"?"符后的字串 | |
115 | - var url = location.search; | |
116 | - var theRequest = new Object(); | |
117 | - if (url.indexOf("?") != -1) { | |
118 | - var str = url.substr(1); | |
119 | - strs = str.split("&"); | |
120 | - for (var i = 0; i < strs.length; i++) { | |
121 | - theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]); | |
122 | - } | |
123 | - } else { | |
124 | - theRequest = null; | |
119 | + //var url = location.search; //获取url中"?"符后的字串 | |
120 | + var url = location.search; | |
121 | + var theRequest = new Object(); | |
122 | + if (url.indexOf("?") != -1) { | |
123 | + var str = url.substr(1); | |
124 | + strs = str.split("&"); | |
125 | + for (var i = 0; i < strs.length; i++) { | |
126 | + theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]); | |
125 | 127 | } |
126 | - return theRequest; | |
128 | + } else { | |
129 | + theRequest = null; | |
130 | + } | |
131 | + return theRequest; | |
127 | 132 | } |
128 | 133 | |
129 | 134 | /*统一提示信息*/ |
130 | 135 | window.alertMsg = function (txt) { |
131 | - var alertFram = document.createElement("DIV"); | |
132 | - alertFram.id = "alertFram"; | |
133 | - alertFram.style.position = "fixed"; | |
134 | - alertFram.style.width = "100%"; | |
135 | - alertFram.style.textAlign = "center"; | |
136 | - alertFram.style.top = "40%"; | |
137 | - alertFram.style.zIndex = "10001"; | |
138 | - strHtml = " <span style=\"font-family: 微软雅黑;display:inline-block;background:#333;color:#fff;padding:0 20px;line-height:36px;border-radius:6px; \">" + txt + "</span>"; | |
139 | - alertFram.innerHTML = strHtml; | |
140 | - document.body.appendChild(alertFram); | |
141 | - setTimeout((function () { | |
142 | - alertFram.style.display = "none"; | |
143 | - }), 2500); | |
136 | + var alertFram = document.createElement("DIV"); | |
137 | + alertFram.id = "alertFram"; | |
138 | + alertFram.style.position = "fixed"; | |
139 | + alertFram.style.width = "100%"; | |
140 | + alertFram.style.textAlign = "center"; | |
141 | + alertFram.style.top = "40%"; | |
142 | + alertFram.style.zIndex = "10001"; | |
143 | + strHtml = " <span style=\"font-family: 微软雅黑;display:inline-block;background:#333;color:#fff;padding:0 20px;line-height:36px;border-radius:6px; \">" + txt + "</span>"; | |
144 | + alertFram.innerHTML = strHtml; | |
145 | + document.body.appendChild(alertFram); | |
146 | + setTimeout((function () { | |
147 | + alertFram.style.display = "none"; | |
148 | + }), 2500); | |
144 | 149 | }; |
145 | 150 | |
146 | 151 | //四舍五入保留2位小数(不够位数,则用0替补) |
147 | 152 | function keepTwoDecimalFull(num) { |
148 | - var result = parseFloat(num); | |
149 | - if (isNaN(result)) { | |
150 | - alert('传递参数错误,请检查!'); | |
151 | - return false; | |
152 | - } | |
153 | - result = Math.round(num * 100) / 100; | |
154 | - var s_x = result.toString(); | |
155 | - var pos_decimal = s_x.indexOf('.'); | |
156 | - if (pos_decimal < 0) { | |
157 | - pos_decimal = s_x.length; | |
158 | - s_x += '.'; | |
159 | - } | |
160 | - while (s_x.length <= pos_decimal + 2) { | |
161 | - s_x += '0'; | |
162 | - } | |
163 | - return s_x; | |
153 | + var result = parseFloat(num); | |
154 | + if (isNaN(result)) { | |
155 | + alert('传递参数错误,请检查!'); | |
156 | + return false; | |
157 | + } | |
158 | + result = Math.round(num * 100) / 100; | |
159 | + var s_x = result.toString(); | |
160 | + var pos_decimal = s_x.indexOf('.'); | |
161 | + if (pos_decimal < 0) { | |
162 | + pos_decimal = s_x.length; | |
163 | + s_x += '.'; | |
164 | + } | |
165 | + while (s_x.length <= pos_decimal + 2) { | |
166 | + s_x += '0'; | |
167 | + } | |
168 | + return s_x; | |
164 | 169 | } |
165 | 170 | |
166 | 171 | /** |
... | ... | @@ -171,156 +176,155 @@ function keepTwoDecimalFull(num) { |
171 | 176 | * return URL参数字符串 |
172 | 177 | */ |
173 | 178 | var parseParams = function (data) { |
174 | - try { | |
175 | - var tempArr = []; | |
176 | - for (var i in data) { | |
177 | - var key = (i); | |
178 | - var value = encodeURIComponent(data[i]);//decodeURIComponent | |
179 | - tempArr.push(key + '=' + value); | |
180 | - } | |
181 | - var urlParamsStr = tempArr.join('&'); | |
182 | - return urlParamsStr; | |
183 | - } catch (err) { | |
184 | - return ''; | |
179 | + try { | |
180 | + var tempArr = []; | |
181 | + for (var i in data) { | |
182 | + var key = (i); | |
183 | + var value = encodeURIComponent(data[i]);//decodeURIComponent | |
184 | + tempArr.push(key + '=' + value); | |
185 | 185 | } |
186 | + var urlParamsStr = tempArr.join('&'); | |
187 | + return urlParamsStr; | |
188 | + } catch (err) { | |
189 | + return ''; | |
190 | + } | |
186 | 191 | }; |
187 | 192 | |
188 | - | |
189 | 193 | /*获取对象*/ |
190 | 194 | function getObjectByID(id) { |
191 | - return document.getElementById(id); | |
195 | + return document.getElementById(id); | |
192 | 196 | } |
193 | 197 | |
194 | - | |
195 | 198 | /*秒转时分*/ |
196 | 199 | function formatSeconds(value) { |
197 | - var secondTime = parseInt(value);// 秒 | |
198 | - var minuteTime = 0;// 分 | |
199 | - var hourTime = 0;// 小时 | |
200 | - if (secondTime > 60) {//如果秒数大于60,将秒数转换成整数 | |
201 | - //获取分钟,除以60取整数,得到整数分钟 | |
202 | - minuteTime = parseInt(secondTime / 60); | |
203 | - //获取秒数,秒数取佘,得到整数秒数 | |
204 | - secondTime = parseInt(secondTime % 60); | |
205 | - //如果分钟大于60,将分钟转换成小时 | |
206 | - if (minuteTime > 60) { | |
207 | - //获取小时,获取分钟除以60,得到整数小时 | |
208 | - hourTime = parseInt(minuteTime / 60); | |
209 | - //获取小时后取佘的分,获取分钟除以60取佘的分 | |
210 | - minuteTime = parseInt(minuteTime % 60); | |
211 | - } | |
200 | + var secondTime = parseInt(value);// 秒 | |
201 | + var minuteTime = 0;// 分 | |
202 | + var hourTime = 0;// 小时 | |
203 | + if (secondTime > 60) {//如果秒数大于60,将秒数转换成整数 | |
204 | + //获取分钟,除以60取整数,得到整数分钟 | |
205 | + minuteTime = parseInt(secondTime / 60); | |
206 | + //获取秒数,秒数取佘,得到整数秒数 | |
207 | + secondTime = parseInt(secondTime % 60); | |
208 | + //如果分钟大于60,将分钟转换成小时 | |
209 | + if (minuteTime > 60) { | |
210 | + //获取小时,获取分钟除以60,得到整数小时 | |
211 | + hourTime = parseInt(minuteTime / 60); | |
212 | + //获取小时后取佘的分,获取分钟除以60取佘的分 | |
213 | + minuteTime = parseInt(minuteTime % 60); | |
212 | 214 | } |
213 | - var result = "" + parseInt(secondTime) + "秒"; | |
215 | + } | |
216 | + var result = "" + parseInt(secondTime) + "秒"; | |
214 | 217 | |
215 | - if (minuteTime > 0) { | |
216 | - result = "" + parseInt(minuteTime) + "分" + result; | |
217 | - } | |
218 | - if (hourTime > 0) { | |
219 | - result = "" + parseInt(hourTime) + "小时" + result; | |
220 | - } | |
221 | - return result; | |
218 | + if (minuteTime > 0) { | |
219 | + result = "" + parseInt(minuteTime) + "分" + result; | |
220 | + } | |
221 | + if (hourTime > 0) { | |
222 | + result = "" + parseInt(hourTime) + "小时" + result; | |
223 | + } | |
224 | + return result; | |
222 | 225 | } |
223 | 226 | |
224 | 227 | /*只能输入数字加字母*/ |
225 | 228 | function checkCharAndNumber(ev) { |
226 | - //this.value = this.value.toUpperCase(); | |
227 | - var tmpValue = this.value.replace(/[^\d|chun]/g, ''); | |
228 | - this.value = this.value.toUpperCase(); | |
229 | + //this.value = this.value.toUpperCase(); | |
230 | + var tmpValue = this.value.replace(/[^\d|chun]/g, ''); | |
231 | + this.value = this.value.toUpperCase(); | |
229 | 232 | } |
230 | 233 | |
231 | 234 | /*检测当前app浏览器*/ |
232 | 235 | function clientBrowserEx() { |
233 | - var state = "other";//default | |
234 | - if (/MicroMessenger/.test(window.navigator.userAgent)) { | |
235 | - console.log("微信客户端"); | |
236 | - //this.switchShow("wxPay"); | |
237 | - state = "wxPay"; | |
238 | - } else if (/AlipayClient/.test(window.navigator.userAgent)) { | |
239 | - console.log("支付宝客户端"); | |
240 | - //this.switchShow("aliPay"); | |
241 | - state = "aliPay"; | |
242 | - } else { | |
243 | - console.log("其他浏览器"); | |
244 | - state = "other"; | |
245 | - } | |
246 | - return state; | |
236 | + var state = "other";//default | |
237 | + if (/MicroMessenger/.test(window.navigator.userAgent)) { | |
238 | + console.log("微信客户端"); | |
239 | + //this.switchShow("wxPay"); | |
240 | + state = "wxPay"; | |
241 | + } else if (/AlipayClient/.test(window.navigator.userAgent)) { | |
242 | + console.log("支付宝客户端"); | |
243 | + //this.switchShow("aliPay"); | |
244 | + state = "aliPay"; | |
245 | + } else { | |
246 | + console.log("其他浏览器"); | |
247 | + state = "other"; | |
248 | + } | |
249 | + return state; | |
247 | 250 | } |
248 | 251 | |
249 | - | |
250 | 252 | /*支付倒计时 @id*/ |
251 | 253 | function countDownTime(id) { |
252 | - $obj = getObjectByID(id); | |
253 | - getObjectByID("headTip").style.display = "block"; | |
254 | - var count = appState.defaultTime; | |
255 | - appState.countDownTime_timer = setInterval(function () { | |
256 | - if (count==0) { | |
257 | - clearInterval(appState.countDownTime_timer); | |
258 | - appState.countDownTime_timer = null; | |
259 | - $obj.innerHTML = count + "秒"; | |
260 | - //删除code后刷新 | |
261 | - window.location.href = funcUrlDel("code"); | |
262 | - } else { | |
263 | - --count; | |
264 | - $obj.innerHTML = count + "秒"; | |
265 | - } | |
266 | - }, 1000); | |
254 | + $obj = getObjectByID(id); | |
255 | + getObjectByID("headTip").style.display = "block"; | |
256 | + var count = appState.defaultTime; | |
257 | + appState.countDownTime_timer = setInterval(function () { | |
258 | + if (count == 0) { | |
259 | + clearInterval(appState.countDownTime_timer); | |
260 | + appState.countDownTime_timer = null; | |
261 | + $obj.innerHTML = count + "秒"; | |
262 | + //删除code后刷新 | |
263 | + window.location.href = funcUrlDel("code"); | |
264 | + } else { | |
265 | + --count; | |
266 | + $obj.innerHTML = count + "秒"; | |
267 | + } | |
268 | + }, 1000); | |
267 | 269 | } |
268 | 270 | |
269 | 271 | /*删除url中某个参数*/ |
270 | 272 | function funcUrlDel(name) { |
271 | - var loca = window.location; | |
272 | - var baseUrl = loca.origin + loca.pathname + "?"; | |
273 | - var query = loca.search.substr(1); | |
274 | - if (query.indexOf(name) > -1) { | |
275 | - var obj = {} | |
276 | - var arr = query.split("&"); | |
277 | - for (var i = 0; i < arr.length; i++) { | |
278 | - arr[i] = arr[i].split("="); | |
279 | - obj[arr[i][0]] = arr[i][1]; | |
280 | - }; | |
281 | - delete obj[name]; | |
282 | - var url = baseUrl + JSON.stringify(obj).replace(/[\"\{\}]/g, "").replace(/\:/g, "=").replace(/\,/g, "&"); | |
283 | - return url | |
284 | - } else { | |
285 | - return loca.href; | |
273 | + var loca = window.location; | |
274 | + var baseUrl = loca.origin + loca.pathname + "?"; | |
275 | + var query = loca.search.substr(1); | |
276 | + if (query.indexOf(name) > -1) { | |
277 | + var obj = {} | |
278 | + var arr = query.split("&"); | |
279 | + for (var i = 0; i < arr.length; i++) { | |
280 | + arr[i] = arr[i].split("="); | |
281 | + obj[arr[i][0]] = arr[i][1]; | |
286 | 282 | } |
283 | + ; | |
284 | + delete obj[name]; | |
285 | + var url = baseUrl + JSON.stringify(obj).replace(/[\"\{\}]/g, "").replace(/\:/g, "=").replace(/\,/g, "&"); | |
286 | + return url | |
287 | + } else { | |
288 | + return loca.href; | |
289 | + } | |
287 | 290 | } |
291 | + | |
288 | 292 | var userAgent = navigator.userAgent; |
289 | 293 | var isAndroid = userAgent.indexOf('Android') > -1 || userAgent.indexOf('Adr') > -1; //android终端 |
290 | 294 | |
291 | -function utilParams(val,orderID,openId) { | |
292 | - var _orderTotalFee = Number($('#due').text())*100 //总金额 | |
295 | +function utilParams(val, orderID, openId) { | |
296 | + var _orderTotalFee = Number($('#due').text()) * 100 //总金额 | |
293 | 297 | var fee = $('#discountFee').text() |
294 | 298 | var _fee = fee.substring(0, fee.length - 1); |
295 | - var _orderDicountFee = Number(_fee)*100 //优惠了多少钱 | |
299 | + var _orderDicountFee = Number(_fee) * 100 //优惠了多少钱 | |
296 | 300 | var _orderActFee = _orderTotalFee - _orderDicountFee //实收多少钱 |
297 | 301 | var jsondata; |
298 | - if(_orderDicountFee > 0){ | |
302 | + if (_orderDicountFee > 0) { | |
299 | 303 | jsondata = { |
300 | - orderBigType:100, | |
301 | - payOrderType:101, | |
302 | - rltOrderId:orderID, | |
303 | - payType:val, | |
304 | - terminalSource:7, | |
305 | - orderActFee:_orderActFee, | |
306 | - orderTotalFee:_orderTotalFee, | |
307 | - orderDicountFee:_orderDicountFee, | |
308 | - payUserId:openId, | |
309 | - terminalOS:isAndroid?'AND':'IOS', | |
310 | - couponType:1, //优惠类型 | |
311 | - couponCode:$('#discountBox').val(), | |
304 | + orderBigType: 100, | |
305 | + payOrderType: 101, | |
306 | + rltOrderId: orderID, | |
307 | + payType: val, | |
308 | + terminalSource: 7, | |
309 | + orderActFee: _orderActFee, | |
310 | + orderTotalFee: _orderTotalFee, | |
311 | + orderDicountFee: _orderDicountFee, | |
312 | + payUserId: openId, | |
313 | + terminalOS: isAndroid ? 'AND' : 'IOS', | |
314 | + couponType: 1, //优惠类型 | |
315 | + couponCode: $('#discountBox').val(), | |
312 | 316 | }; |
313 | - }else{ | |
317 | + } else { | |
314 | 318 | jsondata = { |
315 | - orderBigType:100, | |
316 | - payOrderType:101, | |
317 | - rltOrderId:orderID, | |
318 | - payType:val, | |
319 | - terminalSource:7, | |
320 | - orderActFee:_orderActFee, | |
321 | - orderTotalFee:_orderTotalFee, | |
322 | - payUserId:openId, | |
323 | - terminalOS:isAndroid?'AND':'IOS', | |
319 | + orderBigType: 100, | |
320 | + payOrderType: 101, | |
321 | + rltOrderId: orderID, | |
322 | + payType: val, | |
323 | + terminalSource: 7, | |
324 | + orderActFee: _orderActFee, | |
325 | + orderTotalFee: _orderTotalFee, | |
326 | + payUserId: openId, | |
327 | + terminalOS: isAndroid ? 'AND' : 'IOS', | |
324 | 328 | }; |
325 | 329 | } |
326 | 330 | return jsondata | ... | ... |
js/config.js
... | ... | @@ -5,7 +5,6 @@ |
5 | 5 | */ |
6 | 6 | window.webAppH5 = {}; |
7 | 7 | |
8 | - | |
9 | 8 | /*服务器地址*/ |
10 | 9 | // var webAppRoot = "http://pay.service.huangshiparking.com"; |
11 | 10 | //test 测试环境 |
... | ... | @@ -15,19 +14,19 @@ var webAppPayResult = "http://wxgzh.huangshiparking.com/HSwechat/PDA-Payment/wxp |
15 | 14 | |
16 | 15 | /*公共参数*/ |
17 | 16 | webAppH5.comParams = { |
18 | - app_id: 'wx945eccc8163fd75b', | |
19 | - salt: 2, | |
20 | - deviceInfo: 3, | |
21 | - sign_type: 'md5', | |
22 | - sign: 4, | |
23 | - token: '666' | |
17 | + app_id: 'wx945eccc8163fd75b', | |
18 | + salt: 2, | |
19 | + deviceInfo: 3, | |
20 | + sign_type: 'md5', | |
21 | + sign: 4, | |
22 | + token: '666' | |
24 | 23 | } |
25 | 24 | |
26 | 25 | //小票扫码支付参数 |
27 | 26 | webAppH5.dynCode = {//卫岗固定参数 |
28 | - direction: 1, | |
29 | - codeType: 1, | |
30 | - channelId: "小票二维码" | |
27 | + direction: 1, | |
28 | + codeType: 1, | |
29 | + channelId: "小票二维码" | |
31 | 30 | } |
32 | 31 | |
33 | 32 | /*出、入场接口*/ |
... | ... | @@ -49,19 +48,9 @@ webAppH5.useCouponQueryFee = "/keyTopQrCodeInOutPark/useCouponQueryFee"; |
49 | 48 | /*0元支付*/ |
50 | 49 | webAppH5.zeroPayServer = "/appAccountPay/zeroPay"; |
51 | 50 | |
52 | - | |
53 | 51 | // 新接口银联 |
54 | 52 | webAppH5.doPay = "/unionpay/doPay"; |
55 | 53 | |
56 | - | |
57 | - | |
58 | - | |
59 | - | |
60 | - | |
61 | - | |
62 | - | |
63 | - | |
64 | - | |
65 | 54 | /*入场参数*/ |
66 | 55 | //测试地址 |
67 | 56 | //http://localhost:18879/page/in.html?plNo=P11011700C&parkingId=1&channelId=172198242&direction=0&codeType=0&expireDate=expireDate&extendData=extendData |
... | ... | @@ -89,7 +78,6 @@ webAppH5.doPay = "/unionpay/doPay"; |
89 | 78 | //http://39.98.54.240/codepay/index.html?appid=0&lotId=1&payConfigId=2&receiptNo=3 |
90 | 79 | //http://localhost:1260/codepay/index.html?appid=0&lotId=1&payConfigId=2&receiptNo=3 |
91 | 80 | |
92 | - | |
93 | 81 | //首页 |
94 | 82 | //进出场标识>>>>>>>>>>direction=0 [通行方向 入:0,1:出 必填] |
95 | 83 | //测试服务器进场首页 |
... | ... | @@ -98,15 +86,12 @@ webAppH5.doPay = "/unionpay/doPay"; |
98 | 86 | //测试服务器出场首页 |
99 | 87 | //http://39.98.54.240/codepay/index.html?plNo=P11011700C&parkingId=1&channelId=172198243&direction=1&codeType=0&expireDate=expireDate&extendData=extendData |
100 | 88 | |
101 | - | |
102 | - | |
103 | 89 | //测试支付[任你停测试-首页-停车记录(停车列表车牌号,再找到对应停车场编号)] |
104 | 90 | //http://test.renniting.cn/parking/admin/SubMenus/allparkrecords.html |
105 | 91 | |
106 | 92 | //http://localhost:1260/pay.html?orderId=101526715300086198272&parkName=%E9%9D%99%E9%9B%85%E5%9C%B0%E4%B8%8A&parkCode=B1504020C7&inparktime=2018-12-24%2010%3A58%3A24&outtime=2018-12-24%2011%3A05%3A10&staytime=420&due=70&paid=0&orderTotalFee=70&orderFee=7&discountFee=63&plateno=%E8%92%99DTK366&outPayOrderNo=B1504020C720181224110510813DTK366-172192102&appOrderTimeout=%E8%AF%B7%E5%9C%A8%E6%94%AF%E4%BB%98%E5%AE%8C%E6%88%9010%E5%88%86%E9%92%9F%E5%86%85%E5%87%BA%E5%9C%BA%EF%BC%8C%E5%A6%82%E8%B6%85%E6%97%B6%E6%9C%AA%E5%87%BA%E5%9C%BA%EF%BC%8C%E4%BC%9A%E7%BB%A7%E7%BB%AD%E8%AE%A1%E8%B4%B9%E3%80%82&discountDesc=1%E6%8A%98%E4%BC%98%E6%83%A0&queryOrderInfo=%7B%22app_id%22%3A%221%22%2C%22carNumber%22%3A%22%E8%92%99DTK366%22%2C%22channelId%22%3A%22172192102%22%2C%22codeType%22%3A0%2C%22deviceInfo%22%3A%223%22%2C%22direction%22%3A1%2C%22parkingId%22%3A%22B1504020C7%22%2C%22plNo%22%3A%22B1504020C7%22%2C%22salt%22%3A%222%22%2C%22sign%22%3A%224%22%2C%22sign_type%22%3A%22md5%22%2C%22terminalSource%22%3A%227%22%2C%22token%22%3A%22666%22%7D&needPay=true |
107 | 93 | |
108 | - | |
109 | -function IsWeixinOrAlipay(){ | |
94 | +function IsWeixinOrAlipay() { | |
110 | 95 | // |
111 | 96 | // var ua = window.navigator.userAgent; |
112 | 97 | // //判断是不是微信 |
... | ... | @@ -120,12 +105,12 @@ function IsWeixinOrAlipay(){ |
120 | 105 | // //哪个都不 |
121 | 106 | // return "false"; |
122 | 107 | var clientType = clientBrowserEx(); |
123 | - if(clientType=='wxPay'){ | |
108 | + if (clientType == 'wxPay') { | |
124 | 109 | return 4 |
125 | - }else if(clientType=='aliPay'){ | |
126 | - return 1 | |
127 | - }else { | |
128 | - return 1 | |
110 | + } else if (clientType == 'aliPay') { | |
111 | + return 1 | |
112 | + } else { | |
113 | + return 1 | |
129 | 114 | } |
130 | 115 | } |
131 | 116 | ... | ... |
js/pay.js
1 | - | |
2 | -var webAppParams = null; | |
1 | +var webAppParams = null; | |
3 | 2 | var $btnObj = null; |
4 | 3 | var $btnLoad = null; |
5 | 4 | var flag = 0; |
... | ... | @@ -8,688 +7,583 @@ var appWxID = getQueryString(window.location).appId; |
8 | 7 | var webAppCode = null;//如果是微信,先获取微信code |
9 | 8 | //var $btnLoad = document.getElementById("loading"); |
10 | 9 | window.onload = function () { |
11 | - //var root = document.getElementById("root"); | |
12 | - $btnObj = document.getElementById("btnPayOK"); | |
13 | - $btnLoad = document.getElementById("loading"); | |
14 | - | |
15 | - $discountBtn = document.getElementById("discountBtn"); | |
16 | - var webRoot = window.location.href; | |
17 | - //设置当前客户端浏览器模式[微信、支付宝、其他] | |
18 | - webAppClass.clientBrowser(); | |
19 | - //绑定事件 | |
20 | - var ali = document.getElementById("rowAliPay"); | |
21 | - var wx = document.getElementById("rowWxPay"); | |
22 | - ali.onclick = webAppClass.aliClick; | |
23 | - wx.onclick = webAppClass.wxClick; | |
24 | - //$btnObj.onclick = webAppClass.okClick; | |
25 | - | |
26 | - $btnObj.onclick = webAppClass.okPay; | |
27 | - | |
28 | - document.getElementById("payTip").innerHTML = ""; | |
29 | - //参数 | |
30 | - webAppParams = getQueryString(window.location); | |
31 | - if (webAppParams != null) { | |
32 | - console.log(webAppParams.carNumber) | |
33 | - | |
34 | - | |
35 | - //设置UI参数 | |
36 | - webAppClass.setUI(webAppParams); | |
37 | - } else { | |
38 | - alertMsg("暂无订单信息"); | |
39 | - } | |
40 | - | |
41 | - //获取微信code | |
42 | - //webAppClass.getCode(); | |
43 | - var state = clientBrowserEx(); | |
44 | - if (state == "wxPay") { | |
45 | - webAppCode = webAppClass.getCode(); | |
46 | - } | |
47 | - // $discountBtn.onclick = webAppClass.discountClick; | |
10 | + //var root = document.getElementById("root"); | |
11 | + $btnObj = document.getElementById("btnPayOK"); | |
12 | + $btnLoad = document.getElementById("loading"); | |
13 | + | |
14 | + $discountBtn = document.getElementById("discountBtn"); | |
15 | + var webRoot = window.location.href; | |
16 | + //设置当前客户端浏览器模式[微信、支付宝、其他] | |
17 | + webAppClass.clientBrowser(); | |
18 | + //绑定事件 | |
19 | + var ali = document.getElementById("rowAliPay"); | |
20 | + var wx = document.getElementById("rowWxPay"); | |
21 | + ali.onclick = webAppClass.aliClick; | |
22 | + wx.onclick = webAppClass.wxClick; | |
23 | + //$btnObj.onclick = webAppClass.okClick; | |
24 | + | |
25 | + $btnObj.onclick = webAppClass.okPay; | |
26 | + | |
27 | + document.getElementById("payTip").innerHTML = ""; | |
28 | + //参数 | |
29 | + webAppParams = getQueryString(window.location); | |
30 | + if (webAppParams != null) { | |
31 | + console.log(webAppParams.carNumber) | |
32 | + | |
33 | + //设置UI参数 | |
34 | + webAppClass.setUI(webAppParams); | |
35 | + } else { | |
36 | + alertMsg("暂无订单信息"); | |
37 | + } | |
38 | + | |
39 | + //获取微信code | |
40 | + //webAppClass.getCode(); | |
41 | + var state = clientBrowserEx(); | |
42 | + if (state == "wxPay") { | |
43 | + webAppCode = webAppClass.getCode(); | |
44 | + } | |
45 | + // $discountBtn.onclick = webAppClass.discountClick; | |
48 | 46 | } |
49 | 47 | /**/ |
50 | 48 | var webAppClass = { |
51 | - //优惠券兑换 | |
52 | - codediscountClick: function (tmpObj) { | |
53 | - discountVal = document.getElementById("discountBox").value; | |
54 | - // console.log(discountVal) | |
55 | - // console.log(discountVal.length) | |
56 | - if (discountVal.length > 0) { | |
57 | - $btnObj.style.display = "none"; | |
58 | - $btnLoad.style.display = "block"; | |
59 | - $discountBtn.disabled = true | |
60 | - console.log(webAppParams.orderId) | |
61 | - var url = webAppRoot + window.webAppH5.discountServer; | |
62 | - var discountParams = { | |
63 | - app_id: '1', | |
64 | - salt: '1', | |
65 | - deviceInfo: '1', | |
66 | - sign_type: '1', | |
67 | - sign: '1', | |
68 | - token: '1', | |
69 | - terminalSource: 7, | |
70 | - orderId: webAppParams.orderId, | |
71 | - cardNo: discountVal, | |
72 | - codeType: 0 | |
73 | - } | |
74 | - postRequest(url, discountParams, function (res) { | |
75 | - console.log(res) | |
76 | - if (res.code == 0) { | |
77 | - | |
78 | - document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | |
79 | - document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
80 | - document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | |
81 | - document.getElementById("discountDesc").style.display = "none" | |
82 | - $btnLoad.style.display = "none"; | |
83 | - $btnObj.style.display = "block"; | |
84 | - flag = 1; | |
85 | - webAppClass.okPay(tmpObj);//唤醒支付 | |
86 | - } else { | |
87 | - $btnLoad.style.display = "none"; | |
88 | - $btnObj.style.display = "block"; | |
89 | - $discountBtn.disabled = false; | |
90 | - document.getElementById("discountTip").innerHTML = res.message | |
91 | - } | |
92 | - }) | |
93 | - | |
49 | + //优惠券兑换 | |
50 | + codediscountClick: function (tmpObj) { | |
51 | + discountVal = document.getElementById("discountBox").value; | |
52 | + // console.log(discountVal) | |
53 | + // console.log(discountVal.length) | |
54 | + if (discountVal.length > 0) { | |
55 | + $btnObj.style.display = "none"; | |
56 | + $btnLoad.style.display = "block"; | |
57 | + $discountBtn.disabled = true | |
58 | + console.log(webAppParams.orderId) | |
59 | + var url = webAppRoot + window.webAppH5.discountServer; | |
60 | + var discountParams = { | |
61 | + app_id: '1', | |
62 | + salt: '1', | |
63 | + deviceInfo: '1', | |
64 | + sign_type: '1', | |
65 | + sign: '1', | |
66 | + token: '1', | |
67 | + terminalSource: 7, | |
68 | + orderId: webAppParams.orderId, | |
69 | + cardNo: discountVal, | |
70 | + codeType: 0 | |
71 | + } | |
72 | + postRequest(url, discountParams, function (res) { | |
73 | + console.log(res) | |
74 | + if (res.code == 0) { | |
75 | + | |
76 | + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | |
77 | + document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
78 | + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | |
79 | + document.getElementById("discountDesc").style.display = "none" | |
80 | + $btnLoad.style.display = "none"; | |
81 | + $btnObj.style.display = "block"; | |
82 | + flag = 1; | |
83 | + webAppClass.okPay(tmpObj);//唤醒支付 | |
94 | 84 | } else { |
95 | - return | |
85 | + $btnLoad.style.display = "none"; | |
86 | + $btnObj.style.display = "block"; | |
87 | + $discountBtn.disabled = false; | |
88 | + document.getElementById("discountTip").innerHTML = res.message | |
96 | 89 | } |
97 | - }, | |
98 | - discountClick: function () { | |
99 | - discountVal = document.getElementById("discountBox").value; | |
100 | - // console.log(discountVal) | |
101 | - // console.log(discountVal.length) | |
102 | - if (discountVal.length > 0) { | |
103 | - $btnObj.style.display = "none"; | |
104 | - $btnLoad.style.display = "block"; | |
105 | - $discountBtn.disabled = true | |
106 | - // console.log(webAppParams.orderId); | |
107 | - if (webAppParams === null || webAppParams === 'null' || webAppParams === undefined) { | |
108 | - document.getElementById("discountTip").innerHTML = '缺少参数'; | |
109 | - $btnLoad.style.display = "none"; | |
110 | - $btnObj.style.display = "block"; | |
111 | - return false; | |
112 | - } | |
113 | - var url = webAppRoot + window.webAppH5.discountServer; | |
114 | - var discountParams = { | |
115 | - app_id: '1', | |
116 | - salt: '1', | |
117 | - deviceInfo: '1', | |
118 | - sign_type: '1', | |
119 | - sign: '1', | |
120 | - token: '1', | |
121 | - terminalSource: 7, | |
122 | - orderId: webAppParams.orderId, | |
123 | - cardNo: discountVal, | |
124 | - codeType: 0 | |
125 | - } | |
126 | - postRequest(url, discountParams, function (res) { | |
127 | - console.log(res) | |
128 | - if (res.code == 0) { | |
129 | - | |
130 | - document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | |
131 | - document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
132 | - document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | |
133 | - document.getElementById("discountDesc").style.display = "none" | |
134 | - $btnLoad.style.display = "none"; | |
135 | - $btnObj.style.display = "block"; | |
136 | - document.getElementById("discountBox").setAttribute('readonly', 'readonly'); | |
137 | - flag = 1 | |
138 | - } else { | |
139 | - $btnLoad.style.display = "none"; | |
140 | - $btnObj.style.display = "block"; | |
141 | - $discountBtn.disabled = false; | |
142 | - document.getElementById("discountTip").innerHTML = res.message | |
143 | - } | |
144 | - }) | |
90 | + }) | |
145 | 91 | |
92 | + } else { | |
93 | + return | |
94 | + } | |
95 | + }, | |
96 | + discountClick: function () { | |
97 | + discountVal = document.getElementById("discountBox").value; | |
98 | + // console.log(discountVal) | |
99 | + // console.log(discountVal.length) | |
100 | + if (discountVal.length > 0) { | |
101 | + $btnObj.style.display = "none"; | |
102 | + $btnLoad.style.display = "block"; | |
103 | + $discountBtn.disabled = true | |
104 | + // console.log(webAppParams.orderId); | |
105 | + if (webAppParams === null || webAppParams === 'null' || webAppParams === undefined) { | |
106 | + document.getElementById("discountTip").innerHTML = '缺少参数'; | |
107 | + $btnLoad.style.display = "none"; | |
108 | + $btnObj.style.display = "block"; | |
109 | + return false; | |
110 | + } | |
111 | + var url = webAppRoot + window.webAppH5.discountServer; | |
112 | + var discountParams = { | |
113 | + app_id: '1', | |
114 | + salt: '1', | |
115 | + deviceInfo: '1', | |
116 | + sign_type: '1', | |
117 | + sign: '1', | |
118 | + token: '1', | |
119 | + terminalSource: 7, | |
120 | + orderId: webAppParams.orderId, | |
121 | + cardNo: discountVal, | |
122 | + codeType: 0 | |
123 | + } | |
124 | + postRequest(url, discountParams, function (res) { | |
125 | + console.log(res) | |
126 | + if (res.code == 0) { | |
127 | + | |
128 | + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | |
129 | + document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
130 | + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | |
131 | + document.getElementById("discountDesc").style.display = "none" | |
132 | + $btnLoad.style.display = "none"; | |
133 | + $btnObj.style.display = "block"; | |
134 | + document.getElementById("discountBox").setAttribute('readonly', 'readonly'); | |
135 | + flag = 1 | |
146 | 136 | } else { |
147 | - $btnLoad.style.display = "none"; | |
148 | - $btnObj.style.display = "block"; | |
149 | - return false; | |
150 | - } | |
151 | - }, | |
152 | - //OK | |
153 | - okClick: function (ev) { | |
154 | - document.getElementById("payTip").innerHTML = ""; | |
155 | - if (webAppParams == null) { | |
156 | - alertMsg("暂无订单信息"); | |
157 | - return; | |
137 | + $btnLoad.style.display = "none"; | |
138 | + $btnObj.style.display = "block"; | |
139 | + $discountBtn.disabled = false; | |
140 | + document.getElementById("discountTip").innerHTML = res.message | |
158 | 141 | } |
159 | - //先校验停车费用后缴费提交 | |
160 | - webAppClass.checkParkCost(); | |
161 | - }, | |
162 | - //校验该订单当前支付时的费用(排除扫描订单后不支付时长) | |
163 | - checkParkCost: function () { | |
164 | - $btnObj.style.display = "none"; | |
165 | - $btnLoad.style.display = "block"; | |
166 | - if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 | |
167 | - window.history.back(-1); | |
168 | - } | |
169 | - var tmpParams = JSON.parse(webAppParams.queryOrderInfo); | |
170 | - var url = webAppRoot + window.webAppH5.comServer; | |
171 | - postRequest(url, tmpParams, function (res) { | |
172 | - //btnObj.style.display = "block"; //$btnLoad.style.display = "none"; | |
173 | - //$btnObj.style.display = "block"; | |
174 | - if (res.code == 0) {//进场 | |
175 | - var tmpObj = res.data; | |
176 | - if (tmpObj) { | |
177 | - if (flag == 1) { | |
178 | - webAppClass.codediscountClick(tmpObj); | |
179 | - } else { | |
180 | - webAppClass.setUI(tmpObj); | |
181 | - webAppParams = tmpObj;//重新赋值 | |
182 | - webAppClass.okPay(tmpObj);//唤醒支付 | |
183 | - } | |
184 | - | |
185 | - console.log(tmpObj) | |
186 | - // webAppClass.okPay(tmpObj);//唤醒支付 | |
187 | - } else { | |
188 | - alertMsg("没有找到相应订单"); | |
189 | - } | |
190 | - } else {//其他情况如【该卡号场内已存在】 | |
191 | - $btnLoad.style.display = "none"; | |
192 | - $btnObj.style.display = "block"; | |
193 | - console.log(res.message); | |
194 | - alertMsg(res.message); | |
195 | - } | |
196 | - }, function (err) { | |
197 | - console.log("网络服务超时..." + url); | |
198 | - alertMsg("网络服务超时"); | |
199 | - $btnLoad.style.display = "none"; | |
200 | - $btnObj.style.display = "block"; | |
201 | - //$btnLoad.style.display = "none"; | |
202 | - }); | |
203 | - }, | |
204 | - | |
205 | - //确定支付 | |
206 | - okPay: function (params) { | |
207 | - var orderID = webAppParams.orderId;//订单号 | |
208 | - // alert(orderID) | |
209 | - //var moneyID = document.getElementById("sumMoney").innerHTML = webAppParams.orderId;//订单号 | |
210 | - var val = document.getElementById("sumMoney").innerText; | |
211 | - //var couponPersonId = document.getElementById("discountBox").value; | |
212 | - var url = webAppRoot + window.webAppH5.zeroPayServer; | |
213 | - var _paySrcType = getQueryString(window.location)._paySrcType | |
214 | - var _mon = document.getElementById("sumMoney").innerText | |
215 | - | |
216 | - var discountParams = { | |
217 | - payOrderType: _paySrcType, | |
218 | - recordArreaInfos: JSON.stringify([{ | |
219 | - "orderId": webAppParams.orderId, | |
220 | - "orderNotPayFee": _mon * 100, | |
221 | - "parkId": getQueryString(window.location).parkCode | |
222 | - }]), | |
223 | - terminalSource: 7, | |
224 | - orderId: webAppParams.orderId, | |
225 | - //couponPersonId:couponPersonId, | |
226 | - app_id: '123', | |
227 | - sign_type: '123', | |
228 | - salt: '123', | |
229 | - deviceInfo: '123', | |
230 | - sign: '123', | |
231 | - } | |
232 | - if (val == '0.00' || val == '0') { | |
233 | - postRequest(url, discountParams, function (res) { | |
234 | - console.log(res) | |
235 | - if (res.code == 0) { | |
236 | - document.getElementById("paySuccess").style.display = 'block' | |
237 | - // | |
238 | - // document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) | |
239 | - // document.getElementById("discountTip").innerHTML = res.data.couponDescribe | |
240 | - // document.getElementById("discountFee").innerHTML = (res.data.discountFee/100) | |
241 | - // document.getElementById("discountDesc").style.display="none" | |
242 | - // $btnLoad.style.display = "none"; | |
243 | - // $btnObj.style.display = "block"; | |
244 | - // document.getElementById("discountBox").setAttribute('readonly','readonly'); | |
245 | - // flag = 1 | |
246 | - } else { | |
247 | - alert(res.message) | |
248 | - // $discountBtn.disabled = false | |
249 | - // document.getElementById("discountTip").innerHTML = res.message | |
250 | - } | |
251 | - }) | |
142 | + }) | |
143 | + | |
144 | + } else { | |
145 | + $btnLoad.style.display = "none"; | |
146 | + $btnObj.style.display = "block"; | |
147 | + return false; | |
148 | + } | |
149 | + }, | |
150 | + //OK | |
151 | + okClick: function (ev) { | |
152 | + document.getElementById("payTip").innerHTML = ""; | |
153 | + if (webAppParams == null) { | |
154 | + alertMsg("暂无订单信息"); | |
155 | + return; | |
156 | + } | |
157 | + //先校验停车费用后缴费提交 | |
158 | + webAppClass.checkParkCost(); | |
159 | + }, | |
160 | + //校验该订单当前支付时的费用(排除扫描订单后不支付时长) | |
161 | + checkParkCost: function () { | |
162 | + $btnObj.style.display = "none"; | |
163 | + $btnLoad.style.display = "block"; | |
164 | + if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 | |
165 | + window.history.back(-1); | |
166 | + } | |
167 | + var tmpParams = JSON.parse(webAppParams.queryOrderInfo); | |
168 | + var url = webAppRoot + window.webAppH5.comServer; | |
169 | + postRequest(url, tmpParams, function (res) { | |
170 | + //btnObj.style.display = "block"; //$btnLoad.style.display = "none"; | |
171 | + //$btnObj.style.display = "block"; | |
172 | + if (res.code == 0) {//进场 | |
173 | + var tmpObj = res.data; | |
174 | + if (tmpObj) { | |
175 | + if (flag == 1) { | |
176 | + webAppClass.codediscountClick(tmpObj); | |
177 | + } else { | |
178 | + webAppClass.setUI(tmpObj); | |
179 | + webAppParams = tmpObj;//重新赋值 | |
180 | + webAppClass.okPay(tmpObj);//唤醒支付 | |
181 | + } | |
182 | + | |
183 | + console.log(tmpObj) | |
184 | + // webAppClass.okPay(tmpObj);//唤醒支付 | |
252 | 185 | } else { |
253 | - var root = webAppRoot; | |
254 | - //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] | |
255 | - var clientType = clientBrowserEx(); | |
256 | - //alert(clientType); | |
257 | - switch (clientType) { | |
258 | - case "wxPay"://微信[内置浏览器] | |
259 | - //var wxPay = webAppH5.wxPayServer; | |
260 | - //var wxParams = webAppH5.comParams; | |
261 | - //wxParams.orderId = orderID; | |
262 | - //wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
263 | - //wxParams.terminalSource = 3;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
264 | - //debugger; | |
265 | - | |
266 | - | |
267 | - // //新增start | |
268 | - // | |
269 | - // var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | |
270 | - // //window.location.href = url; | |
271 | - // var wxPay = webAppH5.wxPayServer; | |
272 | - // var wxParams = webAppH5.comParams; | |
273 | - // wxParams.carNumber = getQueryString(window.location).carnum; | |
274 | - // wxParams.orderId = orderID; | |
275 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
276 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
277 | - // | |
278 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
279 | - // | |
280 | - // wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | |
281 | - // | |
282 | - // //新增end | |
283 | - | |
284 | - // if (webAppCode == null || webAppCode == "") {//code检测 | |
285 | - // alertMsg(appState.codeNullTip); | |
286 | - // $btnObj.style.display = "block"; | |
287 | - // $btnLoad.style.display = "none"; | |
288 | - // return; | |
289 | - // } | |
290 | - webAppClass.payAjaxJDK(orderID); | |
291 | - console.log("wxPay");//微信支付 | |
292 | - break; | |
293 | - case "aliPay"://支付宝 | |
294 | - console.log("aliPay"); | |
295 | - //订单号 | |
296 | - var obj = {}; | |
297 | - | |
298 | - var aliPay = webAppH5.doPay; | |
299 | - | |
300 | - //this.payAjax(url, { orderId: "11111", price: 0.01 }); | |
301 | - // var aliPay = webAppH5.aliPayServer; | |
302 | - // var aliParams = webAppH5.comParams; | |
303 | - // aliParams.orderId = orderID; | |
304 | - // aliParams.carNumber = getQueryString(window.location).carnum; | |
305 | - // aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
306 | - // aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
307 | - // aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
308 | - // | |
309 | - // aliParams.recordArreaInfos = JSON.stringify([{ | |
310 | - // "orderId": webAppParams.orderId, | |
311 | - // "orderNotPayFee": _mon * 100, | |
312 | - // "parkId": getQueryString(window.location).parkCode | |
313 | - // }]); | |
314 | - webAppClass.payAliAjax(root + aliPay, utilParams(1,orderID,'')); | |
315 | - break; | |
316 | - default://第三方浏览器other | |
317 | - //默认支付宝 | |
318 | - if (document.getElementById("aliPay").checked) { | |
319 | - console.log("aliPay"); | |
320 | - //订单号 | |
321 | - var obj = {}; | |
322 | - //this.payAjax(url, { orderId: "11111", price: 0.01 }); | |
323 | - var aliPay = webAppH5.doPay; | |
324 | - // var aliParams = webAppH5.comParams; | |
325 | - // aliParams.orderId = orderID; | |
326 | - // aliParams.carNumber = getQueryString(window.location).carnum; | |
327 | - // aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
328 | - // aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
329 | - // aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
330 | - // | |
331 | - // aliParams.recordArreaInfos = JSON.stringify([{ | |
332 | - // "orderId": webAppParams.orderId, | |
333 | - // "orderNotPayFee": _mon * 100, | |
334 | - // "parkId": getQueryString(window.location).parkCode | |
335 | - // }]); | |
336 | - | |
337 | - //webAppClass.payAliAjax(root + aliPay, aliParams); | |
338 | - webAppClass.payAliAjax(root + aliPay, utilParams(1,orderID,'')); | |
339 | - } else {//微信页面支付 | |
340 | - var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | |
341 | - //window.location.href = url; | |
342 | - var wxPay = webAppH5.wxPayServer; | |
343 | - var wxParams = webAppH5.comParams; | |
344 | - wxParams.carNumber = getQueryString(window.location).carnum; | |
345 | - wxParams.orderId = orderID; | |
346 | - wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
347 | - wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
348 | - | |
349 | - wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
350 | - | |
351 | - wxParams.recordArreaInfos = JSON.stringify([{ | |
352 | - "orderId": webAppParams.orderId, | |
353 | - "orderNotPayFee": _mon * 100, | |
354 | - "parkId": getQueryString(window.location).parkCode | |
355 | - }]); | |
356 | - webAppClass.payAjax(root + wxPay, wxParams); | |
357 | - console.log("wxPay"); | |
358 | - } | |
359 | - break; | |
360 | - } | |
186 | + alertMsg("没有找到相应订单"); | |
361 | 187 | } |
188 | + } else {//其他情况如【该卡号场内已存在】 | |
189 | + $btnLoad.style.display = "none"; | |
190 | + $btnObj.style.display = "block"; | |
191 | + console.log(res.message); | |
192 | + alertMsg(res.message); | |
193 | + } | |
194 | + }, function (err) { | |
195 | + console.log("网络服务超时..." + url); | |
196 | + alertMsg("网络服务超时"); | |
197 | + $btnLoad.style.display = "none"; | |
198 | + $btnObj.style.display = "block"; | |
199 | + //$btnLoad.style.display = "none"; | |
200 | + }); | |
201 | + }, | |
202 | + | |
203 | + //确定支付 | |
204 | + okPay: function (params) { | |
205 | + var orderID = webAppParams.orderId;//订单号 | |
206 | + // alert(orderID) | |
207 | + //var moneyID = document.getElementById("sumMoney").innerHTML = webAppParams.orderId;//订单号 | |
208 | + var val = document.getElementById("sumMoney").innerText; | |
209 | + //var couponPersonId = document.getElementById("discountBox").value; | |
210 | + var url = webAppRoot + window.webAppH5.zeroPayServer; | |
211 | + var _paySrcType = getQueryString(window.location)._paySrcType | |
212 | + var _mon = document.getElementById("sumMoney").innerText | |
213 | + | |
214 | + var discountParams = { | |
215 | + payOrderType: _paySrcType, | |
216 | + recordArreaInfos: JSON.stringify([{ | |
217 | + "orderId": webAppParams.orderId, | |
218 | + "orderNotPayFee": _mon * 100, | |
219 | + "parkId": getQueryString(window.location).parkCode | |
220 | + }]), | |
221 | + terminalSource: 7, | |
222 | + orderId: webAppParams.orderId, | |
223 | + //couponPersonId:couponPersonId, | |
224 | + app_id: '123', | |
225 | + sign_type: '123', | |
226 | + salt: '123', | |
227 | + deviceInfo: '123', | |
228 | + sign: '123', | |
229 | + } | |
230 | + if (val == '0.00' || val == '0') { | |
231 | + postRequest(url, discountParams, function (res) { | |
232 | + console.log(res) | |
233 | + if (res.code == 0) { | |
234 | + document.getElementById("paySuccess").style.display = 'block' | |
362 | 235 | |
363 | - }, | |
364 | - | |
365 | - getCode: function () { | |
366 | - var appID = appWxID; | |
367 | - var code = getUrlParam('code'); | |
368 | - var local = window.location.href; | |
369 | - //alert("local:" + local); | |
370 | - if (code == null || code === '') { | |
371 | - //alert(code); | |
372 | - window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' | |
373 | - //window.event.returnValue = false; | |
374 | - //window.open('https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'); | |
375 | - //alert("22"); | |
376 | 236 | } else { |
377 | - //getOpenId(code); //把code传给后台获取用户信息 | |
378 | - //alert(code); | |
379 | - //webAppCode = code; | |
380 | - return code; | |
381 | - } | |
237 | + alert(res.message) | |
382 | 238 | |
383 | - function getUrlParam(name) { | |
384 | - var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | |
385 | - var r = window.location.search.substr(1).match(reg) | |
386 | - if (r != null) return unescape(r[2]) | |
387 | - return null | |
388 | 239 | } |
389 | - }, | |
390 | - //Ali | |
391 | - aliClick: function (ev) { | |
392 | - console.log("AliClick"); | |
240 | + }) | |
241 | + } else { | |
242 | + var root = webAppRoot; | |
243 | + //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] | |
244 | + var clientType = clientBrowserEx(); | |
245 | + //alert(clientType); | |
246 | + switch (clientType) { | |
247 | + case "wxPay"://微信[内置浏览器] | |
248 | + | |
249 | + webAppClass.payAjaxJDK(orderID); | |
250 | + console.log("wxPay");//微信支付 | |
251 | + break; | |
252 | + case "aliPay"://支付宝 | |
253 | + console.log("aliPay"); | |
254 | + //订单号 | |
255 | + var obj = {}; | |
256 | + | |
257 | + var aliPay = webAppH5.doPay; | |
258 | + | |
259 | + webAppClass.payAliAjax(root + aliPay, utilParams(1, orderID, '')); | |
260 | + break; | |
261 | + default://第三方浏览器other | |
262 | + //默认支付宝 | |
263 | + if (document.getElementById("aliPay").checked) { | |
264 | + console.log("aliPay"); | |
265 | + //订单号 | |
266 | + var obj = {}; | |
267 | + //this.payAjax(url, { orderId: "11111", price: 0.01 }); | |
268 | + var aliPay = webAppH5.doPay; | |
269 | + webAppClass.payAliAjax(root + aliPay, utilParams(1, orderID, '')); | |
270 | + } else {//微信页面支付 | |
271 | + var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | |
272 | + //window.location.href = url; | |
273 | + var wxPay = webAppH5.wxPayServer; | |
274 | + var wxParams = webAppH5.comParams; | |
275 | + wxParams.carNumber = getQueryString(window.location).carnum; | |
276 | + wxParams.orderId = orderID; | |
277 | + wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
278 | + wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
279 | + | |
280 | + wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
281 | + | |
282 | + wxParams.recordArreaInfos = JSON.stringify([{ | |
283 | + "orderId": webAppParams.orderId, | |
284 | + "orderNotPayFee": _mon * 100, | |
285 | + "parkId": getQueryString(window.location).parkCode | |
286 | + }]); | |
287 | + webAppClass.payAjax(root + wxPay, wxParams); | |
288 | + console.log("wxPay"); | |
289 | + } | |
290 | + break; | |
291 | + } | |
292 | + } | |
293 | + | |
294 | + }, | |
295 | + | |
296 | + getCode: function () { | |
297 | + var appID = appWxID; | |
298 | + var code = getUrlParam('code'); | |
299 | + var local = window.location.href; | |
300 | + //alert("local:" + local); | |
301 | + if (code == null || code === '') { | |
302 | + //alert(code); | |
303 | + window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' | |
304 | + //window.event.returnValue = false; | |
305 | + //window.open('https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'); | |
306 | + //alert("22"); | |
307 | + } else { | |
308 | + //getOpenId(code); //把code传给后台获取用户信息 | |
309 | + //alert(code); | |
310 | + //webAppCode = code; | |
311 | + return code; | |
312 | + } | |
313 | + | |
314 | + function getUrlParam(name) { | |
315 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | |
316 | + var r = window.location.search.substr(1).match(reg) | |
317 | + if (r != null) return unescape(r[2]) | |
318 | + return null | |
319 | + } | |
320 | + }, | |
321 | + //Ali | |
322 | + aliClick: function (ev) { | |
323 | + console.log("AliClick"); | |
324 | + document.getElementById("aliPay").checked = true; | |
325 | + ev.preventDefault(); | |
326 | + }, | |
327 | + //Wx | |
328 | + wxClick: function (ev) { | |
329 | + console.log("wxClick"); | |
330 | + document.getElementById("wxPay").checked = true; | |
331 | + ev.preventDefault(); | |
332 | + }, | |
333 | + //浏览器 | |
334 | + clientBrowser: function () { | |
335 | + if (/MicroMessenger/.test(window.navigator.userAgent)) { | |
336 | + console.log("微信客户端"); | |
337 | + this.switchShow("wxPay"); | |
338 | + } else if (/AlipayClient/.test(window.navigator.userAgent)) { | |
339 | + console.log("支付宝客户端"); | |
340 | + this.switchShow("aliPay"); | |
341 | + } else { | |
342 | + console.log("其他浏览器"); | |
343 | + this.switchShow("other"); | |
344 | + } | |
345 | + }, | |
346 | + //根据浏览器显示内容[aliPay、wxPay、other] | |
347 | + switchShow: function (type) { | |
348 | + var aliObj = document.getElementById("rowAliPay"); | |
349 | + var wxObj = document.getElementById("rowWxPay"); | |
350 | + var lineObj = document.getElementById("splitLine"); | |
351 | + switch (type) { | |
352 | + case "aliPay": | |
353 | + lineObj.style.display = "none"; | |
354 | + wxObj.style.display = "none"; | |
393 | 355 | document.getElementById("aliPay").checked = true; |
394 | - ev.preventDefault(); | |
395 | - }, | |
396 | - //Wx | |
397 | - wxClick: function (ev) { | |
398 | - console.log("wxClick"); | |
356 | + break; | |
357 | + case "wxPay": | |
358 | + lineObj.style.display = "none"; | |
359 | + aliObj.style.display = "none"; | |
399 | 360 | document.getElementById("wxPay").checked = true; |
400 | - ev.preventDefault(); | |
401 | - }, | |
402 | - //浏览器 | |
403 | - clientBrowser: function () { | |
404 | - if (/MicroMessenger/.test(window.navigator.userAgent)) { | |
405 | - console.log("微信客户端"); | |
406 | - this.switchShow("wxPay"); | |
407 | - } else if (/AlipayClient/.test(window.navigator.userAgent)) { | |
408 | - console.log("支付宝客户端"); | |
409 | - this.switchShow("aliPay"); | |
361 | + break; | |
362 | + default://其他浏览器[浏览器暂时屏蔽微信] | |
363 | + lineObj.style.display = "none"; | |
364 | + wxObj.style.display = "none"; | |
365 | + document.getElementById("aliPay").checked = true; | |
366 | + break; | |
367 | + } | |
368 | + }, | |
369 | + | |
370 | + //异步请求-微信H5页面 | |
371 | + payAjax: function (url, params) { | |
372 | + var btnOBj = $btnObj; | |
373 | + postRequest(url, params, function (res) { | |
374 | + btnOBj.style.display = "block"; | |
375 | + $btnLoad.style.display = "none"; | |
376 | + //debugger; | |
377 | + if (res.code == 0) {//进场 | |
378 | + //alertMsg("出场成功"); | |
379 | + if (res.data) { | |
380 | + var tmpObj = res.data; | |
381 | + if (typeof (tmpObj.mwebUrl) != "undefined") { | |
382 | + window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult; | |
383 | + } else { | |
384 | + alertMsg("没有返回支付地址mwebUrl"); | |
385 | + } | |
386 | + console.log(JSON.stringify(tmpObj)); | |
410 | 387 | } else { |
411 | - console.log("其他浏览器"); | |
412 | - this.switchShow("other"); | |
413 | - } | |
414 | - }, | |
415 | - //根据浏览器显示内容[aliPay、wxPay、other] | |
416 | - switchShow: function (type) { | |
417 | - var aliObj = document.getElementById("rowAliPay"); | |
418 | - var wxObj = document.getElementById("rowWxPay"); | |
419 | - var lineObj = document.getElementById("splitLine"); | |
420 | - switch (type) { | |
421 | - case "aliPay": | |
422 | - lineObj.style.display = "none"; | |
423 | - wxObj.style.display = "none"; | |
424 | - document.getElementById("aliPay").checked = true; | |
425 | - break; | |
426 | - case "wxPay": | |
427 | - lineObj.style.display = "none"; | |
428 | - aliObj.style.display = "none"; | |
429 | - document.getElementById("wxPay").checked = true; | |
430 | - break; | |
431 | - default://其他浏览器[浏览器暂时屏蔽微信] | |
432 | - lineObj.style.display = "none"; | |
433 | - wxObj.style.display = "none"; | |
434 | - document.getElementById("aliPay").checked = true; | |
435 | - break; | |
388 | + alertMsg("没有找到返回值"); | |
436 | 389 | } |
437 | - }, | |
438 | - | |
439 | - //异步请求-微信H5页面 | |
440 | - payAjax: function (url, params) { | |
441 | - var btnOBj = $btnObj; | |
442 | - postRequest(url, params, function (res) { | |
443 | - btnOBj.style.display = "block"; | |
444 | - $btnLoad.style.display = "none"; | |
445 | - //debugger; | |
446 | - if (res.code == 0) {//进场 | |
447 | - //alertMsg("出场成功"); | |
448 | - if (res.data) { | |
449 | - var tmpObj = res.data; | |
450 | - if (typeof (tmpObj.mwebUrl) != "undefined") { | |
451 | - window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult; | |
452 | - } else { | |
453 | - alertMsg("没有返回支付地址mwebUrl"); | |
454 | - } | |
455 | - console.log(JSON.stringify(tmpObj)); | |
456 | - } else { | |
457 | - alertMsg("没有找到返回值"); | |
458 | - } | |
459 | - } else {//其他情况如【该卡号场内已存在】 | |
460 | - console.log(res.message); | |
461 | - alertMsg(res.message); | |
462 | - } | |
463 | - }, function (err) { | |
464 | - console.log("网络地址出错..."); | |
465 | - alertMsg("网络地址出错..."); | |
466 | - $btnLoad.style.display = "none"; | |
467 | - btnOBj.style.display = "block"; | |
468 | - }); | |
469 | - }, | |
470 | - //异步请求-微信JDK调用 | |
471 | - payAjaxJDK: function (orderID) { | |
472 | - var btnOBj = $btnObj; | |
473 | - //0:页面初始化获取code[webAppCode] | |
474 | - var codeParams = {code: webAppCode, appId: appWxID}; | |
475 | - var openIdUrl = webAppRoot + window.webAppH5.wxGetOpenIdServer; | |
476 | - | |
477 | - //1:有code获取OpenId | |
478 | - postRequest(openIdUrl, codeParams, function (res) { | |
479 | - //alert(JSON.stringify(res)); | |
480 | - if (res.code == 0) { | |
481 | - //alert(res.data); | |
482 | - webAppClass.getPayParams(res.data, orderID); | |
483 | - } else if (res.code == 40163) {//code been used, hints[重复code问题] | |
484 | - | |
485 | - alertMsg(appState.codeNullTip); | |
486 | - console.log(res.message); | |
487 | - $btnObj.style.display = "block"; | |
488 | - $btnLoad.style.display = "none"; | |
489 | - } else { | |
490 | - alertMsg(res.message); | |
491 | - $btnObj.style.display = "block"; | |
492 | - $btnLoad.style.display = "none"; | |
493 | - } | |
494 | - }, function (err) { | |
495 | - console.log("网络地址出错..." + openIdUrl); | |
496 | - $btnObj.style.display = "block"; | |
497 | - $btnLoad.style.display = "none"; | |
498 | - }); | |
499 | - //2:获取支付参数 | |
500 | - //function getPayParams(openId) { | |
501 | - | |
502 | - //} | |
503 | - }, | |
504 | - getPayParams: function (openId, orderID) { | |
505 | - // var wxPay = window.webAppH5.wxPayServer; | |
506 | - // var wxParams = window.webAppH5.comParams; | |
507 | - // var _mon = document.getElementById("sumMoney").innerHTML | |
508 | - // wxParams.orderId = orderID; | |
509 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
510 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
511 | - // //webAppClass.payAjax(root + wxPay, wxParams); | |
512 | - // | |
513 | - // | |
514 | - // //新增start | |
515 | - // | |
516 | - // | |
517 | - // wxParams.carNumber = getQueryString(window.location).carnum; | |
518 | - // | |
519 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | |
520 | - // | |
521 | - // wxParams.recordArreaInfos = JSON.stringify([{ | |
522 | - // "orderId": webAppParams.orderId, | |
523 | - // "orderNotPayFee": _mon * 100, | |
524 | - // "parkId": getQueryString(window.location).parkCode | |
525 | - // }]); | |
526 | - // | |
527 | - // //新增end | |
528 | - // | |
529 | - // | |
530 | - // wxParams.openId = openId; | |
531 | - // wxParams.appId = appWxID; | |
532 | - // var payParamsUrl = webAppRoot + window.webAppH5.wxPayServer; | |
533 | - | |
534 | - | |
535 | - | |
536 | - var jsondata = utilParams(2,orderID,openId); | |
537 | - | |
538 | - | |
539 | - | |
540 | - var payParamsUrl = webAppRoot + window.webAppH5.doPay; | |
541 | - | |
542 | - //alert(payParamsUrl);alert(orderID); | |
543 | - postRequest(payParamsUrl, jsondata, function (res) { | |
544 | - $btnObj.style.display = "block"; | |
545 | - $btnLoad.style.display = "none"; | |
546 | - //debugger; | |
547 | - if (res.code == 0) {//进场 | |
548 | - //alertMsg("出场成功"); | |
549 | - if (res.data) { | |
550 | - var tmpObj = res.data; | |
551 | - webAppClass.weixinJSBridge(tmpObj); | |
552 | - console.log(JSON.stringify(tmpObj)); | |
553 | - //alert(JSON.stringify(tmpObj)); | |
554 | - } else { | |
555 | - alertMsg("没有找到返回值"); | |
556 | - } | |
557 | - } else { | |
558 | - $btnLoad.style.display = "none"; | |
559 | - $btnObj.style.display = "block"; | |
560 | - console.log(res.message); | |
561 | - alertMsg(res.message); | |
562 | - } | |
563 | - }, function (err) { | |
564 | - console.log("网络地址出错..."); | |
565 | - alertMsg("网络地址出错..." + payParamsUrl); | |
566 | - $btnLoad.style.display = "none"; | |
567 | - $btnObj.style.display = "block"; | |
568 | - }); | |
569 | - }, | |
570 | - | |
571 | - //调用微信内置WeixinJSBridge对象发起支付 | |
572 | - weixinJSBridge: function (data) { | |
573 | - var datas = JSON.parse(data.jsPayRequest); | |
574 | - //datas = JSON.parse(datas); | |
575 | - var timeStamp = datas.timeStamp; | |
576 | - var appId = datas.appId; | |
577 | - var nonceStr = datas.nonceStr; | |
578 | - var package = datas.package; | |
579 | - var paySign = datas.paySign; | |
580 | - var type = datas.signType; | |
581 | - | |
582 | - function onBridgeReady() { | |
583 | - WeixinJSBridge.invoke( | |
584 | - 'getBrandWCPayRequest', { | |
585 | - "appId":appId, //公众号名称,由商户传入 | |
586 | - "timeStamp":timeStamp, //时间戳,自1970年以来的秒数 | |
587 | - "nonceStr":nonceStr, //随机串 | |
588 | - "package":package, | |
589 | - "signType":type, //微信签名方式: | |
590 | - "paySign":paySign //微信签名 | |
591 | - }, | |
592 | - function (res) { | |
593 | - //alert(res.err_msg); | |
594 | - if (res.err_msg == "get_brand_wcpay_request:ok") { | |
595 | - // 使用以上方式判断前端返回,微信团队郑重提示: | |
596 | - //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | |
597 | - | |
598 | - | |
599 | - | |
600 | - //window.location.href = webAppPayResult + "?trade_no=" + "success"; | |
601 | - window.history.go(-2); | |
602 | - setTimeout(function(){ | |
603 | - window.history.go(-2); | |
604 | - //var src = mUrl.Uri+'/WEB-INF/pages/select.html?openid='+func.openid+'&token='+func.token+"&";//mUrl.myParkCardView; | |
605 | - //window.location.href = src; | |
606 | - },3000); | |
607 | - | |
608 | - | |
609 | - } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | |
610 | - window.location.href = webAppPayResult + "?trade_no=" + "fail"; | |
611 | - } else { | |
612 | - alertMsg(JSON.stringify(res)); | |
613 | - //alert(res.err_msg); | |
614 | - } | |
615 | - }); | |
616 | - } | |
617 | - | |
618 | - if (typeof WeixinJSBridge == "undefined") { | |
619 | - if (document.addEventListener) { | |
620 | - document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); | |
621 | - } else if (document.attachEvent) { | |
622 | - document.attachEvent('WeixinJSBridgeReady', onBridgeReady); | |
623 | - document.attachEvent('onWeixinJSBridgeReady', onBridgeReady); | |
624 | - } | |
390 | + } else {//其他情况如【该卡号场内已存在】 | |
391 | + console.log(res.message); | |
392 | + alertMsg(res.message); | |
393 | + } | |
394 | + }, function (err) { | |
395 | + console.log("网络地址出错..."); | |
396 | + alertMsg("网络地址出错..."); | |
397 | + $btnLoad.style.display = "none"; | |
398 | + btnOBj.style.display = "block"; | |
399 | + }); | |
400 | + }, | |
401 | + //异步请求-微信JDK调用 | |
402 | + payAjaxJDK: function (orderID) { | |
403 | + var btnOBj = $btnObj; | |
404 | + //0:页面初始化获取code[webAppCode] | |
405 | + var codeParams = { code: webAppCode, appId: appWxID }; | |
406 | + var openIdUrl = webAppRoot + window.webAppH5.wxGetOpenIdServer; | |
407 | + | |
408 | + //1:有code获取OpenId | |
409 | + postRequest(openIdUrl, codeParams, function (res) { | |
410 | + //alert(JSON.stringify(res)); | |
411 | + if (res.code == 0) { | |
412 | + //alert(res.data); | |
413 | + webAppClass.getPayParams(res.data, orderID); | |
414 | + } else if (res.code == 40163) {//code been used, hints[重复code问题] | |
415 | + | |
416 | + alertMsg(appState.codeNullTip); | |
417 | + console.log(res.message); | |
418 | + $btnObj.style.display = "block"; | |
419 | + $btnLoad.style.display = "none"; | |
420 | + } else { | |
421 | + alertMsg(res.message); | |
422 | + $btnObj.style.display = "block"; | |
423 | + $btnLoad.style.display = "none"; | |
424 | + } | |
425 | + }, function (err) { | |
426 | + console.log("网络地址出错..." + openIdUrl); | |
427 | + $btnObj.style.display = "block"; | |
428 | + $btnLoad.style.display = "none"; | |
429 | + }); | |
430 | + //2:获取支付参数 | |
431 | + //function getPayParams(openId) { | |
432 | + | |
433 | + //} | |
434 | + }, | |
435 | + getPayParams: function (openId, orderID) { | |
436 | + | |
437 | + var jsondata = utilParams(2, orderID, openId); | |
438 | + var payParamsUrl = webAppRoot + window.webAppH5.doPay; | |
439 | + | |
440 | + //alert(payParamsUrl);alert(orderID); | |
441 | + postRequest(payParamsUrl, jsondata, function (res) { | |
442 | + $btnObj.style.display = "block"; | |
443 | + $btnLoad.style.display = "none"; | |
444 | + //debugger; | |
445 | + if (res.code == 0) {//进场 | |
446 | + //alertMsg("出场成功"); | |
447 | + if (res.data) { | |
448 | + var tmpObj = res.data; | |
449 | + webAppClass.weixinJSBridge(tmpObj); | |
450 | + console.log(JSON.stringify(tmpObj)); | |
451 | + //alert(JSON.stringify(tmpObj)); | |
625 | 452 | } else { |
626 | - onBridgeReady(); | |
453 | + alertMsg("没有找到返回值"); | |
627 | 454 | } |
628 | - }, | |
629 | - | |
630 | - //异步请求-支付宝 | |
631 | - payAliAjax: function (url, params) { | |
632 | - | |
633 | - var btnOBj = $btnObj; | |
634 | - postRequest(url, params, function (res) { | |
635 | - btnOBj.style.display = "block"; | |
636 | - $btnLoad.style.display = "none"; | |
637 | - if (res.code == 0) {//进场 | |
638 | - window.location.href = res.data.h5PayRequest | |
639 | - //document.write(res.data.h5PayRequest);//打开支付表单 | |
640 | - } else {//其他情况如【该卡号场内已存在】 | |
641 | - console.log(res.message); | |
642 | - alertMsg(res.message); | |
643 | - } | |
644 | - }, function (err) { | |
645 | - console.log("网络地址出错..."); | |
646 | - alertMsg("网络地址出错..."); | |
647 | - $btnLoad.style.display = "none"; | |
648 | - btnOBj.style.display = "block"; | |
455 | + } else { | |
456 | + $btnLoad.style.display = "none"; | |
457 | + $btnObj.style.display = "block"; | |
458 | + console.log(res.message); | |
459 | + alertMsg(res.message); | |
460 | + } | |
461 | + }, function (err) { | |
462 | + console.log("网络地址出错..."); | |
463 | + alertMsg("网络地址出错..." + payParamsUrl); | |
464 | + $btnLoad.style.display = "none"; | |
465 | + $btnObj.style.display = "block"; | |
466 | + }); | |
467 | + }, | |
468 | + | |
469 | + //调用微信内置WeixinJSBridge对象发起支付 | |
470 | + weixinJSBridge: function (data) { | |
471 | + var datas = JSON.parse(data.jsPayRequest); | |
472 | + //datas = JSON.parse(datas); | |
473 | + var timeStamp = datas.timeStamp; | |
474 | + var appId = datas.appId; | |
475 | + var nonceStr = datas.nonceStr; | |
476 | + var package = datas.package; | |
477 | + var paySign = datas.paySign; | |
478 | + var type = datas.signType; | |
479 | + | |
480 | + function onBridgeReady() { | |
481 | + WeixinJSBridge.invoke( | |
482 | + 'getBrandWCPayRequest', { | |
483 | + "appId": appId, //公众号名称,由商户传入 | |
484 | + "timeStamp": timeStamp, //时间戳,自1970年以来的秒数 | |
485 | + "nonceStr": nonceStr, //随机串 | |
486 | + "package": package, | |
487 | + "signType": type, //微信签名方式: | |
488 | + "paySign": paySign //微信签名 | |
489 | + }, | |
490 | + function (res) { | |
491 | + //alert(res.err_msg); | |
492 | + if (res.err_msg == "get_brand_wcpay_request:ok") { | |
493 | + // 使用以上方式判断前端返回,微信团队郑重提示: | |
494 | + //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | |
495 | + | |
496 | + //window.location.href = webAppPayResult + "?trade_no=" + "success"; | |
497 | + window.history.go(-2); | |
498 | + setTimeout(function () { | |
499 | + window.history.go(-2); | |
500 | + //var src = mUrl.Uri+'/WEB-INF/pages/select.html?openid='+func.openid+'&token='+func.token+"&";//mUrl.myParkCardView; | |
501 | + //window.location.href = src; | |
502 | + }, 3000); | |
503 | + | |
504 | + } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | |
505 | + window.location.href = webAppPayResult + "?trade_no=" + "fail"; | |
506 | + } else { | |
507 | + alertMsg(JSON.stringify(res)); | |
508 | + //alert(res.err_msg); | |
509 | + } | |
649 | 510 | }); |
650 | - }, | |
651 | - | |
652 | - //设置UI | |
653 | - setUI: function (params) { | |
654 | - console.log('ui') | |
655 | - var $carNum = getObjectByID("carNum"),//车牌号 | |
656 | - $orderNum = getObjectByID("orderNum"),//订单号 | |
657 | - $sumMoney = getObjectByID("sumMoney"),//实际应付金额 | |
658 | - $outtime = getObjectByID("outtime"),//实际出场时间 | |
659 | - $payTip = getObjectByID("payTip"),//支付提示 | |
660 | - | |
661 | - $parkName = getObjectByID("parkName"),//车场名称 | |
662 | - $inparktime = getObjectByID("inparktime"),//进场时间 | |
663 | - $staytime = getObjectByID("staytime"),//停车时长 | |
664 | - $due = getObjectByID("due"),//停车总费用 | |
665 | - | |
666 | - $paid = getObjectByID("paid"),//已支付金额 | |
667 | - $discountDesc = getObjectByID("discountDesc"),//8折优惠折扣费用 | |
668 | - $discountFee = getObjectByID("discountFee");//优惠金额 | |
669 | - | |
670 | - if (params != null && params != "") { | |
671 | - var price = keepTwoDecimalFull((params.orderFee / 100));//(params.orderFee / 100); | |
672 | - $carNum.innerHTML = params.carnum;//手机号 | |
673 | - $orderNum.innerHTML = params.orderId;//订单号 | |
674 | - $sumMoney.innerHTML = price;///params.orderFee//缴费金额 | |
675 | - $outtime.innerHTML = params.parkOutTime;//实际出场时间 | |
676 | - //.appOrderTimeout | |
677 | - $payTip.innerHTML = "注意: " + params.appOrderTimeout;//请在支付完成10分钟内出场,如超时未出场,会继续计费。 | |
678 | - | |
679 | - $parkName.innerHTML = params.parkName; | |
680 | - $inparktime.innerHTML = params.inparktime; | |
681 | - $staytime.innerHTML = formatSeconds(params.staytime); | |
682 | - | |
683 | - $due.innerHTML = keepTwoDecimalFull((params.due / 100));//停车总费用 | |
684 | - $paid.innerHTML = keepTwoDecimalFull(params.paid / 100); | |
685 | - $discountFee.innerHTML = params.discountFee;//优惠金额 | |
686 | - | |
687 | - // $discountDesc.innerHTML = params.discountDesc; | |
688 | - } else { | |
689 | - console.log("没有接受到参数"); | |
690 | - } | |
691 | - }, | |
511 | + } | |
692 | 512 | |
513 | + if (typeof WeixinJSBridge == "undefined") { | |
514 | + if (document.addEventListener) { | |
515 | + document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); | |
516 | + } else if (document.attachEvent) { | |
517 | + document.attachEvent('WeixinJSBridgeReady', onBridgeReady); | |
518 | + document.attachEvent('onWeixinJSBridgeReady', onBridgeReady); | |
519 | + } | |
520 | + } else { | |
521 | + onBridgeReady(); | |
522 | + } | |
523 | + }, | |
524 | + | |
525 | + //异步请求-支付宝 | |
526 | + payAliAjax: function (url, params) { | |
527 | + | |
528 | + var btnOBj = $btnObj; | |
529 | + postRequest(url, params, function (res) { | |
530 | + btnOBj.style.display = "block"; | |
531 | + $btnLoad.style.display = "none"; | |
532 | + if (res.code == 0) {//进场 | |
533 | + window.location.href = res.data.h5PayRequest | |
534 | + //document.write(res.data.h5PayRequest);//打开支付表单 | |
535 | + } else {//其他情况如【该卡号场内已存在】 | |
536 | + console.log(res.message); | |
537 | + alertMsg(res.message); | |
538 | + } | |
539 | + }, function (err) { | |
540 | + console.log("网络地址出错..."); | |
541 | + alertMsg("网络地址出错..."); | |
542 | + $btnLoad.style.display = "none"; | |
543 | + btnOBj.style.display = "block"; | |
544 | + }); | |
545 | + }, | |
546 | + | |
547 | + //设置UI | |
548 | + setUI: function (params) { | |
549 | + console.log('ui') | |
550 | + var $carNum = getObjectByID("carNum"),//车牌号 | |
551 | + $orderNum = getObjectByID("orderNum"),//订单号 | |
552 | + $sumMoney = getObjectByID("sumMoney"),//实际应付金额 | |
553 | + $outtime = getObjectByID("outtime"),//实际出场时间 | |
554 | + $payTip = getObjectByID("payTip"),//支付提示 | |
555 | + | |
556 | + $parkName = getObjectByID("parkName"),//车场名称 | |
557 | + $inparktime = getObjectByID("inparktime"),//进场时间 | |
558 | + $staytime = getObjectByID("staytime"),//停车时长 | |
559 | + $due = getObjectByID("due"),//停车总费用 | |
560 | + | |
561 | + $paid = getObjectByID("paid"),//已支付金额 | |
562 | + $discountDesc = getObjectByID("discountDesc"),//8折优惠折扣费用 | |
563 | + $discountFee = getObjectByID("discountFee");//优惠金额 | |
564 | + | |
565 | + if (params != null && params != "") { | |
566 | + var price = keepTwoDecimalFull((params.orderFee / 100));//(params.orderFee / 100); | |
567 | + $carNum.innerHTML = params.carnum;//手机号 | |
568 | + $orderNum.innerHTML = params.orderId;//订单号 | |
569 | + $sumMoney.innerHTML = price;///params.orderFee//缴费金额 | |
570 | + $outtime.innerHTML = params.parkOutTime;//实际出场时间 | |
571 | + //.appOrderTimeout | |
572 | + $payTip.innerHTML = "注意: " + params.appOrderTimeout;//请在支付完成10分钟内出场,如超时未出场,会继续计费。 | |
573 | + | |
574 | + $parkName.innerHTML = params.parkName; | |
575 | + $inparktime.innerHTML = params.inparktime; | |
576 | + $staytime.innerHTML = formatSeconds(params.staytime); | |
577 | + | |
578 | + $due.innerHTML = keepTwoDecimalFull((params.due / 100));//停车总费用 | |
579 | + $paid.innerHTML = keepTwoDecimalFull(params.paid / 100); | |
580 | + $discountFee.innerHTML = params.discountFee;//优惠金额 | |
581 | + | |
582 | + // $discountDesc.innerHTML = params.discountDesc; | |
583 | + } else { | |
584 | + console.log("没有接受到参数"); | |
585 | + } | |
586 | + }, | |
693 | 587 | |
694 | 588 | } |
695 | 589 | ... | ... |
js/url.js
1 | 1 | var mUrl = mUrl || {}; |
2 | 2 | |
3 | - | |
4 | 3 | //songcxa 15801541129 |
5 | 4 | mUrl.testtoken = "a49e4835f5184f0fb5d0aba2a30bca8b"; |
6 | 5 | mUrl.testdeviceInfo = "868869021179618";//android |
7 | 6 | |
8 | 7 | /*获取设置openid start*/ |
9 | -mUrl.GetOpenid = function(){ | |
10 | - var openid = sessionStorage.getItem('wx_openId'); | |
11 | - if(!openid||openid==''){ | |
12 | - openid = null; | |
13 | - } | |
14 | - return openid; | |
8 | +mUrl.GetOpenid = function () { | |
9 | + var openid = sessionStorage.getItem('wx_openId'); | |
10 | + if (!openid || openid == '') { | |
11 | + openid = null; | |
12 | + } | |
13 | + return openid; | |
15 | 14 | } |
16 | -mUrl.SetOpenid = function(openid){ | |
17 | - sessionStorage.setItem('wx_openId',openid); | |
15 | +mUrl.SetOpenid = function (openid) { | |
16 | + sessionStorage.setItem('wx_openId', openid); | |
18 | 17 | } |
19 | 18 | /*end*/ |
20 | 19 | /*获取设置Token start wx_openId wx_Token*/ |
21 | -mUrl.GetToken = function(){ | |
22 | - var openid = sessionStorage.getItem('wx_Token'); | |
23 | - //测试环境 | |
24 | - //var openid = this.testtoken; | |
25 | - if(!openid||openid==''){ | |
26 | - openid = null; | |
27 | - } | |
28 | - return openid; | |
20 | +mUrl.GetToken = function () { | |
21 | + var openid = sessionStorage.getItem('wx_Token'); | |
22 | + //测试环境 | |
23 | + //var openid = this.testtoken; | |
24 | + if (!openid || openid == '') { | |
25 | + openid = null; | |
26 | + } | |
27 | + return openid; | |
29 | 28 | } |
30 | -mUrl.SetToken = function(token){ | |
31 | - sessionStorage.setItem('wx_Token',token); | |
29 | +mUrl.SetToken = function (token) { | |
30 | + sessionStorage.setItem('wx_Token', token); | |
32 | 31 | } |
33 | 32 | /*end*/ |
34 | 33 | /*获取设置phone start*/ |
35 | -mUrl.GetPhone = function(){ | |
36 | - var openid = sessionStorage.getItem('WXPhone'); | |
37 | - if(!openid||openid==''){ | |
38 | - openid = null; | |
39 | - } | |
40 | - return openid; | |
41 | - //alert('murl 获取用户WXPhone'+openid); | |
34 | +mUrl.GetPhone = function () { | |
35 | + var openid = sessionStorage.getItem('WXPhone'); | |
36 | + if (!openid || openid == '') { | |
37 | + openid = null; | |
38 | + } | |
39 | + return openid; | |
40 | + //alert('murl 获取用户WXPhone'+openid); | |
42 | 41 | } |
43 | -mUrl.SetPhone = function(openid){ | |
44 | - sessionStorage.setItem('WXPhone',openid); | |
42 | +mUrl.SetPhone = function (openid) { | |
43 | + sessionStorage.setItem('WXPhone', openid); | |
45 | 44 | } |
46 | 45 | |
47 | 46 | //获取是在app上还是在微信上 |
48 | -mUrl.setApporWX = function(pt){ | |
49 | - //pt='androidapp' pt='iosapp' pt = 'wx'; | |
50 | - sessionStorage.setItem('RNTApporWx',pt); | |
47 | +mUrl.setApporWX = function (pt) { | |
48 | + //pt='androidapp' pt='iosapp' pt = 'wx'; | |
49 | + sessionStorage.setItem('RNTApporWx', pt); | |
51 | 50 | } |
52 | -mUrl.getApporWX = function(){ | |
53 | - var pt = sessionStorage.getItem('RNTApporWx'); | |
54 | - if(!pt||pt==''){ | |
55 | - pt = null; | |
56 | - } | |
57 | - return pt; | |
51 | +mUrl.getApporWX = function () { | |
52 | + var pt = sessionStorage.getItem('RNTApporWx'); | |
53 | + if (!pt || pt == '') { | |
54 | + pt = null; | |
55 | + } | |
56 | + return pt; | |
58 | 57 | } |
59 | 58 | //获取是在app上还是在微信上 |
60 | -mUrl.setDevice = function(pt){ | |
61 | - //pt='androidapp' pt='iosapp' pt = 'wx'; | |
62 | - sessionStorage.setItem('RNTsetDevice',pt); | |
59 | +mUrl.setDevice = function (pt) { | |
60 | + //pt='androidapp' pt='iosapp' pt = 'wx'; | |
61 | + sessionStorage.setItem('RNTsetDevice', pt); | |
63 | 62 | } |
64 | -mUrl.getDevice = function(){ | |
65 | - var pt = sessionStorage.getItem('RNTsetDevice'); | |
66 | - //测试环境 | |
67 | - //var pt = this.testdeviceInfo; | |
68 | - if(!pt||pt==''){ | |
69 | - pt = 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E'; | |
70 | - } | |
71 | - return pt; | |
63 | +mUrl.getDevice = function () { | |
64 | + var pt = sessionStorage.getItem('RNTsetDevice'); | |
65 | + //测试环境 | |
66 | + //var pt = this.testdeviceInfo; | |
67 | + if (!pt || pt == '') { | |
68 | + pt = 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E'; | |
69 | + } | |
70 | + return pt; | |
72 | 71 | } |
73 | 72 | |
74 | - | |
75 | 73 | //获取是在android app 上 还是在iospp上 |
76 | -mUrl.setJx = function(x){ | |
77 | - sessionStorage.setItem('RNTJx',x); | |
74 | +mUrl.setJx = function (x) { | |
75 | + sessionStorage.setItem('RNTJx', x); | |
78 | 76 | } |
79 | -mUrl.getJx = function(){ | |
80 | - var openid = sessionStorage.getItem('RNTJx'); | |
81 | - if(!openid||openid==''){ | |
82 | - openid = null; | |
83 | - } | |
84 | - return openid; | |
85 | - //sessionStorage.getItem('RNTJx',x); | |
77 | +mUrl.getJx = function () { | |
78 | + var openid = sessionStorage.getItem('RNTJx'); | |
79 | + if (!openid || openid == '') { | |
80 | + openid = null; | |
81 | + } | |
82 | + return openid; | |
83 | + //sessionStorage.getItem('RNTJx',x); | |
86 | 84 | } |
87 | 85 | |
88 | 86 | /*end*/ |
... | ... | @@ -104,106 +102,101 @@ mUrl.bindphone = cepath + '/wxPublicUser/bindCustByOpenId'; |
104 | 102 | |
105 | 103 | /*----------------------支付页面所需接口 start*/ |
106 | 104 | //mUrl.tcwaitcheckorder = cepath+'/weixinPublicPay/queryNoPayedOrderByCarNum'; |
107 | -mUrl.tcwaitcheckorder = cepath+'/queryParkOrder/queryParkingByCarNumber';//根据车牌查多个订单--修改 | |
108 | -mUrl.oneCardorder = cepath+'/queryParkOrder/billQuery';//查询单个待支付订单 | |
109 | -mUrl.tcgetopenid =cepath+'/weixinPublicPay/getOpenIdByCode'; | |
110 | -mUrl.tcgettoken =cepath+'/wxPublicUser/getTokenByOpenId'; | |
111 | -mUrl.tcpaysuccess = cepath+'/query/Issued';//目前暂时不用//无用 | |
105 | +mUrl.tcwaitcheckorder = cepath + '/queryParkOrder/queryParkingByCarNumber';//根据车牌查多个订单--修改 | |
106 | +mUrl.oneCardorder = cepath + '/queryParkOrder/billQuery';//查询单个待支付订单 | |
107 | +mUrl.tcgetopenid = cepath + '/weixinPublicPay/getOpenIdByCode'; | |
108 | +mUrl.tcgettoken = cepath + '/wxPublicUser/getTokenByOpenId'; | |
109 | +mUrl.tcpaysuccess = cepath + '/query/Issued';//目前暂时不用//无用 | |
112 | 110 | //mUrl.tcwxpay = cepath+ '/weixinPublicPay/unifiedOrder'; |
113 | -mUrl.tcwxpay = cepath+ '/weixinpay/publicUnifiedOrder';//修改 添加字段 | |
114 | - mUrl.SelectCar = cepath +'/user/queryUserCars';//车辆信息查询(查看是否绑定车牌号)无用 | |
115 | - mUrl.SelectOrder = cepath +'/query/queryOrderByCarNumbers';//查询订单 (查询待支付订单)//无用 | |
111 | +mUrl.tcwxpay = cepath + '/weixinpay/publicUnifiedOrder';//修改 添加字段 | |
112 | +mUrl.SelectCar = cepath + '/user/queryUserCars';//车辆信息查询(查看是否绑定车牌号)无用 | |
113 | +mUrl.SelectOrder = cepath + '/query/queryOrderByCarNumbers';//查询订单 (查询待支付订单)//无用 | |
116 | 114 | |
117 | 115 | /*----------------------支付页面所需接口 end*/ |
118 | 116 | |
119 | 117 | /*----------------------停车场接口 start*/ |
120 | -mUrl.ParkingLots = cepath+ '/park/queryParkingLots'; | |
121 | -mUrl.Parklist = cepath+'/park/queryParkingLotsByParkName';//无用 | |
122 | -mUrl.Searchpark = cepath+'/park/queryParkingLotsByParkName'; | |
123 | -mUrl.sendFreepark = cepath+'/push/sendFreeParkingSpace'; | |
118 | +mUrl.ParkingLots = cepath + '/park/queryParkingLots'; | |
119 | +mUrl.Parklist = cepath + '/park/queryParkingLotsByParkName';//无用 | |
120 | +mUrl.Searchpark = cepath + '/park/queryParkingLotsByParkName'; | |
121 | +mUrl.sendFreepark = cepath + '/push/sendFreeParkingSpace'; | |
124 | 122 | |
125 | 123 | /*----------------------停车场接口 end*/ |
126 | 124 | |
127 | - | |
128 | 125 | /*------------------------------- 更多模块 start------------------------------------*/ |
129 | 126 | |
130 | 127 | /*----会员卡 start---*/ |
131 | -mUrl.parkCards = cepath+'/parkvip/queryParkVipCard'; //获取会员卡列表//无用 | |
132 | -mUrl.cardbuyorxf = cepath+'/vip/createCustCardOrder';//提交订单 //无用 | |
128 | +mUrl.parkCards = cepath + '/parkvip/queryParkVipCard'; //获取会员卡列表//无用 | |
129 | +mUrl.cardbuyorxf = cepath + '/vip/createCustCardOrder';//提交订单 //无用 | |
133 | 130 | mUrl.CardoneInfo = cepath + '/parkvip/queryVipCardBYParkNo';//获取单个停车场的会员卡列表信息//无用 |
134 | -mUrl.getminecard = cepath +'/parkvip/queryUserVipCards';//获取用户已经购买的会员卡//无用 | |
135 | - mUrl.selectPark = cepath+'/parkvip/queryParkVipCardByParkName';//搜索有会员卡的停车场//无用 | |
136 | - mUrl.wxpay = cepath+'/weixinPublicPay/unifiedOrder';//调用微信支付 //无用 | |
137 | - mUrl.Buysuccess = cepath+'/vip/createCardCust';//购买成功后调用//无用 | |
131 | +mUrl.getminecard = cepath + '/parkvip/queryUserVipCards';//获取用户已经购买的会员卡//无用 | |
132 | +mUrl.selectPark = cepath + '/parkvip/queryParkVipCardByParkName';//搜索有会员卡的停车场//无用 | |
133 | +mUrl.wxpay = cepath + '/weixinPublicPay/unifiedOrder';//调用微信支付 //无用 | |
134 | +mUrl.Buysuccess = cepath + '/vip/createCardCust';//购买成功后调用//无用 | |
138 | 135 | /*----会员卡 end---*/ |
139 | 136 | |
140 | 137 | /*----个人中心 start----*/ |
141 | -mUrl.loginOut = cepath+'/user/logout';//退出登录 //个人信息目前无用 | |
142 | - | |
143 | - //车辆管理模块 | |
144 | - mUrl.CarInfo = cepath+'/user/queryUserCars';//获取已经绑定的车牌号信息同mUrl.SelectCar | |
145 | - mUrl.Caredit = cepath+'/user/userCarsInfoEdit'; //编辑车牌号 | |
146 | - //停车记录模块 | |
147 | - mUrl.Parkrecord = cepath+'/queryParkOrder/queryParkingRecordCarNumbers'; | |
148 | - //反馈建议模块 | |
149 | - mUrl.getjyQuestionT = cepath+'/suggest/getFeedbackType';//获取反馈建议问题类型 | |
150 | - mUrl.jianyi = cepath+'/suggest/saveFeedbackAndSuggest';//保存用户的反馈建议 | |
151 | - | |
152 | - /*--------------------------发票模块 -----------------------*/ | |
153 | - mUrl.getallUplist = cepath+'/invoice/queryCustInvoiceInfoList';//获取所有的发票抬头信息 | |
154 | - mUrl.addUp = cepath+'/invoice/insertCustInvoiceInfo';//新增发票抬头 | |
155 | - mUrl.upUpinfo = cepath+'/invoice/updateCustInvoiceInfo';//更新编辑抬头信息 | |
156 | - mUrl.deleteUp = cepath+'/invoice/deleteCustInvoiceInfoByID';//删除发票抬头 | |
157 | - mUrl.checkUpbyId = cepath+'/invoice/queryCustInvoiceInfoById';//根据id查询发票的抬头信息 | |
158 | - | |
159 | - mUrl.getallAddress = cepath+'/invoice/queryCustMailingAddressInfoList';//获取所有的地址 | |
160 | - mUrl.addaddress = cepath+'/invoice/insertCustMailingAddressInfo';//地址新增 | |
161 | - mUrl.Upaddress = cepath+'/invoice/updateCustomerMailingAddressInfo';//更新邮寄地址 | |
162 | - mUrl.deleteaddress = cepath+'/invoice/deleteCustMailingAddressInfoByID';//删除一条邮寄地址 | |
163 | - mUrl.checkAddress = cepath+'/invoice/queryCustMailingAddressInfoById';//'/invoice/queryCustrMailingAddressInfoById';//根据id查询出地址详情信息 | |
138 | +mUrl.loginOut = cepath + '/user/logout';//退出登录 //个人信息目前无用 | |
139 | + | |
140 | +//车辆管理模块 | |
141 | +mUrl.CarInfo = cepath + '/user/queryUserCars';//获取已经绑定的车牌号信息同mUrl.SelectCar | |
142 | +mUrl.Caredit = cepath + '/user/userCarsInfoEdit'; //编辑车牌号 | |
143 | +//停车记录模块 | |
144 | +mUrl.Parkrecord = cepath + '/queryParkOrder/queryParkingRecordCarNumbers'; | |
145 | +//反馈建议模块 | |
146 | +mUrl.getjyQuestionT = cepath + '/suggest/getFeedbackType';//获取反馈建议问题类型 | |
147 | +mUrl.jianyi = cepath + '/suggest/saveFeedbackAndSuggest';//保存用户的反馈建议 | |
148 | + | |
149 | +/*--------------------------发票模块 -----------------------*/ | |
150 | +mUrl.getallUplist = cepath + '/invoice/queryCustInvoiceInfoList';//获取所有的发票抬头信息 | |
151 | +mUrl.addUp = cepath + '/invoice/insertCustInvoiceInfo';//新增发票抬头 | |
152 | +mUrl.upUpinfo = cepath + '/invoice/updateCustInvoiceInfo';//更新编辑抬头信息 | |
153 | +mUrl.deleteUp = cepath + '/invoice/deleteCustInvoiceInfoByID';//删除发票抬头 | |
154 | +mUrl.checkUpbyId = cepath + '/invoice/queryCustInvoiceInfoById';//根据id查询发票的抬头信息 | |
155 | + | |
156 | +mUrl.getallAddress = cepath + '/invoice/queryCustMailingAddressInfoList';//获取所有的地址 | |
157 | +mUrl.addaddress = cepath + '/invoice/insertCustMailingAddressInfo';//地址新增 | |
158 | +mUrl.Upaddress = cepath + '/invoice/updateCustomerMailingAddressInfo';//更新邮寄地址 | |
159 | +mUrl.deleteaddress = cepath + '/invoice/deleteCustMailingAddressInfoByID';//删除一条邮寄地址 | |
160 | +mUrl.checkAddress = cepath + '/invoice/queryCustMailingAddressInfoById';//'/invoice/queryCustrMailingAddressInfoById';//根据id查询出地址详情信息 | |
164 | 161 | |
165 | 162 | //mUrl.vipkpList = cepath+'/invoice/queryVipCardTicketList';//获取会员卡开票列表[old] |
166 | - mUrl.vipkpList = cepath + '/invoice/queryRntPayOrderForInvoice';//获取会员卡开票列表[new] | |
167 | - mUrl.kaipaioHistory = cepath + '/invoice/insertCustInvoiceHisInfo';//•记录客户开发票历史信息及开票历史详情信息 | |
168 | - mUrl.queryAppOrgs = cepath + '/appOrg/queryAppOrgs';//获取区域列表songcxa | |
169 | - | |
170 | - mUrl.gethistorylist = cepath+'/invoice/queryCustInvoiceHistoryList';//获取所有的历史接口 | |
163 | +mUrl.vipkpList = cepath + '/invoice/queryRntPayOrderForInvoice';//获取会员卡开票列表[new] | |
164 | +mUrl.kaipaioHistory = cepath + '/invoice/insertCustInvoiceHisInfo';//•记录客户开发票历史信息及开票历史详情信息 | |
165 | +mUrl.queryAppOrgs = cepath + '/appOrg/queryAppOrgs';//获取区域列表songcxa | |
171 | 166 | |
167 | +mUrl.gethistorylist = cepath + '/invoice/queryCustInvoiceHistoryList';//获取所有的历史接口 | |
172 | 168 | |
173 | - mUrl.gKhisInfoByid = cepath+'/invoice/queryCustInvoiceHisInfoById';//根据id获取开票历史信息 | |
174 | - mUrl.gethistoryDetail = cepath+'/invoice/queryCustInvoiceHisDetailInfoById';//•通过ID查询客户开票历史详情信息 | |
169 | +mUrl.gKhisInfoByid = cepath + '/invoice/queryCustInvoiceHisInfoById';//根据id获取开票历史信息 | |
170 | +mUrl.gethistoryDetail = cepath + '/invoice/queryCustInvoiceHisDetailInfoById';//•通过ID查询客户开票历史详情信息 | |
175 | 171 | |
176 | 172 | /*---个人中心 end---*/ |
177 | 173 | |
178 | - | |
179 | 174 | /*------------------------------- 更多模块 end------------------------------------*/ |
180 | 175 | //新增 |
181 | 176 | |
182 | 177 | //个人中心,查询用户信息包括积分卡券等 |
183 | -mUrl.getUserinfo = cepath+'/user/queryUserInfo';//获取押金手机号 | |
184 | - | |
178 | +mUrl.getUserinfo = cepath + '/user/queryUserInfo';//获取押金手机号 | |
185 | 179 | |
186 | 180 | //年底活动 |
187 | -mUrl.yearjudge = cepath+'/yearActivity/judgeGetCouponOrScore';//判断当前用户今天是否已经领取积分或者卡劵 | |
188 | -mUrl.yearShare = cepath+'/yearActivity/shareToReceiveCoupon';//分享领券 | |
189 | -mUrl.yearGcoupon = cepath+'/yearActivity/getCouponOrScore';//客户随机获取卡劵或者积分 | |
190 | - | |
181 | +mUrl.yearjudge = cepath + '/yearActivity/judgeGetCouponOrScore';//判断当前用户今天是否已经领取积分或者卡劵 | |
182 | +mUrl.yearShare = cepath + '/yearActivity/shareToReceiveCoupon';//分享领券 | |
183 | +mUrl.yearGcoupon = cepath + '/yearActivity/getCouponOrScore';//客户随机获取卡劵或者积分 | |
191 | 184 | |
192 | 185 | //查询用户个人信息 |
193 | -mUrl.getcustinfo = cepath+'/user/queryCustPersonBaseInfo';//获取手机号和头像 | |
186 | +mUrl.getcustinfo = cepath + '/user/queryCustPersonBaseInfo';//获取手机号和头像 | |
194 | 187 | |
195 | 188 | //反向寻车 |
196 | -mUrl.fxBycar = cepath+'/query/queryParkingByCarNumber'; | |
189 | +mUrl.fxBycar = cepath + '/query/queryParkingByCarNumber'; | |
197 | 190 | |
198 | 191 | //会员卡新增 |
199 | 192 | //会员卡列表 |
200 | -mUrl.vipcardlist = cepath+'/parkvip/queryVipCardList'; | |
193 | +mUrl.vipcardlist = cepath + '/parkvip/queryVipCardList'; | |
201 | 194 | //搜索有会员卡的停车场 |
202 | -mUrl.vipsearch = cepath+ '/parkvip/queryVipCardListByPlName'; | |
195 | +mUrl.vipsearch = cepath + '/parkvip/queryVipCardListByPlName'; | |
203 | 196 | //查询单个停车场会员卡具体信息 |
204 | -mUrl.vipinfo = cepath+ '/parkvip/queryVipCardByPlNo'; | |
197 | +mUrl.vipinfo = cepath + '/parkvip/queryVipCardByPlNo'; | |
205 | 198 | //查询用户已购买的会员卡 |
206 | -mUrl.vipbuyed = cepath+ '/parkvip/queryVipCardsByCustId'; | |
199 | +mUrl.vipbuyed = cepath + '/parkvip/queryVipCardsByCustId'; | |
207 | 200 | //查询用户已购买会员卡详情 |
208 | 201 | mUrl.vbuyedInfo = cepath + '/parkvip/queryVipCardsDetail'; |
209 | 202 | |
... | ... | @@ -211,16 +204,15 @@ mUrl.vbuyedInfo = cepath + '/parkvip/queryVipCardsDetail'; |
211 | 204 | mUrl.vipinfobyCN = cepath + '/parkvip/queryVipCardMsgByCardNo'; |
212 | 205 | |
213 | 206 | //会员卡购买/续费 |
214 | -mUrl.vipbuyorxufei = cepath+ '/vip/createVipCardOrder';//入参修改 | |
207 | +mUrl.vipbuyorxufei = cepath + '/vip/createVipCardOrder';//入参修改 | |
215 | 208 | |
216 | 209 | //会员卡微信支付服务号 |
217 | 210 | //mUrl.vipxwxfpay = cepath+ '/weixinPublicPay/unifiedVipCardOrder'; |
218 | -mUrl.vipxwxfpay = cepath+ '/weixinpay/publicUnifiedOrder';//统一下单接口 修改 | |
211 | +mUrl.vipxwxfpay = cepath + '/weixinpay/publicUnifiedOrder';//统一下单接口 修改 | |
219 | 212 | //会员卡微信支付app |
220 | -mUrl.vipxwxpay = cepath+ '/weixinpay/unifiedVipCardOrder'; | |
213 | +mUrl.vipxwxpay = cepath + '/weixinpay/unifiedVipCardOrder'; | |
221 | 214 | //会员卡支付宝支付app |
222 | -mUrl.vipxAliPay = cepath+ '/alipay/sendAliPayVipCardOrderInfo'; | |
223 | - | |
215 | +mUrl.vipxAliPay = cepath + '/alipay/sendAliPayVipCardOrderInfo'; | |
224 | 216 | |
225 | 217 | // 记录 |
226 | -mUrl.listServer=cepath+"/queryParkOrder/queryParkingRecordPageByCarNumbers" | |
218 | +mUrl.listServer = cepath + "/queryParkOrder/queryParkingRecordPageByCarNumbers" | ... | ... |