diff --git a/h5/pages/main/tjyy/tjyy.vue b/h5/pages/main/tjyy/tjyy.vue index 7dc99f0..ee5df0c 100755 --- a/h5/pages/main/tjyy/tjyy.vue +++ b/h5/pages/main/tjyy/tjyy.vue @@ -162,8 +162,8 @@ const comfrimyy = async () => { // } console.log(yytjInfo.value?.nmr_list); for (let i = 0; i < yytjInfo.value?.nmr_list?.length; i++) { - if (!yytjInfo.value?.nmr_list[i].time) { - uni.$lu.toast("请选择预约时间"); + if (!yytjInfo.value?.nmr_list[i].id) { + uni.$lu.toast("请完善预约时间"); return; } } diff --git a/h5/pages/main/yytjsj/yytjsj.vue b/h5/pages/main/yytjsj/yytjsj.vue index e9f1e7b..809b88e 100755 --- a/h5/pages/main/yytjsj/yytjsj.vue +++ b/h5/pages/main/yytjsj/yytjsj.vue @@ -27,6 +27,8 @@ let timeIndex = ref(null); // 当前选中时间索引 let status = ref(0); // 1:点了确定 2:未点确定 let calendarShow = ref(false); // 日历显示 const rl_list = ref(false); //日历插槽 +let calendar = ref(null); +let isClickDoctor = ref(0); // 是否点击了医生 const mountedAction = async () => { uni.showLoading({ @@ -79,11 +81,14 @@ const getnmrList = async () => { }); }; -const moreTime = async (m) => { +const moreTime = async (m, status) => { + isClickDoctor.value = status; // 日历 const [year, month, day] = currentDate.value.split("-"); let dqmonth = m || `${year}-${month}`; //年 月份 - let obj = { + let obj = {}; + let methods = ""; + obj = { hospital: buyInfo.value.hospital, person_id: buyInfo.value.person_id, month: dqmonth, //月份 @@ -93,7 +98,22 @@ const moreTime = async (m) => { : $store.getCheckupTypeId()?.id, amount: truePrice.value, }; - const response = await $api("GetMonthPlanCount", obj); + 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 = []; @@ -104,17 +124,25 @@ const moreTime = async (m) => { }; rlArr.push(o); }); + console.log(rlArr); rl_list.value = rlArr; calendarShow.value = true; }); }; -const monthSwitch = (e) => { - let [year, month] = getToday().split("-"); - if (e.year >= year && e.month >= month) { - console.log(e, "monthSwitch"); - let str = `${e.year}-${e.month}`; - moreTime(str); +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 = () => { @@ -190,36 +218,67 @@ const changerl = (e) => { 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}`, + }); + } + if (date_list.value[3]?.date == e.fulldate) { + calendarShow.value = false; + return; + } uni.showLoading({ title: "加载中", }); 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; } }; 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; } - time.value = ""; - timeIndex.value = null; - yytjInfo.value.nmr_list[nmrIndex.value].time = ""; - yytjInfo.value.nmr_list[nmrIndex.value].id = ""; - console.log( - yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time, - "xxsxsx" - ); - if (!yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time) { - yytjInfo.value.doctor_name = ""; + if (i != 3) { + 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); //带着选中的日期重新选择 } - $store.setYytjInfo(yytjInfo.value); - status.value = 0; - currentDate.value = item.date; - getTjTimeList(item); //带着选中的日期重新选择 }; const getCurrentTime = (item, index) => { // 选择时分 @@ -236,6 +295,14 @@ const getCurrentTime = (item, index) => { }; const xmmcClick = (val, index) => { // 选择项目 + if ( + yytjInfo.value.nmr_list.length > 1 && + index != 0 && + yytjInfo.value.nmr_list[0].time == "" + ) { + uni.$lu.toast("请先选择" + yytjInfo.value.nmr_list[0].name + "时间"); + return; + } nmrIndex.value = index; time.value = ""; timeIndex.value = null; @@ -249,18 +316,52 @@ const xmmcClick = (val, index) => { }; const clickDoctor = () => { - //选择医生列表 + //选择医生 + if ( + yytjInfo.value.nmr_list.length > 1 && + yytjInfo.value.nmr_list[0].time == "" + ) { + uni.$lu.toast("请先选择" + yytjInfo.value.nmr_list[0].name + "时间"); + return; + } if (yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time == "") { - uni.$lu.toast("请先选择体检时间"); + nmrIndex.value = yytjInfo.value.nmr_list?.length - 1; + moreTime(null, 1); 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=${currentDate.value}`, + url: `/pages/main/selectDoctor/selectDoctor?date=${date}`, + }); +}; + +const confirm = (e) => { + console.log(e); + if (new Date(e.fulldate).getTime() < new Date(getToday()).getTime()) { + uni.$lu.toast("不能选择过去时间"); + let time = setTimeout(() => { + calendar.value.open(); + clearTimeout(time); + }, 500); + return; + } + 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}`, }); }; const comfrimyy = () => { + console.log(yytjInfo.value); status.value = 1; uni.navigateBack({ delta: 1, @@ -422,15 +523,25 @@ onShow(() => { + + + { > {{ item.newMonthDate }} @@ -482,7 +594,7 @@ onShow(() => { { background-color: #e0f1f2; } -::v-deep #ylrl { +::v-deep .ylrl { .uni-calendar__header, .uni-calendar__weeks-day { border: none; @@ -615,5 +727,11 @@ onShow(() => { .uni-calendar__backtoday { display: none; } + + .uni-calendar-item--disable { + .uni-calendar-item__weeks-lunar-text { + display: none; + } + } }