xinelu-doctor-app/pages/ServiceSchedule/ServiceSchedule.vue

609 lines
12 KiB
Vue
Raw Normal View History

2023-10-23 16:57:19 +08:00
<template>
<view class="app">
2023-10-25 16:01:03 +08:00
<view class="content" v-if='tabslist.length>0'>
<view class="" v-if="timecurrent==0">
<span>{{tabslist[0].name}}&nbsp;&nbsp;{{tabslist[0].dates}}</span>
</view>
<view class="" v-else>
<span>{{tabslist[timecurrent].name}}&nbsp;&nbsp;{{tabslist[timecurrent].dates}}</span>
</view>
2023-10-23 16:57:19 +08:00
<tabs :list="tabslist" :current="timecurrent" @change="timechange" active-color="#18CBB3"
background="#18CBB3">
</tabs>
<view class="imageitem">
2023-10-26 15:08:24 +08:00
<image src="../../static/jiantou.png" mode="" @tap="timedata"></image>
2023-10-23 16:57:19 +08:00
</view>
</view>
<view class="time">
2023-10-25 16:01:03 +08:00
<view @tap="tapSoonerorlater('morning')"
:class="Soonerorlater=='morning'?'morningbutton':'afternoonbutton'">
2023-10-23 16:57:19 +08:00
上午
</view>
2023-10-25 16:01:03 +08:00
<view @tap="tapSoonerorlater('after')" :class="Soonerorlater=='after'?'morningbutton':'afternoonbutton'">
2023-10-23 16:57:19 +08:00
下午
</view>
2023-10-25 16:01:03 +08:00
<view @tap="tapSoonerorlater('all')" :class="Soonerorlater=='all'?'morningbutton':'afternoonbutton'">
2023-10-23 16:57:19 +08:00
全天
</view>
</view>
<view class="morning">
<view class="morningtime">
上午
</view>
<view class="bodyitem">
2023-10-25 16:01:03 +08:00
<view class="" v-for="(item ,index) in List[timecurrent].morningList">
<view @tap='taptimemorning(item,index)'
2023-10-26 13:51:55 +08:00
:class="item.status==true?'morningbodytwo':'morningbody'">
2023-10-25 16:01:03 +08:00
<span class="spanitem">{{item.scheduleTimeSlot}}</span>
<view class="spanitem" v-if="item.status==false">不可预约</view>
<view class="spanitem" v-else>可预约</view>
2023-10-23 16:57:19 +08:00
</view>
2023-10-25 16:01:03 +08:00
2023-10-23 16:57:19 +08:00
</view>
</view>
</view>
2023-10-24 10:53:33 +08:00
<view class="morning after">
2023-10-23 16:57:19 +08:00
<view class="morningtime">
下午
</view>
<view class="bodyitem">
2023-10-25 16:01:03 +08:00
<view class="" v-for="(item ,index) in List[timecurrent].afternoonList">
<view @tap='taptimeafter(item,index)'
2023-10-26 13:51:55 +08:00
:class="item.status==true?'bodytwo':'body'">
2023-10-25 16:01:03 +08:00
<span class="spanitem">{{item.scheduleTimeSlot}}</span>
<view class="spanitem" v-if="item.status==false">不可预约</view>
<view class="spanitem" v-else>可预约</view>
2023-10-23 16:57:19 +08:00
</view>
</view>
</view>
</view>
2023-10-25 16:01:03 +08:00
<u-toast ref="uToast" />
2023-10-23 16:57:19 +08:00
</view>
</template>
<script>
import tabs from '@/components/utabs/u-tabs.vue'
2023-10-25 16:01:03 +08:00
import {
getListByDoctor,
updateStatus
} from '@/api/ServiceSchedule/ServiceSchedule.js'
2023-10-23 16:57:19 +08:00
export default {
components: {
tabs
},
data() {
return {
2023-10-25 16:01:03 +08:00
time: 0,
2023-10-23 16:57:19 +08:00
timecurrent: 0,
tabslist: [{
2023-10-25 16:01:03 +08:00
dates: '',
name: '',
}],
doctorId: '', //医生id
List: [{
morningList: {},
afternoonList: {},
}],
morningListdata: [],
status: '',
timeindex: null,
timeindexafter: null,
Soonerorlater: 'afternoonbutton',
qurey: {
2023-10-26 13:51:55 +08:00
schedulePlanDetailIds: [],
2023-10-25 16:01:03 +08:00
status: "",
},
2023-10-23 16:57:19 +08:00
}
},
onLoad() {
2023-10-25 16:01:03 +08:00
},
onShow() {
this.doctorId = uni.getStorageSync('id')
// console.log(this.doctorId)
this.getListByDoctordata()
2023-10-23 16:57:19 +08:00
},
methods: {
2023-10-26 13:51:55 +08:00
//切换上下午全天
2023-10-25 16:01:03 +08:00
tapSoonerorlater(item) {
this.Soonerorlater = item
2023-10-26 13:51:55 +08:00
console.log(item)
2023-10-25 16:01:03 +08:00
if (this.Soonerorlater == 'morning') {
this.timeindexafter = null
this.timeindex = null
2023-10-26 13:51:55 +08:00
this.morningdata()
2023-10-25 16:01:03 +08:00
} else if (this.Soonerorlater == 'after') {
this.timeindexafter = null
this.timeindex = null
2023-10-26 13:51:55 +08:00
this.afterdata()
2023-10-25 16:01:03 +08:00
} else if (this.Soonerorlater == 'all') {
this.timeindexafter = null
this.timeindex = null
2023-10-26 13:51:55 +08:00
this.alldata()
}
},
// 修改上午全部状态
morningdata(){
this.qurey={
schedulePlanDetailIds:[],
status:'1',
2023-10-25 16:01:03 +08:00
}
2023-10-26 13:51:55 +08:00
getListByDoctor(this.doctorId).then(res => {
if (res.data) {
res.data[this.timecurrent].morningList.forEach(e=>{
this.qurey.schedulePlanDetailIds.push(e.schedulePlanDetailId)
})
updateStatus(this.qurey).then(res => {
if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
} else {
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: '1000'
})
this.updata()
}
})
}
})
},
// 修改下午全部状态
afterdata(){
this.qurey={
schedulePlanDetailIds:[],
status:'1',
},
getListByDoctor(this.doctorId).then(res => {
if (res.data) {
console.log(res.data[this.timecurrent].afternoonList)
// var schedulePlanDetailId
res.data[this.timecurrent].afternoonList.forEach(e=>{
this.qurey.schedulePlanDetailIds.push(e.schedulePlanDetailId)
})
updateStatus(this.qurey).then(res => {
if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
} else {
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: '1000'
})
this.updata()
}
})
}
})
},
// 修改全天状态
alldata(){
getListByDoctor(this.doctorId).then(res => {
this.qurey={
schedulePlanDetailIds:[],
status:'1',
}
if (res.data) {
console.log(res.data[this.timecurrent].afternoonList)
// var schedulePlanDetailId
res.data[this.timecurrent].afternoonList.forEach(e=>{
this.qurey.schedulePlanDetailIds.push(e.schedulePlanDetailId)
})
res.data[this.timecurrent].morningList.forEach(e=>{
this.qurey.schedulePlanDetailIds.push(e.schedulePlanDetailId)
})
updateStatus(this.qurey).then(res => {
if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
} else {
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: '1000'
})
this.updata()
}
})
}
})
2023-10-25 16:01:03 +08:00
},
//选择时间
taptimemorning(item, index) {
2023-10-26 13:51:55 +08:00
this.qurey={
schedulePlanDetailIds:[],
status:'1',
}
2023-10-25 16:01:03 +08:00
this.status = item.status
this.timeindex = index
if (item.status == true) {
this.qurey.status = "1"
} else {
this.qurey.status = "0"
}
2023-10-26 13:51:55 +08:00
this.qurey.schedulePlanDetailIds.push(item.schedulePlanDetailId)
2023-10-25 16:01:03 +08:00
console.log(this.qurey)
updateStatus(this.qurey).then(res => {
if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
} else {
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: '1000'
})
this.updata()
}
})
},
// 下午
taptimeafter(item, index) {
this.timeindexafter = index
2023-10-26 13:51:55 +08:00
this.qurey={
schedulePlanDetailIds:[],
status:''
}
2023-10-25 16:01:03 +08:00
if (item.status == true) {
this.qurey.status = "1"
} else {
this.qurey.status = "0"
}
2023-10-26 13:51:55 +08:00
this.qurey.schedulePlanDetailIds.push(item.schedulePlanDetailId)
2023-10-25 16:01:03 +08:00
console.log(this.qurey)
updateStatus(this.qurey).then(res => {
if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
} else {
this.$refs.uToast.show({
title: '修改成功',
type: 'success',
duration: '1000'
})
this.updata()
// this.getListByDoctordata()
}
})
this.status = item.status
},
updata() {
getListByDoctor(this.doctorId).then(res => {
if (res.data) {
this.List = res.data
}
})
},
getListByDoctordata() {
this.tabslist = []
getListByDoctor(this.doctorId).then(res => {
if (res.data) {
res.data.forEach(e => {
// console.log(e)
this.tabslist.push({
dates: e.week,
name: e.scheduleDate,
})
})
console.log(this.tabslist)
this.List = res.data
}
})
},
2023-10-23 16:57:19 +08:00
timechange(index) {
this.timecurrent = index
2023-10-25 16:01:03 +08:00
this.timeindexafter = null
this.timeindex = null
this.Soonerorlater = null
2023-10-23 16:57:19 +08:00
},
2023-10-26 15:08:24 +08:00
timedata(){
this.timecurrent++
this.timeindexafter = null
this.timeindex = null
this.Soonerorlater = null
},
2023-10-23 16:57:19 +08:00
}
}
</script>
<style lang="scss">
.app {
2023-10-24 10:53:33 +08:00
height: 100vh;
2023-10-23 16:57:19 +08:00
background: #F1F1F1;
position: relative;
2023-10-24 10:53:33 +08:00
overflow: hidden;
2023-10-25 16:01:03 +08:00
2023-10-23 16:57:19 +08:00
.time {
display: flex;
2023-10-25 16:01:03 +08:00
position: absolute;
right: 2%;
2023-10-26 15:08:24 +08:00
top: 20%;
2023-10-23 16:57:19 +08:00
flex-wrap: wrap;
width: 400rpx;
.morningbutton {
width: 128rpx;
margin: 0 1px 1px 2px;
font-size: 32rpx;
border-radius: 30rpx;
line-height: 54rpx;
text-align: center;
color: #FFFFFF;
background-color: #18CBB3;
}
.afternoonbutton {
margin: 0 1px 1px 2px;
width: 128rpx;
font-size: 32rpx;
border-radius: 30rpx;
line-height: 54rpx;
text-align: center;
color: #18CBB3;
background-color: #FFFFFF;
2023-10-26 14:58:55 +08:00
border: 1rpx solid #18CBB3;
2023-10-23 16:57:19 +08:00
}
}
.afternoon {
width: 100%;
height: 361px;
background: #fff;
border-radius: 0rpx 5rpx 5rpx 0rpx;
2023-10-24 10:53:33 +08:00
// margin: 15px 0 15px 0;
}
.after {
height: 100vh !important;
2023-10-23 16:57:19 +08:00
}
.morning {
width: 100%;
2023-10-25 16:01:03 +08:00
height: 420rpx;
2023-10-23 16:57:19 +08:00
background: #FFFFFF;
border-radius: 0rpx 5rpx 5rpx 0rpx;
margin: 20rpx auto;
background-color: #fff;
2023-10-24 10:53:33 +08:00
margin: 15px 0 15px 0;
2023-10-23 16:57:19 +08:00
.morningtime {
padding: 15px 27px 62rpx 20rpx;
width: 150rpx;
font-size: 28rpx;
font-family: SourceHanSansSC-Medium, SourceHanSansSC;
font-weight: 500;
color: #333333;
line-height: 38rpx;
}
.bodyitem {
display: flex;
align-items: flex-start;
justify-content: flex-start;
height: 50rpx;
color: #000000;
line-height: 27rpx;
text-align: center;
flex-wrap: wrap;
}
.bodytwo {
background-color: #18CBB3;
// font-size: 36rpx;
// color: #26A888;
margin-bottom: 30rpx;
width: 200rpx;
height: 109rpx;
// background: #fff;
margin: 10rpx 30rpx 10rpx 22rpx;
.spanitem {
// width: 121px;
// height: 22px;
display: inline-block;
padding: 8rpx;
font-size: 28rpx;
font-family: SourceHanSansSC-Medium, SourceHanSansSC;
font-weight: 500;
color: #FFFFFF;
line-height: 38rpx;
}
}
.body {
font-size: 36rpx;
color: #18CBB3;
margin-bottom: 30rpx;
width: 200rpx;
height: 109rpx;
background: #fff;
margin: 10rpx 30rpx 10rpx 22rpx;
// border-radius: 10rpx 10rpx 10rpx 10rpx;
// opacity: 1;
// margin: 30rpx;
border: 1rpx solid #E6E6E6;
2023-10-25 16:01:03 +08:00
.spanitem {
// width: 121px;
// height: 22px;
display: inline-block;
padding: 8rpx;
font-size: 28rpx;
font-family: SourceHanSansSC-Medium, SourceHanSansSC;
font-weight: 500;
color: #666666;
line-height: 38rpx;
}
}
.morningbodytwo {
background-color: #18CBB3;
// font-size: 36rpx;
// color: #26A888;
margin-bottom: 30rpx;
width: 200rpx;
height: 109rpx;
// background: #fff;
margin: 10rpx 30rpx 10rpx 22rpx;
.spanitem {
// width: 121px;
// height: 22px;
display: inline-block;
padding: 8rpx;
font-size: 28rpx;
font-family: SourceHanSansSC-Medium, SourceHanSansSC;
font-weight: 500;
color: #FFFFFF;
line-height: 38rpx;
}
}
.morningbody {
font-size: 36rpx;
color: #18CBB3;
margin-bottom: 30rpx;
width: 200rpx;
height: 109rpx;
background: #fff;
margin: 10rpx 30rpx 10rpx 22rpx;
// border-radius: 10rpx 10rpx 10rpx 10rpx;
// opacity: 1;
// margin: 30rpx;
border: 1rpx solid #E6E6E6;
2023-10-23 16:57:19 +08:00
.spanitem {
// width: 121px;
// height: 22px;
display: inline-block;
padding: 8rpx;
font-size: 28rpx;
font-family: SourceHanSansSC-Medium, SourceHanSansSC;
font-weight: 500;
color: #666666;
line-height: 38rpx;
}
}
}
2023-10-25 16:01:03 +08:00
2023-10-23 16:57:19 +08:00
.content {
background-color: #fff;
width: 100%;
height: 214rpx;
border-radius: 5rpx 5rpx 5rpx 0rpx;
::v-deep .u-tabs[data-v-59a86fad] {
2023-10-24 10:53:33 +08:00
padding: 74rpx 0 0 0;
2023-10-23 16:57:19 +08:00
}
::v-deep .uni-scroll-view,
.uni-scroll-view-content {
width: 96%;
height: 100%;
}
span {
position: absolute;
left: 50%;
transform: translateX(-50%);
2023-10-24 10:53:33 +08:00
top: 1%;
2023-10-23 16:57:19 +08:00
}
::v-deep.tabs {
width: 100%;
position: fixed;
2023-10-24 13:42:14 +08:00
2023-10-23 16:57:19 +08:00
}
.imageitem {
position: absolute;
top: 8%;
right: 1%;
// padding-top: 100rpx;
float: right;
image {
width: 18rpx;
height: 32rpx;
}
}
}
}
2023-10-25 16:01:03 +08:00
</style>