<template>
	<view class="content">
		<view class="top" :class="{active : type}">
			<view class="base">
				<view class="base-tab">
					<view class="base-tab-item">
						<image class="base-tab-img" src="/static/icon//bankIcon_01_active.png" mode="aspectFill"></image>
						<view class="base-tab-cont">
							<view class="base-tab-name">
								银行信息
							</view>
							<view class="base-tab-tips">
								已完善 √
							</view>
						</view>
					</view>
					<view class="base-tab-spot">
						<text></text>
						<text></text>
						<text></text>
					</view>
					<view class="base-tab-item">
						<image class="base-tab-img" src="/static/icon/bankIcon_02_active.png" mode="aspectFill"></image>
						<view class="base-tab-cont">
							<view class="base-tab-name">
								其他信息
							</view>
							<view class="base-tab-tips">
								已完善 √
							</view>
						</view>
					</view>
				</view>
				<view class="white">
					<view class="base-title">
						<view class="base-name">
							银行信息
						</view>
					</view>
					<view class="base-list">
						<view class="base-block" :class="{baseAline : items.type === 'text' || items.type === 'textarea' }" v-for="(items, itemsIndex) in backParams" :key="itemsIndex">
							<view class="base-block-name" v-if="items.label == 1">
								<text>*</text>{{items.title}}
							</view>
							
							<!-- 单输入框 -->
							<block v-if="items.label == 1">
								<view class="base-block-write" v-if="items.type === 'price' || items.type === 'number' || items.type === 'text' || items.type === 'password' || items.type === 'mobile' || items.type === 'day'">
									{{items.value || '--'}}
									<text v-if="items.type === 'price'">元</text>
									<text v-else-if="items.type === 'day'">天</text>
								</view>
							</block>
							
							<!-- 日期 -->
							<block v-if="items.label == 1">
								<view class="base-block-write" v-if="items.type === 'date'">
									{{items.value || '--'}}
								</view>
							</block>
							
							<!-- 城市地址 -->
							<block v-if="items.label == 1">
								<view class="base-block-write" v-if="items.type === 'region'">
									{{items.value || '--'}}
								</view>
							</block>
							
							<!-- 办卡城市 -->
							<block v-if="items.label == 1">
								<view class="base-block-write" v-if="items.type === 'city'">
									{{items.value || '--'}}
								</view>
							</block>
							
							<!-- 单选 -->
							<block v-if="items.label == 1">
								<view class="idcardAdd-aline" v-if="items.type === 'radio'">
									{{items.value_text || '--'}}
								</view>
							</block>
							
							<!-- 多选 -->
							<block v-if="items.label == 1">
								<view class="idcardAdd-aline-more" v-if="items.type === 'checkbox'">
									{{items.value_text || '--'}}
								</view>
							</block>
							
							<!-- 描述 -->
							<block v-if="items.label == 1">
								<view class="base-block-textarea" v-if="items.type === 'textarea'">
									{{items.value || '--'}}
								</view>
							</block>
							
							<!-- 下拉框 -->
							<block v-if="items.label == 1">
								<view class="base-block-write" v-if="items.type === 'select'">
									{{items.value_text || '--'}}
								</view>
							</block>
						</view>
					</view>
				</view>
				
				<view class="white">
					<view class="base-title">
						<view class="base-name">
							其他信息
						</view>
					</view>
					<view class="base-list">
						<view class="base-block">
							<block v-for="(items, itemsIndex) in backParams" :key="itemsIndex">
								<view class="base-block-name" v-if="items.label == 2">
									<text>*</text>{{items.title}}
								</view>
								<!-- 描述 -->
								<block v-if="items.label == 2">
									<view class="base-block-textarea" v-if="items.type === 'textarea'">
										{{items.value || '--'}}
									</view>
								</block>
							</block>
						</view>
					</view>
				</view>
				
			</view>
		</view>
		
		<view class="introduce-btn" v-if="type">
			<button class="btn" size="mini" :disabled="disabled" @click="infoSubmit">提交审核</button>
		</view>
		
	</view>
</template>

