web端四方支付 只有安卓可以跳转

本文详细介绍了在一个小程序中实现VIP会员开通的过程,包括不同等级会员的选择、支付方式的切换以及具体的支付流程。通过代码示例展示了如何使用微信支付和支付宝进行在线支付,并处理支付回调。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<template>
	<view style="width: 750upx;">
		<view class="back">
			<view class="back-a">
				<view style="margin-left: 30upx;" @tap="Vip2">
					黄金会员
				</view>
				<view style="margin-right: 30upx;" @tap="Vip3">
					钻石会员
				</view>
			</view>
			<view class="ba">
				<image src="../../../static/vip/vip0.png"></image>
				<view class="baba">
					{{cost}}元
				</view>
				<view class="huiyuan">
					银级会员
				</view>
			</view>
			<view class="back-c" @tap="toPlay">
				立刻开通
			</view>
			<view class="pay" v-if="all" @tap="toPlay">
				<view class="pay-kuang">
					<view class="zf-kuang" @tap="zf(902)">
						<image src="../../../static/center/weixin.png"></image>
						<text style="margin-left: 30upx;">微信支付</text>
					</view>
					<view class="zf-kuang" @tap="zf(903)">
						<image src="../../../static/zfb.png"></image>
						<text style="margin-left: 30upx;">支付宝支付</text>
					</view>
				</view>
			</view>
		</view>
		<view>
			<view class="back-d"></view>
			<view class="back-e">
				<view class="hui">
					银级会员福利
				</view>
			</view>
			<view class="back-f">
				<view class="text">
					<image class="ree" src="../../../static/vip/reward@2x.png"></image>
				</view>
				<view class="ti">
					<view class="ti-t">
						获赠29800待激活趣币
					</view>
					<view class="ti-t">
						邀请满10人兑换现金
					</view>
				</view>
			</view>
			<view class="back-f">
				<view class="text">
					<image class="ree" src="../../../static/vip/VIP@2x.png" mode=""></image>
				</view>
				<view class="ti">
					<view class="ti-t">
						银级会员<text style="font-weight: bold;font-size: 38upx;">{{cost}}</text>元
					</view>
					<view class="ti-t">
						日赚6.8元
					</view>
				</view>
			</view>
			<view class="back-f">
				<view class="text">
					<image class="ree" src="../../../static/vip/InvitingFriends@2x.png"></image>
				</view>
				<view class="ti">
					<view class="ti-t">
						邀好友立获240元奖励
					</view>
					<view class="ti-t">
						邀请银级奖励15元/人,金级75/人,钻石150元/人
					</view>
				</view>
			</view>
			<view class="back-f">
				<view class="text">
					<image class="ree" src="../../../static/vip/Reentry@2x.png"></image>
				</view>
				<view class="ti">
					<view class="ti-t">
						徒弟完成任务的奖励返现
					</view>
					<view class="ti-t">
						可得一级徒弟10%,二级徒孙5%奖励
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				name: '',
				val: '',
				token: '',
				all: false, //隐藏
				pay_amount: '', //金额
				pay_applydate: '', //时间
				pay_bankcode: '', //支付方式
				pay_callbackurl: '', //域名
				pay_memberid: '', //支付号
				pay_notifyurl: '', //二维码地址
				pay_orderid: '', //订单号
				pay_md5sign: '', //key签名
				pay_productname: '', //提示
				cost: '', //支付金额
				tjurl: '', //支付连接
				index: '',
				code: ''
			}
		},
		onLoad() {
			this.Level()
		},
		methods: {
			Level() {
				uni.request({
					url: this.baseUrl + 'api/Level/LevelInfo',
					method: 'POST', //请求方式
					data: { //传值的数据
						"token": uni.getStorageSync('token')
					},
					header: {
						'Content-type': 'application/x-www-form-urlencoded',
					},
					success: (ret) => {
						console.log("Level", ret.data.data);
						if (ret.data.code == 0) { //判断状态码
							var that = this
							that.id = ret.data.data[0].id
							that.name = ret.data.data[0].name
							that.cost = ret.data.data[0].cost
							that.pay_amount = that.cost
							console.log(that.cost)
						} else {
							uni.hideLoading();
							uni.showToast({
								title: ret.data.msg,
								icon: 'none'
							});
						}
					},
					error: (e) => {
						uni.hideLoading();
						uni.showToast({
							title: e.response.data.msg,
							icon: 'none'
						});
					}
				})
			},
			Vip2() {
				//黄金会员
				uni.navigateTo({
					url: 'vip2'
				})
			},
			Vip3() {
				//钻石
				uni.navigateTo({
					url: 'vip3'
				})
			},
			topaly() {
				uni.navigateTo({
					url: 'topay/topay'
				})
			},
			toPlay() {
				this.all = !this.all
			},
			//支付方式
			zf(pay_bankcode) {
				// console.log('pay_bankcode', pay_bankcode)
				this.pay_bankcode = pay_bankcode;
				this.tovip()
			},
			tovip() { //开通白银vip
				// console.log("开通白银", this.cost)
				var that = this
				if (that.pay_bankcode === 902) {
					var code = 'wxpay'
				} else {
					code = 'alipay'
				}

				that.token = uni.getStorageSync('token')
				if (that.token) {
					// 获得订单数据
					uni.request({
						url: this.baseUrl + 'api/Order/huanxunPay', //地址--
						method: 'POST', //请求方式
						data: { //传值的数据
							"token": that.token,
							"pay_type": that.code, //支付宝支付:alipay 微信支付:wxpay	
							"category": 1, //0充值,1开通白银会员,2开通黄金会员,3开通钻石会员
							"category_name": '开通白银', //	分类名,前端定,如:充值,开通白银会员
							"amount": that.cost, //金额
							"pay_bankcode": that.pay_bankcode
						},
						header: {
							'Content-type': 'application/x-www-form-urlencoded',
						},
						success: (ret) => {
							console.log("创建订单", ret);
							var that = this
							that.pay_amount = ret.data.data.pay_amount //金额
							that.pay_applydate = ret.data.data.pay_applydate //时间
							that.pay_bankcode = ret.data.data.pay_bankcode //支付方式902微信  903支付宝
							that.pay_callbackurl = ret.data.data.pay_callbackurl //域名
							that.pay_md5sign = ret.data.data.pay_md5sign //key签名
							that.pay_memberid = ret.data.data.pay_memberid //支付号
							that.pay_notifyurl = ret.data.data.pay_notifyurl //二维码地址
							that.pay_orderid = ret.data.data.pay_orderid //订单编号
							that.pay_productname = ret.data.data.pay_productname //提示
							that.tjurl = ret.data.tjurl //支付连接
							//走支付	
							this.comment(that.tjurl)
						},
						error: (e) => {
							uni.hideLoading();
							uni.showToast({
								title: e.response.data.msg,
								icon: 'none'
							});
						}
					});
				} else {
					uni.showToast({
						title: '请先去登录',
						icon: 'none'
					})
					uni.navigateTo({
						url: '../login/login'
					})
				}
			},
			comment(tjurl) {
				console.log("提交四方支付地址", tjurl)
				var that = this
				uni.request({
					url: tjurl, //支付连接
					method: 'POST', //请求方式
					data: {
						pay_amount: that.pay_amount, //金额
						pay_applydate: that.pay_applydate, //时间
						pay_bankcode: that.pay_bankcode, //支付方式  902微信  903支付宝
						pay_callbackurl: that.pay_callbackurl, //页面跳转返回地址
						pay_md5sign: that.pay_md5sign, //签名
						pay_memberid: that.pay_memberid, //平台分配商户号
						pay_notifyurl: that.pay_notifyurl, //服务端返回地址
						pay_orderid: that.pay_orderid, //上送订单号唯一, 字符长度20
						pay_productname: that.pay_productname //提示
					},
					header: {
						'Content-type': 'application/x-www-form-urlencoded',
					},
					success: (ret) => {
						console.log("四方支付", ret)
						//获得用户当前的系统
						switch (uni.getSystemInfoSync().platform) {
							case 'android':
								console.log('运行Android上', ret.header.Location)
								// #ifdef APP-PLUS
								plus.runtime.openURL(ret.header.Location, (err) => {
									console.log(err);
								});
								// #endif
								break;
							case 'ios':
								console.log('运行iOS上', ret)
								if (ret.statusCode === 200) {

								}
								break;
							default:
								console.log('运行在开发者工具上')
								plus.runtime.openURL(ret.header.Location, (err) => {
									console.log(err);
								});
								break;
						}
						// console.log(encodeURI(ret))
						// plus.runtime.openURL(encodeURI(ret))
						// encodeURIComponent(ret.header.Location)
						// plus.runtime.openWeb(ret.header.Location,(err)=>{})  无法使用微信支付 
					},
					error: (e) => {
						uni.hideLoading();
						uni.showToast({
							title: e.response.data.msg,
							icon: 'none'
						});
					}
				});
			}
		}
	}
