You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

614 lines
17 KiB
Vue

<template>
<TabBar/>
<view class="ctime_main">
<view class="zhouli">
<WeeklyCalendar v-if="weekList" :dataInfo="weekList" :selectedTime="selectedTime" :YuYueInfo="YuYueInfo" :TjDTime="tj_date+' '+tj_time" :ItemSelected="itemSelected"
@selectDate="selectDateFunc" @selectTime="selectTimeFunc" @openMonth="openMonthFunc" />
</view>
<view class="dateitem" v-if="orderInfo">
<view
style="background-color: #f7f7f7; padding: 20rpx; font-size: 30rpx; border-radius: 20rpx;color: #333;">
<view>{{orderInfo.name}}</view>
<view
style="background-color: #f1f1f1;padding: 20rpx 10rpx; margin-top: 10rpx;border-radius: 14rpx;font-size: 28rpx;color: #666;">
<view v-if="YuYueInfo.NmrInfo.length>0">
<view @click="itemClick('nmr',item_nmr,index_nmr)" v-for="(item_nmr,index_nmr) in YuYueInfo.NmrInfo" :key="index_nmr"
style="padding: 20rpx;" :class="(itemSelected.type=='nmr' && itemSelected.index==index_nmr)?'itemSelected':''">
{{item_nmr.name}} <span v-if="item_nmr.date && item_nmr.time">{{item_nmr.date}} {{item_nmr.time}}</span>
</view>
</view>
<view @click="itemClick('tj','',0)" style="margin-top: 10rpx;padding: 20rpx;color: #666;"
:class="itemSelected.type=='tj'?'itemSelected':''">体检日期 <span v-if="tj_date && tj_time">{{tj_date}}
{{tj_time}}</span></view>
<view v-if="orderInfo" style="display: flex;justify-content: space-between;padding: 20rpx;color: #666;">
<view style="font-size: 26rpx; color: #666;">体检医生 - <span v-if="doctor_name" @click="doctorNameClick()"
style="font-size: 28rpx;font-weight: 700;"> {{doctor_name}}</span></view>
<view style="font-size: 26rpx; color: #333;font-weight: 700;" @click="selectDoctor()">重新选择 </view>
</view>
</view>
</view>
</view>
<view class="pb-100rpx">
<view @click="StartYuYue()"
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 id="ylrl">
<uni-calendar :insert="false" :showMonth="false" ref="DoctorMonthCalendar" @confirm="DoctMonthConfirm" />
<uni-calendar ref="MonthCalendar" :start-date="GetToday()" :date="currentDate" :selected="MonthList" @monthSwitch="monthSwitch" :insert="false"
:showMonth="false" @confirm="MonthConfirm" />
</view>
</view>
</template>
<script setup>
import {
onMounted,
ref
} from 'vue';
import {
$image,
$api,
$response
} from "@/api";
import {
useStore
} from "@/store";
const $store = useStore();
import {
onShow,onLoad
} from "@dcloudio/uni-app";
import WeeklyCalendar from '@/common/WeeklyCalendar.vue';
import TabBar from "@/common/TabBar.vue";
let nmr_date = ref(null);
let nmr_time = ref(null);
let nmr_plan_id = ref(null); //核磁号源id
let tj_date = ref(null);
let tj_time = ref(null);
let tj_plan_id = ref(null); //体检号源id
let yytjInfo = ref({}); // 预约信息
let weekList = ref(null);
let doctor_name = ref(null);
const doctorNameClick=()=>{
if (doctor_name.value) {
uni.showModal({
title: '提示',
content: '是否取消预约此医生',
cancelText: '关闭',
confirmText: '确定',
success: function(res) {
if (res.confirm) {
doctor_name.value = null //清空体检医生
} else if (res.cancel) {
}
}
});
}
}
//查询体检号源
const GetDayPlanListFunc = async () => {
uni.showLoading();
let data = {
hospital: orderInfo.value.hospital_id,
person_id: orderInfo.value.person_id,
date: selectedDate.value,
use_type: orderInfo.value.type,
checkup_type_id: orderInfo.value.checkup_type_id,
amount: orderInfo.value.true_price,
combo_id: orderInfo.value.combo_id?orderInfo.value.combo_id:"",
danwei_id:orderInfo.value.appointment_back_info?.单位Id,
big_date:MonthSelectedDate.value
}
const response = await $api("GetDayPlanList", data);
uni.hideLoading();
$response(response, () => {
weekList.value = response.data
});
};
//查询核磁号源
const NMRGetDayPlanListFunc = async () => {
uni.showLoading();
let data = {
hospital: orderInfo.value.hospital_id,
date: selectedDate.value,
}
const response = await $api("NMRGetDayPlanList", data);
uni.hideLoading();
$response(response, () => {
weekList.value = response.data
});
};
let selectedTime = ref(null);
let orderInfo = ref(null)
let YuYueInfo=ref({
TjInfo:{},
NmrInfo:{}
})
const GetOrderInfo = async () => {
uni.showLoading();
const response = await $api("GetOrderDetail", {
id: OrderId.value
});
uni.hideLoading();
$response(response, () => {
orderInfo.value = response.data.info
doctor_name.value = orderInfo.value.doctor
//如果有核磁项目
// if (orderInfo.value.buy_info.nmr_list && orderInfo.value.buy_info.nmr_list.length > 0) {
// itemSelected.value.type = 'nmr'
// if(orderInfo.value.erxian_appointment_info.length>0){
// selectedTime.value = orderInfo.value.erxian_appointment_info[0].time //应该是核磁时间
// selectedDate.value = orderInfo.value.erxian_appointment_info[0].date //应该是核磁日期
// YuYueInfo.value.NmrInfo= orderInfo.value.erxian_appointment_info
// YuYueInfo.value.NmrInfo=[]
// }
// NMRGetDayPlanListFunc()
// } else {
itemSelected.value.type = 'tj'
selectedTime.value = orderInfo.value.appointment_time
selectedDate.value = orderInfo.value.appointment_date
yytjInfo.value.nmr_list=[]
yytjInfo.value.nmr_list.push({
item_id: -1,
name: "体检时间",
time:selectedDate.value+' '+selectedTime.value,
id: orderInfo.value.plan_id,
});
$store.setYytjInfo(yytjInfo.value);
GetDayPlanListFunc()
//}
tj_date.value = orderInfo.value.appointment_date
tj_time.value = orderInfo.value.appointment_time
tj_plan_id.value=orderInfo.value.plan_id
});
}
//weekly子组件点击了日期
let selectedDate = ref(null);
const selectDateFunc = (date) => {
if(doctor_name.value){
uni.showModal({
title: '提示',
content: '已选择医生,切换日期将重新选择医生,是否继续',
cancelText:'取消',
confirmText:'确定',
success: function (res) {
if (res.confirm) {
currentDate.value=date
DateChange(date)
} else if (res.cancel) {
}
}
});
}else{
currentDate.value=date
DateChange(date)
}
}
//weekly子组件点击了时间
let SelectedPlanId = ref(null)
const selectTimeFunc = (timeinfo) => {
selectedTime.value = timeinfo.time
SelectedPlanId.value = timeinfo.id
if (itemSelected.value.type == 'nmr') {
YuYueInfo.value.NmrInfo[itemSelected.value.index].time = timeinfo.time
nmr_plan_id.value = timeinfo.id
}
if (itemSelected.value.type == 'tj') {
tj_time.value = timeinfo.time
tj_plan_id.value = timeinfo.id
let temp = $store.getYytjInfo()
temp.nmr_list[0].time = selectedDate.value+ ' '+ timeinfo.time
temp.nmr_list[0].id = timeinfo.id
$store.setYytjInfo(temp)
}
}
let itemSelected = ref({
type:null,
item:{},
index:0
});
const itemClick = (type,item,index) => {
//weekList.value=null
if (type == 'nmr') {
//selectedTime.value = nmr_time.value
//selectedDate.value = nmr_date.value
selectedTime.value = YuYueInfo.value.NmrInfo[index].time
selectedDate.value = YuYueInfo.value.NmrInfo[index].date
NMRGetDayPlanListFunc()
}
if (type == 'tj') {
// if (orderInfo.value.buy_info.nmr_list && orderInfo.value.buy_info.nmr_list.length > 0) {
// if (YuYueInfo.value.NmrInfo[itemSelected.value.index].date == null || YuYueInfo.value.NmrInfo[itemSelected.value.index].time == null) {
// uni.$lu.toast("请先预约为影像科项目选择时间");
// return false
// }
// }
// if (tj_date.value == null) {
// tj_date.value =YuYueInfo.value.NmrInfo[itemSelected.value.index].date
// }
selectedTime.value = tj_time.value
selectedDate.value = tj_date.value
GetDayPlanListFunc()
}
itemSelected.value.type = type
itemSelected.value.item=item
itemSelected.value.index=index
}
let DoctorMonthCalendar = ref(null)
const selectDoctor = () => {
// if (orderInfo.value.buy_info.nmr_list && orderInfo.value.buy_info.nmr_list.length > 0) {
// if (YuYueInfo.value.NmrInfo[itemSelected.value.index].date == null || YuYueInfo.value.NmrInfo[itemSelected.value.index].time == null) {
// uni.$lu.toast("请先预约为影像科项目选择时间");
// return false
// }
// }
if (tj_date.value == null) { //如果没有选定体检日期,则打开日历
DoctorMonthCalendar.value.open();
} else {
uni.navigateTo({
url: `/pages/main/selectDoctor/selectDoctor?date=${tj_date.value}`,
});
}
}
//点击医生月历日期后跳转
const DoctMonthConfirm = (e) => {
tj_date.value = e.year + "-" + e.month + "-" + e.date
uni.navigateTo({
url: `/pages/main/selectDoctor/selectDoctor?date=${tj_date.value}`,
});
}
let MonthCalendar = ref(null)
let MonthList = ref([]); //月历号源数据
let currentDate = ref(null); //月历当前日期
const monthSwitch = (e) => { //月历切换月份
let ym=e.year+""+"-"+e.month+""
if (itemSelected.value.type == 'nmr') {
NMRGetMonthPlanListFunc(ym)
}
if (itemSelected.value.type == 'tj') {
GetMonthPlanListFunc(ym)
}
}
let MonthSelectedDate=ref('');//点击月历获取的日期,用来获取7天内的日期
const MonthConfirm = (e) => { //月历确认日期
// if(e.extraInfo.date ==undefined){
// uni.$lu.toast("此日期已无号源,请重新选择");
// return false
// }
if(doctor_name.value){
uni.showModal({
title: '提示',
content: '已选择医生,切换日期将重新选择医生,是否继续',
cancelText:'取消',
confirmText:'确定',
success: function (res) {
if (res.confirm) {
MonthSelectedDate.value=e.fulldate
DateChange(e.fulldate)
} else if (res.cancel) {
}
}
});
}else{
MonthSelectedDate.value=e.fulldate
DateChange(e.fulldate)
}
}
//获取体检每月号源数量
const GetMonthPlanListFunc = async (ym='') => {
uni.showLoading();
let data = {
hospital: orderInfo.value.hospital_id,
person_id: orderInfo.value.person_id,
month: ym?ym:tj_date.value.substring(0, 7),
use_type: orderInfo.value.type,
checkup_type_id: orderInfo.value.checkup_type_id,
amount: orderInfo.value.true_price,
danwei_id:orderInfo.value.appointment_back_info?.单位Id,
combo_id: orderInfo.value.combo_id?orderInfo.value.combo_id:"",
}
const response = await $api("GetMonthPlanCount", data);
uni.hideLoading();
$response(response, () => {
let rlArr = [];
response.data.list.forEach((item) => {
let info=""
if(item.count===0){
info="满号"
}
if(item.date<GetToday()){
info=" "
}
if(item.count == -1){
info=" "
}
let o = {
date: item.date,
// info: "余号" + item.count,
info:info
};
if ((item.count >= -1 && item.date!=GetToday()) ||(item.date==GetToday() && item.count === 0) ) {
rlArr.push(o);
}
});
MonthList.value = rlArr;
//MonthCalendar.value.open()
});
};
//获取核磁每月号源数量
const NMRGetMonthPlanListFunc = async (ym='') => {
uni.showLoading();
let data = {
hospital: orderInfo.value.hospital_id,
month: ym?ym:YuYueInfo.value.NmrInfo[itemSelected.value.index].date.substring(0, 7),
}
const response = await $api("NMRGetMonthPlanCount", data);
uni.hideLoading();
$response(response, () => {
let rlArr = [];
response.data.list.forEach((item) => {
let o = {
date: item.date,
info: "余号" + item.count,
};
rlArr.push(o);
});
MonthList.value = rlArr;
//MonthCalendar.value.open()
});
};
//打开月历
const openMonthFunc = async() => {
if (itemSelected.value.type == 'nmr') {
await NMRGetMonthPlanListFunc()
}
if (itemSelected.value.type == 'tj') {
let ym=''
if(tj_date.value<GetToday()){
ym=GetToday()
}
await GetMonthPlanListFunc(ym)
}
MonthCalendar.value.open()
}
//点击提交
const StartYuYue = async() => {
if(tj_time.value==null){
uni.$lu.toast("请选择体检日期");
return false
}
console.log(tj_plan_id.value);
uni.showLoading();
let data = {
orderid: orderInfo.value.id,
planid: tj_plan_id.value,
nmr_info:YuYueInfo.value.NmrInfo,
doctor: doctor_name.value
}
console.log(data);
const response = await $api("ChangeAppointment", data);
uni.hideLoading();
$response(response, () => {
if(response.status){
uni.showToast({
title: '改约完成'
});
setTimeout(()=>{
uni.redirectTo({
url:'/pages/main/order/order'
})
},1000)
}
});
}
//改变日期
const DateChange=(date)=>{
selectedDate.value=date
selectedTime.value = null
if (itemSelected.value.type == 'nmr') {
YuYueInfo.value.NmrInfo[itemSelected.value.index].time = null
YuYueInfo.value.NmrInfo[itemSelected.value.index].date = date
tj_time.value = null //如果切换核磁日期则清空体检选择的日期时间
tj_date.value = null
doctor_name.value = null //清空体检医生
NMRGetDayPlanListFunc()
}
if (itemSelected.value.type == 'tj') {
tj_time.value = null
tj_date.value = date
temp = $store.getYytjInfo()
if(date!=temp.doctor_date){
doctor_name.value = null //清空体检医生
}
GetDayPlanListFunc()
}
}
let temp = null
onMounted(() => {
//清空一下缓存的医生,防止出问题
temp = $store.getYytjInfo()
temp.doctor_name = ""
$store.setYytjInfo(temp)
yytjInfo.value = $store.getYytjInfo();
GetOrderInfo()
});
let OrderId=ref(0)
onLoad((e)=>{
OrderId.value=e.id
})
onShow(() => {
temp = $store.getYytjInfo()
if(temp.nmr_list && temp.nmr_list[0].name=='体检时间' && temp.nmr_list[0].time!=''){
tj_time.value = temp.nmr_list[0].time.substring(11,19)
tj_date.value = temp.nmr_list[0].time.substring(0,10)
selectedDate.value=tj_date.value
selectedTime.value =tj_time.value
tj_plan_id.value=temp.nmr_list[0].id
console.log(tj_time.value)
console.log(tj_date.value)
console.log(tj_plan_id.value)
}
if (temp.doctor_name != null && temp.doctor_name != '') {
doctor_name.value = temp.doctor_name
}
if(temp.nmr_list && temp.nmr_list[0].name=='体检时间' && temp.nmr_list[0].time==''){
tj_time.value = null
tj_date.value = null
tj_plan_id.value=null
}
if(temp.doctor_date!=tj_date.value && temp.doctor_date!=undefined){
selectedTime.value = null
tj_date.value = temp.doctor_date
MonthSelectedDate.value=temp.doctor_date
currentDate.value=temp.doctor_date
DateChange(temp.doctor_date)
}
})
const GetToday = () => {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
</script>
<style scoped lang="scss">
.ctime_main {
padding: 20rpx;
}
.top {
background-color: #fff;
border-radius: 20rpx;
margin-bottom: 20rpx;
padding: 20rpx;
}
.zhouli {
padding: 20rpx;
background-color: #fff;
border-radius: 20rpx;
}
.itemSelected {
background-color: #e0fafa;
border-radius: 10rpx;
}
.dateitem {
padding: 20rpx;
background-color: #fff;
border-radius: 20rpx;
margin-top: 20rpx;
}
::v-deep #ylrl {
.uni-calendar--fixed{
bottom: 110rpx !important;
}
.uni-calendar__header,
.uni-calendar__weeks-day {
border: none;
}
.uni-calendar-item--checked {
background-color: transparent;
color: #239ea3 !important;
.uni-calendar-item__weeks-box-item {
background-color: #EBFBFF !important;
border-radius: 12rpx;
.uni-calendar-item--extra {
color: #239ea3 !important;
}
}
}
.uni-calendar-item--isDay {
background-color: #EBFBFF !important;
border-radius: 12rpx;
color: #239ea3 !important;
.uni-calendar-item--extra{
color:#ff5500 !important;
}
}
.uni-calendar-item--extra {
color: #ff5500;
font-size: 21rpx !important;
}
.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: 30rpx;
// font-weight: 700;
color: #239ea3;
}
.uni-calendar-item--disable{
color:#c0c0c0 !important;
font-weight: 400;
}
.uni-calendar-item__weeks-box-text:has(+ .uni-calendar-item--extra) {
color: #ccc ;
}
.uni-calendar-item__weeks-box-text:has(+ .uni-calendar-item--disable) {
color: #ccc !important;
}
.uni-calendar-item__weeks-lunar-text {
font-size: 21rpx;
}
.uni-calendar-item__weeks-box-item {
width: 100%;
}
.uni-calendar__backtoday {
display: none;
}
}
</style>