<template>
	<view>
		<view class='my-promotion'>
			<view class="header">
				<view class='name acea-row row-center-wrapper'>
					<!-- 当前佣金 -->
					<view>
						<view class="user-msg">
							<view class="nickname">我的佣金</view>
						</view>
					</view>
				</view>
				<view class='num'>{{userInfo.brokerage_price}}</view>
				<view class='profit item-top acea-row row-between-wrapper'>
					<view class='item'>
						<view>会员商品佣金</view>
						<view class='money'>{{userInfo.mson}}</view>
					</view>
					<view class='item'>
						<view>普通商品佣金<text class='iconfont icon-xiangyou'></text></view>
						<view class='money'>{{userInfo.pson}}</view>
					</view>
				</view>
				<view class='profit acea-row row-between-wrapper'>
					<view class='item'>
						<view>昨日投资分红</view>
						<view class='money'>{{userInfo.fh1}}</view>
					</view>
					<view class='item'>
						<view>昨日推广分红<text class='iconfont icon-xiangyou'></text></view>
						<view class='money'>{{userInfo.fh2}}</view>
					</view>
				</view>
			</view>
			<!-- #ifdef APP-PLUS || H5 -->
			<view  @click="navToo('/pages/user/withdrawal')"  hover-class="none" class='bnt bg-color'>立即提现</view>
			<!-- #endif -->
			<!-- #ifdef MP -->
			<view @click="navToo('/pages/user/withdrawal')" class='bnt bg-color'>立即提现</view>
			<!-- #endif -->
			<view class='list acea-row row-between-wrapper'>
				<view  @click="navToo('/pages/user/shareQrCode')" hover-class="none"
					class='item row-center-wrapper row-column'>
					<image class='iconfonts'src="../../static/img/9.png" mode=""></image>
					<view>推广名片</view>
				</view>
				<view  @click="navToo('/pages/user/promoter_order?type=1')"  hover-class="none"
					class='item  row-center-wrapper row-column'>
					<image class='iconfonts'src="../../static/img/5.png" mode=""></image>
					<view>未发放订单</view>
				</view>
				<view @click="navToo('/pages/user/user_spread_money')"  hover-class="none"
					class='item  row-center-wrapper row-column'>
						<image class='iconfonts'src="../../static/img/8.png" mode=""></image>
					<view>佣金明细</view>
				</view>

				<view @click="navToo('/pages/user/promoter_order?type=0')" hover-class="none"
					class='item  row-center-wrapper row-column'>
				    <image class='iconfonts'src="../../static/img/10.png" mode=""></image>
					<view>已发放订单</view>
				</view>
				<view  @click="navToo('/pages/user/rank')" hover-class="none"
					class='item  row-center-wrapper row-column'>
					<image class='iconfonts'src="../../static/img/6.png" mode=""></image>
					<view>推广排行榜</view>
				</view>
				<view  @click="navToo('/pages/user/promoter_rank')" hover-class="none"
					class='item row-center-wrapper row-column'>
					<image class='iconfonts'src="../../static/img/7.png" mode=""></image>
					<view>佣金排行榜</view>
				</view>
			</view>
		</view>
		<!-- #ifdef MP -->
		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
		<!-- #endif -->
		<!-- #ifndef MP -->
		<home></home>
		<!-- #endif -->
	</view>
</template>

