Vue. js payment front-end code sharing, vue. js payment front-end code
The instance is as follows:
OnBridgeReady: function () {const openId = localStorage. getItem ('openid') payService. payment (this. $ route. params. orderId, 1, openId ). then (rt => {// 1: Payment type. You can leave this blank. message = rt. t WeixinJSBridge. invoke ('getbrandwcpayrequest', {'appid ': this. message. appId, 'timestamp': this. message. timeStamp, 'noncestr ': this. message. nonceStr, 'package': this. message. package, 'signattype': this. message. signType, 'Pay Sign ': this. message. paySign}, function (res) {console. log (res) if (res. err_msg = 'get _ brand_wcpay_request: OK ') {Toast ('payment successful') this. $ router. push ('/mineorder')} else if (res. err_msg = 'get _ brand_wcpay_request: cancel ') {Toast ('user canceled pay') // window. location. href = 'gift _ failview. do? Out_trade_no = '+ this. orderId} else if (res. err_msg = 'get _ brand_wcpay_request: fail ') {Toast ('network exception, Please retry')}, 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 ()}}
The above vue. js payment front-end code is a small part of the Content shared to everyone, I hope to give you a reference, but also hope you can support a lot of help homes.