<template>
	<view class="recycling">
		<view class="recycling-navbar">
			<u-navbar title="上门回收" :border-bottom="false" :background="isScroll?background:background1"></u-navbar>
		</view>
		<view class="recycling-hd"></view>
		<view class="recycling-notice">
			<image src="@/static/news/icon-volume.png"></image>
			<view class="notice">
				<u-notice-bar mode="horizontal" :volume-icon="false" bg-color="#fff" color="#212121" :list="list"></u-notice-bar>
			</view>
		</view>
		<view class="recycling-bd">
			<view class="tab">
				<view class="item" :class="tabIndex==0?'item-on':''" @click="tabItem(0)">
					<image v-if="tabIndex==0" src="@/static/news/icon-recycling-01-on.png"></image>
					<image v-else src="@/static/news/icon-recycling-01.png"></image>
					家电回收
				</view>
				<view class="item" :class="tabIndex==1?'item-on':''" @click="tabItem(1)">
					<image v-if="tabIndex==1" src="@/static/news/icon-recycling-02-on.png"></image>
					<image v-else src="@/static/news/icon-recycling-02.png"></image>
					手机回收
				</view>
				<view class="item" :class="tabIndex==2?'item-on':''" @click="tabItem(2)">
					<image v-if="tabIndex==2" src="@/static/news/icon-recycling-03-on.png"></image>
					<image v-else src="@/static/news/icon-recycling-03.png"></image>
					电脑回收
				</view>
				<view class="item" :class="tabIndex==3?'item-on':''" @click="tabItem(3)">
					<image v-if="tabIndex==3" src="@/static/news/icon-recycling-04-on.png"></image>
					<image v-else src="@/static/news/icon-recycling-04.png"></image>
					平板回收
				</view>
			</view>
			<view class="list">
				<view class="item" v-for="i in 10" :key="i" @click="openPage()">
					<image src="@/static/home/phone.jpg"></image>
					<view class="info">
						<view class="title">苹果手机上门回收</view>
						<view class="desc">专业上门回收</view>
						<view class="price">
							<view class="btn">免支付预约</view>
							<view class="num">已售400+ 好评87%</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	import img from "@/static/news/recycling-bg.png"
	export default {
		data() {
			return {
				isScroll: true,
				tabIndex: 0,
				background: {
					background: 'transparent',
				},
				background1: {
					background: '#fff',
				},
				list: ['寒雨连江夜入吴',
					'平明送客楚山孤',
					'洛阳亲友如相问',
					'一片冰心在玉壶'],
			}
		},
		onPageScroll(e){
			if(e.scrollTop <= 44){
				this.isScroll = true;
			}else{
				this.isScroll = false;
			}
		},
		methods: {
			openPage() {
				uni.navigateTo({
					url: "/pages/news/recycling/detail"
				})
			},
			tabItem(index){
				this.tabIndex = index;
			},
			tabItem1(index){
				this.tabIndex1 = index;
			},
			tabFilter(index){
				this.filterIndex = index;
			}
		}
	}
</script>

<style lang="scss" scoped>
.recycling{
	background: url(@/static/news/recycling-bg.png) center top no-repeat;
	background-size: 100% auto;
	&-hd{
		height: 340rpx;
	}
	&-notice{
		background-color: #fff;
		display: flex;
		align-items: center;
		padding: 0 30rpx;
		image{
			width: 50rpx;
			height: 50rpx;
			display: block;
		}
		.notice{
			width: 500rpx;
			flex: 1;
		}
	}
	&-bd{
		padding: 30rpx 0 30rpx 36rpx;
		overflow: hidden;
		background-color: #fff;
		.tab{
			width: 100%;
			.item{
				width: 25%;
				float: left;
				text-align: center;
				font-size: 24rpx;
				font-weight: 500;
				color: #4F4F4F;
				position: relative;
				padding-bottom: 30rpx;
				image{
					width: 60rpx;
					height: 60rpx;
					display: block;
					margin: 0 auto;
					margin-bottom: 12rpx;
				}
				&-on{
					color: #FF4949;
					&::after{
						content: "";
						width: 50rpx;
						height: 6rpx;
						background: #FF4949;
						border-radius: 6rpx;
						position: absolute;
						left: 50%;
						bottom: 10rpx;
						z-index: 1;
						margin-left: -25rpx;
					}
				}
			}
		}
		.list{
			width: 100%;
			overflow: hidden;
			.item{
				 padding: 28rpx 0;
				 overflow: hidden;
				 display: flex;
				 border-top: 1px solid #F2F2F2;
				 &:first-child{
					 border-top-color: #fff;
				 }
				 image{
					 width: 234rpx;
					 height: 222rpx;
					 border-radius: 12rpx;
					 margin-right: 20rpx;
				 }
				 .info{
					 width: 440rpx;
					 white-space: nowrap;
					 .title{
						 overflow: hidden;
						 font-size: 28rpx;
						 text-overflow: ellipsis;
						 font-weight: 600;
						 color: #2C2C2C;
					 }
					 .desc{
						 overflow: hidden;
						 font-size: 28rpx;
						 text-overflow: ellipsis;
						 margin-top: 10rpx;
						 color: #888888;
						 height: 110rpx;
					 }
					 .price{
						 display: flex;
						 align-items: center;
						 justify-content: space-between;
						 font-size: 24rpx;
						 font-weight: 400;
						 color: #888888;
						 .btn{
							 width: 134rpx;
							 line-height: 44rpx;
							 text-align: center;
							 background: #FFFFFF;
							 border-radius: 8rpx;
							 border: 1px solid #FF4949;
							font-size: 24rpx;
							font-weight: 400;
							color: #FF4949;
						 }
					 }
					 
				 }
			}
		}
	}
}
</style>
