<template>
	<view class="content">
		<view class="gq-list">
			<view class="gq-item" v-for="item in list" @click="goPage('/pagesT/unit/itemdetail?id=' + item.id)">
				<view class="gq-logo">
					<image :src="item.image" mode="" class=""></image>
				</view>

				<view class="info">
					<view class="info-tit">
						名称：
					</view>
					<view class="info-val clamp">
						{{item.name}}
					</view>
				</view>
				<view class="info">
					<view class="info-tit">
						价格：
					</view>
					<view class="info-val clamp">
						{{item.price}}
					</view>
				</view>
				<view class="info">
					<view class="info-tit">
						服务时间：
					</view>
					<view class="info-val clamp">
						{{item.service_time}}分钟
					</view>
				</view>
				<view class="info">
					<view class="info-tit">
						可预约：
					</view>
					<view class="info-val clamp">
						是
					</view>
				</view>
				<view class="info">
					<view class="info-tit">
						可下单：
					</view>
					<view class="info-val clamp">
						是
					</view>
				</view>
			</view>
		</view>
		<u-loadmore :status="loadingType" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				type: '',
				page: 1,
				limit: 12,
				loadingType: 'loadmore'
			}
		},
		onLoad(opt) {
			this.getList()
		},
		onShow() {

		},
		onReachBottom() {
			this.getList()
		},
		onReady() {
			
		},
		methods: {
			navto(url) {
				uni.navigateTo({
					url
				})
			},
			getList() {
				let that = this
				if (that.loadingType == 'nomore' || that.loadingType == 'loading') {
					return
				}
				that.loadingType = 'loading'
				this.$u.api.getItemList({
					page: that.page,
					pageSize: that.limit
				}).then(res => {
					console.log(res)
					that.list = that.list.concat(res.data)
					console.log(that.list)
					that.page++
					if(res.data.length == that.limit) {
						that.loadingType = 'loadmore'
					}else {
						that.loadingType = 'nomore'
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.gq-list {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-start;
		// justify-content: space-between;
		padding: 20rpx 0 20rpx 20rpx;
	}

	.gq-item {
		margin: 0 0 20rpx 14rpx;
		width: 227rpx;
		// height: 425rpx;
		background: #FFFFFF;
		box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
		border-radius: 10rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-between;
		padding: 15rpx 14rpx;

		.gq-logo {
			width: 182rpx;
			height: 192rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-bottom: 20rpx;

			image {
				width: 182rpx;
				height: 192rpx;
				background-color: #eee;
			}
		}

		.store-name {
			padding-top: 10rpx;
			text-align: center;
			width: 100%;
			font-size: 26rpx;
			font-weight: 500;
			color: #262261;
			overflow: hidden;
		}

		.info {
			width: 100%;
			display: flex;
			padding: 5rpx 0;

			.info-tit {
				font-size: 18rpx;
				flex-shrink: 0;
			}

			.info-val {
				flex-grow: 1;
				text-align: center;
				font-size: 20rpx;
				width: 140rpx;
				border-bottom: 1px #C7C7C7 solid;
			}
		}

	}
</style>
