<template>
	<view class="center">
		<view class="topcontent padding-b-30">
			<view class="top">
				<view class="vheigh"></view>
				<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">
				<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="stre flex">
				<view class="ic-text flex">
					<image class="ic-tubiao" src="../../static/icon/shou-ic.png" mode=""></image>
					<view class="ic-wen">自用购物优惠</view>
				</view>
				<view class="ic-text flex">
					<image class="ic-tubiao" src="../../static/icon/shou-ic.png" mode=""></image>
					<view class="ic-wen">分享好友赚钱</view>
				</view>
				<view class="ic-text flex">
					<image class="ic-tubiao" src="../../static/icon/shou-ic.png" mode=""></image>
					<view class="ic-wen">超值正品优惠</view>
				</view>
			</view>
			<view class="zhishi flex">
				<navigator url="/pages/index/category">
					<view class="zhishi-item">
						<image class="zhishi-ic" src="../../static/img/img-f.png" mode=""></image>
						<view class="zhishi-te">全部分类</view>
					</view>
				</navigator>
				<navigator url="/pages/user/shareQrCode">
					<view class="zhishi-item">
						<image class="zhishi-ic" src="../../static/img/img-d.png" mode=""></image>
						<view class="zhishi-te">邀请好友</view>
					</view>
				</navigator>
				<navigator url="/pages/index/artDetail?id=6">
					<view class="zhishi-item">
						<image class="zhishi-ic" src="../../static/img/img-a.png" mode=""></image>
						<view class="zhishi-te">关于我们</view>
					</view>
				</navigator>
				<view class="zhishi-item" @click="openKf">
					<image class="zhishi-ic" src="../../static/img/img-b.png" mode=""></image>
					<view class="zhishi-te">联系客服</view>
				</view>
				
			</view>
			<!-- 首购推荐 -->
			<view class="tj">
				<image class="tj-ic" src="../../static/img/sy-icon.png" mode=""></image>
				<view class="sg">首购推荐</view>
			</view>
			<swiper class="car" autoplay="true" duration="400" interval="5000">
				<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="splist flex" v-for="item in 3">
				<view class="tp">
					<image class="list-iamg" src="../../static/error/errorImage.jpg" mode=""></image>
				</view>
				<view class="right" >
					<view class="list-title">风平乐樱桃姜黄复合肽压片 糖果套盒...</view>
					<view class="ysjg flex-start">
						<view class="yj">￥139</view>
						<view class="dz">直降40元</view>
					</view>
					<view class="bto flex">
						<view class="xj">￥99</view>
						<button class="ljgm text-center">立即购买</button>
					</view>
				</view>
				
			</view>
			<!-- 复购专区 -->
			<view class="tj">
				<image class="tj-ic" src="../../static/img/sy-icon.png" mode=""></image>
				<view class="sg">复购专区</view>
			</view>
			<view class="splist flex" v-for="item in 3">
				<view class="tp">
					<image class="list-iamg" src="../../static/error/errorImage.jpg" mode=""></image>
				</view>
				<view class="right" >
					<view class="list-title">风平乐樱桃姜黄复合肽压片 糖果套盒...</view>
					<view class="ysjg flex-start">
						<view class="yj">￥139</view>
						<view class="dz">直降40元</view>
					</view>
					<view class="bto flex">
						<view class="xj">￥99</view>
						<button class="ljgm text-center">立即购买</button>
					</view>
				</view>
				
			</view>
		</view>
		<uni-popup ref="popupkf" type="center">
			<view class="popup-box">
				<view class="img">
					<image src="../../static/img/img009.png" mode=""></image>
				</view>
				<view class="mian">
					<view class="delivery">
						<view class="title">已经为您定制专属客服</view>
						<image src="../../static/img/img010.png" mode=""></image>
					</view>
					<view class="nocancel">客服VX:{{ kefu }}</view>
					<view class="comfirm-box">
						<view class="cancel" @click="cancel">取消</view>
						<view class="comfirm" @click="comfirm(kefu)">复制微信</view>
					</view>
				</view>
			</view>
		</uni-popup>
		<u-tabbar activeColor="#01A6A8" inactive-color='#666666' :list="tabbar"></u-tabbar>
	</view>
</template>

