<template>
	<view class="content">
		<view class="minehead">
			<view class="minemsg">
				<view class="flex2 minename">
					<view class="flex5 ">
						<text class="nametit">{{msg.realName?msg.realName:''}}</text>
						<text class="nametit" v-if="msg.name">{{msg.name?msg.name:''}}</text>
						<text class="number" v-if="msg.account">账号 {{msg.account?msg.account:''}}</text>
					</view>
					<view class="logbox">
						<image src="/static/logo.png" mode="aspectFill"></image>
					</view>
				</view>
				<view class="callphone">
					<text style="color: #68625B;">联系电话</text>
					<text v-if="msg.contactsMobile">{{msg.contactsMobile}}</text>
					<text v-if="msg.mobile">{{msg.mobile}}</text>
				</view>
			</view>
		</view>
		<view class="choosebox">
			<view class="chooselist" v-if="state==1">
				<view class="flex1">
					<view class="iconbox">
						<image src="../../static/icon/contract.png" mode="aspectFill"></image>
					</view>
					<text style="padding-left: 30rpx;">联系人</text>
				</view>
				<text>{{msg.contacts}}</text>
			</view>
			<view class="chooselist" v-if="state==1">
				<view class="flex1">
					<view class="iconbox">
						<image src="../../static/icon/mobile.png" mode="aspectFill"></image>
					</view>
					<text style="padding-left: 30rpx;">联系电话</text>
				</view>
				<text>{{msg.contactsMobile}}</text>
			</view>
			<view class="chooselist" v-if="state==1">
				<view class="flex1">
					<view class="iconbox">
						<image src="../../static/icon/account.png" mode="aspectFill"></image>
					</view>
					<text style="padding-left: 30rpx;">账号</text>
				</view>
				<text>{{msg.account}}</text>
			</view>
			<view class="chooselist" @click="checkPwd">
				<view class="flex1">
					<view class="iconbox">
						<image src="../../static/icon/pwd.png" mode="aspectFill"></image>
					</view>
					<text style="padding-left: 30rpx;">密码</text>
				</view>
				<u-icon name="arrow-right" color="rgba(187,188,190)" bold="true"></u-icon>
			</view>
			<view class="chooselist" v-if="state==1" @click="checkIdentifyPic">
				<view class="flex1">
					<view class="iconbox">
						<image src="../../static/icon/renzheng.png" mode="aspectFill"></image>
					</view>
					<text style="padding-left: 30rpx;">认证照片</text>
				</view>
				<u-icon name="arrow-right" color="rgba(187,188,190)" bold="true"></u-icon>
			</view>

			<view class="chooselist" v-if="state==1" @click="checkProxy">
				<view class="flex1">
					<view class="iconbox">
						<image src="../../static/icon/shouquan.png" mode="aspectFill"></image>
					</view>
					<text style="padding-left: 30rpx;">授权委托书</text>
				</view>
				<u-icon name="arrow-right" color="rgba(187,188,190)" bold="true"></u-icon>
			</view>
		</view>

		<view class="logininbtn" @click="loginOut">
			<text>退出登录</text>
		</view>
		<view style="padding-bottom: 220rpx;"></view>
		<tabar checked="my"></tabar>
	</view>
</template>

<script>
	let that
	import tabar from "@/componet/tabbar/tabbar.vue"
	export default {
		components: {
			tabar
		},
		data() {
			return {
				keywords: '',
				wagesheight: '',
				state: '',
				msg:''
			}
		},
		onLoad() {
			this.state = this.$store.state.admin
			that = this
			uni.getSystemInfo({
				success: function(res) {
					console.log(res.safeArea.bottom); // print 610
					let bottom = res.safeArea.bottom
					let height = res.safeArea.height
					let cacl = bottom - height
					that.wagesheight = cacl
					console.log(that.wagesheight); // print 292
				}
			})
			this.init()
		},
		onshow(){
			this.init()
		},
		methods: {
			init(){
				uni.showLoading()
				if(this.state==0){
					uni.$u.http.get('/api/Account',{
						custom: {
							auth: true
						}
					}).then((res) => {
						uni.hideLoading()
						this.msg=res
						
					}).catch((err) => {
						uni.hideLoading()
						console.log(err)
					})
				}else if(this.state==1){
					uni.$u.http.get('/api/Supplier',{
						custom: {
							auth: true
						}
					}).then((res) => {
						uni.hideLoading()
						this.msg=res
						
					}).catch((err) => {
						uni.hideLoading()
						console.log(err)
					})
				}
			},
			checkIdentifyPic(){
				uni.navigateTo({
					url:"/pages/alldeatil/identifypic?pic="+JSON.stringify(this.msg.identifyPicList)
				})
			},
			checkProxy(){
				uni.navigateTo({
					url:"/pages/alldeatil/proxypic?pic="+JSON.stringify(this.msg.proxyFileList)
				})
			},
			loginOut() {
				uni.showModal({
					title: '是否确认退出？',
					success: function(res) {
						if (res.confirm) {
							uni.setStorageSync('token', '')
							uni.reLaunch({
								url: "/pages/login/login"
							})
						} else if (res.cancel) {
							
						}
					}
				})
				
			},
			checkPwd() {
				uni.navigateTo({
					url: "/pages/bsinessadmin/setpassword?account="+this.msg.account
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F6F6F6 !important;
	}

	.minehead {
		width: 100%;
		height: 367rpx;
		position: relative;
		background-color: #FAECD3;
		// background-image: url("@/static/img/minebg.png");

		.minemsg {
			position: absolute;
			left: 0;
			right: 0;
			bottom: 0;
			margin: 0 auto;
			background-color: #fff;
			bottom: -176rpx;
			width: 690rpx;
			height: 370rpx;
			border-radius: 20rpx;

			.logbox {
				width: 174rpx;
				height: 123rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.minename {
				padding: 0 45rpx;
				padding-top: 74rpx;
			}

			.nametit {
				font-size: 48rpx;
				font-weight: 600;

			}

			.number {
				font-size: 30rpx;
				color: #68625B;
				padding-top: 30rpx;
			}

			.callphone {
				width: 622rpx;
				height: 80rpx;
				background: url("@/static/img/mynumbg.png") no-repeat;
				background-size: 100%;
				text-align: center;
				line-height: 80rpx;
				font-size: 30rpx;
				margin: 0 auto;
				margin-top: 50rpx;
				padding: 0 30rpx;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
			}
		}
	}

	.choosebox {
		margin: 0 auto;
		margin-top: 215rpx;

		.chooselist {

			margin: 0 auto;
			margin-bottom: 20rpx;
			width: 690rpx;
			height: 100rpx;
			background-color: #fff;
			border-radius: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 30rpx;
			box-sizing: border-box;

			.iconbox {
				width: 42rpx;
				height: 42rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}
		}
	}

	.logininbtn {
		margin: 0 auto;
		// position: fixed;
		// left: 0;
		// right: 0;
		// bottom: 180rpx;
		margin-top:250rpx;
		// : 220rpx;
		width: 690rpx;
		border-radius: 20rpx;
		border: 1rpx solid #BEBDBB;
		height: 100rpx;
		text-align: center;
		color: #BEBDBB;
		line-height: 100rpx;
	}
</style>
