<script setup>
	import DraggableButton from "@/pages/components/goHome.vue";
	/**
	 * name：
	 * user：yytjsj
	 * date：2024年9月25日 10:25:00
	 */
	import {
		ref,
		onBeforeUnmount
	} from "vue";
	import {
		$api,
		$response,
		$image
	} from "@/api";
	import {
		onShow
	} from "@dcloudio/uni-app";
	import {
		useStore
	} from "@/store"; 
	const $store = useStore();

	let date_list = ref(false);
	let time_list = ref(false);
	let currentDate = ref(0);
	let currentTime = ref(0);
	let buyInfo = ref({}); // 购买信息
	let yytjInfo = ref({}); // 购买信息
	let groupInfo = ref({});
	let comboInfo = ref({});
	let itemsInfo = ref({});
	let truePrice = ref(0); // 总价
	let nmrIndex = ref(0); // 当前选中项目索引
	let time = ref(""); // 时分
	let timeIndex = ref(null); // 当前选中时间索引
	let status = ref(0); // 1：点了确定 2：未点确定
	let calendarShow = ref(false); // 日历显示
	const rl_list = ref(false); //日历插槽
	let isClickDoctor = ref(0); // 是否点击了医生
	let erxianInfo=ref(null);

	const mountedAction = async () => {
		uni.showLoading({
			title: "加载中",
		});
		console.log($store.getYytjInfo(), "swsw");
		console.log($store.getBuyInfo(), "tyuiopiuytr");
		yytjInfo.value = $store.getYytjInfo();
		buyInfo.value = $store.getBuyInfo();
		await getnmrList();
	};

	onBeforeUnmount(() => {
		if (!status.value) {
			$store.setYytjInfo(uni.getStorageSync("yytjInfoS"));
		}
	});

	const getnmrList = async () => {
		// 获取项目列表
		const response = await $api("BuyInfo", buyInfo.value);
		$response(response, () => {
			if (buyInfo.value.group_id && response.data.group_info.length) {
				// 团检
				groupInfo.value = response.data.group_info[0];
			}
			comboInfo.value = response.data.combo_info;
			itemsInfo.value = response.data.items_info;
			truePrice.value = response.data.true_price;
			erxianInfo.value = response.data.nmr_list2;
			currentDate.value = getToday(); //huo获取今天的日期
			console.log(yytjInfo.value, "cfvghbjnkmljhbgvfcgvhbjnk");
			if (!yytjInfo.value?.nmr_list?.length) {
				yytjInfo.value.nmrIndex = 0;
				yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => {
					return {
						...val,
						time: "",
						id: "",
					};
				});
				yytjInfo.value.nmr_list.push({
					item_id: -1,
					name: "体检时间",
					time: "",
					id: "",
				});
			}
			nmrIndex.value = yytjInfo.value.nmrIndex;
			if (nmrIndex.value == -1) {
				// 选择医生
				if (yytjInfo.value.doctor_date) {
					currentDate.value = yytjInfo.value.doctor_date;
				}
				clickDoctor(1);
			} else {
				// 选择体检时间和核磁时间
				xmmcClick(yytjInfo.value.nmr_list[nmrIndex.value], nmrIndex.value);
			}
			uni.hideLoading();
		});
	};

	const moreTime = async (m, status) => {
		uni.showLoading({
			title: "加载中"
		});
		isClickDoctor.value = status;
		if (status) {
			if (yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time) {
				currentDate.value =
					yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time.split(
						" "
					)[0];
			} else {
				currentDate.value = getToday();
			}
		}
		// 日历
		const [year, month, day] = currentDate.value.split("-");
		let dqmonth = m || `${year}-${month}`; //年 月份
		let obj = {};
		let methods = "";
		obj = {
			hospital: buyInfo.value.hospital,
			person_id: buyInfo.value.person_id,
			month: dqmonth, //月份
			use_type: buyInfo.value.group_id ? 2 : 1,
			checkup_type_id: buyInfo.value.group_id ?
				$store.getGroupInfo()?.checkup_type_id : $store.getCheckupTypeId()?.id,
			amount: truePrice.value,
		};
		if (yytjInfo.value.nmr_list?.length > 1) {
			if (nmrIndex.value) {
				// 体检
				methods = "GetMonthPlanCount";
			} else {
				// 核磁
				methods = "NMRGetMonthPlanCount";
				obj = {
					hospital: buyInfo.value.hospital,
					month: dqmonth, //月份
				};
			}
		} else {
			methods = "GetMonthPlanCount";
		}
		const response = await $api(methods, obj);
		$response(response, () => {
			console.log(response.data.list, "response.data.list");
			let rlArr = [];
			response.data.list.forEach((item) => {
				let o = {
					date: item.date,
					info: "余号" + item.count,
				};
				rlArr.push(o);
			});
			console.log(rlArr);
			rl_list.value = rlArr;
			calendarShow.value = true;
			if(!!yytjInfo.value.doctor_date){
				currentDate.value=yytjInfo.value.doctor_date
			}
			uni.hideLoading();
		});
	};

	const monthSwitch = (givenDate) => {
		const currentYear = new Date().getFullYear();
		const currentMonth = new Date().getMonth() + 1;
		// 获取当前日期
		if (
			givenDate.year < currentYear ||
			(givenDate.year === currentYear && givenDate.month < currentMonth)
		) {
			// uni.$lu.toast("不能选择过去时间");
			return false;
		} else {
			let str = `${givenDate.year}-${givenDate.month}`;
			moreTime(str, 0);
		}
	};
	const getToday = () => {
		// 获取当前日期
		var today = new Date();

		// 获取年、月、日
		var year = today.getFullYear(); // 年
		var month = (today.getMonth() + 1).toString().padStart(2, "0"); // 月，月份是从0开始的，所以要+1，并使用padStart补零
		var day = today.getDate().toString().padStart(2, "0"); // 日，使用padStart补零

		// 拼接日期字符串
		return year + "-" + month + "-" + day;
	};
	const getTjTimeList = async (val) => {
		console.log($store.getCheckupTypeId());
		console.log(val);
		// 获取 体检号源
		let obj = {};
		let apiText = "";
		if (val.item_id == -1) {
			obj = {
				hospital: buyInfo.value.hospital,
				person_id: buyInfo.value.person_id,
				combo_id: buyInfo.value.combo_id,
				date: currentDate.value, //currentDate.value
				use_type: buyInfo.value.group_id ? 2 : 1,
				checkup_type_id: buyInfo.value.group_id ?
					$store.getGroupInfo()?.checkup_type_id : $store.getCheckupTypeId()?.id,
				amount: truePrice.value,
			};
			apiText = "GetDayPlanList";
		} else {
			obj = {
				hospital_id: buyInfo.value.hospital,
				date: currentDate.value,
			};
			apiText = "NMRGetDayPlanList";
		}
		uni.showLoading({
			title: "加载中",
		});
		const response = await $api(apiText, obj);
		$response(response, () => {
			console.log(response, "response");
			// currentXmmcObj.value["sj"] = ""; //每次请求新的时间时间置空
			currentTime.value = "";
			date_list.value = response.data.weeklist;
			time_list.value = response.data.list;

			time_list.value.forEach((item) => {
				console.log(item.date);
				item.newTime = item?.time.slice(0, 5);
				item.date = currentDate.value;
			});
			date_list.value.forEach((item) => {
				console.log(item);
				item.item_id = val.item_id;
				const [year, month, day] = item.date.split("-");
				item.newMonthDate = `${month}/${day}`; //月份日期
				item.newWeek = item.xingqi.replace("星期", "周");
			});
			if (val.time) {
				timeIndex.value = time_list.value.findIndex(
					(item) => item.newTime == val.time.split(" ")[1]
				);
			}
			uni.hideLoading();
		});
	};

	const changerl = (e) => {
		// 选中某天日期
		console.log(e, "changerl");
		let num = e.extraInfo.info ? e.extraInfo.info.substring(2) : 0;
		if (num == 0) {
			uni.$lu.toast("当前余号剩余0");
		} else if (num > 0) {
			if (isClickDoctor.value == 1) {
				// 点击医生进入的
				status.value = 0;
				// yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time =
				//   e.fulldate;
				yytjInfo.value.doctor_date = e.fulldate;
				$store.setYytjInfo(yytjInfo.value);
				uni.navigateTo({
					url: `/pages/main/selectDoctor/selectDoctor?date=${e.fulldate}`,
				});
				return;
			}
			if (date_list.value[3]?.date == e.fulldate) {
				calendarShow.value = false;
				return;
			}
			if (
				nmrIndex.value == yytjInfo.value.nmr_list.length - 1 &&
				yytjInfo.value.doctor_date
			) {
				console.log("切换体检时间");
				if(!!yytjInfo.value.doctor_name) {
					uni.showModal({
						title: "提示",
						content: "已选择医生，切换日期将重新选择医生，是否继续",
						showCancel: true,
						success: ({
							confirm
						}) => {
							if (confirm) {
								currentDate.value = e.fulldate;
								time.value = "";
								timeIndex.value = null;
								yytjInfo.value.nmr_list[nmrIndex.value].time = "";
								yytjInfo.value.nmr_list[nmrIndex.value].id = "";
								yytjInfo.value.doctor_name = ""; // 每次切换都清空医生
								getTjTimeList(yytjInfo.value.nmr_list[nmrIndex.value]);
								calendarShow.value = false;
							}
						},
					});
					return;
				}
			}
			// uni.showLoading({
			//   title: "加载中",
			// });
			currentDate.value = e.fulldate;
			time.value = "";
			timeIndex.value = null;
			if (!yytjInfo.value.doctor_name) {
				yytjInfo.value.nmr_list[nmrIndex.value].time = "";
				yytjInfo.value.nmr_list[nmrIndex.value].id = "";
				yytjInfo.value.doctor_name = ""; // 每次切换都清空医生
			}
			getTjTimeList(yytjInfo.value.nmr_list[nmrIndex.value]);
			calendarShow.value = false;
		}
	};

	const getCurrentClick = (item, i) => {
		// 选择日期
		console.log(item, i); //当前日期和星期
		if (new Date(item.date).getTime() < new Date(getToday()).getTime()) {
			uni.$lu.toast("不能选择过去时间");
			return;
		}
		if (item.count < 0) {
			uni.$lu.toast("该日期已满，请选择其他日期");
			return;
		}
		if (i != 3) {
			if (
				nmrIndex.value == yytjInfo.value.nmr_list.length - 1 &&
				yytjInfo.value.doctor_date
			) {
				console.log("切换体检时间");
				if(!!yytjInfo.value.doctor_name){
					uni.showModal({
						title: "提示",
						content: "已选择医生，切换日期将重新选择医生，是否继续",
						showCancel: true,
						success: ({
							confirm
						}) => {
							console.log(confirm);
							if (confirm) {
								if (yytjInfo.value.nmr_list.length > 1 && nmrIndex.value == 0) {
									yytjInfo.value.nmr_list = yytjInfo.value.nmr_list.map((val) => {
										return {
											...val,
											time: "",
											id: "",
										};
									});
								}
								time.value = "";
								timeIndex.value = null;
								yytjInfo.value.nmr_list[nmrIndex.value].time = "";
								yytjInfo.value.nmr_list[nmrIndex.value].id = "";
								yytjInfo.value.doctor_name = ""; // 每次切换都清空医生
								yytjInfo.value.doctor_date = ""; // 每次切换都清空医生
								$store.setYytjInfo(yytjInfo.value);
								status.value = 0;
								currentDate.value = item.date;
								getTjTimeList(item); //带着选中的日期重新选择
							}
						},
					});
					return;
				}
			}
			if (yytjInfo.value.nmr_list.length > 1 && nmrIndex.value == 0) {
				if (!yytjInfo.value.doctor_name) {
					// yytjInfo.value.nmr_list = yytjInfo.value.nmr_list.map((val) => {
					// 	return {
					// 		...val,
					// 		time: "",
					// 		id: "",
					// 	};
					// });
					yytjInfo.value.nmr_list[nmrIndex.value].time = "";
					yytjInfo.value.nmr_list[nmrIndex.value].id = "";
				}
			}
			time.value = "";
			timeIndex.value = null;
			if (!yytjInfo.value.doctor_name) {
				yytjInfo.value.nmr_list[nmrIndex.value].time = "";
				yytjInfo.value.nmr_list[nmrIndex.value].id = "";
				yytjInfo.value.doctor_name = ""; // 每次切换都清空医生
				yytjInfo.value.doctor_date = ""; // 每次切换都清空医生
			}
			$store.setYytjInfo(yytjInfo.value);
			status.value = 0;
			currentDate.value = item.date;
			getTjTimeList(item); //带着选中的日期重新选择
		}
	};
	//查询是否有可用二线号源
	const CheckEnableNmrTimeFunc= async (date,time)=>{
		uni.showLoading({
		  title: "加载中",
		});
		const response = await $api("CheckEnableNmrTime", {date:date,time:time});
		 uni.hideLoading();
		let status=false;
		$response(response, () => {
			status=response.status
		})
		return status;
	}
	const getCurrentTime = async (item, index) => {
		// 选择时分
		if (item.status == 2) {
			uni.$lu.toast("该号源已被其他人预约");
			return;
		}
		//如果有核磁，查询核磁是否有可用号源
		if(erxianInfo.value.length>0){ 
			let checknmr= await CheckEnableNmrTimeFunc(item.date,item.newTime);
			console.log('------',checknmr);
			if(checknmr !==true){
				uni.$lu.toast("此时间点，无可用二线号源，请选择其他时间");
				return;
			}
		}
		
		let pick_day = 3
		let active_item = yytjInfo.value.nmr_list[nmrIndex.value]
		if (active_item.item_id !== -1) {
			// 这个是 核磁项目 判断时间
			if (!!yytjInfo.value.doctor_name) {
				let doctor_time = new Date(yytjInfo.value.doctor_date) / 1
				let choose_time = new Date(item.date) / 1
				let day_check = ''
				if (doctor_time > choose_time) {
					day_check = `请选择${yytjInfo.value.doctor_date}之后${pick_day}天以内的日期`
				} else {
					if (doctor_time !== choose_time) {
						choose_time = choose_time - (60 * 60 * 24 * 1000 * pick_day)
						if (doctor_time < choose_time) {
							day_check = `请选择${yytjInfo.value.doctor_date}之后${pick_day}天以内的日期.`
						}
					}
				}
				if (!!day_check) {
					uni.$lu.toast(day_check);
					return;
				}
			}
		} else {
			// 体检  检查一下 核磁时间 是不是 符合逻辑
			//选出最小的日期
			let minDateItem = yytjInfo.value.nmr_list[0];
			for (let i = 1; i < yytjInfo.value.nmr_list.length; i++) {
			    if (new Date(yytjInfo.value.nmr_list[i].time.split(' ')[0]) < new Date(minDateItem.time.split(' ')[0])) {
			        minDateItem = yytjInfo.value.nmr_list[i];
			    }
			}
			//let heci_item = yytjInfo.value.nmr_list[0]
			let heci_item = minDateItem
			if (heci_item.item_id !== -1) {
				// 是核磁
				if (!!heci_item.time) {
					// 并且选了时间
					
					let heci_time = new Date(heci_item.time.split(' ')[0]) / 1
					let choose_time = new Date(item.date) / 1
					let day_check = ''
					if (choose_time > heci_time) {
						day_check = `请选择${heci_item.time.split(' ')[0]}之前${pick_day}天以内的日期`
					} else {
						if (heci_time !== choose_time) {
							choose_time = choose_time + (60 * 60 * 24 * 1000 * pick_day)
							if (choose_time < heci_time) {
								day_check = `请选择${heci_item.time.split(' ')[0]}之前${pick_day}天以内的日期.`
							}
						}
					}
					if (!!day_check) {
						uni.$lu.toast(day_check);
						return;
					}
				}
			}
		}
		console.log(item);
		timeIndex.value = index;
		yytjInfo.value.nmr_list[nmrIndex.value].time = item.date + " " + item.newTime;
		yytjInfo.value.nmr_list[nmrIndex.value].id = item.id;
		status.value = 0;
		$store.setYytjInfo(yytjInfo.value);
	};
	const xmmcClick = (val, index, status) => {
		if (nmrIndex.value == index && status) {
			return;
		}
		// 选择项目
		if (
			yytjInfo.value.nmr_list.length > 1 &&
			index != 0 &&
			yytjInfo.value.nmr_list[0]?.time == ""
		) {
			if (!yytjInfo.value.doctor_name) {
				uni.$lu.toast("请先选择" + yytjInfo.value.nmr_list[0]?.name + "时间");
				return;
			}
		}
		nmrIndex.value = index;
		time.value = "";
		timeIndex.value = null;
		isClickDoctor.value = 0;
		calendarShow.value = false;
		if (val.time) {
			currentDate.value = val.time.split(" ")[0];
		} else {
			if (
				((yytjInfo.value.nmr_list.length > 1 &&
						index == yytjInfo.value.nmr_list.length - 1) ||
					(yytjInfo.value.nmr_list.length == 1 && index == 0)) &&
				yytjInfo.value.doctor_date
			) {
				currentDate.value = yytjInfo.value.doctor_date;
			} else {
				currentDate.value = getToday();
			}
		}
		// 体检号源
		getTjTimeList(val);
	};

	const clickDoctor = (s) => {
		//选择医生
		console.log(yytjInfo.value.nmr_list[0]?.time);
		console.log(yytjInfo.value.nmr_list[0]?.name);
		if (
			yytjInfo.value.nmr_list.length > 1 &&
			yytjInfo.value.nmr_list[0]?.time == ""
		) {
			if (!yytjInfo.value.doctor_name) {
				uni.$lu.toast("请先选择" + yytjInfo.value.nmr_list[0]?.name + "时间");
				return;
			}
		}
		// if (yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1]?.time == "") {
		// nmrIndex.value = yytjInfo.value.nmr_list?.length - 1;
		nmrIndex.value = -1;
		//判断是否选择了体检时间
		
		    let is_tj_date=false;
			yytjInfo.value.nmr_list.forEach((vv,ii)=>{
				if(vv.item_id=='-1' && vv.time){
					yytjInfo.value.doctor_date=vv.time.substr(0,10)
					is_tj_date=true;
				}
			})
			console.log("999999999999",is_tj_date);
	    if(!is_tj_date){
			moreTime(null, 1);
			return false;
		}	
		// return;
		// }
		console.log('00000000000',yytjInfo.value);
		if (s) {
			return;
		}
		status.value = 0;
		let date =
			yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1]?.time?.split(
				" "
			)[0];
		yytjInfo.value.doctor_date = date;
		$store.setYytjInfo(yytjInfo.value);
		uni.navigateTo({
			url: `/pages/main/selectDoctor/selectDoctor?date=${date}`,
		});
	};

	const comfrimyy = () => {
		console.log(yytjInfo.value);
		status.value = 1;
		uni.navigateBack({
			delta: 1,
		});
	};

	const config_ref = ref(null);
	const configRef = (e) => {
		if (!config_ref.value) {
			config_ref.value = e;
			mountedAction();
		}
	};

	onShow(() => {
		if (!!config_ref.value) {
			mountedAction();
		}
	});
