<template>
	<view>
		<view class="se-px-20 se-py-20 se-bgc-white">
			<u-tabs :current="current" :activeStyle="{
			    color: '#669A32',
			    transform: 'scale(1.05)'
			}" lineColor="#669A32" :list="list" @click="onClick"></u-tabs>
		</view>
		<view class="se-m-20" v-if="current==0">
			<view class="se-bgc-white se-br-20 se-p-20 se-mb-20 se-flex" v-for="(items,indexs) in directUserList" :key="indexs">
				<image class="se-a-80 se-br-p-50 se-bgc-f5" :src="items.headImage" mode=""></image>
				<view class="se-flex se-flex-v se-flex-1 se-px-20">
					<view class="se-c-black se-fw-6 se-fs-26 se-toe-1 se-pt-5">
						{{items.nickName}}
						<text v-if="items.phone">-{{items.phone}}</text>
					</view>
					<view class="se-c-33 se-fs-24 se-lh-40 se-toe-3 se-pt-10">
						{{$u.timeFormat(items.createTime, 'yyyy年mm月dd日')}}加入
					</view>
				</view>
			</view>
			<u-empty v-if="directUserList && directUserList.length==0" mode="list"></u-empty>
		</view>
		<view class="se-m-20" v-if="current==1">
			<view class="se-bgc-white se-br-20 se-p-20 se-mb-20 se-flex" v-for="(items,indexs) in indirectUserList" :key="indexs">
				<image class="se-a-80 se-br-p-50 se-bgc-f5" :src="items.headImage" mode=""></image>
				<view class="se-flex se-flex-v se-flex-1 se-px-20">
					<view class="se-c-black se-fw-6 se-fs-26 se-toe-1 se-pt-5">
						{{items.nickName}}
						<text v-if="items.phone">-{{items.phone}}</text>
					</view>
					<view class="se-c-33 se-fs-24 se-lh-40 se-toe-3 se-pt-10">
						{{$u.timeFormat(items.createTime, 'yyyy年mm月dd日')}}加入
					</view>
				</view>
			</view>
			<u-empty v-if="indirectUserList && indirectUserList.length==0" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	import { getInviteUser } from "@/common/api.js"
	export default {
		data(){
			return{
				current:0,
				list:[
					{
						name: '直接用户',
					}, {
						name: '间推用户',
					}
				],
				directUserList:[],
				indirectUserList:[]
			}
		},
		watch: {
			
		},
		onLoad(options) {
			this.onInviteUser()
		},
		methods:{
			onInviteUser(){
				let that = this
				let params ={}
				getInviteUser(params).then(response=>{
					console.info("getInviteUser",response)
					that.directUserList = response.result.directUserList
					that.indirectUserList = response.result.indirectUserList
				}).catch(error=>{
					
				})
			},
			onClick(event){
				// console.info(event)
				this.current = event.index
			}
		}
	}
</script>

<style>
	page{
		background-color: #f5f5f5;
	}
</style>