<template>
	<view class="center">
		<view class="top">
			<image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
			<view class="top-main flex">
				<view class="search-box flex" @click="clickSearch()">
					<image class="search" src="../../static/img/search.png" mode=""></image>
					<view class="search-font">输入关键词搜索</view>
				</view>
			</view>
		</view>
		<swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
			<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item" @click="bannerNavToUrl(item)"><image :src="item.pic" /></swiper-item>
		</swiper>
		<view class="tongz flex">
			<view>
				<view class="tongz-bg"><image src="../../static/img/tongz-bg.png" mode=""></image></view>
				<view class="tongz-left flex">
					<image class="image-left" src="../../static/img/ling.png" mode=""></image>
					<u-notice-bar
						style="width: 100%;"
						mode="vertical"
						type="none"
						:volume-icon="false"
						:more-icon="true"
						:list="text"
						@click="goDetails"
						@getMore="nav('/pages/index/message')"
					></u-notice-bar>
				</view>
			</view>
		</view>
		<view class="navbar flex">
			<view class="navbar-item" @click="nav('/pages/product/classify')">
				<image class="nitem-image" src="../../static/img/index-inco1.png" mode=""></image>
				<view class="nitem-font">随意嗨购</view>
			</view>
			<view class="navbar-item" @click="nav('/pages/product/classify')">
				<image class="nitem-image" src="../../static/img/index-inco2.png" mode=""></image>
				<view class="nitem-font">赠艺金券</view>
			</view>
			<view class="navbar-item" @click="nav('/pages/product/classify')">
				<image class="nitem-image" src="../../static/img/index-inco3.png" mode=""></image>
				<view class="nitem-font">置换</view>
			</view>
			<!-- <view class="navbar-item" @click="nav('/pages/product/classify')">
				<image class="nitem-image" src="../../static/img/index-inco4.png" mode=""></image>
				<view class="nitem-font">趣豆购</view>
			</view> -->
			<view class="navbar-item" @click="nav('/pages/product/seckill')">
				<image class="nitem-image" src="../../static/img/index-inco5.png" mode=""></image>
				<view class="nitem-font">秒杀</view>
			</view>
			<!-- <view class="navbar-item" @click="nav('/pages/product/zero')">
				<image class="nitem-image" src="../../static/img/index-inco6.png" mode=""></image>
				<view class="nitem-font">0元购</view>
			</view> -->
			<view class="navbar-item" @click="nav('/pages/store/store')">
				<image class="nitem-image" src="../../static/img/index-inco7.png" mode=""></image>
				<view class="nitem-font">服务专区</view>
			</view>
			<view class="navbar-item" @click="nav('/pages/hall/hall')">
				<image class="nitem-image" src="../../static/img/index-inco8.png" mode=""></image>
				<view class="nitem-font">大品牌区</view>
			</view>
		</view>
		<!-- <view class="product"><image class="product-image" src="../../static/img/index-product.png" mode=""></image></view> -->
		<view class="shingle">
			<view class="shingle-top flex">
				<view class="shingle-title">艺术品挂牌交易区</view>
				<view class="shingle-btn" @click="nav('/pages/hall/hall')">
					查看更多趣豆会馆
					<text>></text>
				</view>
			</view>
			<view class="shingle-main" @click="navTo(list)">
				<view class="shingle-bg"><image :src="list.image" mode=""></image></view>
				<view class="shinglem-title flex">
					<image class="tbg" src="../../static/img/tbg-left.png" mode=""></image>
					<view class="shinglemt-center">
						<image class="address" src="../../static/img/address.png" mode=""></image>
						<view class="shingle-font">{{list.name}}</view>
					</view>
					<image class="tbg" src="../../static/img/tbg-right.png" mode=""></image>
				</view>
				<view class="shingle-mmain flex">
					<view class="smmain-item">
						<view class="smitem-top">开放中</view>
						<view class="smitem-bottom">状态</view>
					</view>
					<view class="shu"></view>
					<view class="smmain-item">
						<view class="smitem-top">{{list.nickname}}</view>
						<view class="smitem-bottom">馆长</view>
					</view>
					<view class="shu"></view>
					<view class="smmain-item">
						<view class="people flex">
							<view class="peopleitem" v-for="item in 1"><image src="../../static/img/busy.png" mode=""></image></view>
							<view class="peopleitem" v-for="item in 4"><image src="../../static/img/leisure.png" mode=""></image></view>
						</view>
						<view class="smitem-bottom">流畅</view>
					</view>
				</view>
				<image class="right-bottom" src="../../static/img/right-bottom.png" mode=""></image>
			</view>
		</view>
		<!-- 秒杀楼层 -->
		<seckill></seckill>
		<view class="ge"></view>
		<view class="serve">
			<view class="seckill-title flex">
				<view class="seckill-left flex">
					<image class="seckill-inco" src="../../static/img/serve.png" mode=""></image>
					<view class="seckill-font">服务专区推荐</view>
				</view>
				<view class="seckill-right" @click="nav('/pages/store/store')">
					<view class="seckill-rfont">更多</view>
					<image class="seckill-back" src="../../static/img/back.png" mode=""></image>
				</view>
			</view>
			<view class="serve-main flex">
				<view class="serve-item" @click="nav('/pages/store/store')" v-for="(item, index) in 3" :key="index">
					<image class="serve-price" src="" mode=""></image>
					<view class="clamp serve-title">护肤品套装</view>
					<view class="serve-address flex">
						<image class="saddress-inco" src="../../static/img/address.png" mode=""></image>
						<view class="saddress-font">距离0.3KM</view>
					</view>
				</view>
			</view>
		</view>
		<u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar"></u-tabbar>
	</view>
