<template>
	<view class="order p30">
		<z-paging ref="paging" v-model="dataList" use-page-scroll @query="queryList">
			<view style="height: 20rpx"></view>
			<view style="background-color: #ffffff; padding: 20rpx">邀请人数：{{ total }}</view>
			<view style="height: 20rpx"></view>
			<view>
				<view
					v-for="(item, index) in dataList"
					:key="index"
					style="background-color: #ffffff; border-radius: 10rpx; padding: 30rpx; margin-bottom: 20rpx; font-size: 30rpx"
					@click="toNav(item)"
				>
					<view style="display: flex; align-items: center">
						<u-image width="100rpx" height="100rpx" :src="item.avatar" shape="circle"></u-image>
						<view style="width: 20rpx"></view>
						<view>
							<view>{{ item.nickname }}</view>
							<view style="height: 10rpx"></view>
							<view>{{ item.account }}</view>
						</view>
					</view>
					<u-divider></u-divider>
					<view style="display: flex; justify-content: space-between">
						<view>
							<view>推广人数：{{ item.childCount || 0 }}</view>
							<view>订单金额：{{ item.numberCount || 0 }}</view>
							<view>订单数量：{{ item.orderCount || 0 }}</view>
						</view>
						<view style="width: 20rpx"></view>
						<view>
							<view>手机号：{{ item.phone || '-' }}</view>
							<view style="height: 10rpx"></view>
							<view>等级：v{{ item.levelRatio }}</view>
						</view>
					</view>
					<view style="height: 16rpx"></view>
					<view>注册时间：{{ item.time }}</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
import { shareList } from '@/api/user.js';
export default {
	name: 'login_mobile',
	data() {
		return {
			dataList: [],
			total: 0,
			dataFrom: {
				type: 1
			},
			list: [
				{
					name: '直推',
					id: 1
				},
				{
					name: '间推',
					id: 2
				}
			]
		};
	},
	methods: {
		toNav(e) {
			uni.navigateTo({
				url: './info?id=' + e.uid
			});
		},
		queryList(pageNo, pageSize) {
			const params = {
				page: pageNo,
				limit: pageSize,
				...this.dataFrom
			};

			shareList(params)
				.then((res) => {
					this.$refs.paging.complete(res.data.list);
					this.total = res.data.total;
				})
				.catch((res) => {
					this.$refs.paging.complete(false);
				});
		}
	},
	isPagingRefNotFound() {
		return !this.$refs.paging;
	},
	onPullDownRefresh() {
		if (isPagingRefNotFound()) return;
		this.$refs.paging.updatePageScrollTop(e.scrollTop);
		e.scrollTop < 10 && this.$refs.paging.doChatRecordLoadMore();
	},
	onPageScroll() {
		if (isPagingRefNotFound()) return;
		this.$refs.paging.updatePageScrollTop(e.scrollTop);
		e.scrollTop < 10 && this.$refs.paging.doChatRecordLoadMore();
	},
	onReachBottom() {
		if (isPagingRefNotFound()) return;
		this.$refs.paging.pageReachBottom();
	}
};
</script>

<style scoped lang="scss"></style>
