|
Model.prototype.payOrderByWeixin = function(){
justep.Util.hint("正在打开微信");
var self = this;
if (!navigator.weixin) {
justep.Util.hint("请安装最新版本(含插件)体验!");
return;
};
var notifyUrl = location.origin;
var traceID = justep.UUID.createUUID();
var traceNo = orderID;
var weixin = navigator.weixin;
weixin.generatePrepayId({
"body" : "x5外卖",
"feeType" : "1",
"notifyUrl" : notifyUrl,
"totalFee" : "1",
"traceId" : traceID,
"tradeNo" : traceNo
}, function(prepayId) {
weixin.sendPayReq(prepayId, function(message) {
var responseCode = parseInt(message);
if (responseCode === 0) {
alert("支付成功")
}
}, function(message) {
justep.Util.hint("微信支付失败!");
});
}, function(message) {
justep.Util.hint("微信支付失败!");
})
};
微信支付的代码是从外卖案例拿过来的,不知道为啥打不开微信。
登录是没有问题的,可以正常打开微信。
|
|