|
|
|
<template>
|
|
|
|
<view class="page-prebook">
|
|
|
|
<view class="title flex">
|
|
|
|
<img :src="cssUrl+'ten.svg'">
|
|
|
|
{{depart.hospital_name}} {{depart.depart_name}}
|
|
|
|
</view>
|
|
|
|
<book ref="book" @confirmSubmitEvent="showConfirm" @getAvailabletRegistrationTime = "getAvailabletRegistrationTime" :visitorList="activeVisitors"/>
|
|
|
|
<slider-box ref="sliderbox">
|
|
|
|
<view class="slider-title PfScMedium">预约信息确认</view>
|
|
|
|
<view class="members-box" v-if="needSelectMembers">
|
|
|
|
<view class="desc">当前时段余号不足,只能预约{{times.remain}}人</view>
|
|
|
|
<view class="members">
|
|
|
|
<view :class="'memmbers-item'+(item.choose?' active':'')" v-for="(item,key) in activeVisitors" @click="chooseVisitor(key)">
|
|
|
|
<img :src="cssUrl+'checkbox_false.svg'">
|
|
|
|
<img :src="cssUrl+'checkbox_true.svg'">
|
|
|
|
{{item.name}}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item member-style" v-else>
|
|
|
|
<view class="left">就诊人:</view>
|
|
|
|
<view class="right over2 over5">
|
|
|
|
<text v-for="(item,key) in activeVisitors">
|
|
|
|
<text v-if="key<=9">{{nums[key]}}</text><text v-else>n.</text>{{item.name}}
|
|
|
|
</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item" >
|
|
|
|
<view class="left">医生姓名:</view>
|
|
|
|
<view class="right">{{doctor_name}}</view>
|
|
|
|
</view>
|
|
|
|
<view class="item">
|
|
|
|
<view class="left">就诊医院:</view>
|
|
|
|
<view class="right over2 over5">{{depart.hospital_name}} {{depart.depart_name}}</view>
|
|
|
|
</view>
|
|
|
|
<view class="item">
|
|
|
|
<view class="left">看诊时间:</view>
|
|
|
|
<view class="right orange">{{times.date}} {{times.time_desc}} {{times.time_interval?(times.time_interval.split('-')[0]) :'' }}</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="btns-box flex">
|
|
|
|
<view class="btn cancel btn1" hover-class="hover" @click="closeConfirm">我再想想</view>
|
|
|
|
<view class="primary btn btn1" hover-class="hover" @click="submitConfim">确认预约</view>
|
|
|
|
</view>
|
|
|
|
</slider-box>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Book from '@/components/bookBox.vue'
|
|
|
|
import SliderBox from '@/components/sliderBox.vue'
|
|
|
|
export default {
|
|
|
|
onLoad(op) {
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
cssUrl:this.cssUrl,
|
|
|
|
needSelectMembers:false,
|
|
|
|
hospital:false,
|
|
|
|
activeVisitors:[],
|
|
|
|
nums:['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'],
|
|
|
|
times:false,
|
|
|
|
chooseVisitorCount:0,
|
|
|
|
departId:false,
|
|
|
|
depart:false,
|
|
|
|
visitor_ids:false,
|
|
|
|
checkin:false,
|
|
|
|
doctor_name:''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components:{
|
|
|
|
Book,
|
|
|
|
SliderBox
|
|
|
|
},
|
|
|
|
onLoad(option) {
|
|
|
|
if(option.checkin) this.checkin = true
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.departId = uni.getStorageSync('depart_id')
|
|
|
|
this.depart = uni.getStorageSync('depart')
|
|
|
|
var doctorInfo = uni.getStorageSync('doctor_info')
|
|
|
|
|
|
|
|
var redi_path = '/pages/index/index'
|
|
|
|
if(this.departId && this.checkin) redi_path = "/pages/visitors/visitors?type=3&depart_id="+this.departId
|
|
|
|
if(!doctorInfo){
|
|
|
|
this.$pop.modelShow('请先选择要预约的医生', redi_path)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var activeVisitors = uni.getStorageSync('active_visitors')
|
|
|
|
if(!activeVisitors){
|
|
|
|
this.$func.toPage(redi_path)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.activeVisitors = JSON.parse(activeVisitors)
|
|
|
|
|
|
|
|
this.doctorInfo = JSON.parse(doctorInfo)
|
|
|
|
this.doctor_name = this.doctorInfo.doctor_info.doctor_name
|
|
|
|
|
|
|
|
if(!this.departId && this.depart) {
|
|
|
|
this.$pop.modelShow('请先选择要预约的医院科室', redi_path)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.depart = JSON.parse(this.depart)
|
|
|
|
this.getAvailabletRegistrationTime(true)
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
chooseVisitor(key){
|
|
|
|
var visitor = this.activeVisitors[key]
|
|
|
|
var choose = visitor.choose ? false : true
|
|
|
|
var chooseCount = 0
|
|
|
|
for (var i = 0; i < this.activeVisitors.length; i++) {
|
|
|
|
if(this.activeVisitors[i].choose) ++chooseCount
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.times.left_count <= chooseCount && choose){
|
|
|
|
this.$pop.modelShow('最多预约'+this.times.left_count+'人')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
visitor.choose = choose
|
|
|
|
this.$set(this.activeVisitors, key, visitor)
|
|
|
|
},
|
|
|
|
tips(){
|
|
|
|
uni.removeStorageSync('active_visitors')
|
|
|
|
var that = this
|
|
|
|
uni.showToast({
|
|
|
|
title:"成功预约"+this.chooseVisitorCount+"人",
|
|
|
|
mask:true,
|
|
|
|
image:'/static/images/gou.svg',
|
|
|
|
times:false,
|
|
|
|
success() {
|
|
|
|
setTimeout(function(){
|
|
|
|
if(that.checkin) {
|
|
|
|
that.$nav.navToPath("/pages/visitors/visitors?type=3&depart_id="+that.departId)
|
|
|
|
}else{
|
|
|
|
that.$nav.navToPath("/pages/prebook_list/prebook_list")
|
|
|
|
}
|
|
|
|
}, 1500)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getAvailabletRegistrationTime(flag,date) {
|
|
|
|
const param = {
|
|
|
|
depart_id:this.departId,
|
|
|
|
date:date?date:''
|
|
|
|
}
|
|
|
|
this.$http.req('api/user/get_appoint_times',param, 'POST').then(data=>{
|
|
|
|
let date2work = data.date2work
|
|
|
|
let regxp = /^0/;
|
|
|
|
for(let key in date2work){
|
|
|
|
let itemObj = date2work[key];
|
|
|
|
let month = itemObj.date.split('-')[1];
|
|
|
|
let day = itemObj.date.split('-')[2];
|
|
|
|
itemObj['day'] = day;
|
|
|
|
if(regxp.test(month)){
|
|
|
|
itemObj['month'] = month.replace('0','')
|
|
|
|
}else{
|
|
|
|
itemObj['month'] = month
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(flag) {
|
|
|
|
this.$refs.book.dataInit(data,date)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
closeConfirm() {
|
|
|
|
this.$refs.sliderbox.closeConfirm()
|
|
|
|
},
|
|
|
|
appoint() {
|
|
|
|
var param = new Object()
|
|
|
|
param.depart_id = this.departId
|
|
|
|
var uids = new Array()
|
|
|
|
for (var i = 0; i < this.activeVisitors.length; i++) {
|
|
|
|
var visitor = this.activeVisitors[i]
|
|
|
|
if(!this.needSelectMembers){
|
|
|
|
uids.push(visitor.id)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if(!visitor.choose) continue
|
|
|
|
uids.push(visitor.id)
|
|
|
|
}
|
|
|
|
|
|
|
|
if(uids.length <= 0){
|
|
|
|
this.$pop.modelShow('请选择预约就诊人')
|
|
|
|
console.log(88888);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if(uids.length > this.times.remain){
|
|
|
|
this.$pop.modelShow('当前时段余号不足,只能预约'+this.times.remain+'人')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
param.visitor_ids = uids;
|
|
|
|
param.time_interval = this.times.time_interval;
|
|
|
|
param.date = this.times.date;
|
|
|
|
this.chooseVisitorCount = uids.length
|
|
|
|
this.$http.req('api/user/appoint', param,'POST').then(data=>{
|
|
|
|
if(data == -1) return
|
|
|
|
this.tips()
|
|
|
|
});
|
|
|
|
},
|
|
|
|
appointCheck(times){
|
|
|
|
var param = {...times}
|
|
|
|
param.depart_id = this.departId;
|
|
|
|
let visitor_ids = new Array();
|
|
|
|
for (var i = 0; i < this.activeVisitors.length; i++) {
|
|
|
|
visitor_ids.push(this.activeVisitors[i].id)
|
|
|
|
}
|
|
|
|
|
|
|
|
param.visitor_ids = this.visitor_ids = visitor_ids;
|
|
|
|
this.times = param;
|
|
|
|
this.times.date = times.date;
|
|
|
|
this.times.time_desc = '下午';
|
|
|
|
if(times.type == 1) this.times.time_desc = '上午';
|
|
|
|
this.$http.req('api/user/check_appoint_nums', param,'POST').then(data=>{
|
|
|
|
if(data.remain < this.activeVisitors.length){
|
|
|
|
this.needSelectMembers = true
|
|
|
|
this.$set(this.times, 'remain', data.remain)
|
|
|
|
this.$refs.sliderbox.showConfirm()
|
|
|
|
}else{
|
|
|
|
this.$refs.sliderbox.showConfirm()
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
showConfirm(times) {
|
|
|
|
this.appointCheck(times)
|
|
|
|
},
|
|
|
|
submitConfim(){
|
|
|
|
this.appoint()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.page-prebook{
|
|
|
|
width: 100%;
|
|
|
|
height: 100vh;
|
|
|
|
overflow-y: auto;
|
|
|
|
background: #F8F8F8;
|
|
|
|
.title{
|
|
|
|
margin-top: 24rpx;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 0 41rpx;
|
|
|
|
line-height: 36rpx;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #949699;
|
|
|
|
img{
|
|
|
|
width: 26rpx;
|
|
|
|
height: 26rpx;
|
|
|
|
margin-right: 15rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.slider-title{
|
|
|
|
width: 100%;
|
|
|
|
text-align: center;
|
|
|
|
color: #000000;
|
|
|
|
margin-top: 52rpx;
|
|
|
|
line-height: 50rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
font-size: 32rpx;
|
|
|
|
letter-spacing: 2rpx;
|
|
|
|
}
|
|
|
|
.member-style{
|
|
|
|
margin-top: 82rpx;
|
|
|
|
text{
|
|
|
|
margin-right: 10rpx;
|
|
|
|
text{
|
|
|
|
margin-right: 5rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.item{
|
|
|
|
display: flex;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 0 53rpx;
|
|
|
|
min-height: 42rpx;
|
|
|
|
line-height: 42rpx;
|
|
|
|
font-size: 30rpx;
|
|
|
|
margin-bottom: 24rpx;
|
|
|
|
.left{
|
|
|
|
width: 159rpx;
|
|
|
|
flex-shrink: 0;
|
|
|
|
color: #999999;
|
|
|
|
}
|
|
|
|
.right{
|
|
|
|
flex-grow: 1;
|
|
|
|
color: #242833;
|
|
|
|
&.orange{
|
|
|
|
color: #FD7100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.item:last-of-type{
|
|
|
|
margin-bottom: 62rpx;
|
|
|
|
}
|
|
|
|
.btns-box{
|
|
|
|
justify-content: space-between;
|
|
|
|
width: 750rpx;
|
|
|
|
height: 124rpx;
|
|
|
|
padding: 0 50rpx;
|
|
|
|
box-sizing: border-box;
|
|
|
|
align-items: center;
|
|
|
|
background: #FFFFFF;
|
|
|
|
margin-bottom: 17rpx;
|
|
|
|
box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(181,181,181,0.13);
|
|
|
|
margin-top: 62rpx;
|
|
|
|
}
|
|
|
|
.members-box{
|
|
|
|
margin-top: 52rpx;
|
|
|
|
padding-left: 60rpx;
|
|
|
|
width: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
.desc{
|
|
|
|
height: 50rpx;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #999999;
|
|
|
|
line-height: 50rpx;
|
|
|
|
letter-spacing: 1rpx;
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
.members{
|
|
|
|
width: 630rpx;
|
|
|
|
min-height: 200rpx;
|
|
|
|
max-height: 230rpx;
|
|
|
|
overflow-y: auto;
|
|
|
|
background: #F7F7F7;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
padding: 32rpx 40rpx;
|
|
|
|
box-sizing: border-box;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #000000;
|
|
|
|
line-height: 40rpx;
|
|
|
|
margin-bottom: 52rpx;
|
|
|
|
row-gap: 50rpx;
|
|
|
|
.memmbers-item{
|
|
|
|
width: 50%;
|
|
|
|
overflow-y: auto;
|
|
|
|
display: flex;
|
|
|
|
flex-shrink: 0;
|
|
|
|
align-items: center;
|
|
|
|
word-break: break-all;
|
|
|
|
img{
|
|
|
|
width: 36rpx;
|
|
|
|
height: 36rpx;
|
|
|
|
margin-right: 26rpx;
|
|
|
|
}
|
|
|
|
img:first-of-type{
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
img:last-of-type{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
&.active{
|
|
|
|
img:first-of-type{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
img:last-of-type{
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|