<script>
	import {
		tabbar1
	} from '@/utils/tabbar.js';  //底部导航栏
	import {
		article
	} from '@/api/user.js';
	import {
		getCategoryList,
		getProducts
	} from '@/api/product.js';
	import {
		loadIndexs,
		store_list
	} from '@/api/index.js';
	import {
		auction_gu
	} from '@/api/hall.js';
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		
		data() {
			return {
				current: 0,
				tabbar: tabbar1,
				carouselList: [], //轮播图列表
				kefu: '',
			};
		},
		
		onShow() {
		},
		methods: {
			...mapMutations(['setLat', 'setLon', 'setChoose']),
			// 底部轮播图切换
			changeBottom(res) {
				this.actionArtInd = res.detail.current;
				console.log(res);
			},
			// 打开客服
			openKf() {
				this.$refs.popupkf.open();
			},
			// 关闭客服
			cancel() {
				this.$refs.popupkf.close();
			},
			toBack() {
				uni.navigateTo({
					url: '/pages/navigation/index'
				})
			},
			nav(url) {
				console.log(url, '123456');
				uni.navigateTo({
					url,
					fail() {
						uni.switchTab({
							url
						});
					}
				});
			},
			// 點擊搜索框
			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">
	.center {
		padding-bottom: 30rpx;
	}

	.topcontent {
		background-color: #FFFFFF;
	}

	.vheigh {
		height: var(--status-bar-height);
		background-color: $base-color;
	}

	.top {
		position: relative;
		width: 100%;
		height: 120rpx;

		.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);
				border-radius: 30rpx;
				background-color: #EEEEEE;

				.search {
					width: 34rpx;
					height: 34rpx;
				}

				.search-font {
					margin-left: 14rpx;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #CBCBCB;
				}
			}
		}
	}

	.carousel {
		width: 750rpx;
		height: 360rpx;
		/* #ifndef APP-PLUS */
		// margin: -230rpx auto 0;
		// margin: -160rpx auto 0;
		/* #endif */
		/* #ifdef APP-PLUS */
		// margin: -100rpx auto 0;
		/* #endif */
		image {
			width: 100%;
			height: 100%;
		}
	}

	.stre {
		padding: 0 30rpx;
		margin-top:20rpx ;
		.ic-text {
			.ic-tubiao {
				width: 27rpx;
				height: 27rpx;
			}

			.ic-wen {
				font-size: 21rpx;
				color: #333333;
			}
		}

	}

	.zhishi {
		padding: 30rpx;

		.zhishi-item {
			.zhishi-ic {
				width: 90rpx;
				height: 90rpx;
			}

			.zhishi-te {
				font-size: 24rpx;
				color: #666666;
			}
		}
	}
	.tj {
		.tj-ic {
			width: 350rpx;
			height: 10rpx;
			margin-top: 79rpx;
			margin-left: 199rpx;
		}
		.sg {
			font-size: 35rpx;
			font-weight: 500;
			color: #000000;
			text-align: center;
			margin-top: -35rpx;
		}
	}
	
	.car {
		width: 750rpx;
		height: 240rpx;
		
		image {
			width: 100%;
			height: 100%;
		}
	}
	
	.splist {
		width: 690rpx;
		height: 276rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50,50,52,0.06);
		border-radius: 10rpx;
		margin-left: 30rpx;
		margin-top: 26rpx;
		.tp {
			.list-iamg {
				width: 235rpx;
				height: 235rpx;
				padding-left: 15rpx;
				padding-top: 20rpx;
			}
		}
		.right {
			.list-title {
				font-size: 32rpx;
				font-weight: bold;
				color: #333333;
				padding-left: 22rpx;
				margin-top: 10rpx;
			}
			.ysjg {
				padding-top: 50rpx;
				padding-left: 22rpx;
				.yj {
					width: 65rpx;
					height: 20rpx;
					font-size: 26rpx;
					text-decoration: line-through;
					color: #999999;
				}
				.dz {
					height: 21rpx;
					font-size: 24rpx;
					color: #B59467;
					padding-left: 20rpx;
				}
			}
			.bto {
				padding-top: 20rpx;
				padding-left: 20rpx;
				.xj {
					font-size: 36rpx;
					color: #FF6F0F;
				}
				.ljgm {
					display: inline-block;
					background-color: #01A6A8;
					color: #fff;
					border-radius: 50rpx;
					font-size: $font-base + 2rpx;
					text-align: center;
					margin-left: 160rpx;
				}
			}
		}
		
	}
	
	.popup-box {
		width: 522rpx;
		height: 605rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		position: relative;

		.img {
			position: relative;
			top: -56rpx;
			left: 0;
			width: 522rpx;
			height: 132rpx;
			display: flex;
			justify-content: center;

			image {
				border-radius: 20rpx 20rpx 0 0;
				width: 450rpx;
				height: 132rpx;
			}
		}

		.mian {
			margin-top: -44rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			// padding: 32rpx 32rpx;
			background-color: #ffffff;
			border-radius: 0 0 20rpx 20rpx;
			text-align: center;

			.delivery {
				font-size: 40rpx;
				color: #333333;
				display: flex;
				align-items: center;
				flex-direction: column;

				.title {}

				image {
					margin-top: 48rpx;
					width: 172rpx;
					height: 160rpx;
				}
			}

			.nocancel {
				font-size: 32rpx;
				color: #333333;
				margin-top: 14rpx;
			}

			.comfirm-box {
				margin-top: 52rpx;
				display: flex;
				// margin-bottom: 32rpx;

				// justify-content: space-around;
				.cancel {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 197rpx;
					height: 74rpx;
					border: 1px solid #dcc786;
					border-radius: 38rpx;

					font-size: 32rpx;
					color: #605128;
				}

				.comfirm {
					margin-left: 32rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					width: 197rpx;
					height: 74rpx;
					background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
					border-radius: 38px;
					font-size: 32rpx;
					color: #605128;
				}
			}
		}
	}

	.product-list {
		padding: 0 30rpx;
		line-height: 0;
		align-items: stretch;

		.list-left {
			.imgleft {
				width: 306rpx;
				height: 319rpx;
			}
		}

		.list-right {
			flex-direction: column;

			.imgleft {
				width: 366rpx;
				height: 152rpx;
			}
		}
	}

	.bottom-box {
		padding: 30rpx 0;
		background-color: #FFFFFF;

		.bottom-title {
			text-align: center;

			.image {
				width: 609rpx;
				height: 31rpx;
			}
		}

		.product-art-list {
			height: 432rpx;

			.product-art-item {
				.image-box {
					text-align: center;

					.image {
						width: 432rpx;
						height: 432rpx;
					}
				}
			}
		}

		.product-detail {
			margin: 30rpx;
			height: 4em;
			overflow: hidden;
			text-indent: 2em;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-line-clamp: 4;
			-webkit-box-orient: vertical;
		}
	}
</style>