预约时间和选择医生功能完成

main
刘佳宇 1 year ago
parent 318a89aeea
commit 0740bc8173

@ -1,125 +1,122 @@
<script setup>
import DraggableButton from "@/pages/components/goHome.vue";
/**
* name
* userselectDoctor
* date2024年9月24日 16:24:50
*/
import {
ref
} from 'vue'
import {
$api,
$response,
$image
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
let dqDate = ref('')
let yytjInfo = ref({}); //
const $props = defineProps({
date: {
type: String,
default: "",
},
});
/**
* name
* userselectDoctor
* date2024年9月24日 16:24:50
*/
import { ref } from "vue";
import { $api, $response, $image } from "@/api";
import { onShow } from "@dcloudio/uni-app";
import { useStore } from "@/store";
const $store = useStore();
let dqDate = ref("");
let yytjInfo = ref({}); //
const $props = defineProps({
date: {
type: String,
default: "",
},
});
const mountedAction = () => {
uni.showLoading({
title: "加载中",
});
yytjInfo.value = $store.getYytjInfo();
dqDate.value = $props.date ? $props.date : '2024-08-01';
if (dqDate.value) {
getdoctorList(); //
}
}
const doctor_list = ref(false)
const mountedAction = () => {
uni.showLoading({
title: "加载中",
});
yytjInfo.value = $store.getYytjInfo();
dqDate.value = $props.date ? $props.date : "2024-08-01";
if (dqDate.value) {
getdoctorList(); //
}
};
const doctor_list = ref(false);
const getdoctorList = async () => {
//
console.log($store, 'store')
let obj = {
"date": dqDate.value
};
const response = await $api("DoctorGetList", obj);
$response(response, () => {
console.log(response, 'response')
doctor_list.value = response.data.list;
uni.hideLoading();
});
};
const config_ref = ref(null)
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e
mountedAction()
}
}
const clickDoctor = (item) => {
yytjInfo.value.doctor_name = item.name;
$store.setYytjInfo(yytjInfo.value);
// item.name
uni.navigateBack({
delta: 1
});
const getdoctorList = async () => {
//
console.log($store, "store");
let obj = {
date: dqDate.value,
};
const response = await $api("DoctorGetList", obj);
$response(response, () => {
console.log(response, "response");
doctor_list.value = response.data.list;
uni.hideLoading();
});
};
const config_ref = ref(null);
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e;
mountedAction();
}
};
const clickDoctor = (item) => {
yytjInfo.value.doctor_name = item.name;
yytjInfo.value.nmrIndex = -1;
$store.setYytjInfo(yytjInfo.value);
// item.name
uni.navigateBack({
delta: 1,
});
};
}
onShow(() => {
if (!!config_ref.value) {
mountedAction()
}
})
onShow(() => {
if (!!config_ref.value) {
mountedAction();
}
});
</script>
<template>
<DraggableButton />
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view class=" pb-40rpx">
<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="pb-80rpx pt-30rpx rounded-15rpx bg-#fff">
<view v-for="(item,index) in doctor_list" :key="index" class="p-10rpx ">
<view class="flex flex-row text-#8B8B8B text-23rpx ">
<image :src="$image(item.head_img)" class="w-170rpx h-226rpx mr-20rpx "></image>
<view class="flex-1 flex flex-col flex-justify-start pr-20rpx">
<view class="text-#0E0E0E text-36rpx">
{{item.name}}
<span class="text-26rpx text-#515151 ml-10rpx">{{item.level}}</span>
</view>
<view class="mt-33rpx mb-10rpx line-clamp-1">
{{item.hospital}}:
<span class="ml-11rpx ">{{item.time}}</span>
</view>
<view class="line-clamp-2">
{{item.desc}}
</view>
<view @click="clickDoctor(item)"
class="ml-a mt-25rpx w-190rpx h-55rpx bg-#239EA3 rounded-33rpx text-#fff text-21rpx flex flex-justify-center items-center">
预约此医生 </view>
</view>
</view>
<view class="w-100% h-1rpx bg-#E6E9E9 mt-15rpx" />
</view>
<DraggableButton />
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view class="pb-40rpx">
<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="pb-80rpx pt-30rpx rounded-15rpx bg-#fff"
>
<view
v-for="(item, index) in doctor_list"
:key="index"
class="p-10rpx"
>
<view class="flex flex-row text-#8B8B8B text-23rpx">
<image
:src="$image(item.head_img)"
class="w-170rpx h-226rpx mr-20rpx"
></image>
</view>
</view>
</view>
</view>
<view class="flex-1 flex flex-col flex-justify-start pr-20rpx">
<view class="text-#0E0E0E text-36rpx">
{{ item.name }}
<span class="text-26rpx text-#515151 ml-10rpx">{{
item.level
}}</span>
</view>
<view class="mt-33rpx mb-10rpx line-clamp-1">
{{ item.hospital }}:
<span class="ml-11rpx">{{ item.time }}</span>
</view>
<view class="line-clamp-2">
{{ item.desc }}
</view>
<view
@click="clickDoctor(item)"
class="ml-a mt-25rpx w-190rpx h-55rpx bg-#239EA3 rounded-33rpx text-#fff text-21rpx flex flex-justify-center items-center"
>
预约此医生
</view>
</view>
</view>
<view class="w-100% h-1rpx bg-#E6E9E9 mt-15rpx" />
</view>
</view>
</view>
</view>
</view>
</template>
<style scoped>
</style>
<style scoped></style>

