<template>
	<view>
		<headContent>
			<template #left>
				<reverse-back />
			</template>
			<template #content>
				<view class="haed-title">
					安全设置
				</view>
			</template>
		</headContent>
		<view class="safety-set">
			<view class="safety-set-item" @click.stop="changePassword()">
				<text class="safety-set-lable">登录密码</text>
				<view class="safety-set-more">
					<text class="more-lable">修改</text>
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="safety-set-item">
				<text class="safety-set-lable">谷歌验证</text>
				<view class="safety-set-more">
					<text class="more-lable">绑定</text>
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="safety-set-item" @click.stop="bindContactAccount(2)">
				<text class="safety-set-lable">邮箱 {{ userInfo.email }}</text>
				<view class="safety-set-more">
					<template v-if="userInfo && userInfo.email">
						<text class="more-lable active-more-lable">已绑定</text>
					</template>
					<template v-else>
						<text class="more-lable">绑定</text>
						<text  class="more-icon iconfont">&#xe88e;</text>
					</template>
				</view>
			</view>
			<view class="safety-set-item" @click.stop="bindContactAccount(1)">
				<text class="safety-set-lable">手机</text>
				<view class="safety-set-more">
					<template v-if="userInfo && userInfo.phone">
						<text class="more-lable active-more-lable">已绑定</text>
					</template>
					<template v-else>
						<text class="more-lable">绑定</text>
						<text  class="more-icon iconfont">&#xe88e;</text>
					</template>
				</view>
			</view>
		</view>
		<view class="safety-title">
			交易设置
		</view>
		<view class="safety-set item-border">
			<view class="safety-set-item">
				<text class="safety-set-lable">法币收款设置</text>
				<view class="safety-set-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="safety-set-item " @click.stop="setMoneyPassword()">
				<text class="safety-set-lable">资金密码{法币、转账}</text>
				<view class="safety-set-more">
					<text class="more-lable">去设置</text>
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		Way_getUserInfo
	} from "@/utils/common-request.js"
	export default {
		name: 'safety-set',
		data() {
			return {
				userInfo:{}
			};
		},
		onShow() {
			this.getUserInfo()
		},
		methods: {
			getUserInfo() {
				Way_getUserInfo().then(res => {
					this.userInfo = res
				})
			},
			changePassword() {
				uni.navigateTo({
					url: '/pages/content/change-password'
				})
			},
			bindContactAccount(type) {
				uni.navigateTo({
					url: `/pages/content/bind?type=${type}`
				})
			},
			
			setMoneyPassword(){
				uni.navigateTo({
					url:'/pages/content/money-password'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.safety-set {
		width: 100%;

		.safety-set-item {
			width: 100%;
			height: 80rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 $pages-padding;
			font-size: 28rpx;

			.safety-set-lable {
				// font-weight: 700;
				flex-shrink: 0;
			}

			border-top: 1rpx solid $border-color;

			.safety-set-more {
				flex-shrink: 0;
				display: flex;
				align-items: center;

				.more-lable {
					color: $Theme-Color;
				}

				.active-more-lable {
					color: #ccc;
				}

				.more-icon {
					width: 32rpx;
					height: 32rpx;
					color: #ccc;
					font-size: 32rpx;
				}
			}

			// <view class="safety-set-item">
			// 	<text class="safety-set-lable">邮箱</text>
			// 	<view class="safety-set-more">
			// 		<text class="more-lable active-more-lable">已绑定</text>
			// 		<text class="more-icon iconfont">&#xe88e;</text>
			// 	</view>
			// </view>
		}
	}

	.safety-title {
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 28rpx;
		color: $Theme-Color;
		padding: 0 $pages-padding;
		background-color: $page-bg;
	}

	.item-border {
		.safety-set-item {
			border-top: none;
			border-bottom: 1rpx solid $border-color;
		}
	}
</style>