提交 4a566e93 编写于 作者: M mahaifeng

[provider]修改支付示例

上级 ce408716
......@@ -85,10 +85,13 @@
console.log(obj)
console.log(JSON.stringify(obj))
value.providerObj.push(obj)
if(obj instanceof UniPaymentWxpayProvider ){//判断微信是否安装
// #ifdef APP-ANDROID
if (obj instanceof UniPaymentWxpayProvider) {//判断微信是否安装
var isWeChatInstalled = (obj as UniPaymentWxpayProvider).isWeChatInstalled
console.log(isWeChatInstalled)
}
// #endif
// #ifdef APP-IOS
const providerObjMap = this.getProviderObjectMap(obj)
console.log(providerObjMap)
......
......@@ -63,16 +63,26 @@
if (provider == "alipay") {
this.payAli()
} else if (provider == "wxpay") {
if (e.provider != null && e.provider?.isAppExist==false) {
// #ifdef APP-ANDROID
if (e.provider != null && e.provider instanceof UniPaymentWxpayProvider && !((e.provider as UniPaymentWxpayProvider).isWeChatInstalled)) {
uni.showToast({
title: "微信没有安装",
icon:'error'
icon: 'error'
})
} else {
this.payWX()
}
// #endif
// #ifdef APP-IOS
if (e.provider != null && !e.provider.isAppExist)) {
uni.showToast({
title: "微信没有安装",
icon: 'error'
})
} else {
this.payWX()
}
// #endif
}
},
payAli() {
......@@ -119,7 +129,7 @@
})
let url = 'https://demo.dcloud.net.cn/payment/wxpayv3.__UNI__uniappx/?total=0.01'
const res = uni.getAppBaseInfo();
let packageName:string | null
let packageName : string | null
// #ifdef APP-ANDROID
packageName = res.packageName
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册