<template>
	<view class="myset">
		<view class="myset-header-login  solid-bottom " v-show="!userInfo.token" @click="loginto()">
			<view class="action myset-header-login-text flex justify-between bg-blue">
				<view class="flex align-center">
					<view class="cuIcon-profile login-icon "></view>
					<view class="text-xl ">点击登录</view>
				</view>
				<text class="cuIcon-right text_icon_right flex align-center"></text>
			</view>
		</view>
		<view class="myset_header" v-show="userInfo.token">
			<image src="../../../static/image/member_card.jpg" mode=""></image>
		</view>
		<view class="myset_main ">
			<view class="myset_main_up">
				<navigator url="./common/message/message">
					<view class="text_icon cuIcon-profile text-grey"></view>
					我的信息
					<view class="text_icon_right cuIcon-right"> </view>
				</navigator>
				<view class="hr"></view>
				<navigator url="./common/my-card/my-card">
					<view class="text_icon cuIcon-card text-orange"></view>
					我的卡包
					<view class="text_icon_right cuIcon-right"> </view>
				</navigator>
				<view class="hr"></view>
				<navigator url="./common/account/account">
					<view class="text_icon cuIcon-samefill text-cyan"></view>
					交易记录
					<view class="text_icon_right cuIcon-right"> </view>
				</navigator>
				<view class="hr"></view>
				<!-- <navigator url="./common/expense/expense">
					<view class="text_icon cuIcon-appreciate text-olive"></view>
					消费记录
					<view class="text_icon_right cuIcon-right"> </view>
				</navigator>
				<view class="hr"></view> -->

				<!-- <navigator url="./common/expense-record/expense-record">
					<view class="text_icon cuIcon-time text-progress"></view>
					消费记录
					<view class="text_icon_right cuIcon-right"> </view>
				</navigator>
				<view class="hr"></view>
				-->
				<!-- 	<navigator url="./common/subscribe/subscribe">
					<view class="text_icon cuIcon-dianhua text-grayC"></view>
					我的预约
					<view class="text_icon_right cuIcon-right text-black"> </view>
				</navigator>
				<view class="hr"></view>
				<navigator url="./common/debtMoney/debtMoney">
					<view class="text_icon cuIcon-sponsor text-yellow"></view>
					待支付
					<view class="text_icon_right cuIcon-right text-black"> </view>
				</navigator>
				<view class="hr"></view>
				<navigator url="./common/repayment/repayment">
					<view class="text_icon cuIcon-calendar text-cyan"></view>
					补缴
					<view class="text_icon_right cuIcon-right text-black"> </view>
				</navigator>
				
				<view class="hr"></view>
				<navigator url="./common/echarts/echarts">
					<view class="text_icon cuIcon-appreciate text-olive"></view>
					打卡
					<view class="text_icon_right cuIcon-right"> </view>
				</navigator>
				<view class="hr"></view> -->
				<!-- <navigator url="./common/change-password/change-password">
					<view class="text_icon cuIcon-settings text-grayC"></view>
					修改密码
					<view class="text_icon_right cuIcon-right text-black"> </view>
				</navigator> -->
				<view class="hr"></view>
				<navigator url="/pages/login/agreement/newAgreement">
					<view class="text_icon cuIcon-calendar text-cyan"></view>
					会员协议
					<view class="text_icon_right cuIcon-right text-black"> </view>
				</navigator>
				
				<view class="hr"></view>
			</view>
		</view>
		<view class="margin"></view>

		<button v-show="userInfo.token" @click="loginout" size="default"
			class="myset_footer  cu-btn bg-blue lg">退出当前账号</button>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {},
			}
		},
		methods: {
			loginout() {
				this.$api.memberlogout({
					mobilePhone: this.userInfo.mobilePhone * 1
				}).then(res => {
					if (res.code == '000000') {
						uni.showToast({
							title: '已退出登录',
							icon: "none",
							duration: 1000
						})
						uni.removeStorageSync("userInfo")
						uni.reLaunch({
							url: '../../login/login'
						});
					} else {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 1000
						})
					}
				})

			},

			loginto() {
				uni.reLaunch({
					url: '../../login/login'
				});
			},
			setlogin() {
				this.$api.storelist({
						id: ''
					}).then(res => {
						if (res.code == '510002') {
							uni.showToast({
								title: '登录已过期',
								icon: "none",
								duration: 1000
							})
							uni.reLaunch({
								url: '../../login/login'
							})
						} else if (res.code == '502001') {
							uni.showToast({
								title: '未登录',
								icon: "none",
								duration: 1000
							})
							uni.reLaunch({
								url: '../../login/login'
							})
						} else {

						}
					})
					.catch(error => {
						console.log("error,error", error);
					})
			}
		},

		onShow: function() {
			this.userInfo = uni.getStorageSync('userInfo')

		},
		onPullDownRefresh: function() {
			setTimeout(function() {
				uni.switchTab({
					url: './mySet'
				})
				uni.showToast({
					title: '刷新成功',
					icon: 'success',
					duration: 2000
				});
				uni.stopPullDownRefresh();
			}, 1000);
		}
	}
</script>

<style scoped>
	.bg-blue{
		background-color: #409EFF !important;
		border-color: #409EFF !important;
	}
	/* .myset {
		background-color: #F1F1F1;
	} */

	.myset-header-login {
		width: 100%;
		padding: 20upx 0;
		height: 220upx;
	}

	.myset-header-login-text {
		background: #ff4f4f;
		height: 100%;
		width: 94%;
		margin: 0 3%;
		border-radius: 15upx;
		padding: 0 30upx;
		color: #eeeeee;
		padding-right: 50upx;
	}

	.login-icon {
		font-size: 85upx;
		padding: 10upx 0;
		margin-right: 15upx;
	}

	.myset .myset_header {
		/* height: 35vh; */

		padding: 0 atuo;
		overflow: hidden;
	}

	.myset .myset_header>image {
		width: 94%;
		margin: 20upx 3%;
		border-radius: 20upx;
		font-size: 36upx;
	}

	.myset .myset_main {
		background-color: #FFFFFF;
		width: 94%;
		border: #d0e3da 1upx solid;
		margin: 0 3%;
		border-radius: 15upx;
	}

	.myset .myset_main_up>navigator {
		padding: 30upx 10upx;
	}

	.myset_main .myset_main_up {
		border-radius: 5upx;
	}

	.myset_main_up .text_icon {
		float: left;
		margin-left: 30upx;
		font-size: 36upx;

	}

	.myset_main_up .text_icon_right {
		float: right;
		margin-right: 30upx;
		font-size: 36upx;
	}

	.myset .hr {
		height: 2upx;
		background-color: #aab5d9;
	}

	.myset .myset_footer {
		width: 94%;
		font-size: 30upx;
		margin: 0 3%;
	}
</style>