<script>
	import { BankSee, BankFirst } from '@/apis/interfaces/user'
	
	import mouldCheckbox from '@/components/mould-checkbox.vue'
	import mouldInput from '@/components/mould-input.vue'
	import mouldRadio from '@/components/mould-radio.vue'
	import mouldText from '@/components/mould-text.vue'
	import mouldSelect from '@/components/mould_select.vue'
	import mouldDate from '@/components/mould-date.vue'
	export default {
		components: {
			mouldCheckbox,
			mouldInput,
			mouldRadio,
			mouldText,
			mouldSelect,
			mouldDate
		},
		data() {
			return {
				disabled  : false, // 按钮状态
				bankData  : '', // 基础信息
				backParams: [], // 字段数组
				
				values   : '',
				
				marriage: [],
				marriageIndex : 0,  // 婚姻选择index
				
				education: [],
				educationIndex: 0,  // 学历选择index
				
				type		: '',
			}
		},
		onShow() {
			// 获取基础信息
			this.baseInfo();
			this.type = this.$Route.query.type
		},
		methods: {
			// 基础信息
			baseInfo() {
				BankSee(this.$Route.query.id).then(res => {
					this.bankData   = res
					this.backParams = res.params
					this.values   = res.values
				}).catch( err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
			
			// 首次信息
			infoSubmit() {
				BankFirst(this.$Route.query.userId, this.$Route.query.id).then(res => {
					this.disabled = true
					uni.showToast({
						title: res,
						icon: "none"
					})
					setTimeout(() => {
						uni.navigateBack({
							delta: 1
						})
						uni.hideLoading() 
					}, 1500)
				}).catch( err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.top {
		background-color: #f5f5f5;
		position: relative;
		height: 100vh;
		overflow-y: scroll;
		&.active {
			border-bottom: 140rpx solid transparent;
		}
		&::after {
			content: '';
			position: absolute;
			background-color: $mian-color;
			border-radius: 0 0 $radius*5 $radius*5;
			width: 100%;
			height: 260rpx;
			left: 0;
			top: 0;
		}
		.base {
			position: absolute;
			z-index: 9;
			padding: $padding + 20 $padding;
			box-sizing: border-box;
			.base-tab {
				overflow: hidden;
				display: flex;
				padding: 0 $padding 10rpx 10rpx;
				position: relative;
				.base-tab-item {
					color: #ffffff;
					position: relative;
					display: flex;
					.base-tab-img {
						width: 120rpx;
						height: 120rpx;
					}
					.base-tab-cont {
						padding-top: $padding - 15;
						box-sizing: border-box;
						.base-tab-name {
							font-size: $title-size-sm;
						}
						.base-tab-tips {
							font-size: $title-size-sm - 2;
							border: 2rpx solid #ffeaea;
							border-radius: $radius * 4;
							width: 110rpx;
							text-align: center;
							opacity: .8;
							margin-top: 10rpx;
						}
					}
				}
				.base-tab-spot {
					text-align: center;
					width: 180rpx;
					float: left;
					margin-top: $margin;
					text {
						border-radius: 50%;
						background-color: #ffffff;
						display: inline-block;
						margin-left: 15rpx;
						&:nth-child(1) {
							width: 10rpx;
							height: 10rpx;
							opacity: .5;
						}
						&:nth-child(2) {
							width: 14rpx;
							height: 14rpx;
							opacity: .8;
						}
						&:nth-child(3) {
							width: 16rpx;
							height: 16rpx;
						}
					}
				}
			}
			.white {
				padding: $padding;
				box-sizing: border-box;
				background-color: #ffffff;
				border-radius: $radius-m;
				overflow: hidden;
				margin-bottom: $margin;
				&:last-child {
					margin-bottom: 0;
				}
				.base-title {
					display: flex;
					line-height: 38rpx;
					.base-name {
						flex: 1;
						color: $mian-color;
						font-weight: 600;
						font-size: $title-size + 2;
					}
					.base-number {
						color: #999999;
						font-size: $title-size-m;
					}
				}
				.base-list {
					margin: 0 -10rpx 0;
					overflow: hidden;
					.base-block {
						// width: calc(50% - 20rpx);
						width: calc(100% - 20rpx);
						float: left;
						position: relative;
						.base-block-name {
							margin: $margin + 20 0 $margin - 10;
							color: #111111;
							text {
								color: $mian-color;
								padding-right: 10rpx;
							}
						}
						.base-block-textarea {
							background-color: #F6F6F6;
							border-radius: $radius-sm;
							padding: $padding;
							font-size: $title-size-lg;
							color: #111111;
						}
						.base-block-write {
							background-color: #F6F6F6;
							border-radius: $radius-sm;
							padding: $padding - 10 $padding;
							box-sizing: border-box;
							position: relative;
							display: flex;
							color: #111111;
							font-size: $title-size-m;
							line-height: 48rpx;
							&.prohibit {
								color: #999999;
							}
							.idcardAdd-picker {
								width: 100%;
								height: 100%;
							}
							.base-block-input {
								width: 100%;
								height: 100%;
								font-size: $title-size-lg;
							}
							.base-block-textarea {
								padding: $padding 0;
							}
							.idcardAdd-input {
								display: flex;
								flex: 1;
							}
							.placeholderClass {
							   color: #999999;
							}
							image {
								width: 24rpx;
								height: 24rpx;
								position: absolute;
								top: $margin;
								right: $margin;
							}
							text {
								position: absolute;
								right: $padding;
								top: $padding - 10;
							}
						}
						.base-block-site {
							display: flex;
							margin: 0 -5rpx;
							.base-site-white {
								background-color: #F6F6F6;
								border-radius: $radius-sm;
								flex: 3;
								color: #111111;
								font-size: $title-size-lg;
								height: 84rpx;
								line-height: 84rpx;
								padding: 0 $padding - 10 0 $padding;
								box-sizing: border-box;
								position: relative;
								margin: 0 5rpx;
								width: 100%;
								.picker {
									width: calc(100% - 30rpx)
								}
								image {
									width: 24rpx;
									height: 24rpx;
									position: absolute;
									top: $margin;
									right: 0;
								}
							}
						}
						.idcardAdd-aline {
							font-size: $title-size-m;
							color: $mian-color;
							position: absolute;
							top: $padding + 20;
							right: 0;
						}
						.idcardAdd-aline-more {
							color: $mian-color;
							font-size: $title-size-m;
							padding: $padding - 10 $padding;
							box-sizing: border-box;
							background-color: #F6F6F6;
							border-radius: $radius-sm;
						}
					}
					.baseAline {
						width: calc(100% - 20rpx);
					}
				}
			}
		}
	}
	
	.introduce-btn {
		position: fixed;
		width: 100%;
		left: 0;
		bottom: 0;
		background-color: #f5f5f5;
		text-align: center;
		padding: $padding;
		box-sizing: border-box;
		z-index: 2000;
		.btn {
			background-color: $mian-color;
			color: #ffffff;
			border-radius: $radius-sm;
			width: 100%;
			line-height: 90rpx;
			font-size: $title-size;
			&[disabled] {
				background-color: #eba5a5;
			}
		}
	}
</style>