<template>
	<view class="share-result-container">
		<view class="studentWrapper">
				<view class="studentList" >
				    <view class="studentLeft">
				          <text >登录人数</text>
				    </view>
				    <view class="studentRight">
				           <text>{{shareCount}}</text>
				    </view>
					<uni-icons   type="right" size="15" color="#35b882" ></uni-icons>
				</view>
		</view>
		<view class="studentWrapper">
				<view class="studentList" >
				    <view class="studentLeft">
				           <text >教员人数</text>
				    </view>
				    <view class="studentRight">
				           <text>{{publishCount}}</text>
				    </view>
						<uni-icons   type="right" size="15" color="#35b882" ></uni-icons>
				</view>
		</view>
		<view class="studentWrapper">
				<view class="studentList"  @click="toShareOrders" >
				    <view class="studentLeft">
				          <text >学员单数</text>
				    </view>
				    <view class="studentRight">		      
				           <text>{{orderCount}}</text>
				    </view>
					<uni-icons type="right" size="15" color="#fff" ></uni-icons>
				</view>
		</view>
		
		<view class="shareRule-btn-wrapper" v-if="isShowShareRuleBtn">
			<button class="shareRule-btn" @click="shareRuleButton">分享规则</button>
		</view>
	</view>
</template>

<script>	
	export default {
		data() {
			return {
				shareCount: 0,
				publishCount: 0,
				orderCount: 0,
				isShowShareRuleBtn: false
			};
		},
		created() {
			this.getShareCount()
			this.getTeacherCount()
			this.getOrderCount()
		},
		methods: {
			// 成功注册的条数
			async getShareCount() {
				const { data: result } = await uni.$http.get('/ucenter/mini-program-openid-uid/getShareCount')
				this.shareCount = result.data.result
				if (result.data.result > 0){
					this.isShowShareRuleBtn = true
				}
			},
			// 推荐成功，认证通过的教员 条数
			async getTeacherCount() {
				const { data: result } = await uni.$http.get('/ucenter/mini-program-openid-uid/getShareTeacherCount')
				this.publishCount = result.data.result
			},
			// 推荐成功 对应的 未退款的 学员 订单条数
			async getOrderCount() {
				const { data: result } = await uni.$http.get('/ucenter/mini-program-openid-uid/getShareOrderCount')
				this.orderCount = result.data.result
			},
			toShareOrders(){
				if (this.orderCount > 0) {
					uni.navigateTo({
						url: '/subpkg/my/share/my_share_result_order'
					})
				} else{
					uni.$showMsg("无成交订单！")
				}
			},
			shareRuleButton() {
					uni.navigateTo({
					  url:'/subpkg/my/fee/feeRule_share'
					})
			}
		}
	}
</script>

<!-- 设置页面背景 -->
<style lang="scss">
	page{
		height: 100%;
		// background-color: #FFF;
	}
</style>

<style lang="scss" scoped>
	.share-result-container{
		//height: 100%;
		//background-color: #FFF2CC;
		margin-top: 20rpx;
	}
.studentWrapper{
    //height: 100%;
    //background-color: #E2F0D9;
    padding-left: 40rpx;
	padding-right: 40rpx;
}

.studentList{
	display: flex;
	align-items: center;
	justify-content: space-between;
    padding: 30rpx;
    border-radius: 50rpx;
    //background-color: #FFF2CC;
	// background-color: yellowgreen;
    margin-bottom: 20rpx;
	background-color: #35b882;
	color: white;
}

/* 左侧部分 */
.studentLeft{
	margin-left: 100rpx;
   // font-weight: bold;
    font-size: 35rpx;
}

/* 右侧部分定位 */
.studentRight{
	margin-right: 100rpx;
	//font-weight: bold;
	font-size: 35rpx;
    // color: #FF0000;
   }
   
   // 底部按钮
   .shareRule-btn-wrapper{
   		margin-top: 60rpx;
   		height: 140rpx;
   		align-items: center;
   	}	
   	
   .shareRule-btn{
   		width: 300rpx;
   		border-radius: 50rpx;
   		// margin-bottom: 40rpx;
   		background-color: #35b882;
   		font-size: 35rpx;
   		color:#fff;
   	}
</style>
