<template>
	<view class="mine">
		<image src="../../static/helper/helper_bg2.png" class="helper_bg"></image>
		<view class="set">
			<view v-for="(item, i) in setList" :key="i" class="set_item" @click="toUrlLink(item.url)">
				<view class="set_item_left">
					<image mode="widthFix" :src="`../../static/new_my/new_icon/${item.icon}`" class="icon" />
					<view>{{ item.name }}</view>
				</view>
				<view class="set_item_right">
					<text>{{ item.remark }}</text>
					<image mode="widthFix" src="../../static/new_my/arrow.png" class="right" />
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		_API_GetUserInfo
	} from '@/apis/user.js';
	const setListArr = [
		{
			name: '我的授权',
			icon: '10.png',
			url: 'auth-card/auth-card'
		},
		{
			name: '联系客服',
			icon: '5.png',
			url: 'political/political'
		},
		{
			name: '收货地址',
			remark: '添加、修改',
			icon: '1.png',
			url: 'address-manage/address-manage'
		},
		{
			name: '安全管理',
			remark: '退出、修改手机号',
			icon: '2.png',
			url: 'safe-manage/safe-manage'
		},
		{
			name: '评价客服',
			icon: '7.png',
			url: 'webView/appraise'
		}
	];
	export default {
		data() {
			return {
				// showSigup: true,
				warea: '',
				show_store: false, //true显示微店  false不显示微信
				warea_info: '', //战区信息A
			};
		},
		onPullDownRefresh() {
			uni.$emit('INIT');
		},
		onShow() {
			if (this.userinfo.mobile === '18737108730' || this.userinfo.mobile === '15236877164' || this.userinfo.mobile === '15515667892') {
				const data = {
					name: '扫码',
					icon: '7.png',
					url: 'scanC/scanC'
				}
				setListArr.push(data)
			}
			this.showShop(); //判断是否显示店铺
		},
		computed: {
			tabBerList() {
				return this.$store.state.tabBer.list;
			},
			userinfo() {
				return this.$store.state.userinfo;
			},
			logged() {
				return this.$store.state.app.token ? true : false;
			},
			messageNum() {
				return this.$store.getters['message/messageNum'];
			},
			money() {
				return this.$store.state.userinfo.money;
			},
			setList() {
				let arr = Object.assign([], setListArr);
				// if(this.userinfo.level === '批发商') {
				// 	arr.unshift({ name: '库存管理', icon: '1.png', url: 'stock/stock' })
				// }
				return arr;
			}
		},
		methods: {
			// 跳转到报名支付
			goSigup() {
				uni.navigateTo({
					url: '../payment/payment'
				})
			},
			//判断是否显示微店测试
			showShop() {
				_API_GetUserInfo().then(res => {
					if (res.code == 200) {
						this.show_store = res.data.show_store;
						this.warea = res.data.warea;
						this.warea_info = res.data.warea_info;
					} else {
						uni.showModal({
							content: '获取信息失败',
							showCancel: false
						});
					}
				});
			},
			//跳转到微店测试
			toShop() {
				uni.navigateTo({
					url: '../shop/shop'
				});
			},
			// 跳转我的名片
			toCard() {
				uni.navigateTo({
					url: '../../pages/person-card/person-card?&self=1&id=' + this.userinfo.id
				});
			},
			// 跳转
			toUrlLink(url) {
				if (!url) return false;
				if (url == 'political/political') {
					this.goPolitical()
					return
				}
				uni.navigateTo({
					url: `../../pages/${url}`
				});
			},
			goPolitical() {
				if (!this.warea_info) {
					uni.showModal({
						content: '暂无客服信息',
						showCancel: false
					})
					return false;
				}
				this.warea_info.warea = this.warea;
				let warea = encodeURIComponent(JSON.stringify(this.warea_info));
				uni.navigateTo({
					url: '../political/political?warea=' + warea
				});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.mine {
		.helper_bg {
			width: 750rpx;
			height: 476rpx;
		}
	
		.set {
			width: 100%;
			margin: 0 auto;
			padding: 0 30rpx;
			box-sizing: border-box;
			background-color: #ffffff;
			margin-bottom: 30rpx;
	
			.set_item {
				width: 100%;
				height: 120rpx;
				border-bottom: 2rpx solid #eeeeee;
				display: flex;
				align-items: center;
				justify-content: space-between;
				color: #333333;
				font-size: 28rpx;
	
				&_left {
					display: flex;
					align-items: center;
					font-size: 28rpx;
					font-weight: bold;
				}
	
				&_right {
					display: flex;
					align-items: center;
	
					text {
						color: #999;
						font-size: 28rpx;
					}
	
					.right {
						width: 30rpx;
						height: 30rpx;
					}
				}
	
				.icon {
					width: 50rpx;
					max-height: 50rpx;
					display: block;
					margin-right: 20rpx;
				}
	
				&:nth-last-of-type(1) {
					border-bottom: 0;
				}
			}
	
		}
	
		.out_login {
			width: 100%;
			height: 120rpx;
			background: #fff;
			margin-top: 26rpx;
			padding: 0 30rpx;
			box-sizing: border-box;
	
			.icon {
				width: 50rpx;
				max-height: 50rpx;
				display: block;
				margin-right: 20rpx;
			}
	
			view {
				font-size: 28rpx;
				font-weight: bold;
			}
		}
	}
</style>
