<template>
	<view class="page flex flex-col">
		<!-- <CustomNavBar title="风格选酒" :bgcolor="bgcolor"/> -->
		
		<!-- <view class="" style="margin: 20rpx 0;font-size: 24rpx;color: #606060;padding-left: 32rpx;">
			<view class="" >探索啤酒风味新边界</view>
		</view> -->
		<view class="container">
			
			<scroll-view scroll-y style="height: 100%;width: 100%;">
			<view class="" style="margin: 20rpx 0;font-size: 32rpx;color: #030303;font-weight: 600;">
				<view class="" >TasteRoom 风味屋 · 风味之旅系列</view>
			</view>
			<view class="" style="margin: 20rpx 0;font-size: 24rpx;color: #606060;">
				<view class="" >探索啤酒风味新边界</view>
			</view>
			<view style="width: 100%;" class="flex align-center flex-wrap justify-between">
				<view class="" style="width: 32%;height: 100%;text-align: center;" v-for="it in currentMonth">
					<image :src="it.cover" style="width: 100%;height: 300rpx;margin-right:20rpx;"></image>
					<view class="" style="height: 80rpx;font-size: 28rpx;color: #030303;text-align: left;margin: 12rpx 0;">{{it.beerName}}</view>
					<view class=""
						style="font-size: 24rpx;color: rgba(30, 32, 25, 0.8);text-align: left;">西打酒
					</view>
					<view class="" 
					style="font-size: 24rpx;color: rgba(30, 32, 25, 0.8);text-align: left;margin: 12rpx 0;">
						TasteRoom风味屋
					</view>
					<view class="flex align-center " style="color: #FFCC00;font-size: 28rpx;margin-bottom: 32rpx;">4.9
						<image src="@/static/vector.png" style="width: 20rpx;height: 20rpx;margin-left: 10rpx;">
						</image>
						
					</view>
				</view>
				
				<!-- <view class="beerItem">
					<view class="beerCard flex align-center" @click="toBeer(it)">
						<image :src="it.cover" style="width: 144rpx;height: 204rpx;margin-right:20rpx;"></image>
						<view class="flex-1">

							<view class="word-all margin-bottom-sm" style="color:#1E2019">
								{{it.beerName}}
							</view>
							<view class="word-all margin-bottom-sm"
								style="font-size: 24rpx;color: rgba(30, 32, 25, 0.8);">{{ it.beerStyles}}
							</view>
							<view class="word-all margin-bottom-sm" style="color:#1E2019">{{ it.brandName}}</view>
						</view>
						
					</view>
				</view> -->
			</view>
			
			<view style="width: 100%;color: #979797;margin-top: 60rpx;margin-bottom: 60rpx;text-align: center;">更多新品发布信息，敬请关注更新~</view>
			</scroll-view>
		</view>
		<!-- <view class="flex align-center justify-between tip">
			<text>开启新酒上枪通知，第一时间获取新酒资讯</text>
			<image src="@/static/add.png" style="width: 32rpx;height: 32rpx;"></image>
		</view> -->
		
	</view>
</template>

<script>
	import {
		getLastSixMonth,
		getNewBeerListByMonth,
		popularStyle,
	} from "@/api/platform.js"
	export default {
		components: {
		},
		data() {
			return {
				dataList: [],
				currentMonth: [],
				currentMonthIndex: 0,
				popularStyleList: [],
				queryForm: {
					num: null
				},
				bgcolor:'#19367A',
				
			};
		},
		onLoad() {
			this.getPopularStyle()
			this.getLastSixMonthFun()
			this.$refs.successRef.open
			// uni.showTabBar()
		},
		onShow(){
			// uni.showTabBar()
		},
		methods: {
			// 获取热门风格
			getPopularStyle() {
				popularStyle().then(res => {
					console.log(res)
					this.popularStyleList = res.data
				})
			},
			changeMonth(item, index) {
				this.currentMonthIndex = index
				this.currentMonth = item.beers
				this.queryForm.num = index
				this.getNewBeerListByMonthFun()
			},
			getLastSixMonthFun() {
				getLastSixMonth().then(res => {
					console.log(res)
					this.dataList = res.data
					this.queryForm.num = 0
					this.getNewBeerListByMonthFun()
				})
			},
			// 跳转酒款详情
			toBeer(item) {
				uni.navigateTo({
					url: '/pages/index/review?beerId=' + item.id
				})
			},
			showStyle() {
				this.$refs.popup.open()
			},
			searchByStyle(item) {
				this.queryForm.style = item.beerStyles
				this.getNewBeerListByMonthFun()
				this.$refs.popup.close()
			},
			// 获取新酒列表
			getNewBeerListByMonthFun() {
				getNewBeerListByMonth(this.queryForm).then(res => {
					console.log(res)
					this.currentMonth = res.data
				})
			},
			clear() {
				delete this.queryForm.style
				this.$refs.popup.close()
				this.getNewBeerListByMonthFun()
			},
			handleConfirm(v, selectedValue) {
				console.log('当前项: ', v)
				console.log('---------------')
				console.log('全部项目(所有): ', selectedValue)
			},
			handleClose(v, callbackMenuList) {
			  // console.log('handleClose ==>', v, callbackMenuList)
			},
			handleOpen(v) {
			  // console.log('handleOpen ==>', v)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100vh;
		background: #FFFFFF;
		display: flex;
		flex-direction: column;
		font-family: Roboto;
		.container {
			height: calc(100vh - 102rpx);
			margin-top: -24rpx;
			border-radius: 12rpx;
			padding: 24rpx;
			// background: #F2F2F2;
			padding-bottom: constant(safe-area-inset-bottom);
			padding-bottom: env(safe-area-inset-bottom);
			.style-btn {
				border-radius: 12rpx;
				background: #39E5B1;
				font-family: Roboto;
				font-size: 24rpx;
				color: #0B0E26;
				padding: 6rpx 10rpx;
			}
			.beerItem {
				// padding-left: 18rpx;
				// margin-left: 18rpx;
				// border-left: 4rpx dashed #FFF;
				.beerCard {
					border-radius: 12rpx;
					background: #FFFFFF;
					padding: 24rpx 24rpx 20rpx;
					margin-bottom: 24rpx;

				}
			}
		}

		.tip {
			padding: 0 30rpx 0 48rpx;
			border-radius: 12rpx;
			background: rgba(254, 224, 52, 0.36);
			height: 64rpx;
			position: fixed;
			bottom: env(safe-area-inset-bottom);
			width: 100%;
			color: #5E5F60;
			font-size: 20rpx;
		}
	}
	.active {
		color: #FFC700;
	}
	.clearBtn {
		font-size: 24rpx;
		color: #5E5F60;
	}
</style>