7***@qq.com
7***@qq.com
  • 发布:2016-08-11 10:56
  • 更新:2016-08-11 10:56
  • 阅读:1175

微信支付 -1

分类:HTML5+
plus.payment.getChannels(function(channels) {  
                    for(var i in channels) {  
                        var channel = channels[i];  
                        if(channel.id == 'qhpay' || channel.id == 'qihoo') { // 过滤掉不支持的支付通道:暂不支持360相关支付  
                            continue;  
                        }  
                        pays[channel.id] = channel;  
                        alert(channel.id);  
                        checkServices(channel);  
                    }  
                }, function(e) {  
                    outLine("获取支付通道失败:"   e.message);  
                });  

                function checkServices(channel) { //检测是否安装支付服务  
                    if(!channel.serviceReady) {  
                        var txt = null;  
                        switch(channel.id) {  
                            case "alipay":  
                                txt = "检测到系统未安装“支付宝快捷支付服务”,无法完成支付操作,是否立即安装?";  
                                break;  
                            default:  
                                txt = "系统未安装“"   channel.description   "”服务,无法完成支付,是否立即安装?";  
                                break;  
                        }  
                        plus.nativeUI.confirm(txt, function(e) {  
                            if(e.index == 0) {  
                                channel.installService();  
                            }  
                        }, channel.description);  
                    }  
                }  

                mui("body").on("tap", "#pay", function() {  
                    var obj = new Object();  
                    $.ajax({  
                        type: "POST",  
                        data: obj,  
                        url: basePath   "client/order/getWechatPay.do",  
                        dataType: "json",  
                        success: function(data) {  
//                          alert("22")  
//                          var order='{"appid":"wxcf8f8a1ad6d80d2c","noncestr":"SIgsvzOCCUpQCLQjKjITTSaVYcG1ET","package":"Sign=WXPay","partnerid":"1370274602","prepayid":"wx20160810150529c1693c46680552341470","timestamp":1470812465,"sign":"9CB1E66C3525790CB59B64BA7D8BA373"}';  
//                          alert(data.msg);  
                            plus.payment.request(pays["wxpay"], data.msg, function(result) {  
                                mui.toast("支付成功")  
                            }, function(e) {  
                                console.log(e.message);  
                                plus.nativeUI.alert(e.message);  
                            });  
                        },  
                        error: function() {  
                            plus.nativeUI.closeWaiting();  
                            //请求出错处理  
                            mui.toast('网络不稳定');  
                        }  
                    });  
                });  

manifest.json 也是注册了得

2016-08-11 10:56 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复