</script>

<style lang="less">
	page {
		width: 100%;
		height: 100%;
		font-size: 30upx;
		background-color: #FFFFFF;
		font-family: pingfang-sc-medium;
	}

	.back-a {
		display: flex;
		justify-content: space-between;
		height: 300upx;
		background-color: #333231;
		color: #FDEDA9;
		margin-bottom: 30upx;
	}

	.ba {
		margin-top: 100upx;
		margin-top: -180upx;
		margin-left: 75upx;
	}

	.ba image {
		width: 600upx;
		height: 338upx;
	}

	.baba {
		margin-right: 30upx;
		font-size: 48upx;
		position: absolute;
		top: 380upx;
		right: 70upx;
		font-weight: bold;
	}

	.huiyuan {
		color: #000000;
		position: absolute;
		top: 300upx;
		left: 325upx;
		font-size: 38upx;
		font-weight: bold;
	}

	.zk {
		font-family: PingFang-SC-Bold;
		font-size: 32upx;
		position: absolute;
		top: 360upx;
		left: 100upx;
		font-weight: bold;
	}

	.zkd {
		position: absolute;
		font-family: PingFang-SC-Regular;
		font-size: 22upx;
		top: 420upx;
		left: 90upx;
	}

	.bg-code {
		position: absolute;
		top: 53.5%;
		left: 48%;
		transform: translateX(-50%);
	}


	.back-d {
		height: 10upx;
		background-color: #f5f2f0;
		margin-bottom: 50upx;
	}

	.hui {
		text-align: center;
		font-family: pingfang-sc-medium;
		margin-bottom: 25upx;
	}

	.back-f {
		display: flex;
		margin: 20upx auto;
		width: 690upx;
		border-radius: 10upx;
		background-color: #333231;
	}

	.text {
		width: 80upx;
		height: 100upx;
		margin-top: 40upx;
		margin-left: 40upx;
	}

	.ree {
		width: 58upx;
		height: 60upx;
	}

	.ti {
		color: #FDEDA9;
		line-height: 50upx;
		margin-top: 20upx;
		margin-bottom: 20upx;
	}

	.back-c {
		width: 300upx;
		height: 60upx;
		background-color: #333231;
		border-radius: 10upx;
		color: #beb281;
		margin: 68upx auto;
		text-align: center;
		line-height: 60upx;
	}

	.pay {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		text-align: center;
		background: rgba(0, 0, 0, 0.4);
	}

	.pay-kuang {
		width: 80%;
		height: 9rem;
		background-color: rgb(255, 255, 255);
		margin: 50% auto;
		border-radius: 5px;
	}

	.zf-kuang {
		display: flex;
		height: 50%;
		align-items: center;
		width: 100%;
		justify-content: center;
	}

	.zf-kuang image {
		width: 40upx;
		height: 40upx;
	}

	.zf-kuang:nth-of-type(1) {
		border-bottom: #EEEEEE solid 1upx;
	}
</style>

可怕    IOS不可以呀

然后让客户开户,,之后跑路了

太坑人了

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值