<template>
	<view class="container">
		<view class="searchbackground">
			<view class="backgroundimg">
				<image src="../../static/image/background01.png" mode=""></image>
			</view>
		</view>
		<view class="content flex">
			<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>
			<swiper class="carousel" autoplay="true" :interval="5000" :duration="400">
				<swiper-item @click="carouselList" class="carousel-item" v-for="(item,index) in carouselList"
					:key="index">
					<image :src="item.pic"></image>
				</swiper-item <!-- 自定义swiper指示器 -->
				<view class="swiper-dots">
				</view>
			</swiper>
			<view class="customs">
				<image src="../../static/image/baodan.png" mode=""></image>
			</view>
			<view class="customs-content">
				<view class="backgroundimg1">
					<image src="../../static/image/background02.png" mode=""></image>
				</view>
				<view class="box">
					<view class="customs-img">
						<image src="../../static/img/reduce.png" mode=""></image>
					</view>
					<view class="customstext">
						<view class="customstext1">
							<view class="customstext-title">
								竹胎酵素健康饮
							</view>
							<view class="customstext-product">
								健康生态饮品纯植物无香精
							</view>
						</view>
						<view class="customsprice">
							<view class="customsprice-left">
								健康价:￥
							</view>
							<view class="customsprice-between">
								199
							</view>
							<view class="customsprice-right">
								立即复购
							</view>
						</view>
					</view>
				</view>
				
			</view>
			
			<view class="customs">
				<image src="../../static/image/jifen.png" mode=""></image>
			</view>
			<view class="jifen-content">
				
				
				
				<view class="jifen-box">
					<view class="img">
						<image src="../../static/image/jifen1.png" mode=""></image>
					</view>
					<view class="jifen-list">
						<view class="box-title">
							<view class="top">
								竹胎酵素健康饮
							</view>
							<view class="button">
								健康生态饮品纯植物
							</view>
						</view>
						<view class="box-price">
							<view class="pricebox">
								<image src="../../static/image/search.png" mode=""></image>
							</view>
							<view class="price-left">
								2690
							</view>
							<view class="price-right">
								￥360
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="fiexd">
			<image src="../../static/image/background03.png" mode=""></image>
		</view>
	</view>
</template>
<script>
	// import seckill from '../../components/seckill/seckill.vue';
	// import { loadIndexs } from '@/api/index.js';
	// import { getUserInfo } from '@/api/user.js';
	// import { setCoupons } from '@/api/functionalUnit.js';
	// import { getBargainList } from '@/api/product.js';
	// import { interceptor } from '@/utils/loginUtils';
	import {
		mapState
	} from 'vuex';

	export default {
		components: {

		},
		watch: {
			//自适应swiper高度
			checkid(newValue, oldValue) {
				let obj = this;
				if (newValue == 0) {
					let bHeight = Math.ceil(obj.bastList.length / 2);
					obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
				}
				if (newValue == 1) {
					let bHeight = Math.ceil(obj.goodsList.length / 2);
					obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
				}
				if (newValue == 2) {
					let bHeight = Math.ceil(obj.bastBanner.length / 2);
					obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
				}
			},
			// 初次加载页面高度时修改页面高度
			bastList(newValue, oldValue) {
				let obj = this;
				let bHeight = Math.ceil(newValue.length / 2);
				obj.$nextTick(function() {
					uni.createSelectorQuery()
						.select('#list-box')
						.fields({
								size: true
							},
							function(data) {
								obj.pageProportion = data.width / 750;
								obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
							}
						)
						.exec();
				});
			}
		},
		data() {
			return {
				carouselList: [{
						pic: '../../static/image/background02.png'
					},
					{
						pic: '../../static/image/baodan.png'
					}
				], //轮播列表
				page: 1,
				limit: 5,

			};
		},
		methods: {
			carouselList(item) {

			}
		}

	}
</script>

