h5前端实现微信支付

				//传参
					let data = {
						orderId: this.orderInfo.id,
						total_fee: Number(total_fee) + Number(this.payList[0].payAmount),//房租+押金
						description: "支付",
						appid: app.appid,
						list: list
					}
					AccountWxPay(data).then((res) => {
						console.log(res);
						if (res.code == 0) {
						//支付成功后返回的页面路径
							let redirectUrl = '&redirect_url=' +
								encodeURIComponent(
									'https://xxx.com/#/subpackage/PaySuccess/PaySuccess?orderType=0' + '&payAmount=' + Number(total_fee) + Number(this.payList[0].payAmount)
								)
							//获取当前机型
							let device = uni.getSystemInfoSync().platform
							console.log(device);
							//判断当前机型
							if (/ios/i.test(device)) {
								//ios跳转
								window.location.href = res.data + redirectUrl
							} else {
								//安卓跳转
								window.open(res.data + redirectUrl)
							}

						}
					});

这样就可以实现h5微信支付啦
刚做了个项目记录一下~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值