<template>
	<view class="contatiner">
		<!-- header -->
		<view class="store-header" >
			<image src="../../static/img/store-bg.png"></image>
			<view class="top-box">
				<view class="store-content">
					<view class="store-avatar">
						<image src="../../static/img/1.jpg"></image>
					</view>
					<view class="store-name">雅诗兰黛官方旗舰店</view>
					<view class="store-follow">关注</view>
					<view class="cancel">X<i class="iconfont cancel"></i></view>
				</view>
				<view class="input-box flex" @click="clickSearch">
					<view class=" input-content flex">
						<view class="iconfont iconsearch"></view>
						<view class="input"><input type="text" disabled placeholder="请输入搜索内容" /></view>
					</view>
				</view>
			</view>
		</view>
		<!-- banner -->
		<view class="carousel-section">
			<swiper class="carousel" autoplay="true" duration="400" interval="5000" >
				<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item">
					<!-- <image :src="item.pic" /> -->
					<image src="../../static/img/store-bg.png"></image>
				</swiper-item>
			</swiper>
		</view>
		
		<view class="store-box">
			<!-- 排行榜charts -->
			<view class="charts-box">
				<view class="charts-header">
					<view class="charts-icon"></view>
					<view class="charts-name">排行榜</view>
					<view class="charts-info">店内热销排行榜排行榜</view>
				</view>
				<view class="charts-content">
					<view class="goods-box">
						<view class="goods-bg">
							<image src="../../static/img/1.jpg"></image>
						</view>
						<view class="goods-name">雅诗兰黛修复石佛寺返回</view>
						<view class="goods-info">套装</view>
						<view class="goods-prince">99</view>
					</view>	
					<view class="goods-box">
						<view class="goods-bg">
							<image src="../../static/img/1.jpg"></image>
						</view>
						<view class="goods-name">雅诗兰黛修复石佛寺返回</view>
						<view class="goods-info">套装</view>
						<view class="goods-prince">99</view>
					</view>	
					<view class="goods-box">
						<view class="goods-bg">
							<image src="../../static/img/1.jpg"></image>
						</view>
						<view class="goods-name">雅诗兰黛修复石佛寺返回</view>
						<view class="goods-info">套装</view>
						<view class="goods-prince">￥99</view>
					</view>	
				</view>
			</view>
			<!-- 导航 -->
			<view class="navBar">
				<view class="nav-item" v-for="(item,index) in navList" :key="item.id" :class="{ 'active' : tabIndex == index }" @tap="toggleTab(index)">
					{{ item.text }}
					<view class="nav-item-line"></view>
				</view>
			</view>
			<view class="content">
				<!-- 滑块视图 -->
				<swiper :current="tabIndex" @change="tabChange" style="height: 100%">
					<!-- current:当前所在滑块的index -->
					<swiper-item v-for="(item,index) in contentList" :key="index">
						<view class="content-box">
							<!-- {{ item.id }} -->
							<!-- <view goods-content v-for="(goodsList,index) in contentList[index].goodsList" :key="index" class="goodsList-box">
								<view class="content-bg" >
									<image src="item.pic">	</image>
								</view>
								<view class="content-name">{{goodsList.text}}</view>
								<view class="content-price">{{goodsList.price}}</view>
								<view class="content-info">{{goodsList.info}}</view>
							</view> -->
							<view class="content-bg">
								<image src="../../static/img/1.jpg"></image>
							</view>
							<view class="info-box">
								<view class="content-name">{{item.text}}</view>
								<view class="content-info">{{item.info}}</view>
								<view class="content-price">{{item.price}}</view>
							</view>
							
						</view>
					</swiper-item>
					
				</swiper>
			</view>
			
			<!-- main
			<!-- <view v-for="(item,index) in yearList" :key="index">
				<view>  {{item.year}}
						<view v-for="(month,monthIndex) in yearList[index].month" :key="monthIndex">
									{{month.name}}
						</view>
				</view>
			</view> -->
		</view>
		
	</view>