<style lang="scss" scoped>
	page {
		margin: 0;
		padding: 0;
		height: 100%;

		background-color: #D4FDF9;
	}

	.container {
		min-height: 100%;
		height: auto;
	}

	.searchbackground {
		position: relative;

		.backgroundimg {
			position: absolute;
			width: 750rpx;

			image {
				width: 100%;
			}
		}
	}

	.fiexd {
		position: fiexd;
		bottom: 0;
		width: 750rpx;
		height: 750rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.content {
		flex-direction: column;
		justify-content: center;
		height: 100%;

		.input-box {
			position: absolute;
			left: 0;
			top: 0;
			margin: 66rpx 25rpx;
			justify-content: center;
			background: #FFFFFF;
			box-shadow: 0rpx 1rpx 21rpx 0rpx rgba(255, 255, 255, 0.12);
			border-radius: 35rpx;
			width: 700rpx;
			height: 70rpx;

			.input {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #C4C4C4;
				line-height: 38rpx;
			}
		}

		.carousel {
			margin-top: 165rpx;
			width: 700rpx;
			height: 370rpx;

			.carousel-item {
				image {
					width: 100%;
					height: 100%;
				}
			}
		}

		.customs {
			margin-top: 20rpx;
			width: 700rpx;
			height: 180rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.customs-content {
			position: relative;
			padding-top: 14rpx;

			.backgroundimg1 {
				width: 700rpx;
				height: 300rpx;

				image {
					height: 100%;
					width: 100%;
				}
			}

			.box {
				position: absolute;
				margin-top: -250rpx;
				padding: 0 38rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.customs-img {
					width: 200rpx;
					height: 200rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.customstext {
					margin-left: 14rpx;
					height: 200rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-around;

					.customstext1 {
						.customstext-title {
							font-size: 34rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #3F7C1F;
							line-height: 20rpx;
						}

						.customstext-product {
							margin-top: 25rpx;
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #ABD56F;
							line-height: 20rpx;
						}
					}

					.customsprice {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.customsprice-left {
							font-size: 28rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #FF0000;
							line-height: 20rpx;
						}

						.customsprice-between {
							font-size: 42rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #FF0000;
							line-height: 20rpx;
						}

						.customsprice-right {
							margin-left: 80rpx;
							display: flex;
							justify-content: center;
							align-items: center;
							width: 137rpx;
							height: 52rpx;
							background: #3F7C1F;
							border-radius: 26rpx;
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 400;
							color: #FFFFFF;
						}
					}
				}
			}
		}

		.jifen-content {
			
			width: 700rpx;
			display: flex;

			flex-wrap: wrap;
			justify-content: space-around;


			.jifen-box {
				margin: 20rpx 0;
				display: flex;
				flex-direction: column;
				align-items: center;
				width: 336rpx;
				height: 512rpx;
				background: #E6FCFA;
				box-shadow: 0px 7px 10px 1px #8BAFAB;
				.img {
					margin-top: 20rpx;
					height: 312rpx;
					width: 312rpx;
					image {
						height: 100%;
						width: 100%;
					}
				}
				.jifen-list {
					margin-left: -80rpx;
					.box-title {
						.top {
							padding: 20rpx 0 10rpx 0;
							font-size: 30rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #3F7C1F;
							line-height: 35rpx;
						}

						.button {
							padding-bottom: 20rpx;
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #3F7C1F;
							line-height: 35rpx;
							opacity: 0.8;
						}
					}
					.box-price {
						display: flex;
						align-items: center;
						.pricebox {
							height: 25rpx;
							width: 25rpx;
							image {
								height: 100%;
								width: 100%;
							}
						}

						.price-left {
							font-size: 36rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #FF0000;
							line-height: 35rpx;
						}

						.price-right {
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 500;
							text-decoration: line-through;
							color: #999999;
							line-height: 35rpx;
						}
					}
				}
			}
		}
	}
</style>
