@ -2,18 +2,18 @@
< view class = "page-prebook" >
< view class = "title flex" >
< img :src ="cssUrl+'ten.svg'" >
{ { hospital . hospital _name} } { { hospital . hospital_dep t_name} }
{ { depart . h _name} } { { depart . depar t_name} }
< / view >
< book ref = "book" @confirmSubmitEvent ="showConfirm" :RegistrationTimeList ="RegistrationTimeList" :visitorList ="activeVisitors" / >
< slider -box ref = "sliderbox" >
< view class = "slider-title PfScMedium" > 预约信息确认 < / view >
< view class = "members-box" v-if ="needSelectMembers" >
< view class = "desc" > 当前时段余号不足 , 只能预约 { { times . left_count } } 人 < / view >
< view class = "desc" > 当前时段余号不足 , 只能预约 { { times . remain_num } } 人 < / 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 . real _name } }
{ { item . visito r_name} }
< / view >
< / view >
< / view >
@ -21,21 +21,21 @@
< 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.real _name }}
< text v-if ="key<=9" > {{ nums [ key ] }} < / text > < text v-else > n. < / text > {{ item.visito r_name }}
< / text >
< / view >
< / view >
< view class = "item" >
< view class = "left" > 医生姓名 : < / view >
< view class = "right" > { { doctorInfo . name } } < / view >
< view class = "right" > { { doctorInfo . doctor_info . name } } < / view >
< / view >
< view class = "item" >
< view class = "left" > 就诊医院 : < / view >
< view class = "right over2 over5" > { { hospital . hospital _name} } { { hospital . hospital_dep t_name} } < / view >
< view class = "right over2 over5" > { { depart . h _name} } { { depart . depar t_name} } < / view >
< / view >
< view class = "item" >
< view class = "left" > 看诊时间 : < / view >
< view class = "right orange" > { { times . date } } 上午 { { times . start_time } } - { { times . end_time } } < / view >
< view class = "right orange" > { { times . date } } { { times . time_desc } } { { times . start_time } } - { { times . end_time } } < / view >
< / view >
< view class = "btns-box flex" >
@ -66,7 +66,10 @@
activeVisitors : [ ] ,
nums : [ '①' , '②' , '③' , '④' , '⑤' , '⑥' , '⑦' , '⑧' , '⑨' , '⑩' ] ,
times : false ,
chooseVisitorCount : 0
chooseVisitorCount : 0 ,
departId : false ,
depart : false ,
visit_nums_id : false
}
} ,
components : {
@ -76,26 +79,24 @@
onShow ( ) {
var activeVisitors = uni . getStorageSync ( 'active_visitors' )
if ( ! activeVisitors ) {
this . $pop . modelShow ( '请先选择要预约的就诊人' , '/pages/visitors/visitors?type=1 ' )
this . $func . toPage ( '/pages/index/index ' )
return
}
this . activeVisitors = JSON . parse ( activeVisitors )
this . hospitalId = uni . getStorageSync ( 'hospital_id' )
this . hospital = uni . getStorageSync ( 'hospital' )
this . activeVisitors = JSON . parse ( activeVisitors )
this . departId = uni . getStorageSync ( 'depart_id' )
this . depart = uni . getStorageSync ( 'depart' )
var doctorInfo = uni . getStorageSync ( 'doctor_info' )
if ( ! doctorInfo ) {
this . $pop . modelShow ( '请先选择要预约的医生' , '/pages/index/index' )
return
}
this . doctorInfo = JSON . parse ( doctorInfo )
if ( ! this . hospitalId && this . hospital ) {
this . $pop . modelShow ( '请先选择要预约的医院' , '/pages/index/index' )
if ( ! this . departId && this . depart ) {
this . $pop . modelShow ( '请先选择要预约的医院科室' , '/pages/index/index' )
return
}
this . hospital = JSON . parse ( this . hospital )
this . doctorId = getApp ( ) . globalData . doctorId
this . depart = JSON . parse ( this . depart )
this . getAvailabletRegistrationTime ( )
} ,
methods : {
@ -116,20 +117,23 @@
this . $set ( this . activeVisitors , key , visitor )
} ,
tips ( ) {
uni . removeStorageSync ( 'active_visitors' )
uni . showToast ( {
title : "成功预约" + this . chooseVisitorCount + "人" ,
mask : true ,
image : this . cssUrl + 'gou.svg' ,
times : false ,
success ( ) {
uni . navigateTo ( {
url : "/pages/prebook_list/prebook_list"
} )
setTimeout ( function ( ) {
uni . navigateTo ( {
url : "/pages/prebook_list/prebook_list"
} )
} , 1500 )
}
} )
} ,
getAvailabletRegistrationTime ( refresh = true , chooseDay = '' ) {
this . $http . req ( 'client/doctor/visit_hospital/days/' + this . hospitalId ) . then ( data => {
this . $http . req ( 'get_appoint_times' , { depart_id : this . departId } , 'GET' ) . then ( data => {
if ( data == - 1 ) return
/ / d a t a . d a y s = [
/ / {
@ -221,7 +225,7 @@
/ / ]
/ / }
this . RegistrationTimeList = data . days
this . RegistrationTimeList = data
if ( this . RegistrationTimeList . length > 0 ) {
if ( refresh || chooseDay >= this . RegistrationTimeList . length ) {
this . $refs . book . dataInit ( this . RegistrationTimeList [ 0 ] )
@ -236,11 +240,8 @@
} ,
appoint ( ) {
var param = new Object ( )
param . visit_hospital_id = this . hospitalId
param . start_time = this . times . start_time
param . end_time = this . times . end_time
param . date = this . times . date
param . depart_id = this . departId
param . visit_nums_id = this . visit_nums_id
var uids = new Array ( )
for ( var i = 0 ; i < this . activeVisitors . length ; i ++ ) {
var visitor = this . activeVisitors [ i ]
@ -251,44 +252,59 @@
if ( ! visitor . choose ) continue
uids . push ( visitor . id )
}
if ( uids . length <= 0 ) {
this . $pop . modelShow ( '请选择预约就诊人' )
return
}
this . chooseVisitorCount = uids . length
param . user_ids = JSON . stringify ( uids )
param . handler_type = 1
this . $http . req ( 'client/user/appoint/' , param ) . then ( data => {
if ( uids . length > this . times . remain_num ) {
this . $pop . modelShow ( '当前时段余号不足,只能预约' + this . times . remain_num + '人' )
return
}
param . visitor_ids = uids . join ( ',' )
this . chooseVisitorCount = uids . length
this . $http . req ( 'appoint' , param ) . then ( data => {
if ( data == - 1 ) return
this . tips ( )
} ) ;
} ,
appointCheck ( times , chooseDay = '' ) {
appointCheck ( times , chooseDay = '' , visit_nums_id ) {
var param = new Object ( )
param . start_time = times . start
param . end_time = times . end
param . date = times . date
param . visit_hospital_id = this . hospitalId
param . visit_user_count = 1
param . depart_id = this . departId
this . visit_nums_id = param . visit_nums_id = visit_nums_id
var visitor_ids = new Array ( ) ;
for ( var i = 0 ; i < this . activeVisitors . length ; i ++ ) {
visitor_ids . push ( this . activeVisitors [ i ] . id )
}
param . visitor_ids = visitor_ids . join ( ',' )
this . times = param
this . $http . req ( 'client/user/appoint/check' , param ) . then ( data => {
this . times . date = times . date . date
this . times . start_time = times . start
this . times . end_time = times . end
this . times . time_desc = '下午'
if ( times . type == 1 ) this . times . time_desc = '上午'
this . $http . req ( 'check_appoint_nums' , param ) . then ( data => {
if ( data == - 1 ) {
this . getAvailabletRegistrationTime ( false , chooseDay )
return
}
if ( data . left_count < this . activeVisitors . length ) {
if ( data . remain_num < this . activeVisitors . length ) {
this . needSelectMembers = true
this . $set ( this . times , 'remain_num' , data . remain_num )
this . $refs . sliderbox . showConfirm ( )
this . times . left_count = data . left_count
} else {
this . $refs . sliderbox . showConfirm ( )
}
} ) ;
} ,
showConfirm ( times ) {
this . appointCheck ( times , times . key )
this . appointCheck ( times , times . key , times . id )
} ,
submitConfim ( ) {
this . appoint ( )