<template>
	<view class="meet">
		<view class="mtop">
			<view class="tit">{{datainfo.conferenceTitle}}</view>
			<view class="ftxt">
				<text>会议地点</text>
				<view>{{datainfo.conferenceAddress}}</view>
			</view>
			<view class="ftxt">
				<text>会议时间</text>
				<view class="co1d">{{datainfo.conferenceDate}} {{datainfo.conferenceTime}}</view>
			</view>
			<view class="ftxt">
				<text>备注信息</text>
				<view>{{datainfo.remerk}}</view>
			</view>
		</view>
		<view class="mtop madr">
			<view class="tit mb24">会议签到</view>
			<!-- <view class="madra">
				<image :src="adrimg"></image>
				<view>安徽省合肥市蜀山区高薪技术产业开发区黄山路59号 时代数码港</view>
			</view> -->
			<view class="madrb" @click="getCodeFn">
				<view class="time">14:47:16</view>
				<view class="mqian">扫码签到</view>
			</view>
			<view class="tips flexcc">
				<!-- <image :src="choseimg"></image> -->
				<view>会议即将开始，请尽快签到哦</view>
			</view>
			<view class="madrc">
				<!-- 步骤条 -->
				<meet-step></meet-step>
			</view>
				
		</view>
	</view>
</template>

<script>
	import {getMeetDetaiFn,getMeetPeoListFn,getupdateReplyFn} from "@/api/mine/meeting.js"
	import meetStep from "@/work/components/meeting/step.vue"
	export default{
		components:{meetStep},
		data(){
			return{
				adrimg:require("@/work/static/images/meeting/adr.png"),
				choseimg:require("@/work/static/images/meeting/chose.png"),
				recordList:[{tit:'123'}],
				datainfo:{},
				userId:this.$store.state.user.userId,
			}
		},
		onLoad(e) {
			this.id=e.id;
			this.getDataFn();
		},
		methods:{
			getDataFn(){
				var params={
					conferenceId:this.id,
					userId:this.userId
				}
				getMeetDetaiFn(params).then(res=>{
					this.datainfo=res.data;
				})
				// 人员签到信息
				// getMeetPeoListFn(params).then(res=>{
					
				// })
			},
			getCodeFn(){
				var that = this;
				uni.scanCode({
					onlyFromCamera: true,
					autoZoom:false,
					scanType: ['qrCode'],
					success: function(red) {
						let result = red.result;
						if (typeof result == 'string') {
							try {
							
							} catch (e) {
								uni.navigateBack({
									delta: 1
								})
								uni.showToast({
									title: '扫码查询失败,请检查二维码是否正确',
									icon: "none"
								})
								return
							}
						}
						var id = red.result
						var params = {
							conferenceId: id,
							userId:this.userId
						}
						getupdateReplyFn(params).then(res => {
							if (res.code == 200) {
								if(res.msg=='核销失败'){
									that.$toast(res.msg)
									// that.$tab.navigateTo('/pages/order/stafffail')
								}else{
									that.$toast('签到成功')
									that.getDataFn()
								}
								
							} else {
								uni.showToast({
									title: res.msg,
									duration: 1000,
									icon: 'none'
								});
							
							}
						})
					},
					fail: function(e) {
						if (e && e.errMsg && e.errMsg.indexOf('scanCode:fail cancel') != -1) {
							return;
						}
						uni.showToast({
							title: '扫码失败',
							icon: "none"
						})
					},
				});
			},
		}
	}
</script>

<style scoped lang="scss">
.meet{padding: 34rpx 24rpx;
	.mtop{width: 100%;background: #FFFFFF;box-shadow: 0px 0px 14rpx 0px rgba(153,152,152,0.39);
border-radius: 10rpx;padding: 48rpx 40rpx 28rpx;margin-bottom: 30rpx;
		&.madr{padding: 48rpx 34rpx 28rpx;}
		.tit{font-weight: bold;font-size: 30rpx;color: #343434;margin-bottom: 36rpx;}
		.ftxt{display: flex;align-items: flex-start;margin-bottom: 20rpx;flex:0 1 auto;min-width: 50%;
			text{font-weight: bold;font-size: 26rpx;color: #CACACA;flex: 0 0 auto;min-width: 104rpx;text-align-last: justify;}
			view{flex: 1;color: #343434;font-size: 26rpx;margin-left: 20rpx;line-height: 34rpx;}
		}
	}
	.madra{display: flex;align-items: flex-start;margin-bottom: 56rpx;
		image{width: 24rpx;height: 26rpx;margin-right: 12rpx;flex: 0 0 auto;margin-top: 4rpx;}
		view{font-weight: 400;font-size: 26rpx;color: #222327;}
	}
	.madrb{
		width: 368rpx;height: 194rpx;background: #1D64E2;box-shadow: 0px 0px 10rpx 0px #6296F2;margin: 0 auto 34rpx;
		border-radius: 98rpx;display: flex;align-items: center;flex-direction: column;justify-content: center;
		.time{font-weight: bold;font-size: 30rpx;color: #FFFFFF;margin-bottom: 10rpx;}
		.mqian{font-weight: 500;font-size: 26rpx;color: #FFFFFF;}
	}
	.tips{margin-bottom: 52rpx;
		image{width: 20rpx;height: 20rpx;margin-right: 14rpx;}
		view{font-weight: 400;font-size: 26rpx;color: #666666;}
	}
	.madrc{padding-left: 34rpx;}
	
}	
</style>