<script>
	import {
		myuser
	} from '@/api/user.js';
	import {
		openExtrctSubscribe
	} from '@/utils/SubscribeMessage.js';
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	// #ifdef MP
	import authorize from '@/components/Authorize';
	// #endif
	import home from '@/components/home';
	// import colors from '@/mixins/color.js'
	export default {
		components: {
			// #ifdef MP
			authorize,
			// #endif
			home
		},
		data() {
			return {
				userInfo: {},
				yesterdayPrice: 0.00,
				isAuto: false, //没有授权的不会自动授权
				isShowAuth: false //是否隐藏授权
			};
		},
		onLoad() {
			myuser({})
			.then(({ data }) => {
				 this.userInfo=data
			})
			.catch(e => {
					console.log(e);
				});
		},
		methods: {
			onLoadFun: function() {
				this.getUserInfo();
			},
			navToo(url){
				console.log("0000")
				uni.navigateTo({
					url:url
				});
			},
			//跳转
			jumbPath(type) {
				if (type == 1) {
					uni.navigateTo({
						// 提现记录
						url: '/pages/users/user_spread_money/index?type=1'
					})
				} else {
					uni.navigateTo({
						// 分佣等级
						url: '/pages/users/user_distribution_level/index'
					})
				}
			},
			// 授权关闭
			authColse: function(e) {
				this.isShowAuth = e
			},
			openSubscribe: function(page) {
				uni.showLoading({
					title: '正在加载',
				})
				openExtrctSubscribe().then(res => {
					uni.hideLoading();
					uni.navigateTo({
						url: page,
					});
				}).catch(() => {
					uni.hideLoading();
				});
			},
			/**
			 * 获取个人用户信息
			 */
			getUserInfo: function() {
				let that = this;
				getUserInfo().then(res => {
					that.$set(that, 'userInfo', res.data);
					if (!res.data.spread_status) {
						that.$util.Tips({
							title: "您目前暂无推广权限"
						}, {
							tab: 2,
							url: '/pages/index/index'
						});
					}
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.row-column{
		
		text-align: center;
	}
	.row-column image{
		margin-bottom: 10rpx;
		margin-top: 18%;
		margin-left: 39%;
	}
	.iconfonts{
		display: block;
		width: 80rpx;
		height: 80rpx;
	}
	.bg-color{
		background-color: #303030;
	}
	.my-promotion .header {
		background-image: url(../../static/img/promotion.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
		width: 100%;
		height: 400rpx;
		background-color: var(--view-theme);
	}

	.my-promotion .header .name {
		font-size: 60rpx;
		color: #fff;
		padding-top: 57rpx;
		position: relative;

		.distribution {
			height: 52rpx;
			background-color: #ccc;
			font-size: 24rpx;
			color: #fff;
			position: absolute;
			right: 0;
			border-radius: 30rpx 0 0 30rpx;
			padding: 0 5rpx 0 10rpx;

			&.on {
				background-color: #FFF9E3;
				color: #D16739;
			}

			.iconfont {
				font-size: 18rpx;
			}

			.icon-dengjitubiao {
				font-size: 32rpx;
				margin-right: 10rpx;
			}
		}

		.user-msg {
			display: flex;
			align-items: center;

			.nickname {
				font-size: 28rpx;
			}

			.level {
				border: 1px solid #fff;
				font-size: 32rpx;
				padding: 2rpx 8rpx;
				border-radius: 6rpx;
				transform: scale(0.6);
				display: flex;
				align-items: center;

				.icon-xiangyou {
					font-size: 28rpx;
				}
			}

			image {
				width: 46rpx;
				height: 46rpx;
				border-radius: 50%;
				margin-right: 10rpx;
			}
		}
	}

	.my-promotion .header .name .record {
		font-size: 26rpx;
		color: rgba(255, 255, 255, 0.8);
		position: absolute;
		right: 20rpx;
	}

	.my-promotion .header .name .record .iconfont {
		font-size: 25rpx;
		margin-left: 10rpx;
		vertical-align: 2rpx;
	}

	.my-promotion .header .num {
		text-align: center;
		color: #fff;
		margin-top: 28rpx;
		font-size: 60rpx;
		font-family: 'Guildford Pro';
	}

	.my-promotion .header .profit {
		padding: 0 20rpx;
		font-size: 24rpx;
		color: rgba(255, 255, 255, 0.8);
	}

	.my-promotion .header .profit .item {
		min-width: 200rpx;
		text-align: center;
	}

	.my-promotion .header .profit .item .iconfont {
		font-size: 18rpx;
		color: #fff;
		margin-top: 5rpx;
	}

	.my-promotion .header .profit .item .money {
		font-size: 34rpx;
		color: #fff;
		margin-top: 5rpx;
	}

	.my-promotion .bnt {
		font-size: 28rpx;
		color: #fff;
		width: 258rpx;
		border-radius: 50rpx;
		text-align: center;
		line-height: 68rpx;
		margin: -32rpx auto 0 auto;

		border: 16rpx solid #f5f5f5;
	}

	.my-promotion .list {
		padding: 0 20rpx 50rpx 20rpx;
		margin-top: 10rpx;
	}

	.my-promotion .list .item {
		width: 345rpx;
		height: 240rpx;
		border-radius: 20rpx;
		background-color: #fff;
		margin-top: 20rpx;
		font-size: 30rpx;
		color: #666;
	}

	.my-promotion .list .item .iconfont {
		font-size: 70rpx;
		// background-image: linear-gradient(to right, #fc4d3d 0%, #e93323 100%);
		background-color: var(--view-theme);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		margin-bottom: 20rpx;
	}

	.apply {
		top: 52rpx;
		right: 0;
		position: absolute;
		width: max-content;
		height: 56rpx;
		padding: 0 14rpx;
		background-color: #fff1db;
		color: #a56a15;
		font-size: 22rpx;
		border-radius: 30rpx 0 0 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
</style>
