|
|
@@ -366,7 +366,9 @@
|
|
366
|
366
|
//点击支付创建订单
|
|
367
|
367
|
function btn() {
|
|
368
|
368
|
//开始loading
|
|
369
|
|
- wx.showLoading()
|
|
|
369
|
+ wx.showLoading({
|
|
|
370
|
+ title: '加载中',
|
|
|
371
|
+ })
|
|
370
|
372
|
let data = {
|
|
371
|
373
|
mer_id: mer_id,
|
|
372
|
374
|
money: money,
|
|
|
@@ -435,38 +437,38 @@
|
|
435
|
437
|
|
|
436
|
438
|
wx.ready(function () {
|
|
437
|
439
|
wx.checkJsApi({
|
|
438
|
|
- jsApiList: ['chooseWXPay'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
|
439
|
|
- success: function(res) {
|
|
440
|
|
- console.log(res,'微信支付返回值');
|
|
441
|
|
- },
|
|
442
|
|
- fail: function(res) {
|
|
443
|
|
- console.log(res,'错误1');
|
|
444
|
|
- }
|
|
445
|
|
- });
|
|
446
|
|
- wx.chooseWXPay({
|
|
447
|
|
- appId: appid,
|
|
448
|
|
- timestamp: timestamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
|
449
|
|
- nonceStr: noncestr, // 支付签名随机串,不长于 32 位
|
|
450
|
|
- package: package1, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
|
|
451
|
|
- signType: signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
|
452
|
|
- paySign: paysign, // 支付签名
|
|
453
|
|
- success: (res) => {
|
|
454
|
|
- console.log(res,'支付返回的数据')
|
|
455
|
|
-
|
|
456
|
|
- // 支付成功后的回调函数
|
|
457
|
|
- money = '';
|
|
458
|
|
- wx.hideLoading()
|
|
459
|
|
- alert('支付成功');
|
|
460
|
|
- },
|
|
461
|
|
- cancel: function(res) {
|
|
462
|
|
- wx.hideLoading()
|
|
463
|
|
- alert('取消支付');
|
|
464
|
|
- },
|
|
465
|
|
- fail: function(res) {
|
|
466
|
|
- wx.hideLoading()
|
|
467
|
|
- alert('支付失败');
|
|
468
|
|
- }
|
|
469
|
|
- });
|
|
|
440
|
+ jsApiList: ['chooseWXPay'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
|
|
441
|
+ success: function (res) {
|
|
|
442
|
+ console.log(res, '微信支付返回值');
|
|
|
443
|
+ },
|
|
|
444
|
+ fail: function (res) {
|
|
|
445
|
+ console.log(res, '错误1');
|
|
|
446
|
+ }
|
|
|
447
|
+ });
|
|
|
448
|
+ wx.chooseWXPay({
|
|
|
449
|
+ appId: appid,
|
|
|
450
|
+ timestamp: timestamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
|
|
451
|
+ nonceStr: noncestr, // 支付签名随机串,不长于 32 位
|
|
|
452
|
+ package: package1, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
|
|
|
453
|
+ signType: signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
|
|
454
|
+ paySign: paysign, // 支付签名
|
|
|
455
|
+ success: (res) => {
|
|
|
456
|
+ console.log(res, '支付返回的数据')
|
|
|
457
|
+
|
|
|
458
|
+ // 支付成功后的回调函数
|
|
|
459
|
+ money = '';
|
|
|
460
|
+ wx.hideLoading()
|
|
|
461
|
+ alert('支付成功');
|
|
|
462
|
+ },
|
|
|
463
|
+ cancel: function (res) {
|
|
|
464
|
+ wx.hideLoading()
|
|
|
465
|
+ alert('取消支付');
|
|
|
466
|
+ },
|
|
|
467
|
+ fail: function (res) {
|
|
|
468
|
+ wx.hideLoading()
|
|
|
469
|
+ alert('支付失败');
|
|
|
470
|
+ }
|
|
|
471
|
+ });
|
|
470
|
472
|
});
|
|
471
|
473
|
wx.error(function (res) {
|
|
472
|
474
|
console.log('res', res);
|