<template>
	<list class="list" :offset-accuracy="5" :bounce="false" isSwiperList="true">
		<refresh class="refresh" @refresh="onrefresh" @pullingdown="onpullingdown"
			:display="refreshing ? 'show' : 'hide'">
			<div class="refresh-view">
				<text class="loading-text">{{refreshText}}</text>
			</div>
		</refresh>
		<cell v-for="(item, index) in dataList" :key="item.id" @click="onclick">
			<view class="item_content2" v-if="itemType===2">
				<view class="title">
					<text>邕蚝烧烤</text>
					<image class="xingimage" src="/static/images/listIcon.png" mode="aspectFit"></image>
					<text class="stattype">4</text>
				</view>
				<view class="DishesRow">
					<label class="Dishes">海鲜烧烤</label>
					<label class="Dishes">待支付，剩余12:23</label>
				</view>
				<view class="DishesRow">
					<label class="Dishes">海鲜烧烤</label>
					<label class="Dishes">待支付，剩余12:23</label>
				</view>
				<view class="buyBT">
					<Label class="paybt">点赞</Label>
				</view>
			</view>
		</cell>
	</list>
</template>

<script>
	export default {
		props: {
			pid: {
				type: [Number, String],
				default: ''
			},
			parentId: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				scrollable: true,
				dataList: [],
				refreshing: false,
				refreshText: "",
				refreshFlag: false,
				itemType:2,
			}
		},
		created() {
			for (var i = 1; i < 32; i++) {
				this.dataList.push({
					id: i,
					name: i
				});
			}
		},
		methods: {
			onclick(e) {
				console.log("onclick");
			},
			loadData() {
				// 首次激活时被调用
			},
			clear() {
				// 释放数据时被调用，参考 swiper-list 缓存配置
				this.dataList.length = 0;
			},
			onrefresh(e) {
				this.refreshing = true;
				this.refreshText = "刷新中...";
				setTimeout(() => {
					this.refreshing = false;
					this.refreshFlag = false;
					this.refreshText = "已刷新";
				}, 2000)
			},
			onpullingdown(e) {
				if (this.refreshing) {
					return;
				}

				this.pulling = false;
				if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
					this.refreshFlag = true;
					this.refreshText = "释放立即刷新";
				} else {
					this.refreshFlag = false;
					this.refreshText = "下拉可以刷新";
				}
			}
		}
	}
</script>

<style scoped>
	.refresh-view {
		width: 750rpx;
		height: 80px;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}

	.list {
		flex: 1;
		background-color: #ebebeb;
	}

	.list-item {
		margin-left: 12px;
		margin-right: 12px;
		margin-top: 12px;
		padding: 20rpx;
		background-color: #fff;
		border-radius: 5px;
	}
	
	.item_content{
		background: bisque;
		width: 100%;
		height: 460rpx;
		margin: 10rpx 0;
		padding: 14rpx;
		box-sizing: border-box;
		border-radius: 15rpx;
		border: 2rpx solid red;
	}
	.mainimage{
		width: 100%;
		height: 320rpx;
		display: block;
		background-color: rebeccapurple;
	}
	
	.titleview{
		padding-left: 16rpx;
		padding-top: 16rpx;
		font-size: 40rpx;
		line-height: 46rpx;
	}
	.title{
		width: 100%;
		text-align: left;
		font-size: 36rpx;
		line-height: 40rpx;
		padding-left: 10rpx;
		font-weight:bold;
		flex-direction: row;
		align-items: center;
	}
	.DishesRow{
		margin-left: 10rpx;
		display: flex;
		flex-direction: row;
		justify-content:right;
	}
	.Dishes{
		text-align: left;
		font-size: 30rpx;
		line-height: 40rpx;
	}
	.xiaoliang{
		margin-left: auto;
		display: flex;
		flex-direction: row;
		justify-content:right;
		margin-right: 10rpx;
		word-break:keep-all;
		font-size: 32rpx;
		color: crimson;
		font-weight:bold;
	}
	.price{
		padding-left: 10rpx;
		width: 100%;
		text-align: left;
		font-size: 28rpx;
		line-height: 40rpx;
		color: crimson;
	}
	.buttonCt{
		margin-left: auto;
		display: flex;
		flex-direction: row;
		justify-content:right;
		margin-bottom: 16rpx;
	}
	.paybt{
		margin-right: 20rpx;
		padding-left: 8rpx;
		padding-right: 8rpx;
		height: 48rpx;
		line-height: 48rpx;
		border-radius: 15rpx;
		background-color: yellow;
		
	}
	.canceldd{
		margin-right: 30rpx;
		padding-left: 8rpx;
		padding-right: 8rpx;
		line-height: 48rpx;
		height: 48rpx;
		border-radius: 15rpx;
		background-color: crimson;
	}

	.item_content2{
		background: bisque;
		width: 100%;
		height: 200rpx;
		margin: 10rpx 0;
		padding: 14rpx;
		box-sizing: border-box;
		border-radius: 15rpx;
		border: 2rpx solid red;
	}
	.buyct{
		width: 100%;
		height: 120rpx;
		padding: 14rpx;
		display: flex;
		flex-direction: row;
	}
	.buyimage{
		width: 100rpx;
		height: 100rpx;
		background-color: aquamarine;
	}
	.buyBT{
		margin-left: auto;
		display: flex;
		flex-direction: row;
		justify-content:right;
	}
	.msText{
		padding-left: 10rpx;
		text-align: left;
		font-size: 22rpx;
		line-height: 32rpx;
	}
	.stattype{
		font-size: 22rpx;
		line-height: 32rpx;
		margin-right: 10rpx;
	}
	.xingimage{
		margin-left: auto;
		margin-right: 10rpx;
		width: 30rpx;
		height: 30rpx;
		background-color: aquamarine;
	}
	
</style>
