<template>
	<view class="page-wrap">
		<view class="tabs-panel-wrap" v-if="enterpriseId">
			<view class="tabs-panel">
				<view :class="{ item: true, active: tabActive === item.value }" v-for="(item, index) in tabList" :key="index" @click="tabActive = item.value">
					{{ item.label }}
				</view>
			</view>
		</view>
		<!-- 基础资料 -->
		<BaseInfo v-show="tabActive === 1" :enterpriseId="enterpriseId"/>
		<!-- 资金账户 -->
		<view v-if="tabActive === 2" class="info-panel">
			<view class="title">银行公户</view>
			<view class="row">
				<view class="label">户名</view>
				<view class="text">天津超易达胜科技发展有限公司</view>
			</view>
			<view class="row">
				<view class="label">开户行</view>
				<view class="text">招商银行天津河西支行</view>
			</view>
			<view class="row">
				<view class="label">开户行账号</view>
				<view class="text">70260122000076868</view>
			</view>
			<view class="row">
				<view class="label">银行电话</view>
				<view class="text">023-85206639</view>
			</view>
			<view class="title">其他账号</view>
			<view class="row">
				<view class="label">建行善付通</view>
				<view class="text">6222 8042 5063 2401 868</view>
				<image class="arrow" src="../../../static/svg/arrow.svg"></image>
			</view>
			<view class="row">
				<view class="label">绑定微信</view>
				<view class="text">18863100789</view>
				<image class="arrow" src="../../../static/svg/arrow.svg"></image>
			</view>
		</view>
		<!-- 认证信息 -->
		<view v-if="tabActive === 3" class="info-panel">
			<view class="row">
				<view class="label">认证类型</view>
				<view class="radio-group">
					<view :class="{ item: true, active: authType === 1 }" @click="authType = 1">
						<image class="radio" src="../../../static/icon_checkbox.png"></image>
						企业认证
					</view>
					<view :class="{ item: true, active: authType === 2 }" @click="authType = 2">
						<image class="radio" src="../../../static/icon_checkbox.png"></image>
						个人认证
					</view>
				</view>
			</view>
			<view v-show="authType === 1">
				<view class="space"></view>
				<view class="row">
					<view class="label">法人</view>
					<view class="text">张无忌</view>
				</view>
				<view class="row">
					<view class="label">法人身份证号</view>
					<view class="text">610110199012310987</view>
				</view>
			</view>
			<view class="space"></view>
			<view class="row">
				<view class="label">{{ authType === 1 ? '代表人' : '姓名' }}</view>
				<view class="text">李四</view>
			</view>
			<view class="row">
				<view class="label">证件类型</view>
				<view class="text">大陆身份证</view>
			</view>
			<view class="row">
				<view class="label">证件号</view>
				<view class="text">610110199012310980</view>
			</view>
			<view class="row">
				<view class="label">手机号</view>
				<view class="text">18992804987</view>
			</view>
			<view class="row">
				<view class="label">验证码</view>
				<view class="text">6234</view>
				<view class="code">获取验证码</view>
			</view>
			<view class="row">
				<view class="label">邮箱</view>
				<view class="text">156306621@qq.com</view>
			</view>
			<button class="submit-btn">提交认证信息</button>
		</view>
		<!-- 团队成员 -->
		<view v-if="tabActive === 4" class="list-panel">
			<view class="item">
				<image class="avatar" src="../../../static/auth-icon.png" mode="aspectFill"></image>
				<view class="text">
					张无忌 18991397914
					<text class="sub">总经办·总经理</text>
				</view>
				<button class="btn" @click="handleOpenAuthSetting">权限设置</button>
				<button class="btn">删除</button>
			</view>
			<view class="item">
				<image class="avatar" src="../../../static/auth-icon.png" mode="aspectFill"></image>
				<view class="text">
					张无忌 18991397914
					<text class="sub">财务部·财务主管</text>
				</view>
				<button class="btn">权限设置</button>
				<button class="btn">删除</button>
			</view>
			<view class="item">
				<image class="avatar" src="../../../static/auth-icon.png" mode="aspectFill"></image>
				<view class="text">
					张无忌 18991397914
					<text class="sub">财务部·财务专员</text>
				</view>
				<button class="btn">权限设置</button>
				<button class="btn">删除</button>
			</view>
			<button class="add-btn" @click="handleOpenAddMember">+ 添加团队成员</button>
		</view>
		<!-- 资质文件 -->
		<!-- <view v-if="tabActive === 4" class="file-panel">
			<view class="file-item">
				<view class="upload">
					<image class="upload-icon" src="../../static/icon_plus_large.png" mode="aspectFill"></image>
				</view>
				<view class="name">营业执照</view>
			</view>
			<view class="file-item">
				<view class="upload">
					<image class="upload-icon" src="../../static/icon_plus_large.png" mode="aspectFill"></image>
				</view>
				<view class="name">其他</view>
			</view>
		</view> -->

		<!-- 添加成员弹窗 -->
		<uni-popup ref="memberDialog" type="dialog">
			<uni-popup-dialog ref="inputClose" type="info" title="添加成员" @confirm="dialogInputConfirm">
				<view class="popup-form">
					<view class="popup-form-item">
						<view class="label">姓名</view>
						<input class="input" type="text" placeholder="请输入" maxlength="20" />
					</view>
					<view class="popup-form-item">
						<view class="label">手机号</view>
						<input class="input" type="text" placeholder="请输入" maxlength="11" />
					</view>
					<view class="popup-form-item">
						<view class="label">部门</view>
						<picker class="picker" @change="bindPickerChange" :value="index" :range="array">
							<input class="input" type="text" placeholder="请选择" maxlength="11" :value="test" disabled />
						</picker>
					</view>
					<view class="popup-form-item">
						<view class="label">职务</view>
						<input class="input" type="text" placeholder="请输入" maxlength="11" />
					</view>
				</view>
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
import BaseInfo from './components/BaseInfo.vue';
export default {
	components: { BaseInfo },
	data() {
		return {
			enterpriseId: '',
			tabActive: 1,
			tabList: [
				{
					label: '基础资料',
					value: 1
				},
				{
					label: '资金账户',
					value: 2
				},
				{
					label: '认证信息',
					value: 3
				},
				{
					label: '团队成员',
					value: 4
				}
			],
			authType: 1,
			array: ['总经办', '财务部', '行政部'],
			test: '',
			testValue1: '',
			testValue2: ''
		};
	},
	onLoad(option) {
		this.enterpriseId = option.id;
	},
	methods: {
		handleOpenAddMember() {
			this.$refs.memberDialog.open();
		},
		bindPickerChange(e) {
			this.test = this.array[e.detail.value];
		},
		dialogInputConfirm() {},
		//打开权限设置
		handleOpenAuthSetting() {
			uni.navigateTo({
				url: 'authSetting'
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.tabs-panel {
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	height: 82.42rpx;
	background: #fff;
	display: flex;
	z-index: 2;
	border-width: 1rpx 0;
	border-style: solid;
	border-color: #e0e0e0;
	box-sizing: border-box;

	&-wrap {
		height: 82.42rpx;
	}

	.item {
		flex: 1;
		text-align: center;
		font-size: 27.47rpx;
		color: #999;
		line-height: 82.42rpx;
		position: relative;

		& + .item::before {
			content: '';
			position: absolute;
			left: 0;
			top: 0;
			bottom: 0;
			width: 1rpx;
			background: #e0e0e0;
		}
	}

	.active {
		color: #00bcd2;

		&::after {
			content: '';
			position: absolute;
			left: 0%;
			right: 0%;
			bottom: 0%;
			height: 5.49rpx;
			background: #00bcd2;
			z-index: 1;
		}
	}
}

.info-panel {
	font-size: 27.47rpx;

	.row {
		min-height: 96.15rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20.6rpx 41.21rpx;
		box-sizing: border-box;
		background: #fff;
		position: relative;
		color: #515151;

		&:first-child::before,
		& + .row::before {
			content: '';
			position: absolute;
			left: 0;
			right: 0;
			top: 0;
			height: 1px;
			background: #e0e0e0;
			transform: scaleY(0.5);
		}

		.label {
			white-space: nowrap;
			margin-right: 54.95rpx;
		}

		.text {
			flex: 1;
			text-align: right;
		}

		.arrow {
			width: 27.47rpx;
			height: 27.47rpx;
			margin-left: 6.87rpx;
		}

		.avatar {
			width: 82.42rpx;
			height: 82.42rpx;
			border-radius: 50%;
		}
	}

	.title {
		color: #666666;
		padding: 0 41.21rpx;
		line-height: 82.42rpx;
	}

	.space {
		background: #f3f3f3;
		height: 13.74rpx;
	}

	.radio-group {
		display: flex;

		.item {
			position: relative;
			padding-left: 43.96rpx;
			line-height: 32.97rpx;
			margin-left: 41.21rpx;

			&:before {
				content: '';
				position: absolute;
				left: 0%;
				top: 50%;
				transform: translateY(-50%);
				width: 30.22rpx;
				height: 30.22rpx;
				border: 1rpx solid #ddd;
				border-radius: 50%;
				box-sizing: border-box;
			}

			.radio {
				width: 32.97rpx;
				height: 32.97rpx;
				position: absolute;
				left: 0;
				top: 50%;
				transform: translateY(-50%);
				display: none;
				z-index: 1;
			}

			&.active .radio {
				display: block;
			}
		}
	}
}

.submit-btn {
	width: 549.45rpx;
	height: 75.55rpx;
	background: #079eff;
	font-size: 27.47rpx;
	color: #fff;
	border-radius: 8.24rpx;
	margin: 54.95rpx auto;
}

.list-panel {
	margin-top: 13.74rpx;

	.item {
		display: flex;
		align-items: center;
		padding: 16.48rpx 27.47rpx;
		min-height: 96.15rpx;
		box-sizing: border-box;
		position: relative;
		background: #fff;

		& + .item::before {
			content: '';
			position: absolute;
			left: 0%;
			right: 0%;
			top: 0%;
			height: 1rpx;
			transform: scaleY(0.5);
			background: #e0e0e0;
		}
	}

	.avatar {
		width: 76.92rpx;
		height: 76.92rpx;
	}

	.text {
		flex: 1;
		font-size: 27.47rpx;
		color: #545e8f;
		margin-left: 13.74rpx;
	}

	.sub {
		display: block;
		font-size: 24.73rpx;
		color: #999999;
	}

	.btn {
		background: none;
		border: none;
		font-size: 27.47rpx;
		color: #f97631;
		white-space: nowrap;
		padding: 0;
		margin-left: 13.74rpx;
	}

	.add-btn {
		margin-top: 27.47rpx;
		font-size: 27.47rpx;
		color: #00bcd2;
		height: 82.42rpx;
		line-height: 82.42rpx;
		display: block;
		text-align: left;
		padding: 0 0 0 54.95rpx;
		background: #fff;
		border: none;
		border-radius: 13.74rpx;
	}
}

.popup-form {
	width: 100%;
	font-size: 27.47rpx;

	&-item {
		display: flex;
		align-items: center;
		height: 82.42rpx;
		position: relative;

		&::before {
			content: '';
			position: absolute;
			left: 0;
			right: 0;
			bottom: 0;
			height: 1rpx;
			background: #e0e0e0;
		}
	}

	.label {
		white-space: nowrap;
		margin-right: 13.74rpx;
	}

	.input {
		flex: 1;
		text-align: right;
	}

	.picker {
		flex: 1;
	}
}

// .file-panel {
// 	padding: 27.47rpx;

// 	.file-item {
// 		width: 192.31rpx;

// 		.upload {
// 			width: 192.31rpx;
// 			height: 192.31rpx;
// 			box-sizing: border-box;
// 			border: 1px solid #ddd;
// 			background: #fff;
// 			display: flex;
// 			align-items: center;
// 			justify-content: center;

// 			&-icon {
// 				width: 137.36rpx;
// 				height: 137.36rpx;
// 			}
// 		}

// 		.name {
// 			font-size: 27.47rpx;
// 			text-align: center;
// 			line-height: 86.54rpx;
// 		}
// 	}
// }
</style>
