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

[provider]修改支付示例

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