<template>
	<view class="container">
		<view class="header flex flex-y-center">
			<image :src="info.thumb?URL+info.thumb:'../static/images/avatar_def.png'" class="avatar">
			</image>
			<view class="nick-name text-1">{{info.name||info.nickname}}
				<view class="ft24 cof" v-if="info.squirrel_money>0" style="padding-top: 6rpx;">
					剩余配送金额：{{info.squirrel_money}}
				</view>
			</view>
		</view>

		<view class="page-block">
			<navigator url="/saomaDiancan/addStore/addStore" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_1.png" class="cell-icon"></image>
				<view class="title">新增门店</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator>
			<navigator url="/saomaDiancan/storeNumber/storeNumber" class="cell flex flex-y-center"
				hover-class="nav-hover">
				<image src="../static/images/icon_3.png" class="cell-icon"></image>
				<view class="title">门店账号</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator>
		</view>


		<view class="page-block">
			
			<block v-for="(item,index) in power_list" :key='index'>
				
				<navigator :url="`${item.address}?id=${item.id}&type=1`" class="cell flex flex-y-center" hover-class="nav-hover">
					<image :src="item.image" class="cell-icon"></image>
					<view class="title">{{item.name}}</view>
					<text class="iconfont icon-gengduo"></text>
				</navigator>
				
			</block>
			
			
<!-- 			<navigator url="./myManage" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_9.png" class="cell-icon"></image>
				<view class="title">智慧经营管理</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->
<!-- 
			<navigator url="./Coupon" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_8.png" class="cell-icon"></image>
				<view class="title">支付宝营销</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->
			
		<!-- 	<navigator url="/appletXcx/wechatMarket/index" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_8.png" class="cell-icon"></image>
				<view class="title">微信营销</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator>
 -->
<!-- 			<navigator url="../member/member?is_admin=2" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_3.png" class="cell-icon"></image>
				<view class="title">会员设置</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->

		<!-- 	<navigator url="/sharedPartner/menuList/menuList" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_2.png" class="cell-icon"></image>
				<view class="title">合伙人管理</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->

			<!--  <navigator url="/saomaDiancan/my/xcxAdmin" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/xcx.png" class="cell-icon"></image>
				<view class="title">小程序管理</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->
<!-- 
			<navigator url="/storeInfoIng/deviceList?type=1" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_15.png" class="cell-icon"></image>
				<view class="title">设备管理</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->
			
<!-- 
			<navigator url="/saomaDiancan/editPassword/editPassword" class="cell flex flex-y-center"
				hover-class="nav-hover">
				<image src="../static/images/icon_5.png" class="cell-icon"></image>
				<view class="title">修改密码</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->

			<!-- <navigator url="../order/" class="cell flex flex-y-center" hover-class="nav-hover">
				<image src="../static/images/icon_5.png" class="cell-icon"></image>
				<view class="title">订单管理</view>
				<text class="iconfont icon-gengduo"></text>
			</navigator> -->
		</view>

		<view class="btm-btn" @click="loginOut">退出登录</view>

		<zx-footer-bar :active="2" :type="type" />

	</view>
</template>
<script>
	import zxFooterBar from '../../components/zx-footer-bar/zx-footer-bar.vue'
	export default {
		components: {
			zxFooterBar
		},
		data() {
			return {
				info: {},
				URL: getApp().globalData.URL,
				power_list:[],
				type: 2, //1:用户端跳转过来
			}
		},
		onLoad(e) {
			if(!uni.getStorageSync("admin_id")){
				 uni.reLaunch({
				 	url: "/pages/login/login"
				 })
			}
			this.type = e.type || 2;
			// this.power_list = this.$store.state.management_list_store;
			this.http();
			this.power();
		},
		
		onShareAppMessage() {

		},
		
		onShareTimeline() {

		},
		methods: {
			  power(){
				this.request({
					url: 'index/index',
					data: {
						admin_id: uni.getStorageSync("admin_id")
					},
				   is_agent:'agent',
				}).then(res => {
					console.log(res,"index/index")
					if (res.code == '200') { 
						this.power_list = res.data
						this.$store.commit('SET_MANAGE_STORE', res.data)  
					}
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				});
			},
			http() {
				this.request({
					url: "Smdcshop/store_user_info",
					data: {
						id: uni.getStorageSync("admin_id"),
					},
				}).then(res => {
					console.log(res, "res")
					if (res.code === '200') {
						this.info = res.data;
					}
				}).catch((res) => {});
			},

			loginOut() {
				uni.removeStorageSync("is_shop");
				uni.removeStorageSync("store_id");
				uni.removeStorageSync("store_user");
				uni.removeStorageSync("admin_id");
				uni.removeStorageSync("storeinfo");

				uni.removeStorage({
					key: 'is_login',
					success: (res) => {
						uni.reLaunch({
							url: "../../pages/login/login"
						})
					}
				})
			},

		}
	}
</script>

<style>
	page {
		background: #F4F5F7;
	}

	.btm-btn {
		width: 670rpx;
		height: 98rpx;
		background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
		border-radius: 8rpx;
		box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.2);
		font-size: 32rpx;
		font-weight: 500;
		text-align: center;
		color: #fff;
		line-height: 98rpx;
		margin: 0 auto;
		margin-top: 100rpx;
		margin-bottom: 30rpx;
	}

	.header {
		width: 100%;
		height: 202rpx;
		position: relative;
		background: url(../static/images/my_bg.png) no-repeat center;
		background-size: 100%;
		padding: 0 30rpx 0 50rpx;
	}

	.header .avatar {
		display: block;
		flex: none;
		width: 110rpx;
		height: 110rpx;
		margin-right: 25rpx;
		border-radius: 100px;
	}

	.header .nick-name {
		font-size: 42rpx;
		color: #fff;
	}

	.header .icon-gengduo {
		flex: none;
		font-size: 24rpx !important;
		color: #fff;
	}

	.page-block {
		background-color: #fff;
		padding: 0 25rpx;
		margin-top: 25rpx;
	}

	.page-block .cell {
		height: 98rpx;
		border-bottom: 1rpx solid #f5f5f5;
	}

	.page-block .cell:last-child {
		border-bottom: none;
	}

	.page-block .cell .cell-icon {
		flex: none;
		display: block;
		width: 48rpx;
		height: 48rpx;
	}

	.page-block .cell .icon-gengduo {
		margin-left: auto;
		font-size: 25rpx !important;
		color: #c9c9c9;
	}

	.page-block .cell .title {
		padding: 0 25rpx;
		font-size: 32rpx;
		color: #333;
	}
</style>
