时间: 2020-08-31|tag: 104次围观|0 条评论

var jweixin = require('jweixin-module');                    orderPayApi(this.query).then(res=>{                        this.payParams = res.data.data.payment                        var self = this;                        jweixin.config({                          debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。                          appId: self.payParams.appId, // 必填,公众号的唯一标识                          timestamp: self.payParams.timeStamp, // 必填,生成签名的时间戳                          nonceStr: self.payParams.nonceStr, // 必填,生成签名的随机串                          signature: self.payParams.paySign,// 必填,签名                          jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表                        });                        jweixin.ready(function() {                            jweixin.chooseWXPay({                              timestamp: self.payParams.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符                              nonceStr: self.payParams.nonceStr, // 支付签名随机串,不长于 32 位                              package: self.payParams.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)                              signType: self.payParams.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'                              paySign: self.payParams.paySign, // 支付签名                              success: function (res) {                                // 支付成功后的回调函数                                console.log('paySuccess');                                console.log(res);                                uni.redirectTo({                                    url: '../orderRecord/index'                                })                              }                            });                        });                                                jweixin.error(res=>{                            console.log(res);                            this.$api.msg('支付失败了');                        })                                            }).catch(Error=>{                        console.log(Error)                    })

文章转载于:https://www.jianshu.com/p/60ee2e98de81

原著是一个有趣的人,若有侵权,请通知删除

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《2020-06-12
   

还没有人抢沙发呢~