<template>
	<view class="container">
		<navBar title="推荐奖励" :back="true" color="#333333" background="#FFFFFF" />

		<view class="outerBox">
			<view class="addPd">
				<view class="countBox">
					<view class="left">
						<view class="num">
{{jiangli.currentDiamondCount}}
						</view>
						<view class="tip">
							剩余次数
						</view>
					</view>
					<view class="right">
						<view class="num">
							{{jiangli.shareDiamondCount}}
						</view>
						<view class="tip">
							推荐奖励次数
						</view>
					</view>
				</view>
			</view>


			<view class="mianContent">
				<view class="tipBox">
					<view class="top">
						<view class="tag">
							TIPS
						</view>
						推荐奖励说明
					</view>
					<view class="bot">
						推荐新用户，新用户成功注册后，将奖励推荐次数5次。推荐越多，奖励将会越多哦！
					</view>
				</view>

				<view class="titleBox">
					推荐奖励明细
				</view>
				<view class="list">
					<view class="item" v-for="(item,index) in jiangli.data">
						<view class="left">
							<image :src="item.user.avatar?item.user.avatar:picBase+'defaultAvatar.png'" mode="" class="avatar"></image>
							<view class="des">
								<view class="name">
									{{item.user.name}}
								</view>
								<view class="time">
									{{item.updated_at}}
								</view>
							</view>
						</view>
						<view class="right">
							奖励次数：{{item.diamond}}
						</view>
					</view>
				</view>


			</view>
		</view>
		<view class="btnBox">
			<view class="btn" @click="toTuijian">
				立即推荐
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getTuijian,
	} from '@/api/index/index.js'
	// import navBar from '@/components/navBar/index.vue'
	export default {
		// components: {
		// 	navBar
		// },
		data() {
			return {
				picBase: this.$picBase2,
			jiangli:null,
			}
		},
		onLoad() {
		this.getTuijian()
		},
		methods: {
			toTuijian(){
				uni.navigateTo({
					url:'/'
				})
			},
async getTuijian() {
			let res1 = await getTuijian()
			console.log('推荐奖励返回值--------2', res1);
			if (res1.code == 0) {
				this.jiangli=res1.data
			} else {
			this.$toast(res1.message)
			}
		},
		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>