You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							435 lines
						
					
					
						
							11 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							435 lines
						
					
					
						
							11 KiB
						
					
					
				| <template> | |
| 	<view class="page-prebook"> | |
| 		<view class="title flex"> | |
| 			<img :src="cssUrl+'ten.svg'"> | |
| 			{{hospital.hospital_name}} {{hospital.hospital_dept_name}} | |
| 		</view> | |
| 		<book ref="book" @confirmSubmitEvent="showConfirm" :RegistrationTimeList="RegistrationTimeList" :visitorList="activeVisitors"/> | |
| 		<slider-box ref="sliderbox"> | |
| 			<view class="slider-title PfScMedium">预约信息确认</view> | |
| 			<view class="members-box" v-if="needSelectMembers"> | |
| 				<view class="desc">当前时段余号不足,只能预约{{times.left_count}}人</view> | |
| 				<view class="members"> | |
| 					<view :class="'memmbers-item'+(item.choose?' active':'')" v-for="(item,key) in activeVisitors" @click="chooseVisitor(key)"> | |
| 						<img :src="cssUrl+'checkbox_false.svg'"> | |
| 						<img :src="cssUrl+'checkbox_true.svg'"> | |
| 						{{item.real_name}} | |
| 					</view> | |
| 				</view> | |
| 			</view> | |
| 			<view class="item member-style" v-else> | |
| 				<view class="left">就诊人:</view> | |
| 				<view class="right over2 over5"> | |
| 					<text v-for="(item,key) in activeVisitors"> | |
| 						<text v-if="key<=9">{{nums[key]}}</text><text v-else>n.</text>{{item.real_name}} | |
| 					</text> | |
| 				</view> | |
| 			</view> | |
| 			<view class="item" > | |
| 				<view class="left">医生姓名:</view> | |
| 				<view class="right">{{doctorInfo.name}}</view> | |
| 			</view> | |
| 			<view class="item"> | |
| 				<view class="left">就诊医院:</view> | |
| 				<view class="right over2 over5">{{hospital.hospital_name}} {{hospital.hospital_dept_name}}</view> | |
| 			</view> | |
| 			<view class="item"> | |
| 				<view class="left">看诊时间:</view> | |
| 				<view class="right orange">{{times.date}} 上午 {{times.start_time}}-{{times.end_time}}</view> | |
| 			</view> | |
|  | |
| 			<view class="btns-box flex"> | |
| 				<view class="btn cancel btn1" hover-class="hover" @click="closeConfirm">我再想想</view> | |
| 				<view class="primary btn btn1" hover-class="hover" @click="submitConfim">确认预约</view> | |
| 			</view> | |
| 		</slider-box> | |
| 	</view> | |
| </template> | |
| 
 | |
