<template>
	<view class="page">
		<u-navbar title="大厅详情" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
			title-size='36' height='50' id="navbar">
		</u-navbar>
		<view class="boxmask" v-if="flag"></view>
        <view class="box" v-if="flag">
        	<view class="name">
        		<view class="lt">
        			名称
        		</view>
        		<view class="rt">
        			<input type="text" placeholder="请输入大厅名称"/> <image src="https://api.ccttiot.com/smartmeter/img/static/uCta8cp7uXd1lGjZS6sc" mode=""></image>
        		</view> 
        	</view>
        	<view class="name" style="border: none;">
        		<view class="lt">
        			类型
        		</view>
        		<view class="rt" @click="show = true">
        			{{leixing}}  <image src="https://api.ccttiot.com/smartmeter/img/static/uCta8cp7uXd1lGjZS6sc" mode=""></image>
        		</view> 
        	</view>
			<view class="but">
				<view class="quxiao" @click="flag = false">
					取消
				</view>
				<view class="queding">
					确定
				</view>
			</view>
        </view>
        <view class="liebiao">
        	<view class="top">
        		<view class="lt">
        			设施列表
        		</view>
        		<view class="rt" @click="flag = true">
        			添加
        		</view>
        	</view>
        	<view class="list">
        		<view class="item_list">
        			<view class="lt">
        				<view class="name">
        					2号桌
        				</view>
        				<view class="sn">
        					SN：2234681537
        				</view>
        			</view>
        			<view class="rt">
        				<view class="name">
        					<text></text> 已关闭
        				</view>
        				<view class="img">
        					<image src="https://api.ccttiot.com/smartmeter/img/static/uvqVahRyvBHooSDLQfED" mode=""></image>
        				</view>
        			</view>
        		</view>
				<view class="item_list" @click="btnwbd">
					<view class="lt">
						<view class="name">
							2号桌
						</view>
	
					</view>
					<view class="rt">
						<view class="name">
							<text></text> 未绑定
						</view>
						
					</view>
				</view>
        	</view>
        </view>
		
		<view class="mask" style="z-index: 3;" v-if="addmenflag"></view>
		<view class="addmen" v-if="addmenflag">
			<view class="top">
				<view class="cha" @click="addmenflag = false">
					×
				</view>
				<view class="name">
					请选择添加设施方式
				</view>
			</view>
			<view class="one" @click="btnsaoma">
				<view class="lt">
					<view class="saoma">
						扫码添加
					</view>
					<view class="saomas">
						扫描设备上的二维码
					</view>
					<view class="saomas">
						添加设施
					</view>
				</view>
				<view class="rt">
					<image src="https://api.ccttiot.com/smartmeter/img/static/ukzEfdUUjPKUUOxonIgm" mode=""></image>
				</view>
			</view>
			<view class="one" @click="btntouf">
				<view class="lt">
					<view class="saoma">
						新建添加
					</view>
					<view class="saomas">
						直接添加设施并生成设施二维码
					</view>
					<view class="saomas">
						添加设施
					</view>
				</view>
				<view class="rt">
					<image src="https://api.ccttiot.com/smartmeter/img/static/ukzEfdUUjPKUUOxonIgm" mode=""></image>
				</view>
			</view>
		</view>
		
        <u-select v-model="show" :list="list" @confirm="confirm"></u-select>
		<view class="anniu">
			<view class="xinjian" @click="btndt">
				全关
			</view>
			<view class="queren" @click="btnmd">
				全开
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
	            bgc: {
	            	backgroundColor: "#fff",
	            },
				leixing:'请选择类型',
				show:false,
				list:[
					{
						value: '2',
						label: '棋牌'
					},
					{
						value: '1',
						label: '茶室'
					},
					{
						value: '3',
						label: '台球'
					},
				],
				type:'',
				flag:false,
				addmenflag:false,
				storeId:''
			}
		},
		onLoad(option) {
	        this.storeId = option.storeId
		},
		methods: {
			// 确认选择类型
			confirm(e){
				this.type = e[0].value
				this.leixing =e[0].label
			},
			// 点击确定新建大厅
			btnmd(){
				console.log(1);
			},
			// 点击取消
			btndt(){
				uni.navigateBack()
			},
			//点击的时候判断是否绑定
			btnwbd(){
			   this.addmenflag = true
			},
			// 设施点击扫码添加
			btnsaoma(){
				uni.scanCode({
					onlyFromCamera: true,
					scanType: ['qrCode'],
					success: res => {
						function getQueryParam(url, paramName) {
							let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
							let results = regex.exec(url);
							return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
						}
						console.log(res);
						let sceneValue = res.result
						let decodedValue = decodeURIComponent(sceneValue)
						let id = getQueryParam(decodedValue, 'sn')
						let that = this
						let data = {
							sn: id,
							storeId:this.storeId
						}
						uni.navigateTo({
							url:'/page_moban/addsheshi'
						})
					}
				})
			},
			// 点击新建设施并生成二维码
			btntouf(){
				uni.navigateTo({
					url:'/page_moban/addsheshi'
				})
			}
		}
	}
</script>

