<template>
	<view class="myTeam">
		<view class="card">
			<view class="left">
				<view class="number"> {{userInfo.rebate_total}} </view>
				<view class="label"> 我的业绩 </view>
			</view>
			<view class="middle">
				<u--image width="110rpx" height="110rpx" src="/static/myTeam.png" :fade="true"></u--image>
			</view>
			<view class="right">
				<view class="number"> {{userInfo.user_num}} </view>
				<view class="label"> 我的推荐 </view>
			</view>
		</view>
		<view class="list">
			<view class="item" v-for="item in list" :key="item.id">
				<view class="left">
					<view class="avatar-wrap">
						<u--image width="102rpx" height="102rpx" radius="100%" shape="circle" bgColor="#d3c6b5"
							customStyle="border-radius:100%;" :src="item.headimg" :fade="true" duration="450">
						</u--image>
					</view>
					<view class="info">
						<view class="time">
							{{ item.created_at }}
						</view>
						<view class="name">{{ item.nickname }}</view>
					</view>
				</view>
				<view class="right">
					<text>订单金额：</text>
					<text class="amount">{{ item.order_amount_total }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getMyInviteFriend } from "@/common/api/common";
	export default {
		data() {
			return {
				list: [],
				userInfo: {}
			};
		},
		onShow() {
			this.userInfo = JSON.parse(uni.getStorageSync("userInfo"));
			console.log(222, this.userInfo)
		},
		mounted() {
			this._getMyInviteFriend();
		},
		methods: {
			_getMyInviteFriend() {
				getMyInviteFriend({
					page: 1,
					pageSize: 100,
				}).then(({ data = {} }) => {
					console.log("data=>", data);
					this.list = data.list;
					// this.staticsData = 
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.myTeam {
		padding: 20rpx 20rpx 40rpx;
		background: #f5f6f8;

		.card {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 209rpx;
			background: linear-gradient(180deg, #f3af00 0%, #f39800 100%);
			border-radius: 10rpx 10rpx 10rpx 10rpx;
			color: #fff;

			.number {
				font-size: 46rpx;
				font-weight: bold;
				color: #ffffff;
				line-height: 64rpx;
				text-align: center;
			}

			.label {
				font-size: 28rpx;
				font-weight: 500;
				color: #ffffff;
				line-height: 39rpx;
				margin-top: 14px;
				text-align: center;
			}

			.middle {
				margin: 0 68rpx;
			}
		}

		.item {
			height: 154rpx;
			background: #ffffff;
			border-radius: 10rpx;
			margin-top: 20rpx;
			padding: 0 33rpx 0 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.left {
				display: flex;
				align-items: center;

				.info {
					margin-left: 20rpx;
				}

				.time {
					font-size: 28rpx;
					font-weight: 500;
					color: #807f85;
					line-height: 39rpx;
				}

				.name {
					font-size: 28rpx;
					font-weight: bold;
					color: #1d161f;
					line-height: 39rpx;
					margin-top: 19rpx;
				}
			}

			.right {
				font-size: 28rpx;
				font-weight: 500;
				color: #807f85;
				line-height: 39rpx;

				.amount {
					font-size: 32rpx;
					font-weight: bold;
					color: #c9161e;
					line-height: 39rpx;
				}
			}
		}
	}
</style>
