<template>
	<view class="newPeople">
		<view class="header">
			<view class="inputSearch" @click="clickSearch">
				<image src="@/static/img/search.png"></image>
				请输入关键词
			</view>
		</view>
		<data-list :data='data'></data-list>
	</view>
</template>

<script>
import { loadIndexs } from '@/api/index.js';
import dataList from '@/components/datalist.vue'
	export default {
		data() {
			return {
				data: {
					page: 1,
					limit: 10,
					sum: 0,
					loadingType: 'loadmore',
					data: []
				}
			}
		},
		components: {
			dataList
		},
		mounted() {
			this.init()
		},
		methods: {
			// 點擊搜索框
			clickSearch() {
				uni.navigateTo({
					url: '/pages/product/search'
				});
			},
			init() {
				this.getData()
			},
			getData() {
				loadIndexs().then(res => {
					this.data = res.data.info.bastList
					this.loadingType = 'nomore'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
$grey: #95A0B1;
$text: #333333;
$red: #FF4C4C;
	.newPeople {
		.header {
			background-color: #fff;
			padding: 30rpx;
			.inputSearch {
				line-height: 35rpx;
				text-align: center;
				color: $grey;
				padding: 10rpx 20rpx;
				border-radius: 50rpx;
				background-color: $page-color-base;
				image {
					width: 32rpx;
					height: 32rpx;
					margin: 0 20rpx;
					margin-bottom: -3rpx;
				}
			}
		}
		.list {
			padding: 20rpx;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			.item {
				background-color: #fff;
				border-radius: 10rpx;
				overflow: hidden;
				// box-shadow: 2rpx 2rpx 10rpx #e1e1e1;
				margin: 10rpx 0;
				width: 48%;
				height: 0;
				padding-bottom: calc(48% + 120rpx);
				.img {
					border-radius: 10rpx;
					overflow: hidden;
					width: 100%;
					height: 0;
					padding-bottom: 100%;
					image {
						width: 100%;
						height: 100%;
					}
				}
				.name {
					margin: 0 10rpx;
					font-size: 30rpx;
					font-weight: bold;
				}
				.allprice {
					padding: 20rpx 0;
					.price {
						color: $red;
					}
					.ot-price {
						color: $grey;
						text-decoration: line-through;
						font-size: 26rpx;
					}
				}
			}
		}
		.load {
			text-align: center;
			color: $grey;
			font-size: 28rpx;
		}
	}
</style>