</template>

<script>
import { tabbar1 } from '@/utils/tabbar.js';
import seckill from '../../components/seckill/seckill.vue';
import { article } from '@/api/user.js'
import { loadIndexs } from '@/api/index.js';
import uniCountdowns from '@/components/uni-countdown/uni-countdowns.vue';
import { auction_gu } from '@/api/hall.js';
export default {
	components: {
		seckill,
		uniCountdowns
	},
	data() {
		return {
			current: 0,
			tabbar: tabbar1,
			titleNViewBackground: '',
			swiperCurrent: 0,
			swiperLength: 0,
			dataList: '',
			carouselList: [], //轮播图列表
			text: [],
			article:[],
			list:{},
		};
	},
	onLoad() {
		this.loadData();
	},
	methods: {
		loadData() {
			article({},1).then(({data}) =>{
				data.forEach(e =>{
					this.text.push(e.synopsis)
				})
				this.article = data
			})
			auction_gu({pages:1,limit:1}).then(({data}) =>{
				this.list = data[0]
			}).catch(e =>{
				console.log(e);
			})
			loadIndexs({})
				.then(({ data }) => {
					let goods = data.info;
					this.dataList = goods.bastList; //精品推荐
					this.carouselList = data.banner;
				})
				.catch(e => {});
		},
		goDetails(e) {
			uni.navigateTo({
				url: '/pages/index/messageInfo?id=' + this.article[e].id
			});
		},
		nav(url) {
			uni.navigateTo({
				url,
				fail() {
					uni.switchTab({
						url
					});
				}
			});
		},
		//轮播图切换修改背景色
		swiperChange(e) {
			const index = e.detail.current;
			this.swiperCurrent = index;
			this.titleNViewBackground = this.carouselList[index].background;
		},
		// 點擊搜索框
		clickSearch() {
			uni.navigateTo({
				url: '/pages/product/search'
			});
		},
		navTo(item){
			uni.navigateTo({
				url: "/pages/hall/halllist?id=" + item.id + '&name=' + item.name + '&peoplename=' + item.nickname
			})
		},
		//详情页
		navToDetailPage(item) {
			let id = item.id;
			uni.navigateTo({
				url: '/pages/product/product?id=' + id
			});
		}
	}
};
</script>

