Commit 3cb95b0a by wangshuo

调试

parent 6d139f2e
...@@ -131,19 +131,47 @@ export default class PayOrder extends Component { ...@@ -131,19 +131,47 @@ export default class PayOrder extends Component {
} else { } else {
http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => { http.get(`${API['base-api']}/pay/wxpay/pub_charge/oid/${getParam('oid')}/code/${weixin_code}`).then((res) => {
if (res.data.errno === 0) { if (res.data.errno === 0) {
// let data = res.data.data; let data = res.data.data;
this.BridgeData = res.data.data; // this.BridgeData = res.data.data;
Toast.info(this.BridgeData.appId, 1); // Toast.info(this.BridgeData.appId, 1);
// this.onBridgeReady(this.BridgeData); // 这个应该不需要 // this.onBridgeReady(this.BridgeData); // 这个应该不需要
function onBridgeReady() {
Toast.info(data.appId, 2);
console.log(`181 line data: ${JSON.stringify(data)}`);
let _this = this;
// data = data || _this.BridgeData;
console.log(`184 line data: ${JSON.stringify(data)}`);
Toast.info(data.appId, 5);
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
appId:"wx23dac6775ac82877", //公众号名称,由商户传入
timeStamp:data.timeStamp, //时间戳,自1970年以来的秒数
nonceStr:data.nonceStr, //随机串
package:data.package,
signType:data.signType, //微信签名方式:
paySign:data.paySign //微信签名
},
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast.info('支付成功', 2);
_this.payCallback();
} else {
alert('支付失败')
}
}
)
}
if (typeof WeixinJSBridge == "undefined") { if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) { if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady, false) document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false)
} else if (document.attachEvent) { } else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady); document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady) document.attachEvent('onWeixinJSBridgeReady', onBridgeReady)
} }
} else { } else {
this.onBridgeReady(this.BridgeData); onBridgeReady();
} }
} else { } else {
Toast.info(res.data.msg + 'isweixinPay', 2) Toast.info(res.data.msg + 'isweixinPay', 2)
...@@ -177,7 +205,7 @@ export default class PayOrder extends Component { ...@@ -177,7 +205,7 @@ export default class PayOrder extends Component {
}, 1000) }, 1000)
} }
onBridgeReady = (data) => { onBridgeReady1 = (data) => {
Toast.info(data.appId, 2); Toast.info(data.appId, 2);
console.log(`181 line data: ${JSON.stringify(data)}`); console.log(`181 line data: ${JSON.stringify(data)}`);
let _this = this; let _this = this;
...@@ -187,7 +215,7 @@ export default class PayOrder extends Component { ...@@ -187,7 +215,7 @@ export default class PayOrder extends Component {
WeixinJSBridge.invoke( WeixinJSBridge.invoke(
'getBrandWCPayRequest', { 'getBrandWCPayRequest', {
"appId": data.appId, //公众号名称,由商户传入 "appId": "wx23dac6775ac82877", //公众号名称,由商户传入
"timeStamp": data.timeStamp, //时间戳,自1970年以来的秒数 "timeStamp": data.timeStamp, //时间戳,自1970年以来的秒数
"nonceStr": data.nonceStr, //随机串 "nonceStr": data.nonceStr, //随机串
"package": data.package, "package": data.package,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment