<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>
				</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/rightwhite.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">
	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: 40rpx;
    border-radius: 40rpx;
    //background-color: #FFF2CC;
	// background-color: yellowgreen;
    margin-bottom: 20rpx;
	background-color: #35b882;
	color: white;
}

/* 左侧部分 */
.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: 30rpx;
       width: 30rpx;
   }
</style>