</template>

<script>
	export default {
		data () {
	       return {   
			   yearList: [
			   	{  
			   		id: 2020, 
			   		year: '2020年',
			   		month: [
			   			{ id: 1,name: '20一月'}, 
			   			{ id: 2, name: '20,二月'}, 
			   			{ id: 3, name: '20三月'}
			   		] ,
			   	}, 
			   	{ 	id: 2019, 
			   		year: '2019年', 
			   		month: [
			   			{ id: 1, name: '一月'}, 
			   			{ id: 2, name: '二月',}, 
			   			{ id: 3, name: '三月' }
			   		] 
			   	} 
			   ],
			   isFixed: false, 
			   tabIndex: 0, /* 选中标签栏的序列,默认显示第一个 */
				carouselList:[
					{
						id: 0,
					    pic:'../../static/img/banner01jpg.jpg',
					},
					{
						id: 1,
					    pic:'../../static/img/banner02.jpg',
					},
					{
						id: 2,
					    pic:'../../static/img/banner03.jpg',
					}
				],
				navList:[
					{ id: 0, text: '综合'},
					{ id: 1, text: '销量'},
					{ id: 2, text: '价格'},
					{ id: 3, text: '筛选'},
				],
				contentList:[
					{ 
						id: 0 ,
						pic: '../../static/img/1.jpg',
						text: '雅诗兰黛多效修fasdf复套装22',
						price: 1929,
						info: '115人购买',
						goodsList:[
							{
								id: 0 ,
								pic: '../../static/img/1.jpg',
								text: '雅诗兰黛多效修fasdf复套装22',
								price: 1929,
								info: '115人购买'
							},
							{
								id: 1 ,
								pic: '../../static/img/1.jpg',
								text: '雅诗兰黛多效修fasdf复套装22',
								price: 1929,
								info: '115人购买'
							},
							{
								id: 2 ,
								pic: '../../static/img/1.jpg',
								text: '雅诗兰黛多效修fasdf复套装333',
								price: 1929,
								info: '115人购买'
							},
							{
								id: 3 ,
								pic: '../../static/img/1.jpg',
								text: '雅诗兰黛多效修fasdf复套装444',
								price: 1929,
								info: '115人购买'
							},
						]
					},
					{
						id: 1 ,
						pic: '../../static/img/1.jpg',
						text: '雅诗兰黛多效修fasdf复套装22',
						price: 1929,
						info: '115人购买'
					},
					{
						id: 2,
						pic: '../../static/img/1.jpg',
						text: '雅诗兰黛多效修复dsfasd套装33',
						price: 1499,
						info: '115人购买'
					},
					{
						id: 3 ,
						pic: '../../static/img/1.jpg',
						text: '雅诗兰黛多效修复套装44',
						price: 1999,
						info: '115人购买'
					}
				]
			}
		},
		methods:{
			//切换选项卡
			toggleTab (index) { 
				this.tabIndex=index;
				console.log(index)
				console.log(this.tabIndex,'-----')
			},
			tabChange (e) {
				console.log(e);
				this.tabIndex=e.detail.current;
			}
		}
	}
</script>