</script>
<template>
	<DraggableButton />
	<view>
		<view v-if="!!$store.config">
			<view :ref="configRef"></view>
		</view>
		<view class="h-38rpx bg-#239EA3 pl-20rpx pr-20rpx box-border">
			<view style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
				class="p-16rpx pb-20rpx pt-30rpx rounded-15rpx bg-#fff">
				<view class="flex w-full b-0 b-solid b-b-1 b-#E1ECEE pb-25rpx mb-7rpx"
					v-if="!buyInfo.group_id && comboInfo?.items?.length">
					<!-- 1 个检套餐 显示套餐信息 -->
					<image v-if="comboInfo.img" :src="$image(comboInfo.img)" class="w-190rpx h-190rpx mr-37rpx" mode="widthFix" />
					<view class="flex flex-col grow">
						<text>{{ comboInfo.combo_name }}</text>
						<view class="mt-13rpx mb-18rpx">
							<uni-tag v-for="(val, i) in comboInfo.tags" :key="i" size="small" :inverted="true" :text="val.text"
								class="mr-8rpx" :custom-style="
                  'background-color:' +
                  val.color +
                  ';border-color:' +
                  val.color +
                  '; color:' +
                  val.text_color +
                  ';'
                " />
						</view>
						<view v-if="comboInfo.tags2?.length">
							<text v-for="(val, i) in comboInfo.tags2" :key="i"
								class="text-#8B8B8B text-20rpx line-height-[1] px-5rpx b-0 b-solid b-#8B8B8B"
								:class="i == comboInfo.tags2?.length - 1 ? 'b-r-0' : 'b-r-2'">{{ val }}</text>
						</view>
						<view class="mt-20rpx w-full flex items-end">
							<text class="text-18rpx text-#EC3D15">¥</text>
							<text class="text-38rpx text-#EC3D15 mx-10rpx -mb-8rpx">{{
                comboInfo.price
              }}</text>
							<text class="text-18rpx text-#878787 line-through">{{
                comboInfo.original_price
              }}</text>
							<text class="text-18rpx text-#878787 ml-auto mr-55rpx">已售{{ comboInfo.sale_count }}</text>
						</view>
					</view>
				</view>
				<view v-if="buyInfo.group_id" class="b-0 b-solid b-#E1ECEE pb-25rpx mb-7rpx" :class="{
            'b-b-1': itemsInfo?.items?.length,
          }">
					<!-- 3团检套餐 4团检自选 都要显示头像和名字 -->
					<view class="flex items-center">
						<image src="@/static/assets/userm.png" class="w-70rpx h-70rpx mr-35rpx" />
						<view class="flex items-center grow">
							<text class="text-#707070 text-24rpx">您好，</text>
							<text class="text-#0E0E0E text-32rpx">{{ groupInfo?.name }}</text>
						</view>
					</view>
					<view class="text-24rpx mt-40rpx">
						<!-- 3团检套餐 4团检自选 都要显示单位部门等信息 -->
						<view class="pb-30rpx">
							<text class="text-#8B8B8B">单位名称：</text>
							<text>{{ groupInfo.group_name }}</text>
						</view>
						<view class="pb-30rpx">
							<text class="text-#8B8B8B">部门名称：</text>
							<text>{{ groupInfo.bumen_name }}</text>
						</view>
						<view class="pb-30rpx" v-if="groupInfo.combo_name || comboInfo?.combo_name">
							<text class="text-#8B8B8B">套餐名称：</text>
							<text>{{ groupInfo?.combo_name || comboInfo?.combo_name }}</text>
						</view>
						<view>
							<text class="text-#8B8B8B">体检额度：</text>
							<text>{{ groupInfo.tongshou_xiane }}</text>
						</view>
					</view>
				</view>
				<view class="pt-15rpx" v-if="itemsInfo?.items?.length">
					<view class="text-30rpx text-#0E0E0E pb-30rpx"> 自选项目 </view>
					<view class="text-#8B8B8B text-24rpx">
						<view class="flex mb-20rpx" v-for="(val, index) in itemsInfo?.items.length > 3
                ? 3
                : itemsInfo?.items" :key="index">
							<text class="whitespace-nowrap">{{ itemsInfo?.items[index]?.keshi_name }} -
							</text>
							<view class="line-clamp-2">
								<text class="ml-10rpx text-#0E0E0E" v-for="(v, i) in itemsInfo?.items[index]?.children"
									:key="i">{{ v.name }}</text>
							</view>
						</view>
					</view>
				</view>
				<!-- <view class="center mt-20rpx text-#8B8B8B text-24rpx">
          <text>体检医生 - </text>
          <text
            class="ml-10rpx text-#0E0E0E center mr-auto"
            @click="clickDoctor"
          >
            {{ yytjInfo?.doctor_name || "请选择" }}
            <uni-icons type="right" size="14"></uni-icons>
          </text>
        </view> -->
			</view>
			<view style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
				class="p-16rpx pb-20rpx pt-30rpx rounded-15rpx bg-#fff mt-15rpx ylrl" v-if="calendarShow">
				<uni-calendar :selected="rl_list" :startDate="getToday()" :showMonth="false" :insert="true" :date="currentDate"
					@change="changerl" @monthSwitch="monthSwitch" />
			</view>
			<view style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
				class="p-16rpx pb-20rpx pt-30rpx rounded-15rpx bg-#fff mt-15rpx" v-if="date_list && !calendarShow">
				<view class="">
					<view class="text-30rpx text-#0E0E0E pb-34rpx font-500" v-if="yytjInfo.nmr_list[nmrIndex]?.name">
						{{ yytjInfo.nmr_list[nmrIndex]?.name }}
					</view>
					<view class="flex mb-30rpx items-center">
						<view class="flex-1 text-center text-18rpx" v-for="(item, index) in date_list" :key="index">
							<view @click="getCurrentClick(item, index)" :class="{
                  activeTime: 3 == index,
                  'bg-#efefef text-#aaa8a8':
                    item.count < 0 ||
                    new Date(item.date).getTime() <
                      new Date(getToday()).getTime(),
                }" class="rounded-12rpx pt-10rpx pb-10rpx ml-10rpx mr-10rpx mb-6rpx">
								<view> {{ item.newMonthDate }} </view>
								<view class="text-26rpx font-500"> {{ item.newWeek }} </view>
							</view>
							<view class="ma" v-if="item.count > -1">
								<text :class="{
                    'text-#239EA3 !bg-#E1F4F8': 3 == index,
                  }" class="bg-#EFEFEF rounded-10rpx h-28rpx pl-10rpx pr-10rpx">余{{ item.count }}</text>
							</view>
						</view>
						<view class="flex-1 col center text-#239EA3 text-20rpx bs b-#E7E7E7 b-l-1 h-80rpx"
							@click="moreTime(null, 0)">
							<uni-icons type="calendar" size="30" color="#239EA3"></uni-icons>
							<text>更多</text>
						</view>
					</view>
					<view class="flex flex-wrap pt-30rpx pb-30rpx b-0 b-t-1 b-solid b-#E1ECEE" v-if="time_list.length">
						<view class="w-16.6% text-center box-border p-20rpx text-lan" v-for="(item, index) in time_list" :key="index" :class="{
                'text-hui': item.status == 2,
              }" @click="getCurrentTime(item, index)">
							<view class="text-24rpx rounded-12rpx h-54rpx flex flex-items-center flex-justify-center"
								:class="timeIndex == index ? 'activeTime' : ''">
								{{ item.newTime }}
							</view>
						</view>
					</view>
				</view>
			</view>
			<view style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)"
				class="p-30rpx pl-10rpx pr-10rpx rounded-15rpx bg-#fff mt-15rpx text-#101010 text-28rpx">
				<view class="bg-#F7F7F7 pl-20rpx pr-20rpx pt-23rpx pb-25rpx">
					<text>{{
            buyInfo.group_id
              ? $store.getGroupInfo()?.name
              : $store.getUser()?.name
          }}</text>
					<view class="bg-#EFEFEF rounded-15rpx p-10rpx pb-15rpx pt-15rpx mt-20rpx">
						<view v-for="(item, index) in yytjInfo.nmr_list" :key="index" @click="xmmcClick(item, index, 1)"
							:class="nmrIndex == index ? 'acitvetc' : ''"
							class="flex flex-justify-around p-20rpx pl-10rpx pr-10rpx rounded-15rpx">
							<view class="flex-col flex flex-1 line-clamp-1">
								<text v-for="(v, i) in item.name?.split('/')" :key="i">{{
                  v
                }}</text>
							</view>
							<view class="center">
								{{ item.time }}
							</view>
						</view>
						<view class="p-20rpx pl-10rpx pr-10rpx rounded-15rpx between" :class="nmrIndex == -1 ? 'acitvetc' : ''"
							@click="clickDoctor()">
							<text>体检医生</text>
							<text class="ml-10rpx text-#0E0E0E center">
								{{ yytjInfo?.doctor_name || "请选择" }}
								<uni-icons type="right" size="14"></uni-icons>
							</text>
						</view>
					</view>
				</view>
			</view>
			<view class="pb-100rpx">
				<view @click="comfrimyy"
					class="text-#fff text-32rpx rounded-45rpx bg-#239EA3 mt-40rpx ma w-520rpx h-90rpx flex flex-items-center flex-justify-center">
					确定
				</view>
			</view>
		</view>
	</view>