@ -289,7 +289,7 @@ const comfrimyy = async () => {
console.log(obj);
const response = await $api("OrderCreate", obj);
// return
return;
$response(response, () => {
if (response.status) {
if (response.data.action == "pay") {
@ -361,12 +361,36 @@ onShow(() => {
});
const toRouter = (url, status, index) => {
let i = index;
if (status) {
console.log(index);
yytjInfo.value.nmrIndex = index;
if (
yytjInfo.value.nmr_list.length > 1 &&
yytjInfo.value.nmr_list[0].time == ""
) {
//
i = 0;
}
// if (yytjInfo.value.nmr_list.length == 1 && yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time == "") {
// //
// if(index = -1){
// //
// }else{
// //
// }
// nmrIndex.value = 1;
// moreTime(null, 1);
// return;
// }
yytjInfo.value.nmrIndex = i;
console.log(yytjInfo.value);
uni.setStorageSync("yytjInfoS", yytjInfo.value);
$store.setYytjInfo(yytjInfo.value);
if (yytjInfo.value.doctor_date && i == -1) {
uni.navigateTo({
url: `/pages/main/selectDoctor/selectDoctor?date=${yytjInfo.value.doctor_date}`,
});
return;
}
}
uni.navigateTo({
url: url,
@ -625,9 +649,7 @@ const toRouter = (url, status, index) => {
<view
class="mb-20rpx between"
v-for="(val, index) in yytjInfo?.nmr_list"
@click="
toRouter('/pages/main/yytjsj/yytjsj', 1, val.time ? index : 0)
"
@click="toRouter('/pages/main/yytjsj/yytjsj', 1, index)"
:key="index"
v-if="yytjInfo?.nmr_list?.length"
>
@ -643,7 +665,7 @@ const toRouter = (url, status, index) => {
</view>
<view
class="mb-20rpx between"
@click="toRouter('/pages/main/yytjsj/yytjsj', 1, 0)"
@click="toRouter('/pages/main/yytjsj/yytjsj', 1, -1)"
>
<text>体检医生</text>
<text class="text-30rpx">{{

@ -76,13 +76,22 @@ const getnmrList = async () => {
});
}
nmrIndex.value = yytjInfo.value.nmrIndex;
console.log(yytjInfo.value.nmr_list[nmrIndex.value]);
xmmcClick(yytjInfo.value.nmr_list[nmrIndex.value], nmrIndex.value);
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;
//
const [year, month, day] = currentDate.value.split("-");
@ -128,6 +137,7 @@ const moreTime = async (m, status) => {
console.log(rlArr);
rl_list.value = rlArr;
calendarShow.value = true;
uni.hideLoading();
});
};
@ -196,7 +206,7 @@ const getTjTimeList = async (val) => {
time_list.value.forEach((item) => {
console.log(item.date);
item.newTime = item.time.slice(0, 5);
item.newTime = item?.time.slice(0, 5);
item.date = currentDate.value;
});
date_list.value.forEach((item) => {
@ -232,11 +242,36 @@ const changerl = (e) => {
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("切换体检时间");
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: "",
// });
@ -263,6 +298,42 @@ const getCurrentClick = (item, i) => {
return;
}
if (i != 3) {
if (
nmrIndex.value == yytjInfo.value.nmr_list.length - 1 &&
yytjInfo.value.doctor_date
) {
console.log("切换体检时间");
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) {
yytjInfo.value.nmr_list = yytjInfo.value.nmr_list.map((val) => {
return {
@ -305,14 +376,16 @@ const xmmcClick = (val, index, status) => {
if (
yytjInfo.value.nmr_list.length > 1 &&
index != 0 &&
yytjInfo.value.nmr_list[0].time == ""
yytjInfo.value.nmr_list[0]?.time == ""
) {
uni.$lu.toast("请先选择" + yytjInfo.value.nmr_list[0].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 {
@ -331,23 +404,29 @@ const xmmcClick = (val, index, status) => {
getTjTimeList(val);
};
const clickDoctor = () => {
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 == ""
yytjInfo.value.nmr_list[0]?.time == ""
) {
uni.$lu.toast("请先选择" + yytjInfo.value.nmr_list[0].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;
moreTime(null, 1);
// if (yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1]?.time == "") {
// nmrIndex.value = yytjInfo.value.nmr_list?.length - 1;
nmrIndex.value = -1;
moreTime(null, 1);
// return;
// }
if (s) {
return;
}
status.value = 0;
let date =
yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1].time?.split(
yytjInfo.value.nmr_list[yytjInfo.value.nmr_list.length - 1]?.time?.split(
" "
)[0];
yytjInfo.value.doctor_date = date;
@ -460,7 +539,7 @@ onShow(() => {
/>
<view class="flex items-center grow">
<text class="text-#707070 text-24rpx">您好</text>
<text class="text-#0E0E0E text-32rpx">{{ groupInfo.name }}</text>
<text class="text-#0E0E0E text-32rpx">{{ groupInfo?.name }}</text>
</view>
</view>
<view class="text-24rpx mt-40rpx">
@ -536,135 +615,130 @@ onShow(() => {
@monthSwitch="monthSwitch"
/>
</view>
<template v-else>
<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"
>
<view class="">
<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="text-30rpx text-#0E0E0E pb-34rpx font-500"
v-if="yytjInfo.nmr_list[nmrIndex].name"
class="flex-1 text-center text-18rpx"
v-for="(item, index) in date_list"
:key="index"
>
{{ 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"
@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
@click="getCurrentClick(item, index)"
<view> {{ item.newMonthDate }} </view>
<view class="text-26rpx font-500"> {{ item.newWeek }} </view>
</view>
<view class="ma" v-if="item.count > -1">
<text
:class="{
activeTime: 3 == index,
'bg-#efefef text-#aaa8a8':
item.count < 0 ||
new Date(item.date).getTime() <
new Date(getToday()).getTime(),
'text-#239EA3 !bg-#E1F4F8': 3 == index,
}"
class="rounded-12rpx pt-10rpx pb-10rpx ml-10rpx mr-10rpx mb-6rpx"
class="bg-#EFEFEF rounded-10rpx h-28rpx pl-10rpx pr-10rpx"
>{{ item.count }}</text
>
<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"
class="flex-1 col center text-#239EA3 text-20rpx bs b-#E7E7E7 b-l-1 h-80rpx"
@click="moreTime(null, 0)"
>
<view
class="w-20% text-center box-border p-20rpx"
v-for="(item, index) in time_list"
:key="index"
:class="{
'text-red': 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>
<uni-icons type="calendar" size="30" color="#239EA3"></uni-icons>
<text>更多</text>
</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="flex flex-wrap pt-30rpx pb-30rpx b-0 b-t-1 b-solid b-#E1ECEE"
v-if="time_list.length"
>
<view
class="bg-#EFEFEF rounded-15rpx p-10rpx pb-15rpx pt-15rpx mt-20rpx"
class="w-20% text-center box-border p-20rpx"
v-for="(item, index) in time_list"
:key="index"
:class="{
'text-red': item.status == 2,
}"
@click="getCurrentTime(item, index)"
>
<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"
@click="clickDoctor"
class="text-24rpx rounded-12rpx h-54rpx flex flex-items-center flex-justify-center"
:class="timeIndex == index ? 'activeTime' : ''"
>
<text>体检医生</text>
<text class="ml-10rpx text-#0E0E0E center">
{{ yytjInfo?.doctor_name || "请选择" }}
<uni-icons type="right" size="14"></uni-icons>
</text>
{{ item.newTime }}
</view>
</view>
</view>
</view>
<view class="pb-100rpx">
</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
@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"
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>
</template>
</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>

Loading…
Cancel
Save