<style lang="scss">
.contatiner{
	background-color: #F0F0F0;
	.store-header{
		height: 265rpx;
		width: 100%;
		// background-color: pink;
		position: relative;
		image{
			width: 100%;
			height: 100%;
		}
		.top-box{
			position: absolute;
			top:0;
			width: 100%;
			height: 265rpx;
			display: flex;
			flex-direction: column;
			.store-content{
				margin-top: 70rpx;
				display: flex;
				align-items: center;
				.store-avatar{
					height: 90rpx;
					width: 90rpx;
					background-color: #fff;
					margin-left: 24rpx;
				}
				.store-name{
					color: #fff;
					font-size: 30rpx;
					margin-left: 24rpx;
					height: 90rpx;
					line-height: 90rpx;
				}
				.store-follow{
					width: 120rpx;
					height: 40rpx;
					line-height: 40rpx;
					text-align: center;
					font-size:24rpx;
					color: #fff;;
					// margin-right: 74rpx;
					margin-left: 164rpx;
					border: 1px dashed #fff;
				}
			}
			.input-box {
				width: 100%;
				padding: 25rpx;
				// background-color: #ffffff;
				// z-index: 999;
				// margin-top: 10rpx;
				color: #fff;
				font-size:28px;
				.iconsearch {
					font-size: 50rpx;
					
				}
				.input-content {
					border-radius: 99rpx;
					flex-grow: 1;
					// margin-top:26px;
					padding: 2px 30rpx;
					background-color: rgba(231, 231, 231, 0.7);
					.input {
						
						flex-grow: 1;
						input {
							font-size: $font-lg;
						}
					}
				}
				.input-button {
					padding-left: 20rpx;
					font-size: $font-lg;
					height: 100%;
				}
			}
		}
	}
	.carousel-section{
		width: 100%;
		height: 320rpx;
		padding: 0;
		.carousel{
			width: 100%;
			height: 320rpx;
			image{
				width: 100%;
				height: 320rpx;
			}
		}
	}
	.store-box{
		width: 100%;
		padding: 15rpx 27rpx 40rpx 24rpx;
		.charts-box{
			background-color: #fff;
			.charts-header{
				display: flex;
				// flex-direction: column;
				align-items: center;
				height: 80rpx;
				// padding: 0 30rpx;
				border-bottom: 2rpx solid #F0F0F0;
				margin-left:30rpx;
				margin-right:30rpx;
				.charts-icon{
					height: 30rpx;
					width: 30rpx;
					border: 1px solid #ccc;
					margin-top: 6rpx;
				}
				.charts-name{
					font-size:30rpx;
					color: #333333;
					font-weight:bold;
					margin-left: 10rpx;
				}
				.charts-info{
					color: #DC4D46;
					font-size:24rpx;
					margin-left: 10rpx;
				}
			}
			.charts-content{
				display: flex;
				padding: 30rpx 10rpx 12rpx;
				justify-content: space-around;
				.goods-box{
					// width: 194rpx;
					.goods-bg{
						image{
							width: 194rpx;
							height: 194rpx;
						}
					}
					.goods-name{
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						font-size: 26rpx;
						width: 194rpx;
					}
					.goods-info{
						color: #E93323;
						font-size: 20rpx;
						margin-top:10rpx;
						width: 60rpx;
						height: 30rpx;
						line-height: 30rpx;
						text-align: center;
						border: 1px solid #E93323; 
					}
					.goods-prince{
						font-size: 24rpx;
						color: #FC4141;
					}
				}
			}
		}
		.navBar{
			display: flex;
			width: 100%;
			height: 80rpx;
			background-color: #fff;
			margin-top: 15rpx;
			.nav-item{
				width: 25%;
				text-align: center;
				line-height: 80rpx;
				color: #3F454B;
				font-size: 28rpx;
				.active .nav-item-line{
					width: 60rpx;
					border-bottom: 5rpx solid red;
					border-top: 2rpx solid red;
					margin: 0 auto;
				}
			}
		}
		.content{
			margin-top:15rpx;
			display: block;
			height: 100%;
		
			height: 900rpx;
			.content-box{
			width: 336rpx;
			// height: 100%;
			background-color: #fff;
				.content-bg{
					width: 336rpx;
					height: 336rpx;
					border: 1rpx solid #D6D6D6;
					image{
						width: 336rpx;
						height: 336rpx;
					}
				}
				.info-box{
					padding:24rpx 30rpx 10rpx 20rpx;
					.content-name{
						font-size: 26rpx;
						color: #333333;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
					.content-price{
						color:#FC4141;
						font-size:24rpx;
						margin-top:10rpx;
					}
					.content-info{
						color:#999;
						font-size: 24rpx;
						float: right;
						margin-top:12rpx;
					}
				}
				
			}
		}
	}
	
}
</style>
