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

wenjuan
刘佳宇 1 year ago
parent f02bb1af53
commit c281c3b5f9

@ -162,8 +162,8 @@ const comfrimyy = async () => {
// } // }
console.log(yytjInfo.value?.nmr_list); console.log(yytjInfo.value?.nmr_list);
for (let i = 0; i < yytjInfo.value?.nmr_list?.length; i++) { for (let i = 0; i < yytjInfo.value?.nmr_list?.length; i++) {
if (!yytjInfo.value?.nmr_list[i].time) { if (!yytjInfo.value?.nmr_list[i].id) {
uni.$lu.toast("请选择预约时间"); uni.$lu.toast("请完善预约时间");
return; return;
} }
} }

@ -27,6 +27,8 @@ let timeIndex = ref(null); // 当前选中时间索引
let status = ref(0); // 1 2 let status = ref(0); // 1 2
let calendarShow = ref(false); // let calendarShow = ref(false); //
const rl_list = ref(false); // const rl_list = ref(false); //
let calendar = ref(null);
let isClickDoctor = ref(0); //
const mountedAction = async () => { const mountedAction = async () => {
uni.showLoading({ 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("-"); const [year, month, day] = currentDate.value.split("-");
let dqmonth = m || `${year}-${month}`; // let dqmonth = m || `${year}-${month}`; //
let obj = { let obj = {};
let methods = "";
obj = {
hospital: buyInfo.value.hospital, hospital: buyInfo.value.hospital,
person_id: buyInfo.value.person_id, person_id: buyInfo.value.person_id,
month: dqmonth, // month: dqmonth, //
@ -93,7 +98,22 @@ const moreTime = async (m) => {
: $store.getCheckupTypeId()?.id, : $store.getCheckupTypeId()?.id,
amount: truePrice.value, 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, () => { $response(response, () => {
console.log(response.data.list, "response.data.list"); console.log(response.data.list, "response.data.list");
let rlArr = []; let rlArr = [];
@ -104,17 +124,25 @@ const moreTime = async (m) => {
}; };
rlArr.push(o); rlArr.push(o);
}); });
console.log(rlArr);
rl_list.value = rlArr; rl_list.value = rlArr;
calendarShow.value = true; calendarShow.value = true;
}); });
}; };
const monthSwitch = (e) => { const monthSwitch = (givenDate) => {
let [year, month] = getToday().split("-"); const currentYear = new Date().getFullYear();
if (e.year >= year && e.month >= month) { const currentMonth = new Date().getMonth() + 1;
console.log(e, "monthSwitch"); //
let str = `${e.year}-${e.month}`; if (
moreTime(str); 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 = () => { const getToday = () => {
@ -190,36 +218,67 @@ const changerl = (e) => {
if (num == 0) { if (num == 0) {
uni.$lu.toast("当前余号剩余0"); uni.$lu.toast("当前余号剩余0");
} else if (num > 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({ uni.showLoading({
title: "加载中", title: "加载中",
}); });
currentDate.value = e.fulldate; 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]); getTjTimeList(yytjInfo.value.nmr_list[nmrIndex.value]);
calendarShow.value = false; calendarShow.value = false;
} }
}; };
const getCurrentClick = (item, i) => { const getCurrentClick = (item, i) => {
//
console.log(item, i); // console.log(item, i); //
if (new Date(item.date).getTime() < new Date(getToday()).getTime()) {
uni.$lu.toast("不能选择过去时间");
return;
}
if (item.count < 0) { if (item.count < 0) {
uni.$lu.toast("该日期已满,请选择其他日期"); uni.$lu.toast("该日期已满,请选择其他日期");
return; return;
} }
time.value = ""; if (i != 3) {
timeIndex.value = null; if(yytjInfo.value.nmr_list.length > 1 && nmrIndex.value == 0){
yytjInfo.value.nmr_list[nmrIndex.value].time = ""; yytjInfo.value.nmr_list = yytjInfo.value.nmr_list.map((val) => {
yytjInfo.value.nmr_list[nmrIndex.value].id = ""; return {
console.log( ...val,
yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time, time: "",
"xxsxsx" id: ""
); }
if (!yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time) { })
yytjInfo.value.doctor_name = ""; }
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) => { const getCurrentTime = (item, index) => {
// //
@ -236,6 +295,14 @@ const getCurrentTime = (item, index) => {
}; };
const xmmcClick = (val, 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; nmrIndex.value = index;
time.value = ""; time.value = "";
timeIndex.value = null; timeIndex.value = null;
@ -249,18 +316,52 @@ const xmmcClick = (val, index) => {
}; };
const clickDoctor = () => { 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 == "") { 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; return;
} }
status.value = 0; 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({ 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 = () => { const comfrimyy = () => {
console.log(yytjInfo.value);
status.value = 1; status.value = 1;
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
@ -422,15 +523,25 @@ onShow(() => {
<uni-icons type="right" size="14"></uni-icons> <uni-icons type="right" size="14"></uni-icons>
</text> </text>
</view> </view>
<view class="ylrl">
<uni-calendar
ref="calendar"
:startDate="getToday()"
:showMonth="false"
:date="getToday()"
:insert="false"
@confirm="confirm"
/>
</view>
</view> </view>
<view <view
id="ylrl"
style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04)" 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" v-if="calendarShow"
> >
<uni-calendar <uni-calendar
:selected="rl_list" :selected="rl_list"
:startDate="getToday()"
:showMonth="false" :showMonth="false"
:insert="true" :insert="true"
:date="currentDate" :date="currentDate"
@ -459,12 +570,13 @@ onShow(() => {
> >
<view <view
@click="getCurrentClick(item, index)" @click="getCurrentClick(item, index)"
:style=" :class="{
item.count < 0 activeTime: 3 == index,
? 'background-color:#EFEFEF;color:#aaa8a8' 'bg-#efefef text-#aaa8a8':
: '' item.count < 0 ||
" new Date(item.date).getTime() <
:class="3 == index ? 'activeTime' : ''" new Date(getToday()).getTime(),
}"
class="rounded-12rpx pt-10rpx pb-10rpx ml-10rpx mr-10rpx mb-6rpx" class="rounded-12rpx pt-10rpx pb-10rpx ml-10rpx mr-10rpx mb-6rpx"
> >
<view> {{ item.newMonthDate }} </view> <view> {{ item.newMonthDate }} </view>
@ -482,7 +594,7 @@ onShow(() => {
</view> </view>
<view <view
class="flex-1 col center text-#239EA3 text-20rpx bs b-#E7E7E7 b-l-1 h-80rpx" 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 <uni-icons
type="calendar" type="calendar"
@ -567,7 +679,7 @@ onShow(() => {
background-color: #e0f1f2; background-color: #e0f1f2;
} }
::v-deep #ylrl { ::v-deep .ylrl {
.uni-calendar__header, .uni-calendar__header,
.uni-calendar__weeks-day { .uni-calendar__weeks-day {
border: none; border: none;
@ -615,5 +727,11 @@ onShow(() => {
.uni-calendar__backtoday { .uni-calendar__backtoday {
display: none; display: none;
} }
.uni-calendar-item--disable {
.uni-calendar-item__weeks-lunar-text {
display: none;
}
}
} }
</style> </style>

Loading…
Cancel
Save