diff --git a/pages/prebook/prebook.vue b/pages/prebook/prebook.vue index a548369..ebad003 100644 --- a/pages/prebook/prebook.vue +++ b/pages/prebook/prebook.vue @@ -10,25 +10,10 @@ 当前时段余号不足,只能预约{{times.left_count}}人 - + - 上官子涵 - - - - - 帅哥 - - - - - 发财哥 - - - - - 王富贵 + {{item.real_name}} @@ -80,7 +65,8 @@ hospital:false, activeVisitors:[], nums:['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'], - times:false + times:false, + chooseVisitorCount:0 } }, components:{ @@ -113,81 +99,102 @@ this.getAvailabletRegistrationTime() }, 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.showToast({ - title:"成功预约8人", + title:"成功预约"+this.chooseVisitorCount+"人", mask:true, image:this.cssUrl+'gou.svg', - times:false + times:false, + success() { + uni.navigateTo({ + url:"/pages/prebook_list/prebook_list" + }) + } }) }, getAvailabletRegistrationTime(refresh = true, chooseDay = '') { this.$http.req('client/doctor/visit_hospital/days/'+this.hospitalId).then(data=>{ if(data == -1) return - data.days = [ - { - date: "2024-04-17", type: 2, type_text: "上午出诊", weekday: "周一", - am: [ - { - "start": "12:00", - "end": "12:30", - "bed_count": 0 - }, - { - "start": "13:00", - "end": "14:30", - "bed_count": 2 - } - ], - pm: [] - }, - { - date: "2024-04-18", type: 5, type_text: "未开放预约", weekday: "周二", am: [], pm: [] - }, - { - date: "2024-04-19", type: 3, type_text: "全天出诊", weekday: "周三", am: [ - { - "start": "12:00", - "end": "12:30", - "bed_count": 0 - }, - { - "start": "13:00", - "end": "14:30", - "bed_count": 2 - } - ], pm: [ - { - "start": "12:00", - "end": "12:30", - "bed_count": 0 - }, - { - "start": "13:00", - "end": "14:30", - "bed_count": 8 - } - ] - }, - { - date: "2024-04-20", type: 4, type_text: "下午出诊", weekday: "周四", am: [], pm: [ - { - "start": "12:00", - "end": "12:30", - "bed_count": 0 - }, - { - "start": "13:00", - "end": "14:30", - "bed_count": 1 - } - ] - }, - { - date: "2024-04-21", type: 1, type_text: "全天休息", weekday: "周五", am: [], pm: [] - }, - ] - + // data.days = [ + // { + // date: "2024-04-17", type: 2, type_text: "上午出诊", weekday: "周一", + // am: [ + // { + // "start": "12:00", + // "end": "12:30", + // "bed_count": 0 + // }, + // { + // "start": "13:00", + // "end": "14:30", + // "bed_count": 2 + // } + // ], + // pm: [] + // }, + // { + // date: "2024-04-18", type: 5, type_text: "未开放预约", weekday: "周二", am: [], pm: [] + // }, + // { + // date: "2024-04-19", type: 3, type_text: "全天出诊", weekday: "周三", am: [ + // { + // "start": "12:00", + // "end": "12:30", + // "bed_count": 0 + // }, + // { + // "start": "13:00", + // "end": "14:30", + // "bed_count": 2 + // } + // ], pm: [ + // { + // "start": "12:00", + // "end": "12:30", + // "bed_count": 0 + // }, + // { + // "start": "13:00", + // "end": "14:30", + // "bed_count": 8 + // } + // ] + // }, + // { + // date: "2024-04-20", type: 4, type_text: "下午出诊", weekday: "周四", am: [], pm: [ + // { + // "start": "12:00", + // "end": "12:30", + // "bed_count": 0 + // }, + // { + // "start": "13:00", + // "end": "14:30", + // "bed_count": 1 + // } + // ] + // }, + // { + // date: "2024-04-21", type: 1, type_text: "全天休息", weekday: "周五", am: [], pm: [] + // }, + // ] + // if(!refresh){ // // data.days[3].pm[1].bed_count=0 // // data.days[3].type=1 @@ -227,6 +234,37 @@ closeConfirm() { this.$refs.sliderbox.closeConfirm() }, + 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 + + 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('请选择预约就诊人') + 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(data == -1) return + this.tips() + }); + }, appointCheck(times, chooseDay=''){ var param = new Object() param.start_time = times.start @@ -253,9 +291,7 @@ this.appointCheck(times, times.key) }, submitConfim(){ - uni.navigateTo({ - url:"/pages/index/index" - }) + this.appoint() } } }