<template>
	<view class="app-container">
		<view class="card-container-c">
			<view class="card-container">
				<view class="top">
					<image src="@/static/bg_logo.png" class="bg"></image>
					<view class="title">
						<image src="@/static/mine/ranking/title_l.png"></image>
						<text>本月收益</text>
						<image src="@/static/mine/ranking/title_r.png"></image>
					</view>
					<view class="money"><text>{{detail.income}}</text>元</view>
					<view class="percent">超过本店99%的分销员</view>
					<view class="upDown" v-if="detail.upOrDown">
						<image src="@/static/mine/ranking/up.png"></image>
						<view>相比上一个月有所上升，继续加油哦！</view>
					</view>
					<view class="upDown" v-if="!detail.upOrDown">
						<image src="@/static/mine/ranking/down.png"></image>
						<view>相比上一个月有所上下降，继续加油哦！</view>
					</view>
				</view>
				<view class="bottom">
					<image :src="configInfo.minLogo2" mode="heightFix"></image>
				</view>
			</view>
		</view>
		<view class="tips">统计时间：{{detail.startPeriod}} 至 {{detail.endPeriod}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				configInfo: uni.getStorageSync('configInfo'),
				detail: {},
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			// 获取数据
			getData() {
				this.$axios({
					url: '/user/rank',
					method: 'get',
					params: {}
				}).then(res => {
					this.detail = res.data;
				})
			},
		}
	}
</script>

<style lang="scss">
	.app-container {
		background: #F4F2F2;
		box-sizing: border-box;
	}
	.tips {
		font-size: 28rpx;
		line-height: 28rpx;
		color: #999999;
		text-align: center;
		margin: 60rpx 0 20rpx;
	}
	.card-container-c {
		padding: 40rpx 40rpx 0;
	}
	.card-container {
		width: 670rpx;
		border-radius: 20rpx;
		background: #FFFFFF;
		box-shadow: -20px 0px 40px 20px rgba(155,155,155,0.30); 
		overflow: hidden;
		.top {
			background: #F65759;
			display: flex;
			flex-direction: column;
			align-items: center;
			height: 800rpx;
			position: relative;
			.bg {
				position: absolute;
				top: 140rpx;
				left: 35rpx;
				width: 600rpx;
				height: 600rpx;
				display: block;
				z-index: 0;
			}
			.title {
				display: flex;
				align-items: center;
				margin-top: 56rpx;
				image {
					width: 78rpx;
					height: 22rpx;
					display: block;
				}
				text {
					font-size: 50rpx;
					color: #FFFFFF;
					margin: 0 20rpx;
					line-height: 50rpx;
				}
			}
			.money {
				font-size: 40rpx;
				color: #FFFFFF;
				line-height: 80rpx;
				margin-top: 120rpx;
				text {
					display: inline-block;
					font-size: 80rpx;
					line-height: 80rpx;
					margin-right: 10rpx;
				}
			}
			.percent {
				font-size: 32rpx;
				color: #FFFFFF;
				margin-top: 10rpx;
				line-height: 32rpx;
			}
			.upDown {
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-top: 110rpx;
				image {
					width: 124rpx;
					height: 80rpx;
					display: block;
				}
				view {
					font-size: 32rpx;
					color: #FFFFFF;
					margin-top: 26rpx;
					line-height: 32rpx;
				}
			}
		}
		.bottom {
			height: 140rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			image {
				height: 60rpx;
				display: block;
			}
		}
	}
</style>
