<template>
	<view class=" padding-lr">
		<view class="flex  padding-tb" v-if="userId" @click="goNav('/pages/my/pwd')">
			<view class="flex-sub text-df" style="line-height: 50upx;">修改密码</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 18rpx;height: 30rpx;">
			</image>
		</view>
		<view class="flex  padding-tb" @click="goNav('/my/other/help')">
			<view class="flex-sub text-df" style="line-height: 50upx;">帮助中心</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 18rpx;height: 30rpx;">
			</image>
		</view>
		<view class="flex  padding-tb" @click="goNav('/my/other/xieyi')">
			<view class="flex-sub text-df" style="line-height: 50upx;">用户协议</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 18rpx;height: 30rpx;">
			</image>
		</view>
		<view class="flex  padding-tb" @click="goNav('/my/other/mimi')">
			<view class="flex-sub text-df" style="line-height: 50upx;">隐私政策</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 18rpx;height: 30rpx;">
			</image>
		</view>
		<view class="flex  padding-tb" @click="goNav('/my/other/about')">
			<view class="flex-sub text-df" style="line-height: 50upx;">关于我们</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 18rpx;height: 30rpx;">
			</image>
		</view>
		<view class="btn" v-if="userId" @click="TuiLogin">退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userId: ""
			}
		},
		onLoad() {
			this.userId = uni.getStorageSync('userId')
		},
		methods: {
			goNav(e) {
				uni.navigateTo({
					url: e
				})
			},
			//退出登录
			TuiLogin() {
				let that = this

				if (that.userId) {
					uni.showModal({
						title: '提示',
						content: '确定退出登录吗？',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.removeStorageSync('shopUserName')
								uni.removeStorageSync('shopCover')
								uni.removeStorageSync('userId')
								uni.removeStorageSync('token')
								uni.removeStorageSync('mobile')
								uni.removeStorageSync('zhiFuBaoName')
								uni.removeStorageSync('zhiFuBao')
								uni.removeStorageSync('invitationCode')
								uni.removeStorageSync('unionId')
								uni.removeStorageSync('openId')
								uni.removeStorageSync('shopToken')
								uni.removeStorageSync('shopId')
								uni.showToast({
									title: '退出成功！',
									icon: 'none'
								})
								uni.navigateBack()
								// that.isLogin = true
								// that.shopName = '匿名'
								// this.sumMoney = 0 //累计余额
								// this.dayMoney = 0 //今日收益
								// this.monthMoney = 0 //本月收益
								// this.cashMoney = 0 //本月提现
								// that.shopCover = '../../static/logo.png'
								// that.userId = uni.getStorageSync('userId')
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/my/loginphone'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}


			},
		}

	}
</script>

<style>
	page {
		background: #FFFFFF;
	}

	.btn {
		width: 100%;
		height: 80upx;
		background: #FFAF5E;
		border-radius: 6upx;
		text-align: center;
		line-height: 80upx;
		margin-top: 40upx;
		font-size: 34upx;
		/* color: #fff; */
	}
</style>
