mui 判斷手機客戶端是否安裝微信或支付寶或淘寶等,mui 獲取微信、支付寶支付通道

csl125發表於2018-05-10

mui 判斷手機客戶端是否安裝微信或支付寶或淘寶等,mui 獲取微信、支付寶支付通道

plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})


plus.runtime.isApplicationExist({pname:'com.taobao.taobao',action:'taobao://'})



// 1. 獲取支付通道
document.addEventListener('plusready', function() {
	if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
						alert("微信應用已安裝");
						
					}else{
						alert("微信應用未安裝");
						
						
					}
	
	
	plus.payment.getChannels(function(channels) {
		alert(JSON.stringify(channels));
		for(var i in channels) {
			if(channels[i].id == 'alipay') {
				channel = channels[i];
				shopOrderDetail.alipay_off = channels[i].serviceReady;
			} else if(channels[i].id == 'wxpay') {
				wxchannel = channels[i];
				shopOrderDetail.wxpay_off = channels[i].serviceReady;
			}
		}
		
	}, function(e) {
		alert("獲取支付通道失敗:" + e.message);
	});
}

相關文章