vue调第三方支付宝接口

在前端点击支付的按钮的时候,会请求后台的接口,后台会返回一个form表单的数据
vue调第三方支付宝接口_第1张图片

	//调用支付宝接口			
	goRecharge(){
		this.$http.post('/AliRecharge/Alipay_Scan_Order', {
			phone: '',
			money: this.money,
			integral: this.integral
		}
		})
		.then(function(res) {
			var div = document.createElement('div');
			div.innerHTML = res.data;
			document.body.appendChild(div);
			document.forms.alipaysubmit.submit();  //执行submit表单提交,让页面重定向,跳转到支付宝页面
		})
		.catch(error => {

		})				
	},

成功之后,显示该页面
vue调第三方支付宝接口_第2张图片
充值成功,后端配置返回指定页面的url

你可能感兴趣的:(vue调第三方支付宝接口)