<style lang="scss">
	/deep/ .u-iconfont,
	/deep/ .u-title{
		padding-bottom: 20rpx;
	}
	.liebiao{
		padding: 46rpx 36rpx;
		box-sizing: border-box;
	}
	page {
		background: #F6F6F6;
	}
	.addmen{
		width: 694rpx;
		height: 702rpx;
		background: linear-gradient( 180deg, #DEF1DA 0%, #FFFFFF 100%, #FFFFFF 100%);
		border-radius: 36rpx 36rpx 36rpx 36rpx;
		position: fixed;
		top: 464rpx;
		left: 50%;
		transform: translateX(-50%);
		z-index: 3;
		box-shadow: 1px 2px 4px -3px;
		.one{
			display: flex;
			align-items: center;
			justify-content: space-between;
			width: 100%;
			.rt{
				image{
					width: 60rpx;
					height: 60rpx;
				}
			}
			.saoma{
				font-weight: 600;
				font-size: 36rpx;
				color: #48893B;
				margin-top: 10rpx;
			}
			.saomas{
	            font-size: 28rpx;
	            color: #48893B;		
				margin-top: 10rpx;
			}
			width: 584rpx;
			height: 224rpx;
			border: 2rpx solid #48893B;
			border-radius: 20rpx;
			margin: auto;
			margin-top: 48rpx;
			padding: 38rpx 44rpx;
			box-sizing: border-box;
		}
		.top{
			display: flex;
			flex-wrap: wrap;
			padding: 0 26rpx;
			box-sizing: border-box;
			.name{
				font-weight: 600;
				font-size: 44rpx;
				color: #48893B;
				width: 100%;
				text-align: center;
				position: absolute;
				top: 56rpx;
				left: 50%;
				transform: translateX(-50%);
			}
			.cha{
				font-size: 68rpx;
				font-weight: 600;
				width: 100%;
				text-align: right;
			}
		}
	}
	.top{
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.lt{
			font-weight: 600;
			font-size: 36rpx;
			color: #3D3D3D;
		}
		.rt{
			width: 126rpx;
			height: 58rpx;
			background: #48893B;
			border-radius: 6rpx 6rpx 6rpx 6rpx;
			font-weight: 600;
			text-align: center;
			line-height: 58rpx;
			font-size: 28rpx;
			color: #FFFFFF;
		}
	}
	.list{
		margin-top: 42rpx;
		.item_list{
			display: flex;
			justify-content: space-between;
			margin-top: 18rpx;
			max-height: 184rpx;
			.rt{
				.name{
					display: flex;
					align-items: center;
					text{
						width: 10rpx;
						height: 10rpx;
						background: #7C7C7C;
						border-radius: 50%;
						margin-right: 10rpx;
					}
				}
				.img{
					text-align: right;
					margin-top: 20rpx;
					image{
						width: 50rpx;
						height: 50rpx;
					}
				}
			}
			.lt{
				.name{
					font-weight: 600;
					font-size: 32rpx;
					color: #3D3D3D;
				}
				.sn{
					font-size: 26rpx;
					color: #3D3D3D;
					margin-top: 26rpx;
				}
			}
			padding: 32rpx 30rpx;
			box-sizing: border-box;
			width: 680rpx;
			background: #FFFFFF;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
		}
	}
	.anniu{
		width: 750rpx;
		height: 152rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0,0,0,0.3);
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: -1;
		display: flex;
		justify-content: space-between;
		padding: 0 36rpx;
		box-sizing: border-box;
		padding-top: 24rpx;
		.queren{
			width: 314rpx;
			height: 104rpx;
			background: #48893B;
			text-align: center;
			line-height: 104rpx;
			font-weight: 600;
			font-size: 36rpx;
			color: #FFFFFF;
			border-radius: 20rpx;
		}
		.xinjian{
			width: 314rpx;
			height: 104rpx;
			border: 2rpx solid #48893B;
			border-radius: 20rpx;
			text-align: center;
			line-height: 104rpx;
			font-weight: 600;
			font-size: 36rpx;
			color: #48893B;
		}
	}
	.mask,
	.boxmask{
		width: 100%;
		height: 100vh;
		background-color: #000;
		opacity: .3;
		z-index: 2;
		position: fixed;
		top: 0;
		left: 0;
	}
	.box{
		position: fixed;
		z-index: 2;
		top: 500rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 580rpx;
		max-height: 408rpx;
		background: #FFFFFF;
		margin: auto;
		margin-top: 22rpx;
		padding-top: 20rpx;
		box-sizing: border-box;
		border-radius: 20rpx;
		.but{
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-top:1px solid #D8D8D8;
			font-size: 32rpx;
			font-weight: 600;
			.quxiao{
				border-right: 1px solid #D8D8D8;
			}
			view{
				width: 50%;
				height: 100rpx;
				line-height: 100rpx;
				text-align: center;
			}
		}
		.name{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: auto;
			height: 80rpx;
			padding: 0 30rpx;
			margin-bottom: 10rpx;
			box-sizing: border-box;
			.lt{
				font-size: 32rpx;
				color: #3D3D3D;
			}
			.rt{
				display: flex;
				align-items: center;
				input{
					text-align: right;
					width: 200rpx;
				}
				image{
					width: 14rpx;
					height: 42rpx;
					margin-left: 10rpx;
				}
			}
		}
	}


</style>