<template>
	<view :class="[AppTheme]" class="all_box container">

		<view class="user-section bg-primary">
			<view class="user-info-box">
			</view>
			<view class="mass_a">
				<view class="mass_a_1">已缴诚信保证金(元)</view>
				<view class="mass_a_2">
					<view style="display:flex;flex-wrap: wrap;align-content: flex-end">
						<view style="padding-bottom: 8rpx;">￥</view>
					</view>
					<view class="money">
						{{money||0}}
					</view>
					<view class="btn">
						<view class="btn3" @click="showopen=true">解冻</view>
						<view class="btn4" @click="pay()">缴纳</view>
					</view>
				</view>
			</view>
		</view>
		<!-- <view class="order-section2"> -->
		<view class="wrap">
			<u-divider textSize="18" textColor="#151515" text="缴纳保证金,获取商户特权"></u-divider>
			<view :class="{item:true,action:rowindex==index}" v-for="(item, index) in list" :key="index"
				@click="select(index)">
				<view class="row1">
					<view class="ilogin">
						<u--image :showLoading="true" :src="item.inon" width="40px" height="40px"></u--image>
					</view>
					<view class="name">{{item.name}}</view>
					<view :class="{activation:item.activation==1,noactivation:item.activation==0}">
						<span>{{item.activation==1?'已缴纳':'未缴纳'}}</span>
					</view>
				</view>
				<view class="row2">
					特权说明：{{item.remark}}
				</view>
				<view class="row3">
					<view style="display:flex;flex-wrap: wrap;align-content: flex-end">
						<u-icon name="rmb" color="#646464" size="20" :bold="true"></u-icon>
					</view>

					<view class="money">
						{{item.money||0}}
					</view>
					<view style="width: 100%;display: flex;justify-content: flex-end;">
						<u-icon name="arrow-right" @click="open(item)" labelPos="left" label="查看详情" color="#000000"
							size="18" :bold="true">
						</u-icon>
					</view>
				</view>
			</view>
		</view>
		<u-popup :show="show" @close="close" mode="center" :closeable="true" round="10">
			<view class="title">等级详情</view>
			<view class="parse">
				<u-parse :content="content"></u-parse>
			</view>
		</u-popup>
		<u-modal :show="showopen" title="提示" confirmColor="#007aff" @confirm="confirm" @cancel='showopen=false'
			confirmText="确定解冻" cancelText="不解了" :showConfirmButton="true" :showCancelButton="true">
			<view style="text-align: center;padding: 20rpx;">解冻保证金后将失去等级特权，确定解冻吗？</view>
		</u-modal>
		<payment ref="payment" :channel="10" :alipay="true" :weixinpay="true" :zhtpay="true"></payment>
	</view>
</template>
<script>
	import mineApi from '@/api/home/index.js';
	export default {
		data() {
			return {
				primary: this.$theme.primary,
				settingFile: this.$siteinfo,
				todaypayprice: 0,
				rowindex: -1,
				money: 0,
				smoney: 0,
				bid: 0,
				list: [],
				show: false,
				content: '',
				showopen: false
			};
		},
		onLoad() {
			this.getInitInfo()
		},
		methods: {
			confirm() {
				this.showopen = false;
				mineApi.thaw({}).then(res => {
					if (res.status = 1) {
						this.money='0.00'
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					} 
				});
			},
			select(index) {
				if (this.list.length >= index) {
					let item = this.list[index];
					console.log(item,'item')
					if (item.activation == 0) {
						this.smoney = item.money
						this.bid = item.id
						this.rowindex = index
					}
				}
			},
			open(item) {
				this.content = item.detail
				this.show = true
			},
			close() {
				this.show = false
			},
			pay() {
				if (this.rowindex < 0) {
					uni.showToast({
						title: '请选择正确的等级',
						icon: 'none'
					})
					return;
				} else {
					this.$refs.payment.payopen({
						money: this.smoney,
						bid: this.bid
					});
				}
			},
			getInitInfo() {
				mineApi.bondindex({}).then(res => {
					if (res.status == 1) {
						this.list = res.data.data;
						this.money = res.data.money;
					}
				});
			},


		}
	};
