forked from 1izheng/xpage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d1.html
383 lines (328 loc) · 16.9 KB
/
d1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<title>支付宝</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no,email=no" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<script charset="utf-8" src="https://as.alipayobjects.com:443/g/snake/h5cashier/1.0.5/h5cashier.js"></script>
<link rel="stylesheet" type="text/css" href="https://as.alipayobjects.com:443/g/snake/h5cashier/1.0.5/h5cashier.css"
media="all" />
<script charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
<script charset="utf-8"
src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.inc.min.js"></script>
</head>
<body>
<header class="am-header">
<h1>
<span class="title-main" data-title="支付宝收银台">支付宝收银台</span> </h1>
</header>
<style>
body {
font-weight: 500;
font-family: PingFangSC-Regular, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.am-header {
display: none;
}
.alipay-logo {
display: none;
}
.result {
position: absolute;
top: 50%;
margin-top: -215px;
width: 100%;
}
.result-logo {
width: 70px;
height: 98px;
margin: auto;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAADFCAMAAACxSeqoAAAAMFBMVEVMaXE2RUs8PDw8PDw8PDwMpNs8PDys4/kJpeAAqu4+Pj7+/v4gtfA8vvJy0PXZ8vy+qiS8AAAACXRSTlMAKme4jZHg+tbH0VrYAAAF0klEQVR42u2b4XLjKgyFLZlAsovt93/bbTdxzpBzbQHFIXPX50dn4mLxWRISuOmwK5FLU4kMdZLL9XaArpcKlsvtMF16orCkjqW/c5As/WnA0p8GMeqfN3J7kzoGiXXp6BhWkWP6u+b2Pl07LiVW+yhFqDhOjWHi8hvqDRN+E0y7pLmdMCfMCXPCnDCfBBOnTSUw28NiO5j59081nzD/BgwUN5UkcNzUWWdOmBPmU2EylvYUIegImNCg3nWH+STPLLcPggmHJrCtKUnq9y1tu8nfusFwQENnmEhR6gTDUeoMs1CU+sBwlDrDzFTxjoCZ5rtwJDOjNB8CM4clLfJhZiRO39geZkbhICIjfVvDzM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ZpdDBhoPaNUjyx9IABDVjeACOIMEk9vaU4EIY/slsgJwfC7L7TEJyJPOEcBqMoIikKAJRwDoJBqadcQaYQzmGryafmxL1kCQPqETD8ulIc5vQvPtAx+ZUFo19aTdtd27+8XfJwEj0+O220YID+JRR1S8B/cir5ldxTAMPHXVt6NzwmJCTRMQvG+accbtZcfXnGO5DsSJ1/wri7ZGit83sbp06d6iBHxVXpAMUX/dr+lM1JepuX505G7Pd4mAUGMmH4rcWzxWKgW1vZmHV2khqY8fH6xZO51ws5jkHv1RoYXTf1js3RyCzHPPp4HQxfF5hLrFmOwRwjxlXB/GJz5BoHB+5GSRUDy2B4sN8wZzgGbv3+4atgsFpgzq/m0mTPcYxb/6Yr5TBOVZ1PHvkeDAq7efLHA2KiMphVmlyVv0Mdrdg9x8Cta7CKYfi4o2QOrpGcKLk1jctzRkRoNbA50NlFxn8LtaEExjBnwfAEkNTB2OZsmGfv0r/CAq2DYXNaBIMSjfnxQe+SXBg2VwKDW2CI3a0FMI7MZcOgeGIhMIzLhmFzFswfhGgoIOnCZSQAAAAASUVORK5CYII=);
background-repeat: no-repeat;
background-size: contain;
}
.result-title {
margin: 40px 0 14px;
text-align: center;
font-size: 21px;
color: #00a0e8;
line-height: 25px;
}
.result-tips {
max-width: 370px;
margin: 0 auto 10px;
padding: 0 15px;
font-size: 15px;
color: #a5a5a5;
line-height: 18px;
text-align: left;
word-break: break-all;
word-wrap: break-word;
}
.result-botton {
margin: 0 15px 20px;
}
.result-botton a {
display: block;
margin: auto;
-webkit-box-sizing: border-box;
box-sizing: border-box;
max-width: 384px;
height: 44px;
text-align: center;
}
.result-botton a.am-button-white {
color: #00aaee;
background: #ffffff;
border: 1px solid #00aaee;
}
.result-botton .am-button[disabled=disabled] {
color: #e6e6e6;
background: #f8f8f8;
border: 1px solid #dedede;
}
.loading {
display: none;
}
</style>
<div class="am-content">
<div class="result">
<div class="result-logo"></div>
<div class="result-title">支付宝正在授权...</div>
<div class="result-tips">1.请耐心等待支付,30秒过后会自动唤起支付;</div>
<div class="result-tips">2.支付后,请再耐心等待5秒,再离开,避免充值失败;</div>
<div class="result-botton"><a class="J-h5pay am-button am-button-blue" href="javascript:void(0)"
onclick="gopay()" id="paybtn">继续支付</a></div>
<div class="result-botton"><a class="J-complete am-button am-button-white">如支付完成,请等待5秒再离开此页面</a></div>
</div>
</div>
<script src="/Public/js/jquery.min.js"></script>
<script type="text/javascript">
window.needCountDown = true;
//H5cashier startup client
(function () {
var _AP = {}
var ua = navigator.userAgent.toLowerCase(),
locked = false,
domLoaded = document.readyState === 'complete',
delayToRun;
function customClickEvent() {
var clickEvt;
if (window.CustomEvent) {
clickEvt = new window.CustomEvent('click', {
canBubble: true,
cancelable: true
});
} else {
clickEvt = document.createEvent('Event');
clickEvt.initEvent('click', true, true);
}
return clickEvt;
}
function getAndroidVersion() {
var match = ua.match(/android\s([0-9\.]*)/);
return match ? match[1] : false;
}
var noIntentTest = /aliapp|360 aphone|weibo|windvane|ucbrowser/.test(ua);
var hasIntentTest = /chrome|samsung/.test(ua);
var isAndroid = /android|adr/.test(ua) && !(/windows phone/.test(ua));
var canIntent = !noIntentTest && hasIntentTest && isAndroid;
// 确定浏览器类型
var isChrome = false;
var isWebview = false;
if (ua.match(/(?:chrome|crios)\/([\d\.]+)/)) {
isChrome = true;
if (ua.match(/version\/[\d+\.]+\s*chrome/)) {
isWebview = true;
}
}
var isOriginalChrome = isAndroid && isChrome && !isWebview;
if (ua.indexOf('m353') > -1 && !noIntentTest) {
canIntent = false;
}
// 安卓走iframe方式唤起
if (ua.indexOf('android') > -1 && !noIntentTest) {
canIntent = false;
}
/**
* open client
*/
_AP.open = function (params) {
if (!domLoaded && (ua.indexOf('360 aphone') > -1 || canIntent)) {
var arg = arguments;
delayToRun = function () {
_AP.open.apply(null, arg);
delayToRun = null;
};
return;
}
if (locked) {
return;
}
locked = true;
var o;
if (typeof params === 'object') {
o = {
'ios': encodeURIComponent(JSON.stringify(params)),
'android': encodeURIComponent(params.dataString)
};
} else {
console.error('params error, pls use JSON format!')
}
// params fault tolerance
if (typeof o.ios !== 'string') {
o.ios = '';
} else if (typeof o.android !== 'string') {
o.android = '';
}
// nonsupport Android intent
if (!canIntent) {
if (isAndroid) {
var alipaysUrl = 'alipays://platformapi/startApp?appId=20000125&orderSuffix=' + o.android + '#Intent;scheme=alipays;package=com.eg.android.AlipayGphone;end';
}
//fix for iOS QQ browser
else if (ua.indexOf('mqqbrowser') > -1) {
var alipaysUrl = 'alipay://alipayclient/?' + o.android;
}
else {
var alipaysUrl = 'alipay://alipayclient/?' + o.ios;
}
if (ua.indexOf('qq/') > -1 || (ua.indexOf('safari') > -1 && ua.indexOf('os 9_') > -1) || (ua.indexOf('safari') > -1 && ua.indexOf('os 10_') > -1) || (ua.indexOf('safari') > -1 && ua.indexOf('os 11_') > -1) || (ua.indexOf('safari') > -1 && ua.indexOf('os 12_') > -1) || (ua.indexOf('safari') > -1 && ua.indexOf('os 13_') > -1)) {
var openSchemeLink = document.getElementById('openSchemeLink');
if (!openSchemeLink) {
openSchemeLink = document.createElement('a');
openSchemeLink.id = 'openSchemeLink';
openSchemeLink.style.display = 'none';
document.body.appendChild(openSchemeLink);
}
//openSchemeLink.href = alipaysUrl;
// oppo浏览器兼容写法
openSchemeLink.onclick = function () {
window.location.href = alipaysUrl;
};
// trigger click
openSchemeLink.dispatchEvent(customClickEvent());
} else if (isOriginalChrome) {
if (0 === 0) {
// location.href = alipaysUrl;
// chrome下唤起客户端的同时页面还会关闭掉,导致H5不能正常跳转
window.needCountDown = false;
var clientBtn = '<div class="result-botton"><a class="am-button am-button-blue" href="' + alipaysUrl + '">使用支付宝App支付</a></div>'
$('.J-h5pay').text('继续浏览器支付').parent().before(clientBtn);
}
} else {
var ifr = document.createElement('iframe');
ifr.src = alipaysUrl;
ifr.style.display = 'none';
document.body.appendChild(ifr);
}
}
//support Android intent
else {
var packageKey = 'AlipayGphone';
var intentUrl = 'alipays://platformapi/startApp?appId=20000125&orderSuffix=' + o.android + '#Intent;scheme=alipays;package=com.eg.android.' + packageKey + ';end';
var openIntentLink = document.getElementById('openIntentLink');
if (!openIntentLink) {
openIntentLink = document.createElement('a');
openIntentLink.id = 'openIntentLink';
openIntentLink.style.display = 'none';
document.body.appendChild(openIntentLink);
}
//openIntentLink.href = intentUrl;
// oppo浏览器兼容写法
openIntentLink.onclick = function () {
alert("android");
window.location.href = intentUrl;
};
// trigger click
openIntentLink.dispatchEvent(customClickEvent());
}
setTimeout(function () {
locked = false;
}, 2500)
}
if (!domLoaded) {
document.addEventListener('DOMContentLoaded', function () {
domLoaded = true;
if (typeof delayToRun === 'function') {
delayToRun();
}
}, false);
}
_AP.pay = function (param) {
_AP.open(param);
}
window._AP = _AP;
})();
//唤起客户端快捷参数
var orderStr = 'alipay_sdk=alipay-sdk-java-3.5.35.DEV&app_id=2018101061618854&biz_content=7UyROpIwNDbETBJrNdfXuutjfKDfqQVc5wAB1wHdeQWttRMj8EnIXx74dRUO7eE1jDoQARR9Br4VkWJRygQRUrHAeCMazMTCv8D7BRla69IEKNlbWNjy8zN3TkXO%2Bc%2BfOZrLh9MpInDdZCIJAzeA4kuWuSOaLUT5gE3yFYzyA2pzLQ8Q3e3IdkQmyXnpxuoihsOksh4VZyZTAkbSYnc3Y7%2FZXRgodi6MYqFI48NK5KbOnYiZ0H6T8gZjwArCT2g0ySzc4z%2F5J9qhUtT7s9uXMi1T5RIm1FXVL3miVz3R8qnMz8m8wPtdSIkduR7rtZsC9hI66noC03hqhelzb1RcO9d6i1dSznnoXCi211Sn1osbJXyNJv7BWoIFESy4ecvmqYGXnJRBvEf475i2TE3X1%2Fxvte3T5gs8WVEVs15uT1cL2yyMZWkQUMJ320dgvYwgkImNz54FfmPss%2FnCawBMK4DSpLD4tIwrtmFJDs8fQ6k2xoNA%2BjhUxQSaO2xsAazKpMYXsbyZKaGVQWvmYktV%2BfbKOWEItxiWcXbIiarzo22xvtH7WoRkw69WVksGeGO3XfyIjzOJQhrPRFwB4CdJ1Mq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yErWQR%2FeBU9B5JSN48I%2BihPsbfjn0oY3DZBbedKM8BX1o0FaXWzd88MqItABzjOO1gJnEe41GPuKUs5s%2FGMbVNK9cUiD48CU5fnYmq14HFyVjaOerJUeec5%2FEVreDGKu8UovfD5fyneBIaPtwlucvsY1zmFJXys0KFXwwSVW53hrjSEI0ibDeyY0BiUFYHzLuo5fEqOg3eP2hSlbFS8kRPilylSwxzXuF3%2FrCSsNMCZVv829nFdTA6ESCkdbRu2At2ENFcom%2Fs%2FHuAVCSEClV%2FGLVR2KhyhfIzcgM%2B5fqkSRQ7kA%3D%3D&sign_type=RSA2×tamp=2019-05-03+02%3A48%3A45&version=1.0'
try {
//唤起客户端快捷参数
var data = { "requestType": "SafePay", "fromAppUrlScheme": "alipays", "dataString": orderStr };
window.setTimeout(function () {
// _AP.pay(data);
}, 50);
} catch (e) {
window.console && window.console.log('e.name:' + e.name + ';e.message:' + e.message)
}
// 没有orderStr 意味着产码失败,让用户重新下单,不用傻等
if (!orderStr) {
AlipayJSBridge.call('alert', {
title: '亲',
message: '创建订单失败,请重新下单',
button: '确定'
}, function (e) {
AlipayJSBridge.call('exitApp');
});
}
function gopay() {
if (count > 0) {
// alert('请耐心等待'+time+"秒 ^_^!");
$('#paybtn').html('请耐心等待' + count + "秒 ^_^!");
} else {
try {
//唤起客户端快捷参数
var data = { "requestType": "SafePay", "fromAppUrlScheme": "alipays", "dataString": orderStr };
window.setTimeout(function () {
_AP.pay(data);
}, 50);
} catch (e) {
window.console && window.console.log('e.name:' + e.name + ';e.message:' + e.message)
}
}
}
var count = 10;
// 60-100秒随机,减少同时概率
// var c = 100-60+1;
//var count = Math.floor(Math.random() * c + 60);
var canPoll = true;
//倒计时
var timer = window.setInterval(function () {
if (!canPoll) return
if (count <= 0) {
canPoll = false;
try {
//唤起客户端快捷参数
var data = { "requestType": "SafePay", "fromAppUrlScheme": "alipays", "dataString": orderStr };
window.setTimeout(function () {
_AP.pay(data);
}, 50);
} catch (e) {
window.console && window.console.log('e.name:' + e.name + ';e.message:' + e.message)
}
clearInterval(timer);
return true;
}
$('.result-title').eq(0).html('支付宝授权中,请耐心等待 ' + count + '秒');
$('#paybtn').html("继续支付");
count--;
}, 500);
</script>
</body>
</html>