<template>
	<view class="container">
		<!-- 头部 -->
		<view class="header">
			<image src="../../static/img/img33.png" mode="scaleToFill"></image>
			<!-- 佣金转账 -->
			<view class="accounts" @click="nav('/pages/user/transfer')">
				<view class="text">佣金转账</view>
			</view>
			<!-- 钱 -->
			<view class="money">
				<view class="fuhao">￥</view>
				<view class="counts">3852</view>
			</view>
		</view>
		<!-- 收入和支出 -->
		<view class="navbar">
			<view class="nav-item" v-for="(item, index) in navList" :key="index"
				:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>

		</view>
		<swiper class="swiper-box" :current="tabCurrentIndex" duration="300" @change="changeTab"
			>
			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
				<!-- 空白页 -->
				<!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
				<!-- 推广奖励 -->
				<scroll-view class="scorll" scroll-y="true" >
					<view class="cost">
						<view class="award" v-for="item in 10">
							<view class="award-left">
								<view class="text">推广奖励到账</view>
								<view class="time">2021-8-26 09:30</view>
							</view>
							<view class="award-right">+200</view>
						</view>
					</view>
				</scroll-view>

			</swiper-item>
		</swiper>
		<view class="btm">
			<view class="btn" @click="nav('/pages/user/withdraw')">立即提现</view>
		</view>
	</view>
</template>
 
<script>
	export default {
		data() {
			return {
				bfb:0,
				height: '',
				tabCurrentIndex: 0,
				navList: [{
						state: 1,
						text: '收入',
						loadingType: 'more',
						orderList: [],
						page: 1, //当前页数
						limit: 10 //每次信息条数
					},
					{
						state: 2,
						text: '支出',
						loadingType: 'more',
						orderList: [],
						page: 1, //当前页数
						limit: 10 //每次信息条数
					}
				],
				list: [],
				money: ''
			}
		},
		methods: {
			nav (url) {
				uni.navigateTo({
					url
				})
			},
			// back(){
			// 	uni.navigateBack({
			// 		delta:1
			// 	})
			// },
			// handclick () {
			// 	console.log(123)
			// },
			//swiper 切换
			changeTab(e) {
				this.tabCurrentIndex = e.target.current;
				this.loadData('tabChange')
			},
			//顶部tab点击
			tabClick(index) {
				this.tabCurrentIndex = index;
			}
		}
	}
</script>

<style lang="scss">
	.container {
		width: 750rpx;
		height: 1334rpx;
		background-color: #f1f1f1;

		.header {
			position: relative;
			image {
				width: 750rpx;
				height: 400rpx;
			}

		}
		
		.accounts {
			width: 147rpx;
			height: 56rpx;
			background-color: #fff;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			position: absolute;
			top: 0;
			right: 0;
			margin-top: 134rpx;

			.text {
				width: 112rpx;
				height: 27rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FF0000;
				padding-top: 8rpx;
				margin-left: 18rpx;
			}
		}

		.money {
			top: 0;
			display: flex;
			justify-content: center;
			align-items: center;
			position: absolute;
			padding-left: 246rpx;
			padding-top: 210rpx;

			.fuhao {
				font-size: 45rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #3F7C1F;
				padding-top: 25rpx;
			}

			.counts {
				font-size: 70rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #3F7C1F;
			}
		}

		.swiper-box {
			height: calc(100% - 700rpx);
			background-color: #FFFFFF;
		}
		.scorll {
			height: 100%;
		}
		.navbar {
			display: flex;
			height: 100rpx;
			padding: 0 5rpx;
			background: #fff;
			box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.06);
			position: relative;
			z-index: 10;
			margin-top: 25rpx;

			.nav-item {
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
				height: 100%;
				font-size: 15px;
				color: #999999;
				position: relative;

				&.current {
					color: #333333;

					&:after {
						content: '';
						position: absolute;
						left: 50%;
						bottom: 0;
						transform: translateX(-50%);
						width: 44px;
						height: 0;
						border-bottom: 2px solid #3F7C1F;
					}
				}
			}
		}

		.cost {
			width: 750rpx;
			height: auto;
			background-color: #fff;

			.award {
				width: 701rpx;
				height: 132rpx;
				border-bottom: 1px solid #F0F4F8;
				margin-left: 25rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.award-left {
					width: 221rpx;
					height: 40rpx;
					margin-left: 30rpx;
					margin-bottom: 35rpx;

					.text {
						width: 182rpx;
						height: 30rpx;
						font-size: 30rpx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #666666;
						margin-bottom: 16rpx;
					}

					.time {
						width: 221rpx;
						height: 20rpx;
						font-size: 26rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #AEAEAE;
					}
				}

				.award-right {
					width: 82rpx;
					height: 27rpx;
					font-size: 36rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #FF0000;
					margin-right: 30rpx;
				}
			}
		}
		.btm {
			background-color: #fff;
			height: 190rpx;
			padding-top: 40rpx;
			display: flex;
			justify-content: center;
			.btn {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 674rpx;
				height: 88rpx;
				background: linear-gradient(-35deg, #F8DD4F, #FBEB77);
				border-radius: 44rpx;
			}
		}
	}
</style>
