<template>
	<view class="i-page">
		<view class='i-header'>
			<view :class="isFixed==true ? 'header-titles':'header-title' ">多典花</view>
		</view>
		<view class='i-contain'>
			<view class='header-img' @click="goRecruit">
				<image  class='img-banner' src='https://ddh.yyhock.com/ddhMall/ddh-banner.png'></image>
			</view>
			<view class="i-main">
				<view class='mian-item' v-for="item in list" :key="item.id" @click="goItem">
					<image class='item-img' :src='item.url'></image>
					<view class='item-text'>{{item.name}}</view>
				</view>
			</view>
			<view class="i-mall">
				<view :class="isFixed==true ? 'hot-tab-fixed':'hot-tab'">
					<view :class="hotIndex==item.id ?'hot-header-text':'hot-show'" @click="hotShow(item)"  v-for="item in hotList" :key='item.id'>
						<view class='hot-ative'>{{item.title}}</view>
						<view :class="hotIndex==item.id ?'hot-icon-show':'hot-icon'"></view>
					</view>
				</view>
				<view-goods></view-goods>					
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[
					{url:'https://ddh.yyhock.com/ddhMall/list-o.png',name:'鉴定评估'},
					{url:'https://ddh.yyhock.com/ddhMall/list-t.png',name:'我的需要'},
					{url:'https://ddh.yyhock.com/ddhMall/list-th.png',name:'我的关注'},
					{url:'https://ddh.yyhock.com/ddhMall/list-f.png',name:'用户反馈'}
				],
				hotList:[
					{title:'浏览量',id:0},
					{title:'价格',id:1},
				],
				hotIndex:0,
				isFixed: false,
				headerHeight: 0,
				scrollTop:0,
			}
		},
		onPageScroll(e) {
		    // 页面滚动时设置isFixed和scrollTop
			console.log(e,'876')
		    this.scrollTop = e.scrollTop;
			if( e.scrollTop > 280){
				 this.isFixed = true;
			}else{
				 this.isFixed = false;
			}
		},
		onLoad() {
			
		},
		onReady() {
			const isAgree = uni.getStorageSync('m-agreement')
			if (!isAgree) {
				this.Go('uni:/pages/agreement/index')
			}
		},
		methods: {
			goDetail(){
				this.Go('uni:/pages/productDetails/productDetails')
			},
			goItem(){
				this.Go('uni:/pages/lookGoods/lookGoods')
			},
			goRecruit(){
				console.log(877)
				// this.Go('uni:/pages/recruit/index')
			},
			hotShow(item){
				console.log(item,'9655')
				this.hotIndex=item.id
			},
			toupperTop(e){
				console.log(e,'到顶了');
			},
			lowerMore(e){
				console.log(e,'触底了');
			}
		},
		onShow() {
			
		}
	}
</script>

<style src='./index.less' lang="less" scoped></style>
