完善 有核磁先选核磁,医生和体检日期不分先后,这俩在一天

wenjuan
刘佳宇 1 year ago
parent f02bb1af53
commit c281c3b5f9

@ -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;
}
}

@ -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(() => {
<uni-icons type="right" size="14"></uni-icons>
</text>
</view>
<view class="ylrl">
<uni-calendar
ref="calendar"
:startDate="getToday()"
:showMonth="false"
:date="getToday()"
:insert="false"
@confirm="confirm"
/>
</view>
</view>
<view
id="ylrl"
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"
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"
@ -459,12 +570,13 @@ onShow(() => {
>
<view
@click="getCurrentClick(item, index)"
:style="
item.count < 0
? 'background-color:#EFEFEF;color:#aaa8a8'
: ''
"
:class="3 == index ? 'activeTime' : ''"
: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>
@ -482,7 +594,7 @@ onShow(() => {
</view>
<view
class="flex-1 col center text-#239EA3 text-20rpx bs b-#E7E7E7 b-l-1 h-80rpx"
@click="moreTime()"
@click="moreTime(null, 0)"
>
<uni-icons
type="calendar"
@ -567,7 +679,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;
}
}
}
</style>

Loading…
Cancel
Save