<template>
	<view class="container">
		<navBar title="推广中心" :back="true" color="#333333" background="#FFFFFF" />

		<view class="outerBox">
			<view class="userBox">
				<image class="avatar" :src="!userInfo?picBase+'defaultAvatar.png':userInfo.avatar" mode=""></image>
				{{userInfo.name}}
				<view class="flag">
					推广大使
					<image src="../../../static/other/huangguan.png" mode="" class="hg_i"></image>
				</view>
			</view>

			<view class="card">
				<image src="../../../static/other/liujiaoxing.png" mode="widthFix" class="ljx_i"></image>

				<view class="labelBox">
					推广收入.
					<image :src="state?eyeSrc:eyeSrc2" mode="widthFix" class="eye" @click="handleShow"></image>
				</view>

				<view class="shouRu">
					<view class="left">
						累计收入:{{state?'￥ 999':'******'}}
					</view>
					<view class="right">
						可提现收入: {{state?'￥ 999':'******'}}
					</view>
				</view>
			</view>


			<view class="titleM">
				推广大使权益
			</view>
			<view class="list">
				<view class="item" v-for="(item,index) in serList" @click="toPage(index)">
					<view class="iconBox">
						<image :src="item.icon" mode="widthFix" class="icon"></image>
					</view>
					{{item.txt}}
				</view>
			</view>
			<view class="bLogo">
				<image src="../../../static/other/biyan.png" mode="" class="logo"></image>
				短腿鹤伴读
			</view>
		</view>
	</view>
</template>

<script>
	// import navBar from '@/components/navBar/index.vue'
	import {
		getUserInfo
	} from '@/api/index/index.js'
	export default {
		// components: {
		// 	navBar
		// },
		data() {
			return {
				picBase: this.$picBase2,
				userInfo:null,
				state: true,
				eyeSrc: '../../../static/other/zyan.png',
				eyeSrc2: '../../../static/other/biyan.png',
				serList: [{
						txt: '推广团队',
						icon: '../../../static/other/icon1.png'
					},
					{
						txt: '佣金明细',
						icon: '../../../static/other/icon2.png'
					},
					{
						txt: '佣金提现',
						icon: '../../../static/other/icon3.png'
					},
					{
						txt: '提现明细',
						icon: '../../../static/other/icon4.png'
					},
					{
						txt: '分享海报',
						icon: '../../../static/other/icon5.png'
					},
				]
			}
		},
		onLoad() {
this.getUserInfo()
		},
		methods: {
			async getUserInfo() {
				let res1 = await getUserInfo()
				console.log('用户信息返回值--------', res1);
				if (res1.code == 0) {
					uni.setStorageSync('userInfo', res1.data)
					this.userInfo=res1.data
				} else {
				this.$toast(res1.message)
				}
			},
			handleShow() {
				this.state = !this.state
			},
			toPage(i) {
				if (i == 0) {
					uni.navigateTo({
						url: '/pages/my/team/index'
					})
				} else if (i == 1) {
					uni.navigateTo({
						url: '/pages/my/yongjinDetail/index'
					})
				} else if (i == 2) {
					uni.navigateTo({
						url: '/pages/my/cash/index'
					})
				} else if (i == 3) {
					uni.navigateTo({
						url: '/pages/my/cashRecord/index'
					})
				} else {
					uni.navigateTo({
						url: '/pages/my/tuiguangHaibao/index'
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>