<template>
	<view class="content">
		<view class="content-money">
			<image src="../../static/img/promation.png" mode="" class="bg"></image>
			<view class="money-box">
				<view class="money">
					{{ all }}
					<text>人</text>
				</view>
				<view class="text">我的推广人数</view>
			</view>
		</view>
		<view class="navbar flex">
			<view class="nav-item">
				<view class="num">5</view>
				<view class="font">奖励层数</view>
			</view>
			<view class="xian"></view>
			<view class="nav-item">
				<view class="num">120</view>
				<view class="font">成交人数</view>
			</view>
		</view>
		<view class="swiper-box" :style="{ height: maxheight + 'px' }">
			<scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
				<!-- 空白页 -->
				<empty v-if="loaded === true && list.length === 0"></empty>

				<!-- 订单列表 -->
				<view class="order-item flex" v-for="(item, index) in list" :key="index">
					<view class="title-box flex_item">
						<view class="title-avatar"><image :src="item.avatar"></image></view>
						<view class="list_tpl">
							<view class="title">
								<text>{{ item.email || item.phone }}</text>
							</view>
							<view class="time">
								<text>{{ item.time }}</text>
							</view>
						</view>
					</view>
				</view>
				<uni-load-more :status="loadingType"></uni-load-more>
			</scroll-view>
		</view>
	</view>
</template>

<script>
import { spreadCommission, userBalance } from '@/api/wallet.js';
import { mapState, mapMutations } from 'vuex';
import { getMoneyStyle } from '@/utils/rocessor.js';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from '@/components/empty';
export default {
	components: {
		empty,
		uniLoadMore
	},
	onReady() {
		//初始化获取页面宽度
		uni.createSelectorQuery()
			.select('.content')
			.fields(
				{
					size: true
				},
				data => {
					console.log(data);
					console.log(Math.floor((data.width / 750) * 300));
					//保存头部高度
					this.maxheight = data.height - Math.floor((data.width / 750) * 570);
					console.log(this.maxheight);
				}
			)
			.exec();
	},
	data() {
		return {
			// 头部图高度
			maxheight: '',
			tabCurrentIndex: 0,
			all: '100',
			list: '',
			loadingType: 'more'
		};
	},
	onLoad(options) {},
	onShow() {
		// this.loadData();
	},
	methods: {
		navto(e) {
			uni.navigateTo({
				url: e
			});
		}
	}
};
</script>

<style lang="scss">
page {
	background: #000;
	height: 100%;
}
.content-money {
	padding-bottom: 30rpx;
	background: $page-color-base;
	position: relative;
	.bg {
		position: absolute;
		width: 100%;
	}
	.moneyTx {
		position: absolute;
		top: 150rpx;
		right: 0rpx;
		width: 150rpx;
		padding: 10rpx 30rpx;
		border: 2px solid #ffffff;
		border-top-left-radius: 99rpx;
		border-bottom-left-radius: 99rpx;
		color: #ffffff;
		line-height: 1;
		font-size: $font-base;
	}
	.buttom-box {
		background-color: #ffffff;
		text-align: center;
		margin: 0 30rpx;
		padding: 20rpx 0;
		border-radius: $border-radius-sm;
		margin-top: -60rpx;
		.buttom {
			font-size: $font-lg;
			flex-grow: 1;
		}
		.interval {
			width: 2px;
			height: 60rpx;
			background-color: #eeeeee;
		}
		.icon {
			height: 50rpx;
			width: 48rpx;
			margin: 0 auto;
			.icon-img {
				width: 100%;
				height: 100%;
			}
		}
	}
}
.money-box {
	// background-color: $base-color;
	padding-top: var(--status-bar-height);
	height: 368rpx;
	color: #fad6b0;
	text-align: center;
	position: relative;
	.text {
		font-size: $font-sm;
	}
	.money {
		padding-top: 147rpx;
		font-size: 47px;
		font-family: PingFang SC;
		font-weight: bold;
		text {
			font-size: 24px;
		}
	}
}

.navbar {
	width: 702rpx;
	height: auto;
	padding: 20rpx 0;
	background: linear-gradient(90deg, #393326, #27221d);
	border: 2rpx solid #f5d2ad;
	border-radius: 10rpx;
	position: relative;
	z-index: 10;
	margin: 0 auto;
	.xian {
		width: 2rpx;
		height: 54rpx;
		background: #eeeeee;
	}
	.nav-item {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 100%;
		font-size: 15px;
		color: #fff;
		position: relative;
		width: 50%;
		.num {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #fad6b0;
		}
		.font {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #ffffff;
		}
	}
}
//列表

.swiper-box {
	padding-top: 10rpx;
	.order-item {
		padding: 20rpx 30rpx;
		line-height: 1.5;

		.title-box {
			width: 100%;

			.title-avatar {
				width: 100rpx;
				height: 100rpx;
				margin-right: 25rpx;
				border-radius: 100%;
				image {
					width: 100%;
					height: 100%;
					border-radius: 100%;
				}
			}

			.list_tpl {
				width: 85%;

				.title {
					font-size: $font-lg;
					color: $font-color-base;
					overflow: hidden; //超出的文本隐藏
					text-overflow: ellipsis; //溢出用省略号显示
					white-space: nowrap;
				}

				.time {
					font-size: $font-base;
					color: $font-color-light;
				}
			}
		}

		.money {
			color: #db1935;
			font-size: $font-lg;
		}
	}
}
.content {
	height: 100%;
	.empty-content {
		background-color: #000;
	}
}
</style>
