<template>
	<view :style="viewColor">
		<view class='my-promotion'>
			<view class="header">
				<view class='name acea-row row-center-wrapper'>
					<view>当前佣金</view>
					<text @click="showProtocol=true" class="iconfont wenhao">?</text>
					<navigator v-if="userInfo.brokerage && userInfo.show_brokerage" url='/pages/users/user_brokerage/index' hover-class="none" class='record area-row row-middle'>
						<image v-if="userInfo.brokerage.brokerage_icon" class="level_icon" :src="userInfo.brokerage.brokerage_icon"></image>
						<image v-else class="level_icon" src="../static/images/level_avatar.png"></image>
						<text>{{userInfo.brokerage.brokerage_name}}</text>
						<text class='iconfont icon-xiangyou'></text>
					</navigator>
				</view>
				<view class='num'>{{userInfo.total_brokerage_price}}</view>
				<view class='profit acea-row row-between-wrapper'>
					<view class='item'>
						<view>昨日收益</view>
						<view class='money'>{{userInfo.yesterday_brokerage}}</view>
					</view>
					<view class='item'>
						<navigator url='/pages/users/user_spread_money/index?type=1' hover-class="none">累计已提<text class='iconfont icon-xiangyou font20'></text></navigator>
						<view class='money'>{{userInfo.total_extract}}</view>
					</view>
				</view>
			</view>
			<!-- #ifdef APP-PLUS || H5 -->
			<navigator url="/pages/users/user_cash/index" hover-class="none" class='bnt b-color'>立即提现</navigator>
			<!-- #endif -->
			<!-- #ifdef MP -->
			<view @click="openSubscribe('/pages/users/user_cash/index')" class='bnt b-color'>立即提现</view>
			<!-- #endif -->
			<view class='list acea-row row-between-wrapper'>
				<navigator url='/pages/users/user_spread_code/index' hover-class="none" class='item acea-row row-center-wrapper row-column'>
					<text class='iconfont icon-erweima'></text>
					<view>推广名片</view>
				</navigator>
				<navigator url='/pages/users/promoter-list/index' hover-class="none" class='item acea-row row-center-wrapper row-column'>
					<text class='iconfont icon-tongji'></text>
					<view>推广人统计</view>
				</navigator>
				<navigator url='/pages/users/user_spread_money/index?type=2' hover-class="none" class='item acea-row row-center-wrapper row-column'>
					<text class='iconfont icon-qiandai'></text>
					<view>佣金明细</view>
				</navigator>
				<navigator url='/pages/users/promoter-order/index' hover-class="none" class='item acea-row row-center-wrapper row-column'>
					<text class='iconfont icon-dingdan'></text>
					<view>推广人订单</view>
				</navigator>
				<navigator url='/pages/users/promoter_rank/index' hover-class="none" class='item acea-row row-center-wrapper row-column'>
					<text class='iconfont icon-paihang1'></text>
					<view>推广人排行</view>
				</navigator>
				<navigator url='/pages/users/commission_rank/index' hover-class="none" class='item acea-row row-center-wrapper row-column'>
					<text class='iconfont icon-paihang'></text>
					<view>佣金排行</view>
				</navigator>
			</view>
		</view>
		<view class="instructions" v-if="showProtocol">
			<view class="setAgCount">
				<i class="icon iconfont icon-cha" @click="showProtocol = false"></i>
				<div class="title">佣金说明</div>
				<view class="content">
					<jyf-parser :html="protocol" ref="article" :tag-style="tagStyle"></jyf-parser>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	 
	import { spreadInfo, commissionDescription } from '@/api/user.js';
	import { openEextractSubscribe } from '@/utils/SubscribeMessage.js';
	import { mapGetters } from "vuex";
	import parser from "@/components/jyf-parser/jyf-parser";
	import { toLogin } from '@/libs/login.js';
	export default {
		components: {
			"jyf-parser": parser,
		},
		data() {
			return {
				userInfo: [],
				yesterdayPrice: 0.00,
				protocol: '',
				showProtocol: false,
				tagStyle: {
					img: 'width:100%;display:block;',
					video: 'width:100%;'
				},
			};
		},
		computed: mapGetters(['isLogin','viewColor']),
		onLoad() {
			if (this.isLogin) {
				this.spreadInfo();
				this.getCommissionDescription();
			} else {
				toLogin()
			}
		},
		methods: {
			// 获取佣金说明
			getCommissionDescription() {
				commissionDescription().then(res => {
					if(res.status == 200) {
						this.protocol = res.data.sys_extension_agree
					}
				})
			},
			openSubscribe: function(page) {
				uni.showLoading({
					title: '正在加载',
				})
				openEextractSubscribe().then(res => {
					uni.hideLoading();
					uni.navigateTo({
						url: page,
					});
				}).catch(() => {
					uni.hideLoading();
				});
			},
			/**
			 * 获取佣金数据
			 */
			spreadInfo: function() {
				let that = this;
				spreadInfo().then(res => {
					that.$set(that,'userInfo',res.data);
				}).catch((err) => {
					that.$util.Tips({
						title: err,
					});
					setTimeout(()=>{
						uni.switchTab({
							url: '/pages/user/index',
						});
					},1000)
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.font20{
		font-size: 20rpx;
	}
	.b-color {
		background-color: var(--view-theme);
	}
	.level_icon{
		width: 43rpx;
		height: 43rpx;
		margin-right: 6rpx;
	}
	.my-promotion .header {
		background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAF3AgMAAACH8iZPAAAADFBMVEUAAAD///////////84wDuoAAAABHRSTlMADgUJvaYHcQAAEhtJREFUeNrsnT3L7UQUhScTDhglWtmKTcAPLA9Y5iekODsTJFxTWgYrsZBgp2AZtBIRRFH8aA6IoOQn2EQtRG4jiIXYCGKhZs/McVCw2GuLWsyCe68IM/uZyczkvDlZ6zVZWVlZWVlZWVlZWVlZWVn/sj787Q2j0+O/fWd0eu+3d6B2VyLS0T9x9KCjf//o4S7QrqJDTlO5JNZiomAGoIeVWLPBdSbWkP4HyPAcMmhWj1e2RNjE6RnOFLSpVjxrMqgaCmqlDffYcFBdc9YItscZKorqVatGtelLlOHEm9XPnWbBDo1m5dXMcAZOLG7T+tLtI/iCnSviv+/FT6vpRPz3PeLltvmG3f1Y6Qe5qIcfywXeNG3tF/190gUb4ceihXfbVPgla2d407R++Jdiku7XrQ6lO7R0hCfzNbRfE7yzg3CvxEtGBjpwCkrw24qsmyrB0/Kl9PawBfhlx0on+OlBZOWdArx8+Odbw+dWale49HzAjw3NDbLom9vwnzsfw58kGz3CL83REC49l0RbRd1pAI8rmpjhdAxfsPH2CD8abjigHym7knpz9FIj22aNM9+bmrpG8CGDIvxkmmPe0NIMPx/wl4oU8NMBP9S96Jy7s09VzzM4nBxW2v3UWVqOa9cXyI8kfETuU+EW09BYkQh+fmKqBl5AY42U3vm+2NnxGAbDtxB8V83FwbDytdsk94fJvlFspiLfECtt3rAT9+VKmqC73GyY4T7ywxfBH+2NuTI8OG+8zxd/7JTUgfDM0Hj4SXJ7HEIPoSFU+vLH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MDQSU5OTk5OTk5OTk5OTk5OTs5/8wvD4zyAWF/KQwAAAABJRU5ErkJggg==');
		background-size: 100% 100%;
		background-color: var(--view-theme);
		width: 100%;
		height: 375rpx;
	}
	.my-promotion .header .name {
		font-size: 30rpx;
		color: #fff;
		padding-top: 57rpx;
		position: relative;
	}
	.wenhao{
		width: 34rpx;
		height: 34rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		border-radius: 50%;
		background-color: rgba(255,255,255,.8);
		color: var(--view-theme);
		margin-left: 4rpx;
	}
	.icon-wenti{
		background-color: #fff;
		border-radius: 50%;
		color: #e93323;
		position: relative;
		margin-left: 4rpx;
		&:after{
			content: '';
			width: 20rpx;
			height: 20rpx;
			border: 8rpx solid #fff;
			border-radius: 100%;
			position: absolute;
			top: 0;
			left: -2rpx;
		}
	}
	.my-promotion .header .name .record {
		font-size: 26rpx;
		color: #D16739;
		position: absolute;
		right: 0;
		padding: 10rpx;
		border-radius: 30rpx 0 0 30rpx;
		background-color: #FFF9E3;
		-webkit-box-align: center;
		-moz-box-align: center;
		-o-box-align: center;
		-ms-flex-align: center;
		-webkit-align-items: center;
		align-items: center;
		display: -webkit-box;
		display: -moz-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-lines: multiple;
		-moz-box-lines: multiple;
		-o-box-lines: multiple;
		-webkit-flex-wrap: wrap;
		-ms-flex-wrap: wrap;
		flex-wrap: wrap;
	}
	.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: 90rpx;
	}
	.my-promotion .header .profit {
		padding: 0 20rpx;
		margin-top: 35rpx;
		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 .money {
		font-size: 34rpx;
		color: #fff;
		margin-top: 5rpx;
	}

	.my-promotion .bnt {
		font-size: 28rpx;
		color: #fff;
		width: 278rpx;
		height: 88rpx;
		border-radius: 50rpx;
		text-align: center;
		line-height: 68rpx;
		margin: -32rpx auto 0 auto;
		border: 10rpx solid #fff;
	}
	.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, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		margin-bottom: 20rpx;
	}
	.instructions {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, .5);
		z-index: 10;
	}
	.instructions .setAgCount {
		background: #fff;
		width: 656rpx;
		position: absolute;
		top: 50%;
		left: 50%;
		border-radius: 12rpx;
		-webkit-border-radius: 12rpx;
		padding: 52rpx;
		-webkit-transform: translate(-50%, -50%);
		-moz-transform: translate(-50%, -50%);
		transform: translate(-50%, -50%);
		overflow: hidden;
		.content {
			height: 900rpx;
			overflow-y: scroll;
			/deep/ p {
				font-size: 13px;
				line-height: 22px;
			}
			/deep/ img {
				max-width: 100%;
			}
		}
	}
	.instructions .setAgCount .icon {
		font-size: 42rpx;
		color: #b4b1b4;
		position: absolute;
		top: 15rpx;
		right: 15rpx;
	}
	.instructions .setAgCount .title {
		color: #333;
		font-size: 32rpx;
		text-align: center;
		font-weight: bold;
	}
	.instructions .setAgCount .content {
		margin-top: 32rpx;
		color: #333;
		font-size: 26rpx;
		line-height: 22px;
		text-align: justify;
		text-justify: distribute-all-lines;
		height: 756rpx;
		overflow-y: scroll;
	}
</style>
