您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
三六零分类信息网 > 阿克苏分类信息网,免费分类信息发布

通过vue.js实现微信支付

2025/7/2 11:33:05发布4次查看
下面我就为大家分享一篇vue.js 微信支付前端代码。具有很好的参考价值。希望对大家有所帮助。
实例如下所示:
onbridgeready: function () { const openid = localstorage.getitem('openid') payservice.payment(this.$route.params.orderid, 1, openid).then(rt => { //1:支付类型,可不填 this.message = rt.t weixinjsbridge.invoke( 'getbrandwcpayrequest', { 'appid': this.message.appid, 'timestamp': this.message.timestamp, 'noncestr': this.message.noncestr, 'package': this.message.package, 'signtype': this.message.signtype, 'paysign': this.message.paysign }, function (res) { console.log(res) if (res.err_msg === 'get_brand_wcpay_request:ok') { toast('微信支付成功') this.$router.push('/mineorder') } else if (res.err_msg === 'get_brand_wcpay_request:cancel') { toast('用户取消支付') // window.location.href = 'gift_failview.do?out_trade_no=' + this.orderid } else if (res.err_msg === 'get_brand_wcpay_request:fail') { toast('网络异常,请重试') } } ) }) }, callpay: function () { if (typeof weixinjsbridge === 'undefined') { if (document.addeventlistener) { document.addeventlistener('weixinjsbridgeready', this.onbridgeready(), false) } else if (document.attachevent) { document.attachevent('weixinjsbridgeready', this.onbridgeready()) document.attachevent('onweixinjsbridgeready', this.onbridgeready()) } } else { this.onbridgeready() } }
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
在angularjs中如何实现table增加tr的方法
在angular中如何使用json对象push到数组中的方法
在angularjs数组中如何判断是否含有某个元素
以上就是通过vue.js实现微信支付的详细内容。
阿克苏分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product