</script>
<style lang="scss">
	.all_box {
		/* #ifdef APP-PLUS */
		min-height: calc(100vh - 120rpx);
		/* #endif */
		/* #ifndef APP-PLUS */
		min-height: calc(100vh);
		/* #endif */
		background-color: #fafafa;
	}

	.title {
		padding: 20rpx;
		text-align: center;
	}

	.parse {
		padding: 20rpx;
		width: 90vw;
		height: calc(50vh);
		overflow-y: scroll;
	}
	%flex-center {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	%section {
		display: flex;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10upx;
	}

	%sectio {
		display: flex;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10upx 10upx 0 0;
	}

	.user-section {
		height: 300rpx;
		padding: 0upx 20rpx;

		.bg {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			filter: blur(1px);
			opacity: 0.7;
		}
	}

	.user-info-box {
		display: flex;
		text-align: center;
		align-items: center;
		// position: relative;
		padding: 25rpx 0;
		// z-index: 1;



		.portrait {
			width: 90upx;
			height: 90upx;
			border-radius: 50%;
			display: inline-block;
		}

		.info-box {
			margin-left: 20rpx;
			justify-items: center;
			width: 250rpx;

			.username {
				display: inline-block;
				font-size: 30rpx;
				color: #ffffff;
				margin-top: 20upx;
			}

			.username2 {
				display: inline-block;
				font-size: 28rpx;
				color: #f1f1f1;
				margin-top: 20upx;
			}

			.user-mask {
				// margin-top: 15upx;
				justify-content: start;
				text-align: left;
				color: #ffffff;
				font-size: 28rpx;
			}
		}

	}



	.tj-sction {
		// @extend %section;
		background: #fff;
		width: 100%;
		// margin: 0 30upx;
		border-radius: 10rpx;
		// z-index: 99;
		margin: auto;
		// margin-top: -5rpx;
		// position: relative;

		.top_box {
			padding: 20rpx;
			color: #75787d;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.left {
				width: 70%;

				text {
					font-size: 32rpx;
					padding-left: 20rpx;
				}
			}

			.right {
				color: #fff;
				font-size: 26rpx;
				padding: 15rpx 20rpx;
				border-radius: 40rpx;
				margin-right: 20rpx;
				margin-top: 30rpx;
			}
		}

		.bottom_box {
			display: flex;
			justify-content: space-around;
			align-items: center;

			.tj-item {
				@extend %flex-center;
				flex-direction: column;
				height: 140upx;
				font-size: $font-sm;
				color: #75787d;
			}
		}

		.num {
			font-size: $font-lg;
			color: $font-color-dark;
			margin-bottom: 8upx;
		}
	}

	.vip-card-box {
		display: flex;
		flex-direction: column;
		color: #f7d680;
		height: 240upx;
		background: linear-gradient(left, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.8));
		border-radius: 16upx 16upx 0 0;
		overflow: hidden;
		position: relative;
		padding: 20upx 24upx;

		.card-bg {
			position: absolute;
			top: 20upx;
			right: 0;
			width: 380upx;
			height: 260upx;
		}

		.b-btn {
			position: absolute;
			right: 20upx;
			top: 16upx;
			width: 132upx;
			height: 40upx;
			text-align: center;
			line-height: 40upx;
			font-size: 22upx;
			color: #36343c;
			border-radius: 20px;
			background: linear-gradient(left, #f9e6af, #ffd465);
			z-index: 1;
		}

		.tit {
			font-size: $font-base + 2upx;
			color: #f7d680;
			margin-bottom: 28upx;

			.yticon {
				color: #f6e5a3;
				margin-right: 16upx;
			}
		}

		.e-b {
			font-size: $font-sm;
			color: #d8cba9;
			margin-top: 10upx;
		}
	}

	.cover-container {
		background: $page-color-base;
		/* #ifdef H5 */
		margin-top: 70rpx;
		/* #endif */
		/* #ifndef H5 */
		margin-top: 50rpx;
		/* #endif */
		padding: 20rpx;
		position: relative;
		background: #f5f5f5;
		padding-bottom: 20upx;

		.arc {
			width: 100%;
			height: 36upx;
		}
	}


	.order-section.order-section1 {
		margin-top: 0;
		border-radius: 0 0 10upx;
	}

	.order-section {
		@extend %sectio;
		padding: 28upx 0;
		// margin-top: 20upx;
		border-radius: 10rpx;

		.order-item {
			@extend %flex-center;
			width: 120upx;
			height: 120upx;
			border-radius: 10upx;
			font-size: $font-sm;
			color: $font-color-dark;
		}

		.yticon {
			// width: 52rpx;
			// height: 52rpx;
			/* font-size: 48upx; */
			margin-bottom: 18upx;
			color: #fa436a;
		}

		.icon-shouhoutuikuan {
			font-size: 44upx;
		}
	}

	.wrap {
		padding: 30rpx;
		color: #1d1d1d;

		.item {
			height: 200rpx;
			background-color: #ffffff;
			text-align: center;
			padding: 20rpx;
			border-radius: 10rpx;
			font-size: 30rpx;
			margin-bottom: 15rpx;
		}

		.action {
			border: 4rpx solid #56AB2F;
		}

		.row1 {
			display: flex;
			justify-content: flex-start;
			width: 100%;
			height: 50rpx;
			padding: 15rpx 0rpxs;
			margin-bottom: 15rpx;

			.ilogin image {
				width: 45rpx;
				height: 45rpx;
			}

			.name {
				padding-top: 15rpx;
				padding-left: 15rpx;
				font-size: 30rpx;
			}

			.noactivation {
				height: 30rpx;
				margin-top: 10rpx;
				margin-left: 10rpx;
				color: #ffffff;
				padding: 0.125rem 0.375rem;
				font-size: 20rpx;
				display: flex;
				align-items: center;
				border-radius: 0.25rem 0;
				background-color: #FF3333;
			}

			.activation {
				height: 30rpx;
				margin-top: 10rpx;
				margin-left: 10rpx;
				color: #ffffff;
				padding: 0.125rem 0.375rem;
				font-size: 20rpx;
				display: flex;
				align-items: center;
				border-radius: 0.25rem 0;
				background-color: #76bf6b;

			}
		}

		.row2 {
			margin-top: 45rpx;
			font-size: 26rpx;
			color: #909090;
			text-align: left;
		}

		.row3 {
			display: flex;
			justify-content: flex-start;
			width: 100%;
			height: 30%;
			padding: 15rpx 0rpx;

			.money {
				margin-top: 10rpx;
				font-size: 50rpx;
				padding-left: 10rpx;
			}
		}

		.inner {
			display: inline-block;
			margin-bottom: 60rpx;
			width: 33%;
			text-align: center;

			text {
				display: block;
				text-align: center;
				font-size: 24rpx;
				color: $font-color-dark;
			}

			.yticon {
				width: 65rpx;
				height: 65rpx;
				margin-bottom: 18rpx;
			}

			.icon-shouhoutuikuan {
				font-size: 44upx;
			}
		}
	}

	.order-section2 {
		width: 100%;
		padding: 28upx 0 0 0;
		margin-top: 20upx;
		background-color: #fff;
		border-radius: 10rpx;
	}

	.history-section {
		padding: 30upx 0 0;
		margin-top: 20upx;
		background: #fff;
		border-radius: 10upx;
		border-radius: 10rpx;

		.sec-header {
			display: flex;
			align-items: center;
			font-size: $font-base;
			color: $font-color-dark;
			line-height: 40upx;
			margin-left: 30upx;

			.yticon {
				font-size: 44upx;
				color: #5eba8f;
				margin-right: 16upx;
				line-height: 40upx;
			}
		}

		.h-list {
			white-space: nowrap;
			padding: 30upx 30upx 0;

			image {
				display: inline-block;
				width: 160upx;
				height: 160upx;
				margin-right: 20upx;
				border-radius: 10upx;
			}
		}

		.itme {
			padding: 10rpx 30rpx 20rpx 30rpx;
			display: flex;
			justify-content: space-evenly;
			align-items: center;
			// justify-content: space-between;
		}
	}

	.fram_oper_1 {
		display: flex;
		flex-direction: column;
		color: #fff;
		margin-top: 10rpx;

		.fram_oper_2 {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 10rpx 0;

			.views1 {
				text-align: center;
				font-size: 24rpx;
				width: 30%;
				-webkit-line-clamp: 1;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}

			.views11 {
				text-align: center;
				font-size: 24rpx;
				width: 1rpx;
				background-color: #dedede;
				-webkit-line-clamp: 1;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
	}

	.mass_a {
		display: flex;
		align-items: flex-start;
		color: #fff;
		flex-direction: column;
		padding-left: 20rpx;

		.mass_a_1 {
			font-size: 26rpx;
			text-align: left;
		}

		.mass_a_2 {
			padding: 50rpx 0;
			font-weight: 600;
			text-align: left;
			display: flex;
			justify-content: left;
			width: 100%;

			.money {
				font-size: 80rpx;
				padding-left: 10rpx;
			}

			.btn {
				width: 100%;
				display: flex;
				justify-content: flex-end;

				.btn3 {
					width: 120rpx;
					height: 40rpx;
					line-height: 40rpx;
					color: #c8c8c8;
					text-align: center;
					margin-right: 10px;
					border: 3rpx solid #c8c8c8;
					padding: 8rpx;
					border-radius: 30rpx;
					font-size: 30rpx;
				}

				.btn4 {
					width: 120rpx;
					height: 40rpx;
					line-height: 40rpx;
					text-align: center;
					color: #fff;
					margin-right: 10px;
					border: 3rpx solid #fff;
					padding: 8rpx;
					border-radius: 30rpx;
					font-size: 30rpx;
				}
			}
		}
	}
</style>