</template>
<style scoped lang="scss">
	.text-lan{
		color:#42A89E;
		font-weight: 700;
	}
	.text-hui{
		color:#ccc;
		font-weight: 500;
	}
	.activeTime {
		background-color: #239ea3;
		color: #fff;
	}

	.acitvetc {
		background-color: #e0f1f2;
	}

	::v-deep .ylrl {

		.uni-calendar__header,
		.uni-calendar__weeks-day {
			border: none;
		}

		.uni-calendar-item--checked {
			background-color: transparent;

			.uni-calendar-item__weeks-box-item {
				background-color: #239ea3 !important;
				border-radius: 12rpx;

				.uni-calendar-item--extra {
					color: #fff !important;
				}
			}
		}

		.uni-calendar-item--isDay {
			background-color: #239ea3 !important;
			border-radius: 12rpx;
			color: #fff !important;
		}

		.uni-calendar-item--extra {
			color: #239ea3;
		}

		.uni-calendar-item__weeks-box {
			// padding: 10rpx;
			box-sizing: border-box;
		}

		.uni-calendar-item__weeks-box-circle {
			background-color: rgba(0, 0, 0, 0);
		}

		.uni-calendar-item--isDay-text {
			color: #333;
		}

		.uni-calendar-item__weeks-box-text {
			font-size: 26rpx;
		}

		.uni-calendar-item__weeks-lunar-text {
			font-size: 16rpx;
		}

		.uni-calendar-item__weeks-box-item {
			width: 100%;
		}

		.uni-calendar__backtoday {
			display: none;
		}

		.uni-calendar-item--disable {
			.uni-calendar-item__weeks-lunar-text {
				display: none;
			}
		}
	}
</style>