<template>
	<view class="container">
		<!-- 图片区域 -->
		<img src="../../static/my/shopImg2.png" />

		<!-- 表格区域 -->
		<view class="form">
			<view class="form_title">{{ type === '2' ? '账户解绑' : '账户绑定' }}</view>
			<view class="form_name">
				账户
				<view class="name_input">
					<input type="text" placeholder="请输入账号" v-model="formName" />
				</view>
			</view>
			<view class="form_password">
				密码
				<view class="password_input">
					<input type="text" password placeholder="请输入密码" v-model="formPassword" />
				</view>
			</view>
			<view class="form_msg">{{ info }}</view>
			<view class="form_btn" @click="handleClickBtn">{{ type === '2' ? '解绑' : '绑定' }}</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			// 绑定解绑类型
			type: '',
			// 身份类型
			status: '',
			// 绑定失败，请输入正确的账号或者密码
			info: '',
			// 账户
			formName: '',
			// 密码
			formPassword: ''
		}
	},
	onLoad(options) {
		this.status = options.status
		if (options.type) {
			this.type = options.type
			uni.setNavigationBarTitle({
				title: '验证解绑'
			})
		}
	},
	methods: {
		handleClickBtn() {
			if (!this.formName) {
				uni.showToast({
					title: '请输入账户名',
					icon: 'none',
					mask: true
				})
				return
			}
			if (!this.formPassword) {
				uni.showToast({
					title: '请输入密码',
					icon: 'none',
					mask: true
				})
				return
			}
			uni.navigateTo({
				url: `/pages/web/web?url=https://chtech.ncjti.edu.cn/hotelReservation/getLoginCode/&formName=${this.formName}&formPassword=${this.formPassword}&type=${this.type}&status=${this.status}`
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100vh;
	background-color: #fff;

	img {
		margin-top: 20rpx;
		width: 347rpx;
		height: 387rpx;
	}

	.form {
		box-sizing: border-box;
		padding: 0 30rpx;
		margin-top: 35rpx;
		width: 690rpx;
		height: 548rpx;
		border-radius: 23rpx;
		box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.25);

		.form_title {
			line-height: 120rpx;
			font-size: 32rpx;
			font-weight: bold;
		}

		.form_name {
			display: flex;
			align-items: center;
			font-size: 28rpx;

			.name_input {
				display: flex;
				align-items: center;
				box-sizing: border-box;
				padding: 0 24rpx;
				margin-left: 25rpx;
				width: 545rpx;
				height: 80rpx;
				border-radius: 15rpx;
				border: 1rpx solid #a6a6a6;

				input {
					width: 100%;
				}
			}
		}

		.form_password {
			display: flex;
			align-items: center;
			margin-top: 46rpx;
			font-size: 28rpx;

			.password_input {
				display: flex;
				align-items: center;
				box-sizing: border-box;
				padding: 0 24rpx;
				margin-left: 25rpx;
				width: 545rpx;
				height: 80rpx;
				border-radius: 15rpx;
				border: 1rpx solid #a6a6a6;

				input {
					width: 100%;
				}
			}
		}

		.form_msg {
			margin-top: 23rpx;
			height: 32rpx;
			color: #d43030;
			font-size: 24rpx;
			text-align: center;
		}

		.form_btn {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: 28rpx;
			width: 624rpx;
			height: 96rpx;
			border-radius: 64rpx;
			color: #fff;
			font-size: 32rpx;
			background-color: #096562;
		}
	}
}
</style>
