<template>
	<view class="bg" >
		<image v-if="headImg" :src="showImg(headImg)" class="topImg" mode="widthFix"></image>
		
		<!-- 搜索 -->
		<view class="data-container" >
			<view class="no-data-zhanwei" v-if="list.length<=0">
				<image src="https://static.ticket.sz-trip.com/uploads/20250618/0c2a469b4216f8cd570822b642d0a0fe.png"></image>
				<view style="padding:50rpx 0 67rpx">暂无数据</view>
			</view>
			<view class="right-container no-scrollbar" :scroll-y="true"  v-else>
				<view class="search-result" >
					<view  v-for="(item,i) in list" class="search-item" :key="i" @click="viewDetail(item)">
						<image :src="showImg(item.headimg)" mode="aspectFill"></image>
						<view class="search-result-container">
							<view class="title text-overflowRows">{{item.title}}</view>
							<view class="flex-between" style="padding-top: 20rpx;">
								<view class="price">{{item.price/100}}</view>
								<view class="btn">购买</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view style="height: 60rpx;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: null,
				list:[],
				finished: false,
				headImg: null,
			}
		},
		onLoad(options) {
		},
		onReady() {
			this.getList()
			this.getHeadImg(2381).then(res => {this.headImg = res})
		},

		methods: {
			getList(){

				this.Post({
					tag_id: 662,
					offset: this.list.length,
					limit: 10,
				},'/api/product/get_product_by_tag').then(res => {
					this.list = [...this.list, ...res.data.list];
					if (res.data.list.length < 10) {
						this.finished = true
					}
					console.log(this.list)
				})
			},

			viewDetail(item) {
				// uni.navigateTo({
				// 	url: '/subPackages/techan/detail?id=' + item.id
				// })
				this.gotoDetailByType(item)
			},
		},
		onReachBottom() {
			setTimeout(()=>{
				if (!this.finished) {
					this.getList()
				}
			},200)
			
		}
	}
</script>

<style lang="scss" scoped>
	view {
		box-sizing: border-box;
	}
	.search-header{
		width: 100%;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		display: flex;
		align-items: center;
		padding-left: 10rpx;
		padding-right: 120px;
		background: #fff;
		
		.input-model{
			flex: 1;
			width: 1rpx;
			height: 64rpx;
			background: #F2F4F7;
			border-radius: 55rpx;
			margin-left: 12rpx;
			display: flex;
			align-items: center;
			font-weight: 400;
			font-size: 24rpx;
			color: #999999;
			padding-left: 24rpx;
		}
		.input-text{
			height:19px;
			padding-left: 14rpx;
			font-weight: 400;
			font-size: 24rpx;
			color: #030000;
		}
		.search-btn{
			font-weight: 500;
			font-size: 29rpx;
			color: #6A8A2D;
			padding-left: 25rpx;
			width: 85rpx;
			height: 50%;
			line-height: 1;
			border-left: 1px solid #CCCCCC;
		}
	}
	

	.bg {
		min-height: 100vh;
		background: #F7F7F7;
	}
	.topImg{
		width: 100%;
		// height: 440rpx;
	}
	
	
	
	.right-container{
		width: 100%;
		.search-result{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			width: 100%;
			flex: 1;
			flex-shrink: 0;
			padding:30rpx 26rpx 0;
			.search-item{
				width: 335rpx;
				height: 510rpx;
				overflow: hidden;
				background: #FFFFFF;
				border-radius: 13rpx;
				margin-bottom: 26rpx;
				display: flex;
				flex-direction: column;
				image{
					width: 335rpx;
					height: 342rpx;
					background: #87CD93;
					border-radius: 13rpx 13rpx 0rpx 0rpx;
				}
			}
			
			.search-result-container{
				flex: 1;
				padding:6rpx 12rpx 12rpx;
				width: 100%;
				height: 1rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				
				.title{
					font-weight: 500;
					font-size: 29rpx;
					color: #000000;
				}
				.price{
					font-weight: 400;
					font-size: 33rpx;
					color: #C3282E;
				}
				.price:before{
					content: "￥";
					font-size: 23rpx;
				}
				.price:after{
					content: "起";
					font-size: 23rpx;
					color: #999;
				}
				.btn{
					width: 107rpx;
					height: 47rpx;
					background: #6A8A2D;
					border-radius: 11rpx;
					font-weight: 500;
					font-size: 28rpx;
					color: #FFFFFF;
					text-align: center;
					line-height: 47rpx;
				}

			

			}
		
		}

	}
	.placeholder-content{
		background: white;
		position: relative;
		.btn-cover{
			z-index: 200;
			position: fixed;
			bottom: 0;
			width: 750rpx;
			height: 148rpx;
			background: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
			box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6,0,1,0.1);
			.btn{
				width: 670rpx;
				height: 78rpx;
				text-align: center;
				line-height: 78rpx;
				background: #6A8A2D;
				border-radius: 11rpx;
						
				font-size: 34rpx;
				font-family: PingFangSC;
				font-weight: 500;
				color: #FFFFFF;
			}
		}
	}


	.supplier-box{
		display: flex;
		align-items: center;
		padding: 28rpx 23rpx;
		width: 100%;
		background: #ffffff;
		flex-shrink: 0;
		.supplier-image{
			width: 113.07rpx;
			height: 113.07rpx;
			border-radius: 50%;
			flex-shrink: 0 ;
		}
		.supplier-content{
			flex: 1;
			width: 1px;
			padding: 0 50rpx 0 20rpx;
			height: 113.07rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			font-weight: bold;
			font-size: 32rpx;
			color: #010101;
		}
		
		.tags{
			display: flex;
			width: 100%;
			overflow: hidden;
			.tags-item{
				padding: 4rpx 10rpx;
				font-weight: 500;
				font-size: 24rpx;
				color: #6A8A27;
				border-radius: 5rpx 4rpx 4rpx 5rpx;
				border: 1px solid #6A8A27;
				margin-right: 15rpx;
			}
		}
	}
</style>
