<template>
	<view class="page">
		<navbar
		title="我的分享"
		leftClick 
		@leftClick="$utils.navigateBack"
		bgColor="#DC2828"
		color="#fff"
		/>

		<view class="team">
			<view class="team-message">
				<view class="leftImage">
					<image :src="userInfo.headImage" mode="aspectFill"></image>
				</view>
				<view class="number-team">
					<view class="top-number">
						<text style="font-weight: 500;">{{ userInfo.nickName }}</text>
						<!-- <text style="font-weight: 500;">{{ userInfo.phone }}</text> -->
						<view class="salesman">区域分享</view>
						<!-- <view class="salesman">{{ levelMap[info.role] }}</view> -->
					</view>
					<view class="bottom-number">
						<view class="performance">
							<view class="team-sum">
								客户总订单
							</view>
							<view class="figure">

								<text style="margin-left: 30rpx; color: #DC2828; font-weight: 600;">￥</text><text
									class="money">{{ info.money }}</text>
							</view>
						</view>
						<view class="withdraw" @click="toPurse">
							<view class="withdraw-button">
								去提现
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="user">
			<uv-tabs :list="tabs" :activeStyle="{color : '#FD5100', fontWeight : 600}" lineColor="#FD5100"
				lineHeight="8rpx" lineWidth="50rpx" @click="clickTabs"></uv-tabs>
		</view>
		<view class="user-list">
			<view class="head" 
            :key="index"
            v-for="(item, index) in list">
				<view class="headImage">
					<image :src="item.headImage" mode="aspectFill"></image>
				</view>
				<view class="info">
					<view class="name">
						{{ item.nickName }}{{ item.phone ? item.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '' }}
					</view>
					<view class="headBtn">
						下单量：<text>{{item.orderNum}}</text>单 | 积分： <text style="color: darkorange;">{{item.commission}}</text>
					</view>
					<view class="tips">
						加入<text>{{ $dayjs().diff($dayjs(item.createTime), 'day') }}</text>天
					</view>
				</view>
			</view>
		</view>
		
		<quick-order-entry
		ref="quickOrderEntry"
		/>
	</view>
</template>

<script>
	import mixinsList from '@/mixins/list.js'
	export default {
		mixins: [mixinsList],
		data() {
			return {
				state: -1,
				mixinsListApi: 'getTeamList',
				tabs: [
					{
						name: '友情分享'
					},
					{
						name: '立体分享'
					},
				],
				levelMap : [
					'区域分享',
					'',
				],
                info : {},
			};
		},
        onLoad() {
            this.queryParams.state = 0;
            this.$store.commit('getUserInfo');
            this.getTeamInfo();
        },
		methods: {
			//点击tab栏
			clickTabs({index}) {
				this.queryParams.state = index;
				this.getData()
			},
			// 跳转到钱包提现
			toPurse() {
				uni.navigateTo({
					url: '/pages_order/mine/purse'
				})
			},
            // 获取团队信息
            getTeamInfo() {
                this.$api('getTeamHeader', res => {
                    if (res.code == 200) {
                        this.info = res.result;
                    }
                })
            },
		},
	}
</script>

<style scoped lang="scss">
	.page {
		.team {
			height: 250rpx;
			background-color: #DC2828;
			padding-top: 50rpx;

			.team-message {
				height: 200rpx;
				width: 90%;
				background-color: #fff;
				margin: 0 30rpx;
				position: relative;
				border-radius: 10rpx;

				.leftImage {
					width: 150rpx;
					height: 150rpx;
					background-image: url(/static/image/center/3.png);
					background-size: 100% 100%;
					overflow: hidden;
					border-radius: 50%;
					margin-right: 15rpx;
					display: inline-block;
					position: absolute;
					top: 25rpx;
					left: 26rpx;
                    image{
                        width: 100%;
                        height: 100%;
                    }
				}

				.number-team {
					width: 70%;
					display: inline-block;
					position: absolute;
					top: 0rpx;
					left: 202rpx;

					.top-number {
						height: 70rpx;
						position: relative;
						border-bottom: #DC2828 dotted 1rpx;
						display: flex;
						align-items: center;
						margin: 0 20rpx;

						.salesman {
							position: absolute;
							height: 40rpx;
							width: 160rpx;
							text-align: center;
							background-color: #FF6700;
							border-radius: 50rpx;
							display: inline;
							margin-left: 240rpx;
							color: #fff;
							font-size: 24rpx;
						}
					}

					.bottom-number {
						height: 120rpx;
						position: relative;

						.performance {
							width: 50%;
							height: 100%;
							display: inline-block;
							position: absolute;
							top: 0rpx;

							.team-sum {
								display: inline-block;
								width: 180rpx;
								background-color: #F99F9F;
								border-radius: 50rpx;
								text-align: center;
								margin: 0rpx 20rpx;
								margin-top: 8rpx;
								color: #DC2828;
								font-size: 26rpx;
							}

							.figure {
								height: 60rpx;
								line-height: 60rpx;
								display: flex;
								// align-items: center;
								padding-top: 10rpx;

								.money {
									font-size: 40rpx;
									color: #DC2828;
									display: inline-block;
									font-weight: 600;
								}
							}
						}

						.withdraw {
							width: 30%;
							height: 100%;
							display: inline-block;
							position: absolute;
							right: 10rpx;
							display: flex;
							justify-content: center; //横轴居中
							align-items: center; //竖轴居中
							font-size: 26rpx;

							.withdraw-button {
								background-color: #DC2828;
								color: #fff;
								border-radius: 50rpx;
								text-align: center;
								height: 62rpx;
								width: 200rpx;
								line-height: 62rpx;
							}
						}
					}
				}
			}
		}

		.user {
			height: 120rpx;
			background-color: #fff;
			display: flex;
			align-items: center;
			padding-left: 30rpx;
		}

		.user-list {
			margin: 0 20rpx;

			.head {
				z-index: -1;
				display: flex;
				background-color: #fff;
				padding: 0rpx 20rpx;
				align-items: center;
				position: relative;
				height: 100rpx;
				margin-top: 20rpx;
				border-radius: 20rpx;

				.headImage {
					width: 75rpx;
					height: 75rpx;
					background-image: url(/static/image/center/3.png);
					background-size: 100% 100%;
					overflow: hidden;
					border-radius: 50%;
					margin-right: 15rpx;
                    image{
                        width: 100%;
                        height: 100%;
                    }
				}

				.info {
					font-size: 22rpx;

					.name {
						font-size: 26rpx;
						color: #333;
					}

					.tips {
						font-size: 22rpx;
						color: #999999;
						margin-top: 10rpx;
					}
				}

				.headBtn {
					position: absolute;
					right: 60rpx;
					top: 38rpx;
					color: #333;
					font-size: 26rpx;
				}
			}
		}
	}
</style>