<template>
	<view class="container">
		<view class="list">
			<navigator :url="`/saomaDiancan/tableTypeDetail/tableTypeDetail?id=${item.id}`" class="item"  v-for="(item,index) in list" :key="index">
				<view class="name">{{item.name}}</view>
				<view class="content">
					
					<view class="flex flex-y-center">
						<view class="cell flex flex-y-center">
							<view class="title">人数备注：</view>
							<view class="desc">{{item.content}}</view>
						</view>
						<view class="cell flex flex-y-center">
							<view class="title">分类标识：</view>
							<view class="desc">{{item.mark}}</view>
						</view>
					</view>	
					
					<view class="flex flex-y-center" style="margin-top: 16rpx;">
						<view class="cell flex flex-y-center arr-r" style="width:100%">
							<view class="title">创建时间：</view>
							<view class="desc">{{item.create_time}}</view>
						</view>
					</view>
				</view>
			</navigator>
			<view class="no-more">没有更多内容了~</view>
		</view>

		<view class="footer-bar">
			<view class="content flex flex-center">
				<navigator url="/saomaDiancan/editTableType/editTableType" class="btn">+新增</navigator>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				store_id:"",
				list: [],
				page: 1,
				is_bottom: false
			}
		},
		
		
		onLoad(options) {
			this.store_id = uni.getStorageSync("store_id")
			if(options.name){
				uni.setNavigationBarTitle({
					title:`${options.name}`
				})
			}
		},
		
		onShow() {
			this.getData(1)
		},
		
		onReachBottom() {
			if (!this.is_bottom) {
				this.getData(this.page + 1)
			}
		},
		methods: {
			getData(page) {
				if (page == 1) {
					this.list = []
					this.page = 1
					this.is_bottom = false
				}
				this.request({
					url: 'Smdcshop/table_type_list',
					data: {
						page,
						limit: 10,
						store_id: this.store_id
					}
				}).then(res => {
					if (res.code == 200 && res.data.length) {
						this.list = this.list.concat(res.data)
						this.page = page
					} else {
						this.is_bottom = true
					}
				})
			}
		}
	}
</script>

<style>
	@import url("../static/css/common.css");
	page {
		background-color: #F4F5F7;
	}

	.list {
		padding: 30rpx 25rpx;
	}

	.list .item {
		border-radius: 8rpx;
		overflow: hidden;
		padding-left: 30rpx;
		border-left: 8rpx solid #247EFF;
		background-color: #fff;
		margin-bottom: 30rpx;
	}

	.list .item .name {
		height: 80rpx;
		border-bottom: 1rpx solid #f5f5f5;
		font-size: 30rpx;
		line-height: 80rpx;
		font-weight: bold;
	}

	.list .item .content {
		padding: 20rpx 0 24rpx;
	}

	.list .item .content .cell {
		flex: none;
		width: 50%;
		box-sizing: border-box;
		padding-right: 30rpx;
		font-size: 26rpx;
		line-height: 37rpx;
		color: #666;
	}

	.list .item .content .cell .title {
		color: #99A0AD;
	}

	
</style>
