<template>
	<view>
		<!-- 产品封面 -->
		<view class="goods-swiper">
			<swiper :indicator-dots="false" @change="current = $event.detail.current + 1">
				<swiper-item>
					<view class="swiper-cover">
						<image src="https://yanxuan-item.nosdn.127.net/ec5550bf450f6c65a9610a4c891e217b.jpg" mode="aspectFill" />
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-cover">
						<image src="https://yanxuan-item.nosdn.127.net/dc27864b72701e31286ca2bf6f7bb245.jpg" mode="aspectFill" />
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-cover">
						<image src="https://yanxuan-item.nosdn.127.net/d89f1f13c36c178843f3bd46783f5ad5.jpg" mode="aspectFill" />
					</view>
				</swiper-item>
			</swiper>
			<view class="swiper-pages">
				{{current}}/3
			</view>
		</view>
		<!-- 详情 -->
		<view class="main">
			<view class="title">学生奶 3.8g乳蛋白娟姗纯牛奶 250ml*10盒</view>
			<view class="sub-title">1%英国珍稀牛种，优级口感与营养</view>
			<view class="box-flex">
				<view class="price">
					<text>¥</text>59.9
				</view>
				<view class="sales">销量2w+</view>
			</view>
			<!-- <view class="">
				优惠券
			</view> -->
			<view class="hr">
				<text>详情</text>
			</view>
			<view class="imgs">
				<image src="https://yanxuan-item.nosdn.127.net/eb6eb62a213c1e76e0326f5d77a5e42b.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/8e132a1d2abfc4ff32fad1cd276c3919.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/7485537552e686ca160509b00366d669.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/6fb77ef6204c5e8f695bf54332c74d23.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/27b53bdb3f3131fffd6e50c42dc0468b.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/7d579166b8dd4e32d23bb9b27a02d2e2.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/ce118328a061c332bfe4b7748518b2d3.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/ae47948c2759ac93baba75ee06d657be.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/f46ccd3139cb9c80e583ab52cb8fb296.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/0ee8478ae77fd561b30d1a5b2124fcd8.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/a856fa0c20fd795aac7e9e6a196db901.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/24926a19f720d8a942c44e228e3c6ec9.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/c1db9a998a66646ce659db57b8c2ec6e.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/a85e0b32e5790a287a95146f6fb266ed.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/38c337287af16dce85634d870cb3db41.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/6e4bdbf6c2945f1c8a3f62344f2056fe.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/24460591cf09176f77082a86a8b03dae.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/85d57e7b3c8e1cdcff5a19ce8f01ceaf.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/2ebe43401d79a59c630ce086852f8d60.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/026cfd7317a40ec2950183461c0e1ee1.jpg" mode="widthFix"></image>
				<image src="https://yanxuan-item.nosdn.127.net/397bad0e51e14b64664c8e365aea3266.jpg" mode="widthFix"></image>
			</view>
		</view>
		<!-- 立即购买 -->
		<view class="footer">
			<button type="default" hover-class="none" @click="buy">立即购买</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 1
			};
		},
		methods:{
			buy(){
				uni.navigateTo({
					url: "./buy"
				})
			}
		}
	}
</script>

<style lang="scss">
	.goods-swiper{
		position: relative;
		width: 100%;
		padding-top: 110%;
		background: $window-color;
		&> swiper{
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			.swiper-cover{
				width: 100%;
				height: 100%;
				image{
					position: absolute;
					top: 0;
					left: 0;
					width: 100%;
					height: 100%;
				}
			}
		}
		.swiper-pages{
			position: absolute;
			bottom:20rpx;
			left: 0;
			right: 0;
			z-index: 9;
			line-height: 90rpx;
			text-align: center;
			color: white;
			font-size: $title-size-m;
			text-shadow: 0 5rpx 5rpx rgba($color: #000000, $alpha: .02);
		}
	}
	// 详情
	.main{
		position: relative;
		z-index: 9;
		margin-top: -20rpx;
		background: white;
		border-radius: $radius $radius 0 0;
		box-shadow: 0 0 10rpx 10rpx rgba($color: #000000, $alpha: .02);
		padding-bottom: ($padding*2) + 90;
		.hr{
			position: relative;
			min-height: 1rpx;
			margin: 0 $margin;
			text-align: center;
			text{
				position: relative;
				z-index: 1;
				color: $text-gray;
				font-size: $title-size-m;
				background: white;
				padding: 0 $padding;
			}
			&::after{
				content: " ";
				background: $border-color;
				width: 100%;
				height: 1rpx;
				position: absolute;
				left: 0;
				top: 50%;
			}
		}
		.title{
			padding: $padding;
			font-weight: bold;
			font-size: $title-size + 14;
		}
		.sub-title{
			padding: 0 $padding;
			font-size: $title-size-m;
			color: $text-gray;
		}
		.box-flex{
			padding: $padding;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.price{
				font-weight: bold;
				color: $text-price;
				font-size: $title-size + 10;
				text{
					font-size: 80%;
					margin-right: 10rpx;
				}
			}
			.sales{
				font-size: $title-size-m;
				color: $text-gray;
			}
		}
		.imgs{
			image{
				vertical-align: top;
				width: 100%;
			}
		}
	}
	// 购买
	.footer{
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		padding: $padding;
		z-index: 98;
		background: white;
		// linear-gradient(to top, white 86%, rgba(255,255,255,.0))
		button{
			background: $main-color;
			color: white;
			border-radius: $radius-lg;
			height: 90rpx;
			line-height: 90rpx;
			font-weight: bold;
			font-size: $title-size;
			&::after{
				display: none;
			}
		}
	}
</style>
