<template>
	<view>
		<view class="studentWrapper">
				<view class="studentList" >
				    <view class="studentLeft">
				          <text >打开人数</text>
				    </view>
				    <view class="studentRight">
				           <text>{{shareCount}}</text>
				    </view>
				</view>
		</view>
		<view class="studentWrapper">
				<view class="studentList" >
				    <view class="studentLeft">
				           <text >发布条数</text>
				    </view>
				    <view class="studentRight">
				           <text>{{publishCount}}</text>
				    </view>
				</view>
		</view>
		<view class="studentWrapper">
				<view class="studentList"  @click="toShareOrders" >
				    <view class="studentLeft">
				          <text >成交条数</text>
				    </view>
				    <view class="studentRight">		      
				           <text>{{orderCount}}</text>
				    </view>
					<image class="rightIcon" src="@/static/right.png"></image>
				</view>
		</view>
	</view>
</template>

<script>	
	export default {
		data() {
			return {
				shareCount: 0,
				publishCount: 0,
				orderCount: 0
			};
		},
		created() {
			this.getShareCount()
			this.getPublishCount()
			this.getOrderCount()
		},
		methods: {
			// 成功注册的条数
			async getShareCount() {
				const { data: result } = await uni.$http.get('/ucenter/mini-program-openid-uid/getShareCount')
				this.shareCount = result.data.result
			},
			// 推荐成功，发布的 课程和需求 条数
			async getPublishCount() {
				const { data: result } = await uni.$http.get('/ucenter/mini-program-openid-uid/getSharePublishCount')
				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("无成交订单！")
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.studentWrapper{
    height: 100%;
    background-color: #E2F0D9;
    padding-left: 40rpx;
	padding-right: 40rpx;
}

.studentList{
	display: flex;
	align-items: center;
	justify-content: space-between;
    padding: 40rpx;
    border-radius: 40rpx;
    background-color: #FFF2CC;
    margin-bottom: 20rpx;
}

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

/* 右侧部分定位 */
.studentRight{
	margin-right: 150rpx;
	font-weight: bold;
	font-size: 32rpx;
    color: #FF0000;
   }
   .rightIcon{
	   position: absolute;
	   left: 85%;
       height: 40rpx;
       width: 40rpx;
   }
</style>