<style lang="scss">
page,
.center {
	min-height: 100%;
	height: auto;
	background: #ffffff;
}
.top {
	position: relative;
	width: 100%;
	height: 400rpx;
	.top-bg {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		width: 100%;
		height: 100%;
	}
	.top-main {
		position: relative;
		z-index: 2;
		padding: 30rpx;
		.search-box {
			justify-content: center;
			width: 698rpx;
			height: 60rpx;
			background: rgba(255, 240, 245, 0.4);
			box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
			border-radius: 30rpx;
			.search {
				width: 34rpx;
				height: 34rpx;
			}
			.search-font {
				margin-left: 14rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ffffff;
			}
		}
	}
}
.carousel {
	width: 700rpx;
	height: 300rpx;
	margin: -260rpx auto 0;
	image {
		width: 700rpx;
		height: 300rpx;
	}
}
.tongz {
	width: 690rpx;
	height: 70rpx;
	margin: 32rpx auto 0;
	padding: 18rpx 30rpx 18rpx 24rpx;
	align-items: center;
	position: relative;
	.tongz-bg {
		position: absolute;
		top: 0;
		right: 0;
		left: 0;
		width: 690rpx;
		height: 70rpx;
		image {
			width: 100%;
			height: 100%;
		}
	}
	.tongz-left {
		width: 640rpx;
		.image-left {
			width: 28rpx;
			height: 34rpx;
		}
		.tongz-font {
			margin-left: 22rpx;
			font-size: 28rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #0f253a;
		}
	}
	.tongz-right {
		position: relative;
		z-index: 11;
		width: 12rpx;
		height: 26rpx;
		image {
			width: 100%;
			height: 100%;
		}
	}
}
.navbar {
	justify-content: flex-start;
	flex-wrap: wrap;
	.navbar-item {
		margin-top: 42rpx;
		width: 25%;
		display: flex;
		flex-direction: column;
		align-items: center;
		.nitem-image {
			width: 90rpx;
			height: 90rpx;
		}
		.nitem-font {
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #0c1732;
		}
	}
}
.product {
	width: 662rpx;
	height: 180rpx;
	margin: 44rpx auto;
	.product-image {
		width: 662rpx;
		height: 180rpx;
	}
}
.shingle {
	width: 750rpx;
	background: #f8f8f8;
	border-radius: 10rpx;
	margin: 60rpx auto 0rpx;
	padding: 44rpx 50rpx 40rpx;
	.shingle-top {
		padding-left: 2rpx;
		.shingle-title {
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #dc262b;
		}
		.shingle-btn {
			width: 250rpx;
			height: 50rpx;
			border: 2rpx solid #dc262b;
			border-radius: 10rpx;
			padding: 0 16rpx;
			text-align: left;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #dc262b;
			line-height: 50rpx;
			text {
				display: inline-block;
				padding-left: 6rpx;
			}
		}
	}
	.shingle-main {
		margin: 20rpx auto;
		width: 650rpx;
		height: 206rpx;
		position: relative;
		.shingle-bg {
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			width: 650rpx;
			height: 206rpx;
			image {
				width: 650rpx;
				height: 206rpx;
			}
		}
		.shinglem-title {
			position: relative;
			z-index: 2;
			justify-content: center;
			height: 70rpx;
			.tbg {
				height: 70rpx;
				width: 40rpx;
			}
			.shinglemt-center {
				display: flex;
				align-items: center;
				background: rgba(220,38,43,0.66);
			}
			.address {
				width: 28rpx;
				height: 30rpx;
			}
			.shingle-font {
				font-size: 36rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #ffffff;
				line-height: 70rpx;
				margin-left: 14rpx;
			}
		}
		.shingle-mmain {
			position: relative;
			z-index: 2;
			margin-top: 30rpx;
			.smmain-item {
				width: 33%;
				display: flex;
				flex-direction: column;
				align-items: center;
				.smitem-top {
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #ffffff;
				}
				.smitem-bottom {
					margin-top: 10rpx;
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #ffffff;
				}
				.people {
					justify-content: center;
					.peopleitem {
						width: 24rpx;
						height: 34rpx;
						image {
							width: 100%;
							height: 100%;
						}
					}
				}
			}
			.shu {
				width: 2rpx;
				height: 70rpx;
				background: #ffffff;
			}
		}
		.right-bottom {
			position: absolute;
			z-index: 2;
			right: 0;
			bottom: 0;
			width: 94rpx;
			height: 92rpx;
		}
	}
}
.seckill-left {
	justify-content: flex-start;
	.seckill-inco {
		width: 36rpx;
		height: 36rpx;
		flex-shrink: 0;
	}
	.seckill-font {
		margin-left: 8rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
	}
	.djs {
		margin-left: 12rpx;
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #dc262b;
	}
}
.seckill-right {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	.seckill-rfont {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		margin-right: 8rpx;
	}
	.seckill-back {
		width: 10rpx;
		height: 20rpx;
	}
}
.ge {
	height: 20rpx;
	width: 750rpx;
	background: #f8f8f8;
}
.serve {
	padding: 32rpx 30rpx;
	background: #ffffff;
	.serve-main {
		margin-top: 24rpx;
		flex-wrap: wrap;
		justify-content: flex-start;
		.serve-item:first-child {
			margin-left: 0rpx;
		}
		.serve-item {
			width: 220rpx;
			background: #f6f6f6;
			border-radius: 10rpx;
			margin-left: 14rpx;
			padding-bottom: 22rpx;
			.serve-price {
				width: 220rpx;
				height: 220rpx;
				border-radius: 10rpx 10rpx 0px 0px;
				background: #03a9f4;
			}
			.serve-title {
				margin-top: 16rpx;
				padding: 0 14rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #0a122b;
			}
			.serve-address {
				justify-content: flex-start;
				margin-top: 10rpx;
				padding: 0 14rpx;
				.saddress-inco {
					width: 18rpx;
					height: 24rpx;
				}
				.saddress-font {
					margin-left: 4rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #666666;
				}
			}
		}
	}
}
</style>
