<template>
	<view class="container">
		<view class="page-block">
			<view class="page-title-block">
				<view class="title">基本信息</view>
			</view>
			<view class="content">
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>预约金额</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.money}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="page-block">
			<view class="page-title-block">
				<view class="title">预约信息</view>
			</view>
			<view class="" >
				<view class="tableList" v-for="item in info.content">
					
					<view class="flex">
						
						<view class=" flex flex-y-center" style="flex: 1;">
							<view class="title-block">
								<text style="font-size: 28rpx;color: #333;">位置类型：</text>
							</view>
							<view class="desc">
								<view class="input-box">{{item.name}}</view>
							</view>
						</view>
						
						<view class=" flex flex-y-center" style="flex: 1;padding:20rpx 0;">
							<view class="title-block">
								<text style="font-size: 28rpx;color: #333;">位置人数：</text>
							</view>
							<view class="desc">
								<view class="input-box">{{item.num}}</view>
							</view>
						</view>
					</view>
						
					
					<view class=" flex flex-y-center" style="flex: 1;">
						<view class="title-block">
							<text style="font-size: 28rpx;color: #333;">每小时可预约次数：</text>
						</view>
						<view class="desc">
							<view class="input-box">{{item.time_num}}</view>
						</view>
					</view>
				</view>




			</view>
		</view>

		<view style="height:30rpx;"></view>
		<view class="footer-bar" style="height: 100rpx;">
			<view class="content flex flex-center" style="height: 100rpx;">
				<view class="detail-btn flex flex-center" style="border-right: 2rpx solid #F4F5F7;" @click="onDel">
					<image src="../static/images/icon_16.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#999999">删除预约</view>
				</view>
				<view class="detail-btn flex flex-center" @click="toEdit">
					<image src="../static/images/icon_17.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#3387FF">重新编辑</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				store_id: '',
				id: "",
				info: {}
			}
		},
		onLoad(options) {
			this.store_id = uni.getStorageSync("store_id");
			this.id = options.id;
			this.getData()
		},
		methods: {
			getData() {
				this.request({
					url: "Smdcshop/edityytablelist",
					data: {
						store_id: this.store_id,
						id: this.id
					}
				}).then(res => {
					if (res.code == 200) {
						this.info = res.data.info
					}
				}).catch(err => {
					console.log('err:', err)
				})
			},
			toEdit() {
				uni.redirectTo({
					url: `./yyedit?id=${this.info.id}&titaleType=3`
				})
			},
			onDel() {
				uni.showModal({
					content: "确定删除该预约吗？",
					success: (r) => {
						if (r.confirm) {
							this.request({
								url: "Smdcshop/delete_yy",
								data: {
									id: this.info.id
								}
							}).then(res => {
								if (res.code == 200) {
									let pages = getCurrentPages();
									let prevPage = pages[pages.length - 2];
									//
									// #ifdef H5
									prevPage.getData(1)
									// #endif
									// #ifndef H5
									prevPage.$vm.getData(1)
									// #endif
									uni.navigateBack()
								}
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
	@import url("../static/css/common.css");

	page {
		background: #F4F5F7;
	}

	.goods-item {
		padding: 25rpx 0;
	}

	.goods-item .goods-img {
		display: block;
		width: 120rpx;
		height: 120rpx;
		border-radius: 8rpx;

	}

	.goods-item .goods-info {
		padding-left: 25rpx;
	}

	.goods-item .goods-info .name {
		font-size: 30rpx;
		font-weight: 600;
		color: #333;
		line-height: 1;
	}

	.goods-item .goods-info .stock {
		font-size: 24rpx;
		color: #999;
		margin-top: 16rpx;
		line-height: 1;
	}

	.goods-item .goods-info .price {
		font-size: 30rpx;
		color: #FD3939;
		margin-top: 20rpx;
		font-weight: 600;
		line-height: 1;
	}

	.tableList {
		padding: 15rpx 25rpx;
		border-bottom: 1rpx solid #f5f5f5;
		background: #fff;
		margin-bottom: 25rpx;
	}
</style>
