<template>
	<view class="container">
		<!-- 实名费用 -->
		<view class="auto_cost flex_r flex_ac flex_jb mar_t20">
			<view class="auto_name">实名费用</view>
			<view class="price"><text>￥</text>{{price}}</view>
		</view>
		<!-- 实名费用-end -->

		<!-- 微信支付 -->
		<view class="option flex_c mar_t20">
			<view class="list_name">充值方式</view>
			<view class="option_con flex_r flex_ac flex_jb mar_t16" @tap="setPayWay">
				<view class="way_con flex_r flex_ac">
					<image class="way_img" src="/static/img/weixin_icon.png" mode=""></image>
					<view class="way_text">微信支付</view>
				</view>
				<view class="way_radio" :class="isSelect ? 'select' : ''"></view>
			</view>
		</view>
		<!-- 微信支付-end -->

		<!-- 按钮 -->
		<view class="btn flex_r flex_ac flex_jc" @tap="autoOrderPay">下一步</view>
		<!-- 按钮-end -->
	</view>
</template>

<script>
	let page = 1;
	let app = getApp();
	var appEv = app.$vm.$options;
	import {
		ToPayOpre
	} from "@/utils/reqTools.js";
	let toPayOpre = new ToPayOpre();
	import {
		post
	} from "@/request/api.js";
	export default {
		data() {
			return {
				price: '',
				isSelect: false,
				payDetail:undefined,
				
			};
		},
		onLoad: function(e) {
			// this.loadData()
			console.log(e.payDetail,"aaaaaaaaaaaa")
			this.payDetail = JSON.parse(decodeURIComponent(e.payDetail));
			// console.log(this.payDetail,"支付信息" )
			this.price = e.amount
		},
		methods: {
			autoOrderPay() {
				if (!this.isSelect) {
					appEv.errTips('请选择支付方式')
					return false
				}
				// // #ifdef  H5
				// let type = "H5";
				// // #endif
				// // #ifdef  APP
				// let type = "app";
				// // #endif
				// // #ifdef  MP-WEIXIN
				// let type = "jsapi";
				// // #endif
				// let data = {
				// 	trade_type: type
				// };
				toPayOpre.toPay(this.payDetail, (rea) => {
					if (!rea) {
						// 支付成功
						appEv.errTips('实名认证中，请稍等')
						uni.switchTab({
						  url: "/pages/my/index",
						});
				
					} else {
						// 支付失败
						appEv.errTips('支付已取消')
					}
				});
				// let that = this;
				// let data = {
				// 	price:this.price * 100
				// }
				// return
				// const info = reqApi.identifyPayment(data)
				// if(info){
				// 	info.then(res => {
				// 		if(res.data.status == 200){
				// 			toPayOpre.toPay(res.data.payParam, (rea) => {
				// 				if (!rea) {
				// 					// 支付成功
				// 					uni.redirectTo({
				// 						url: '/pages/autonym-submit/index'
				// 					})
				// 				} else {
				// 					// 支付失败
				// 					appEv.errTips('支付已取消')
				// 				}
				// 			});
				// 		}
				// 	})
				// }
			},
			setPayWay: function() {
				this.isSelect = !this.isSelect
			}
		}
	}
</script>

<style lang="scss">
	// 页面配置
	page {
		background: #F4F4F4;
	}

	// 页面配置-end

	// 实名费用
	.price {
		font-size: 36rpx;
		color: #E75B25;
		font-family: "SourceHanSansCN-Medium";
	}

	.auto_name {
		font-size: 28rpx;
		color: #121212;
		font-family: "SourceHanSansCN-Medium";
	}

	.price text {
		font-size: 24rpx;
		color: #E75B25;
		font-family: "SourceHanSansCN-Medium";
	}

	.auto_cost {
		width: 100%;
		height: 104rpx;
		background: #fff;
		padding: 0 30rpx;
		box-sizing: border-box;
	}

	// 实名费用-end

	// 微信支付
	.option_con {
		width: 100%;
		overflow: hidden;
	}

	.way_img {
		width: 52rpx;
		height: 52rpx;
		margin-right: 8rpx;
	}

	.way_text {
		font-size: 22rpx;
		color: #333333;
		font-family: "SourceHanSansCN-Medium";
	}

	.list_name {
		color: #333333;
		font-size: 28rpx;
		font-family: "SourceHanSansCN-Medium";
		font-weight: 500;
	}

	.option {
		width: 100%;
		overflow: hidden;
		padding: 20rpx 30rpx 60rpx;
		box-sizing: border-box;
		background: #fff;
	}

	.way_radio {
		width: 39rpx;
		height: 35rpx;
		background: url("~@/static/img/weixuanzhong.png");
		background-repeat: no-repeat;
		background-size: 35rpx 35rpx;
		background-position: center center;
	}

	.select {
		background: url("~@/static/img/consent.png");
		background-repeat: no-repeat;
		background-size: 39rpx 35rpx;
		background-position: center center;
	}

	// 微信支付-end

	// 按钮
	.btn {
		width: 689rpx;
		height: 92rpx;
		background: #17BB87;
		border-radius: 10rpx;
		font-family: "SourceHanSansCN-Medium";
		font-size: 42rpx;
		color: #fff;
		margin: 167rpx auto;
	}

	// 按钮-end
</style>