| <script> | |
| 	import Book from '@/components/bookBox.vue' | |
| 	import SliderBox from '@/components/sliderBox.vue' | |
| 	export default { | |
| 		onLoad(op) { | |
| 			uni.setNavigationBarTitle({ | |
| 				title:'李静医生预约就诊' | |
| 			}) | |
| 		}, | |
| 		data() { | |
| 			return { | |
| 				cssUrl:this.cssUrl, | |
| 				needSelectMembers:false, | |
| 				doctorId:false, | |
| 				RegistrationTimeList:[], | |
| 				hospitalId:false, | |
| 				hospital:false, | |
| 				activeVisitors:[], | |
| 				nums:['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'], | |
| 				times:false, | |
| 				chooseVisitorCount:0 | |
| 			} | |
| 		}, | |
| 		components:{ | |
| 			Book, | |
| 			SliderBox | |
| 		}, | |
| 		onShow() { | |
| 			var activeVisitors = uni.getStorageSync('active_visitors') | |
| 			if(!activeVisitors){ | |
| 				this.$pop.modelShow('请先选择要预约的就诊人', '/pages/visitors/visitors?type=1') | |
| 				return | |
| 			} | |
| 			this.activeVisitors = JSON.parse(activeVisitors) | |
| 			this.hospitalId = uni.getStorageSync('hospital_id') | |
| 			this.hospital = uni.getStorageSync('hospital') | |
| 
 | |
| 			var doctorInfo = uni.getStorageSync('doctor_info') | |
| 			if(!doctorInfo){ | |
| 				this.$pop.modelShow('请先选择要预约的医生', '/pages/index/index') | |
| 				return | |
| 			} | |
| 			this.doctorInfo = JSON.parse(doctorInfo) | |
| 
 | |
| 			if(!this.hospitalId && this.hospital) { | |
| 				this.$pop.modelShow('请先选择要预约的医院', '/pages/index/index') | |
| 				return | |
| 			} | |
| 			this.hospital = JSON.parse(this.hospital) | |
| 			this.doctorId = getApp().globalData.doctorId | |
| 			this.getAvailabletRegistrationTime() | |
| 		}, | |
| 		methods: { | |
| 			chooseVisitor(key){ | |
| 				var visitor = this.activeVisitors[key] | |
| 				var choose = visitor.choose ? false : true | |
| 				var chooseCount = 0 | |
| 				for (var i = 0; i < this.activeVisitors.length; i++) { | |
| 					if(this.activeVisitors[i].choose) ++chooseCount | |
| 				} | |
| 
 | |
| 				if(this.times.left_count <= chooseCount && choose){ | |
| 					this.$pop.modelShow('最多预约'+this.times.left_count+'人') | |
| 					return | |
| 				} | |
| 
 | |
| 				visitor.choose = choose | |
| 				this.$set(this.activeVisitors, key, visitor) | |
| 			}, | |
| 			tips(){ | |
| 				uni.showToast({ | |
| 					title:"成功预约"+this.chooseVisitorCount+"人", | |
| 					mask:true, | |
| 					image:this.cssUrl+'gou.svg', | |
| 					times:false, | |
| 					success() { | |
| 						uni.navigateTo({ | |
| 							url:"/pages/prebook_list/prebook_list" | |
| 						}) | |
| 					} | |
| 				}) | |
| 			}, | |
| 			getAvailabletRegistrationTime(refresh = true, chooseDay = '') { | |
| 				this.$http.req('client/doctor/visit_hospital/days/'+this.hospitalId).then(data=>{ | |
| 					if(data == -1) return | |
| 					// data.days = [ | |
| 					// 	{ | |
| 					// 		date: "2024-04-17", type: 2, type_text: "上午出诊", weekday: "周一",  | |
| 					// 		am: [ | |
| 					// 			{ | |
| 					// 				"start": "12:00", | |
| 					// 				"end": "12:30", | |
| 					// 				"bed_count": 0 | |
| 					// 			}, | |
| 					// 			{ | |
| 					// 				"start": "13:00", | |
| 					// 				"end": "14:30", | |
| 					// 				"bed_count": 2 | |
| 					// 			} | |
| 					// 		], | |
| 					// 		pm: [] | |
| 					// 	}, | |
| 					// 	{ | |
| 					// 		date: "2024-04-18", type: 5, type_text: "未开放预约", weekday: "周二", am: [], pm: [] | |
| 					// 	}, | |
| 					// 	{ | |
| 					// 		date: "2024-04-19", type: 3, type_text: "全天出诊", weekday: "周三", am: [ | |
| 					// 			{ | |
| 					// 				"start": "12:00", | |
| 					// 				"end": "12:30", | |
| 					// 				"bed_count": 0 | |
| 					// 			}, | |
| 					// 			{ | |
| 					// 				"start": "13:00", | |
| 					// 				"end": "14:30", | |
| 					// 				"bed_count": 2 | |
| 					// 			} | |
| 					// 		], pm: [ | |
| 					// 			{ | |
| 					// 				"start": "12:00", | |
| 					// 				"end": "12:30", | |
| 					// 				"bed_count": 0 | |
| 					// 			}, | |
| 					// 			{ | |
| 					// 				"start": "13:00", | |
| 					// 				"end": "14:30", | |
| 					// 				"bed_count": 8 | |
| 					// 			} | |
| 					// 		] | |
| 					// 	}, | |
| 					// 	{ | |
| 					// 		date: "2024-04-20", type: 4, type_text: "下午出诊", weekday: "周四", am: [], pm: [ | |
| 					// 			{ | |
| 					// 				"start": "12:00", | |
| 					// 				"end": "12:30", | |
| 					// 				"bed_count": 0 | |
| 					// 			}, | |
| 					// 			{ | |
| 					// 				"start": "13:00", | |
| 					// 				"end": "14:30", | |
| 					// 				"bed_count": 1 | |
| 					// 			} | |
| 					// 		] | |
| 					// 	}, | |
| 					// 	{ | |
| 					// 		date: "2024-04-21", type: 1, type_text: "全天休息", weekday: "周五", am: [], pm: [] | |
| 					// 	}, | |
| 					// ] | |
|  | |
| 					// if(!refresh){ | |
| 					// 	// data.days[3].pm[1].bed_count=0 | |
| 					// 	// data.days[3].type=1 | |
| 					// 	data.days = [ | |
| 					// 		{ | |
| 					// 			date: "2024-04-17", type: 2, type_text: "上午出诊", weekday: "周一",  | |
| 					// 			am: [ | |
| 					// 				{ | |
| 					// 					"start": "12:00", | |
| 					// 					"end": "12:30", | |
| 					// 					"bed_count": 0 | |
| 					// 				}, | |
| 					// 				{ | |
| 					// 					"start": "13:00", | |
| 					// 					"end": "14:30", | |
| 					// 					"bed_count": 2 | |
| 					// 				} | |
| 					// 			], | |
| 					// 			pm: [] | |
| 					// 		}, | |
| 					// 		{ | |
| 					// 			date: "2024-04-18", type: 5, type_text: "未开放预约", weekday: "周二", am: [], pm: [] | |
| 					// 		} | |
| 					// 	] | |
| 					// } | |
|  | |
| 					this.RegistrationTimeList = data.days | |
| 					if(this.RegistrationTimeList.length>0) { | |
| 						if(refresh || chooseDay>=this.RegistrationTimeList.length) { | |
| 							this.$refs.book.dataInit(this.RegistrationTimeList[0]) | |
| 						}else{ | |
| 							this.$refs.book.chooseDay(chooseDay, this.RegistrationTimeList[chooseDay]) | |
| 						} | |
| 					} | |
| 				}); | |
| 			}, | |
| 			closeConfirm() { | |
| 				this.$refs.sliderbox.closeConfirm() | |
| 			}, | |
| 			appoint() { | |
| 				var param = new Object() | |
| 				param.visit_hospital_id = this.hospitalId | |
| 				param.start_time = this.times.start_time | |
| 				param.end_time = this.times.end_time | |
| 				param.date = this.times.date | |
| 
 | |
| 				var uids = new Array() | |
| 				for (var i = 0; i < this.activeVisitors.length; i++) { | |
| 					var visitor = this.activeVisitors[i] | |
| 					if(!this.needSelectMembers){ | |
| 						uids.push(visitor.id) | |
| 						continue | |
| 					} | |
| 					if(!visitor.choose) continue | |
| 					uids.push(visitor.id) | |
| 				} | |
| 				 | |
| 				if(uids.length <= 0){ | |
| 					this.$pop.modelShow('请选择预约就诊人') | |
| 					return | |
| 				} | |
| 				this.chooseVisitorCount = uids.length | |
| 				param.user_ids = JSON.stringify(uids) | |
| 				param.handler_type = 1 | |
| 
 | |
| 				this.$http.req('client/user/appoint/', param).then(data=>{ | |
| 					if(data == -1) return | |
| 					this.tips() | |
| 				}); | |
| 			}, | |
| 			appointCheck(times, chooseDay=''){ | |
| 				var param = new Object() | |
| 				param.start_time = times.start | |
| 				param.end_time = times.end | |
| 				param.date = times.date | |
| 				param.visit_hospital_id = this.hospitalId | |
| 				param.visit_user_count = 1 | |
| 				this.times = param | |
| 				this.$http.req('client/user/appoint/check', param).then(data=>{ | |
| 					if(data == -1) { | |
| 						this.getAvailabletRegistrationTime(false, chooseDay) | |
| 						return | |
| 					} | |
| 					if(data.left_count < this.activeVisitors.length){ | |
| 						this.needSelectMembers = true | |
| 						this.$refs.sliderbox.showConfirm() | |
| 						this.times.left_count = data.left_count | |
| 					}else{ | |
| 						this.$refs.sliderbox.showConfirm() | |
| 					} | |
| 				}); | |
| 			}, | |
| 			showConfirm(times) { | |
| 				this.appointCheck(times, times.key) | |
| 			}, | |
| 			submitConfim(){ | |
| 				this.appoint() | |
| 			} | |
| 		} | |
| 	} | |
| </script> | |
| 
 | |
