<template>
	<view class="padding-lr" style="background-color: #ffffff;">
		<!-- #ifndef MP-WEIXIN -->
		<view class="flex padding-tb align-center" @click="goNav('/pages/public/pwd')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">修改密码</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		<view class="xian"></view>
		<!-- #endif -->
		<view class="flex padding-tb align-center" @click="goNav('/my/order/tousuList')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">我的投诉</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		<view class="xian"></view>
		<view class="flex padding-tb align-center" @click="goNav('/my/help/feedbackIndex')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">帮助中心</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		<view class="xian"></view>
		<view class="flex padding-tb align-center" @click="goNav('/my/feedback/index')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">意见反馈</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		<view class="xian"></view>
		<view class="flex padding-tb align-center" @click="goNav('/my/setting/xieyi')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">用户协议</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		<view class="xian"></view>
		<view class="flex padding-tb align-center" @click="goNav('/my/setting/mimi')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">隐私政策</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		<view class="xian"></view>
		<view class="flex padding-tb align-center" v-if="isShow" @click="goNav('/my/setting/zhuxiao')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">注销账号</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
				</image>
		</view>
		<view class="xian"></view>
		<view class="flex padding-tb align-center" @click="goNav('/my/setting/about')">
			<view class="flex-sub text-df" style="line-height: 50upx;font-size: 30rpx;">关于我们</view>
			<image src="../../static/images/my/right.png" style="line-height: 50upx;width: 12rpx;height: 22rpx;">
			</image>
		</view>
		
		<view style="position: fixed;bottom: 0rpx;left: 0;right: 0;background: #FFFFFF;height: 110rpx;line-height: 110rpx;z-index: 999;">
			<view v-if="isShow" class="btn" @click="TuiLogin">退出登录</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				version: '',
				isShow: false
			}
		},
		onShow() {
			let token = this.$queue.getData('token');
			if (token) {
				this.isShow = true;
			}
		},
		onLoad() {
			// #ifdef APP-PLUS
			plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
				this.version = widgetInfo.version;
			});
			// #endif
		},
		methods: {
			//退出登录
			TuiLogin() {
				let that = this
				let userId = this.$queue.getData('userId');
				if (userId) {
					uni.showModal({
						title: '提示',
						content: '确定退出登录吗？',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.removeStorageSync('userName')
								uni.removeStorageSync('avatar')
								uni.removeStorageSync('userId')
								uni.removeStorageSync('token')
								uni.removeStorageSync('phone')
								uni.removeStorageSync('zhiFuBaoName')
								uni.removeStorageSync('zhiFuBao')
								uni.removeStorageSync('invitationCode')
								uni.removeStorageSync('unionId')
								uni.removeStorageSync('openId')
								uni.removeStorageSync('isVIP')
								uni.showToast({
									title: '退出成功！',
									icon: 'none'
								})
								uni.reLaunch({
									url:'/pages/my/index?money=0&couponnum=0'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			
			
			},
			goNav(e) {
				uni.navigateTo({
					url: e
				})
			},
			goOut() {
				uni.showModal({
					title: '提示',
					content: '确定退出登录吗？',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.removeStorageSync('userName')
							uni.removeStorageSync('avatar')
							uni.removeStorageSync('userId')
							uni.removeStorageSync('token')
							uni.removeStorageSync('phone')
							uni.removeStorageSync('zhiFuBaoName')
							uni.removeStorageSync('zhiFuBao')
							uni.removeStorageSync('invitationCode')
							uni.removeStorageSync('unionId')
							uni.removeStorageSync('openId')
							uni.removeStorageSync('isVIP')
							uni.showToast({
								title: '退出成功！',
								icon: 'none'
							})
							setTimeout(function() {
								uni.navigateBack()
							}, 1000)
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		}

	}
</script>

<style>
	page {
		background: #f7f7f7;
	}
	.btn {
		background: linear-gradient(to right, #223845, #00a85b);
		color: #FFFFFF;
		margin: 16rpx 30upx;
		position: fixed;
		bottom: 0upx;
		width: 90%;
		border-radius: 50rpx;
		height: 78rpx;
		line-height: 78rpx;
		font-size: 32rpx;
		text-align: center;
	}
	.xian{
		width: 100%;
		height: 1px;
		background-color: #f7f7f7;
	}
</style>
