<template>
	<view class="container">
		<view class="m_button illustrate">
			规则说明
		</view>
		<view class="">
			邀请好友
		</view>
		<view class="">
			领现金
		</view>
		<view class="">
			笔笔有提成
		</view>
		<view class="box">
			<view class="item">
				<view class="label">
					已邀请
				</view>
				<view class="value">
					0人
				</view>
			</view>
			<view class="item">
				<view class="label">
					奖励总览
				</view>
				<view class="value">
					0元
				</view>
			</view>
		</view>
		<view class="buttons">
			<view class="m_button">
				邀请好友
			</view>
			<view class="m_button" @click="promotionCode">
				我的推广码
			</view>
		</view>
		<uni-popup ref="popup" background-color="#fff">
			<view class="popup-content" >
				<image class="qrcode" :src="imgUrl" mode=""></image>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		inviteQrcodeApi, 
		inviteInfoApi
	} from "@/api/invite.js"
	export default {
		data() {
			return {
				imgUrl: ''
			}
		},
		methods: {
			promotionCode() {
				let _this = this
				inviteQrcodeApi().then(res => {
					console.log(res, '推广码')
					_this.imgUrl = res.data
					_this.$refs.popup.open('center')
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		background: #e7ffec;
		text-align: center;
		illustrate {
			position: absolute;
			right: 20px;
			top: 40px;
			font-size: 12px;
			padding: 5px 10px;
			border-radius: 4px;
		}
		.box {
			background: #fff;
			margin: 20px 20px;
			padding: 20px;
			border-radius: 15px;
			display: flex;
			justify-content: space-around;
			
			.item {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				.label {
					font-size: 24px;
					font-weight: 600;
				}
				.value {
					font-size: 24px;
					font-weight: 600;
					margin-top: 20px;
				}
			}
		}
		.buttons {
			display: flex;
			justify-content: space-around;
			
			.m_button {
				width: 40vw;
				height: 30px;
				line-height: 30px;
			}
		}
		.qrcode {
			width: 70vw;
			height: 70vw;
		}
	}
</style>
