Commit 2df3e8e1 by cocomilk2012

修改支付链接为调用原生方法getActionUrl

parent acbbe089
......@@ -80,6 +80,23 @@ class Bridge {
}
})
}
/**
* 使APP调用URL
*
* @param {Object=} args 请求对象
*/
getActionUrl(args = {}) {
return new Promise((resolve, reject) => {
try {
jsBridge.callHandler("getActionUrl", args, function (response) {
resolve(response);
});
} catch (err) {
reject(err);
}
})
}
}
export default new Bridge();
......
......@@ -45,11 +45,9 @@
</div>
</div>
<div class="header_info">
<div class="left">
<a :href="nativePayUrl">
<img src="../../assets/images/icon01.png" alt />
<span>充值</span>
</a>
<div class="left" @click="toPay()">
<img src="../../assets/images/icon01.png" alt />
<span>充值</span>
</div>
<div class="right" @click="toPage(2)">
......@@ -250,42 +248,60 @@ export default {
"loadPayUrl"
]),
toPay() {
// this.$bridge
// .setPageNavState({
// headerColor: "#fff",
// isShowClose: true,
// isShowBack: true,
// isCloseLeft: true,
// isShowTitle: true,
// isShowNav: true,
// isCloseWebView: false
// })
// .then(res => {
// console.log("setPageNavState in bill index");
// });
//TODO:根据UA判断:如果App版本<2.1.9就走原来的充值逻辑;如果App版本>=2.1.9就走新的充值逻辑;
const userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf("qqxbua") != -1) {
}
const version = "2.1.9";
if (version < "2.1.9") {
this.toPay_old();
} else {
this.toPay_new();
}
},
toPay_new() {
//TODO:先弹出一个遮罩层,点击任意按钮刷新页面
this.$bridge.getActionUrl(nativePayUrl).then(res => {
console.log("getActionUrl in bill index");
});
},
toPay_old() {
this.$bridge
.setPageNavState({
headerColor: "#fff",
isShowClose: true,
isShowBack: true,
isCloseLeft: true,
isShowTitle: true,
isShowNav: true,
isCloseWebView: false
})
.then(res => {
console.log("setPageNavState in bill index");
});
// this.$bridge
// .setBarColor({
// barColor: "#ffffff"
// })
// .then(res => {});
this.$bridge
.setBarColor({
barColor: "#ffffff"
})
.then(res => {});
// const failUrl = encodeURIComponent(
// "https://pay.qinqinxiaobao.com/callback/fail"
// );
// const successUrl = encodeURIComponent(
// "https://pay.qinqinxiaobao.com/callback/success"
// );
// const payMethod = 0;
// const payType = 4;
// const selected = 0;
// const fee = this.data.waitPay;
// let payUrl = `${this.payUrl}&accountId=${this.currentPerId}&payMethod=${payMethod}&payType=${payType}&fee=${fee}&selected=0&failUrl=${failUrl}&successUrl=${successUrl}`;
// window.onpageshow=null;
// window.onpageshow=function(event){
// location.reload();
// }
let payUrl = `hrs100://native/SelectRechargeMode?periodId=${this.currentPerId}&fee=${this.data.waitPay}`;
const failUrl = encodeURIComponent(
"https://pay.qinqinxiaobao.com/callback/fail"
);
const successUrl = encodeURIComponent(
"https://pay.qinqinxiaobao.com/callback/success"
);
const payMethod = 0;
const payType = 4;
const selected = 0;
const fee = this.data.waitPay;
let payUrl = `${this.payUrl}&accountId=${this.currentPerId}&payMethod=${payMethod}&payType=${payType}&fee=${fee}&selected=0&failUrl=${failUrl}&successUrl=${successUrl}`;
window.onpageshow = null;
window.onpageshow = function(event) {
location.reload();
};
window.location.href = payUrl;
},
toPage(flag) {
......
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 sign in to comment