<template>
	<view class="content">

		<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
		<!-- <view class="top-box">
			<view class="inputbox">
				<u-icon name="search" size="20"></u-icon>
				<input type="text" />
			</view>
			<u-icon name="scan" color="#fff" size="38"></u-icon>
		</view> -->
		<view class="box_">
			<view class="leftbox" @click="goChooseUser()">
				<view class="title_">会员信息</view>
				<view v-if="!isChooseUser">
					请选择会员
				</view>
				<view v-if="isChooseUser">
					<view class="d-s">
						<view class="hui">会员名称:</view>
						<view class="hei">{{userInfo.name}}</view>
					</view>
					<view class="d-s">
						<view class="hui">手机号:</view>
						<view class="hei">{{userInfo.mobile}}</view>
					</view>
					<view class="d-s">
						<view class="hui">账户余额:</view>
						<view class="hei">{{userInfo.cardBalance}}元</view>
					</view>
				</view>
			</view>


			<view class="rightbox">
				<image src="../../static/imgs/av.png" mode=""></image>
			</view>
		</view>
		<view class="d-bs">
			<view class="title_h">充值面额</view>
			<view class="title_lan">充值记录</view>
		</view>
		<view class="wrap-box">
			<view class="w-box" v-for="(item,index) in numList " :key="index" @click="getindex(index)">
				<view class="hezi" :class="{ 'acv' : listindex == index }">
					{{item}}
				</view>
			</view>
		</view>
		<view class="bai-box">
			<view class="h-box">
				<view class="h-ds">
					<view class="icon-img">
						<image src="../../static/imgs/wx.png" mode=""></image>
					</view>
					<view class="">微信扫码支付</view>
				</view>

				<view class="qiu" v-if="memberId != 0" @click="getmemberId(0)"></view>
				<view class="qiux" v-if="memberId == 0">
					<u-icon name="checkmark" color="#fff" size="16"></u-icon>
				</view>
			</view>
			<view class="h-box">
				<view class="h-ds">
					<view class="icon-img">
						<image src="../../static/imgs/zfb.png" mode=""></image>
					</view>
					<view class="">支付宝扫码支付</view>
				</view>

				<view class="qiu" v-if="memberId != 1" @click="getmemberId(1)"></view>
				<view class="qiux" v-if="memberId == 1">
					<u-icon name="checkmark" color="#fff" size="16"></u-icon>
				</view>
			</view>
			<view class="h-box">
				<view class="h-ds">
					<view class="icon-img">
						<image src="../../static/imgs/yl.png" mode=""></image>
					</view>
					<view class="">银联扫码支付</view>
				</view>

				<view class="qiu" v-if="memberId != 2" @click="getmemberId(2)"></view>
				<view class="qiux" v-if="memberId == 2">
					<u-icon name="checkmark" color="#fff" size="16"></u-icon>
				</view>
			</view>
			<view class="h-box">
				<view class="h-ds">
					<view class="icon-img">
						<image src="../../static/imgs/xjzf.png" mode=""></image>
					</view>
					<view class="">现金支付</view>
				</view>

				<view class="qiu" v-if="memberId != 3" @click="getmemberId(3)"></view>
				<view class="qiux" v-if="memberId == 3">
					<u-icon name="checkmark" color="#fff" size="16"></u-icon>
				</view>
			</view>
		</view>
		<view class="bottom-b"></view>
		<view class="p-bottom" @click="govipjs()">
			<view class="anniu">
				确认支付
			</view>
		</view>
	</view>
</template>

<script>
	import request from "../../utils/request";
	import headers from '../../components/header/headers.vue'

	export default {
		data() {
			return {
				titles: "会员充值",
				listindex: 0,
				memberId: 0,
				numList: [
					"50元",
					"100元",
					"300元",
					"500元",
					"1000元",
					"自定义金额",
				],
				isChooseUser: false,
				userId: "",
				userInfo: "",
			}
		},
		onLoad(e) {
			this.userId = e.userId
			if (e.userId) {
				this.isChooseUser = true
				this.getUser()
			}
		},
		onShow() {
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers
		},
		methods: {
			getmemberId(num) {
				this.memberId = num
				console.log(this.memberId);
			},
			// 获取用户信息
			getUser() {
				request({
					url: '/business/userManager/user/' + this.userId,
					method: 'get',
				}).then((res) => {
					this.userInfo = res.data
				})
			},
			goChooseUser() {
				uni.navigateTo({
					url: "/pagesHome/searchVip/searchVip?type=1"
				})
			},
			getindex(index) {
				this.listindex = index
			},
			govipjs() {
				// uni.navigateTo({
				// 	url: '/pagesHome/MemberRecharge/list'
				// })
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #0864e9;
		// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
		height: 30vh;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.container {
		width: 100%;
		background: #f4f5f6;

	}

	.top-box {
		width: 95%;
		margin: 15px auto;

		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.inputbox {
		width: 90%;
		background: #fff;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 5px 15px;
		border-radius: 50px;
	}

	.box_ {
		width: 95%;
		border-radius: 8px;
		height: 154px;
		background: #fff;
		margin: 15px auto;
		border: 1px solid #0864e9;
		box-sizing: border-box;
		padding: 15px;
		display: flex;

		justify-content: space-between;
		position: relative;
		overflow: hidden;

	}

	.d-s {
		display: flex;
		align-items: center;
		margin-bottom: 10px;
	}

	.title_ {
		font-weight: bold;
		font-size: 16px;
		color: #0864E9;
		margin-bottom: 10px;
	}

	.leftbox {
		width: 50%;
	}

	.rightbox {
		position: absolute;
		right: 0px;
		bottom: 0px;

		image {
			width: 145px;
			height: 130px;
		}
	}

	.hui {
		font-weight: 500;
		font-size: 14px;
		color: #333333;
		margin-right: 5px;
	}

	.hei {
		font-weight: bold;
		font-size: 14px;
		color: #333333;
	}

	.bottom-b {
		width: 100%;
		height: 68px;
	}

	.p-bottom {
		width: 100%;
		height: 68px;
		background: #fff;
		position: fixed;
		bottom: 0px;
		left: 0px;
	}

	.anniu {
		height: 40px;
		background: #0864E9;
		width: 80%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		border-radius: 50px;
		margin: 5px auto;
	}

	.d-bs {
		width: 90%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 5px auto;
	}

	.wrap-box {
		width: 100%;
		display: flex;
		flex-wrap: wrap;
	}

	.title_h {
		color: #333333;
		font-weight: bold;
	}

	.title_lan {
		font-weight: 500;
		font-size: 16px;
		color: #0864E9;
	}

	.w-box {
		width: 33.3%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.hezi {
		width: 100px;
		height: 70px;
		background: #f8f8f8;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 6px;
		overflow: hidden;
		margin: 10px auto;
	}

	.acv {
		background: #0864E9 !important;
		color: #fff !important;
	}

	.bai-box {
		width: 90%;
		margin: 15px auto;

	}

	.h-box {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 15px auto;
	}

	.h-ds {
		display: flex;
		align-items: center;
	}

	.icon-img {
		width: 30px;
		height: 30px;
		margin-right: 10px;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.qiu {
		width: 16px;
		height: 16px;
		border-radius: 50%;
		border: 1px solid #333333;
	}

	.qiux {
		width: 16px;
		height: 16px;
		border-radius: 50%;
		border: 1px solid #0864e9;
		background: #0864e9;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
	}
</style>