| <style lang="scss" scoped> | |
| 	.page-prebook{ | |
| 		width: 100%; | |
| 		height: 100vh; | |
| 		overflow-y: auto; | |
| 		background: #F8F8F8; | |
| 		.title{ | |
| 			margin-top: 24rpx; | |
| 			align-items: center; | |
| 			width: 100%; | |
| 			box-sizing: border-box; | |
| 			padding: 0 41rpx; | |
| 			line-height: 36rpx; | |
| 			font-size: 30rpx; | |
| 			color: #949699; | |
| 			img{ | |
| 				width: 26rpx; | |
| 				height: 26rpx; | |
| 				margin-right: 15rpx; | |
| 			} | |
| 		} | |
| 		.slider-title{ | |
| 			width: 100%; | |
| 			text-align: center; | |
| 			color: #000000; | |
| 			margin-top: 52rpx; | |
| 			line-height: 50rpx; | |
| 			height: 50rpx; | |
| 			font-size: 32rpx; | |
| 			letter-spacing: 2rpx; | |
| 		} | |
| 		.member-style{ | |
| 			margin-top: 82rpx; | |
| 			text{ | |
| 				margin-right: 10rpx; | |
| 				text{ | |
| 					margin-right: 5rpx; | |
| 				} | |
| 			} | |
| 		} | |
| 		.item{ | |
| 			display: flex; | |
| 			box-sizing: border-box; | |
| 			padding: 0 53rpx; | |
| 			min-height: 42rpx; | |
| 			line-height: 42rpx; | |
| 			font-size: 30rpx; | |
| 			margin-bottom: 24rpx; | |
| 			.left{ | |
| 				width: 159rpx; | |
| 				flex-shrink: 0; | |
| 				color: #999999; | |
| 			} | |
| 			.right{ | |
| 				flex-grow: 1; | |
| 				color: #242833; | |
| 				&.orange{ | |
| 					color: #FD7100; | |
| 				} | |
| 			} | |
| 		} | |
| 		.item:last-of-type{ | |
| 			margin-bottom: 62rpx; | |
| 		} | |
| 		.btns-box{ | |
| 			justify-content: space-between; | |
| 			width: 750rpx; | |
| 			height: 124rpx; | |
| 			padding: 0 50rpx; | |
| 			box-sizing: border-box; | |
| 			align-items: center; | |
| 			background: #FFFFFF; | |
| 			margin-bottom: 17rpx; | |
| 			box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(181,181,181,0.13); | |
| 			margin-top: 62rpx; | |
| 		} | |
| 		.members-box{ | |
| 			margin-top: 52rpx; | |
| 			padding-left: 60rpx; | |
| 			width: 100%; | |
| 			box-sizing: border-box; | |
| 			.desc{ | |
| 				height: 50rpx; | |
| 				font-size: 30rpx; | |
| 				color: #999999; | |
| 				line-height: 50rpx; | |
| 				letter-spacing: 1rpx; | |
| 				margin-bottom: 20rpx; | |
| 			} | |
| 			.members{ | |
| 				width: 630rpx; | |
| 				min-height: 200rpx; | |
| 				max-height: 230rpx; | |
| 				overflow-y: auto; | |
| 				background: #F7F7F7; | |
| 				display: flex; | |
| 				justify-content: space-between; | |
| 				flex-wrap: wrap; | |
| 				padding: 32rpx 40rpx; | |
| 				box-sizing: border-box; | |
| 				font-size: 28rpx; | |
| 				color: #000000; | |
| 				line-height: 40rpx; | |
| 				margin-bottom: 52rpx; | |
| 				row-gap: 50rpx; | |
| 				.memmbers-item{ | |
| 					width: 50%; | |
| 					overflow-y: auto; | |
| 					display: flex; | |
| 					flex-shrink: 0; | |
| 					align-items: center; | |
| 					word-break: break-all; | |
| 					img{ | |
| 						width: 36rpx; | |
| 						height: 36rpx; | |
| 						margin-right: 26rpx; | |
| 					} | |
| 					img:first-of-type{ | |
| 						display: block; | |
| 					} | |
| 					img:last-of-type{ | |
| 						display: none; | |
| 					} | |
| 					&.active{ | |
| 						img:first-of-type{ | |
| 							display: none; | |
| 						} | |
| 						img:last-of-type{ | |
| 							display: block; | |
| 						} | |
| 					} | |
| 				} | |
| 			} | |
| 		} | |
| 	} | |
| </style>
 | |
| 
 |