$.ajax({
type: 'POST',
url: api + '/pay/generateOrderInfo', //付出接口
data: obj,
dataType:"json",
success: function (res) {
alert(JSON.stringify(res))
if(_this.radio=='2'){ //微信跳转
this.data = res.data;
var dataPay = res.data;
// var url = 'appid='+dataPay.appid+'&noncestr='+dataPay.noncestr+'&package='+ dataPay.package+'&prepayid='+dataPay.prepayid+'&sign='+ dataPay.sign+'×tamp='+dataPay.timestamp;
//一致下单接口返回付出相干参数给商户背景,如付出跳转url(参数名“mweb_url”),商户经由过程mweb_url调起微信付出中心页
window.location.href = res.data.mwebUrl
}else{
//(付出宝)点击付出按钮会触发某个服务端接口,接口返回拼接的form表单,前端拿到表单插进去并触发提交,接着跳转到付出宝付出
const div = document.createElement('div');
div.innerHTML = res.data;
document.body.appendChild(div);
document.forms[0].submit();
}
},
error:function(status){
console.log('error')
}
});