You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
477 lines
13 KiB
477 lines
13 KiB
<template>
|
|
<view class='add-visitor-page'>
|
|
<view class="header block flex line40" @click="addVisitor">
|
|
<img :src="cssUrl+'add.svg'">增加就诊人
|
|
</view>
|
|
<view class="list-wrapper" v-if="type == 1">
|
|
<view :class="'item block'+(item.select?' active':'')" v-for="(item,key) in visitUsers" @click="chooseVisitor(item, key)">
|
|
<view class="top flex">
|
|
<view class="name PfScSemibold">{{item.real_name}}</view>
|
|
<view class="aam_times" v-if="item.aam_times">剩余{{item.aam_times}}次</view>
|
|
</view>
|
|
<view class="bot line36">
|
|
身份证尾号:{{item.id_no}}
|
|
</view>
|
|
<img class="status" :src="cssUrl+'visitor_select_active.svg'">
|
|
<img class="bg" :src="cssUrl+'visitor_list__bg.svg'">
|
|
</view>
|
|
</view>
|
|
<view class="submit" v-if="type == 1" @click="toPrebook">
|
|
<view class="bot primary btn btn2 submitbtn" hover-class="hover">
|
|
确认预约(已选{{selectCount}}位)
|
|
</view>
|
|
<view class="tip height40">请确保预约就诊前在门诊先挂号</view>
|
|
</view>
|
|
|
|
<view class="list-wrapper2" v-if="type == 2">
|
|
<view class="item block" v-for="(item,key) in visitUsers">
|
|
<view class="top flex" @click="vistorOption(item)">
|
|
<view class="PfScSemibold">{{item.real_name}}</view>
|
|
<view>身份证尾号:{{item.id_no}}</view>
|
|
</view>
|
|
<view class="bt" v-if="item.hospital_info.length>0">
|
|
<view class="bt-item flex" v-for="(item2,key2) in item.hospital_info" @click="showNotice(item2.popmsgIndex)">
|
|
<view class="left flex">
|
|
<view class="over3">{{item2.hospital_name}} {{item2.hospital_dept}}</view>
|
|
<view class="status2" v-if="!item2.hospital_state">停诊</view>
|
|
<view class="status2" v-else-if="item2.is_expire">{{item2.expire_day}}未看病</view>
|
|
</view>
|
|
|
|
<view class="more right" v-if="item2.times>=0">剩余<text>{{item2.times}}</text>次</view>
|
|
<view class="owe right" v-else>超<text>{{-item2.times}}</text>次</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<pop
|
|
ref="popcom"
|
|
:content="popContent"
|
|
:title="popTitle"
|
|
:index="popIndex"
|
|
:showCancel='popShowCancel'
|
|
@confirm="popConfirm"
|
|
@cancel="popCancel"
|
|
></pop>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import pop from '@/components/pop.vue';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
cssUrl:this.cssUrl,
|
|
type:1,
|
|
res:true,
|
|
popContent:'删除张杨明后,就诊记录还可以查到,确定删除吗?',
|
|
popTitle:'确认删除',
|
|
popShowCancel:true,
|
|
visitUsers:false,
|
|
selectCount:0,
|
|
hospitalId:false,
|
|
activeVisitors:[],
|
|
popMsgs:[],
|
|
popIndex:0
|
|
}
|
|
},
|
|
components:{
|
|
pop
|
|
},
|
|
onLoad(option) {
|
|
if(option.type) {
|
|
this.type = option.type
|
|
}else{
|
|
var type = uni.getStorageSync('visitor_type')
|
|
if(type) this.type = type
|
|
}
|
|
|
|
uni.setStorageSync('visitor_type', this.type)
|
|
|
|
this.getVisitors()
|
|
this.hospitalId = uni.getStorageSync('hospital_id')
|
|
if(!this.hospitalId && this.type == 1) {
|
|
this.$pop.modelShow('请先选择要预约的医院', '/pages/index/index')
|
|
return
|
|
}
|
|
},
|
|
onShow() {
|
|
if(this.type == 2){
|
|
uni.setNavigationBarTitle({
|
|
title:'就诊人'
|
|
})
|
|
}else{
|
|
uni.setNavigationBarTitle({
|
|
title:'请选择就诊人'
|
|
})
|
|
}
|
|
},
|
|
methods: {
|
|
modifyVistor(visitor){
|
|
uni.setStorageSync('visitor_info_'+visitor.id, JSON.stringify(visitor))
|
|
this.$func.toPage("/pages/modify_visitor/modify_visitor?type="+this.type+'&vid='+visitor.id)
|
|
},
|
|
delVistor(visitor){
|
|
var that = this
|
|
uni.showModal({
|
|
title:'删除',
|
|
content:'确认删除就诊人('+visitor.real_name+')?',
|
|
success(res) {
|
|
if(!res.confirm) return
|
|
that.$http.req('client/user/visit_user/'+visitor.id, {}, 'DELETE').then(data=>{
|
|
if(data == -1) return
|
|
that.getVisitors()
|
|
});
|
|
}
|
|
})
|
|
},
|
|
vistorOption(visitor){
|
|
var that = this
|
|
uni.showActionSheet({
|
|
itemList: ['修改就诊人信息', '删除就诊人'],
|
|
success: function (res) {
|
|
if(res.tapIndex == 0){
|
|
that.modifyVistor(visitor)
|
|
return
|
|
}
|
|
if(res.tapIndex == 1){
|
|
that.delVistor(visitor)
|
|
return
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
}
|
|
});
|
|
console.log(visitor)
|
|
},
|
|
chooseVisitor(info, key){
|
|
this.selectCount = 0
|
|
this.visitUsers[key].select = !this.visitUsers[key].select
|
|
this.$set(this.visitUsers, key, this.visitUsers[key])
|
|
for (var i = 0; i < this.visitUsers.length; i++) {
|
|
if(this.visitUsers[i].select) ++this.selectCount
|
|
}
|
|
},
|
|
getVisitors() {
|
|
var param = new Object()
|
|
param.page = 1
|
|
param.limit = 10000
|
|
this.$http.req('client/user/visit_user/', param, 'GET').then(data=>{
|
|
if(data == -1) return
|
|
var server_time = data.server_time
|
|
this.visitUsers = data.data
|
|
this.popMsgs = []
|
|
var popmsgIndex = 0
|
|
for (var i = 0; i < this.visitUsers.length; i++) {
|
|
this.visitUsers[i].select = false
|
|
// this.visitUsers[i].hospital_info = [
|
|
// {
|
|
// "times": -1,
|
|
// "hospital_name": "测试医院",
|
|
// "hospital_dept": "呼吸科",
|
|
// "hospital_state": true,
|
|
// "is_expire":true,
|
|
// "last_visit_time": "2021-01-12 13:16:26"
|
|
// },
|
|
|
|
// {
|
|
// "times": 10,
|
|
// "hospital_name": "测试医院",
|
|
// "hospital_dept": "呼吸科",
|
|
// "hospital_state": true,
|
|
// "is_expire":true,
|
|
// "last_visit_time": "2021-01-12 13:16:26"
|
|
// }
|
|
// ]
|
|
|
|
try{
|
|
var dateService = new Date(server_time.replaceAll('-', "/"));
|
|
var timestampService = Math.floor(dateService)/1000;
|
|
var hospitalInfo = this.visitUsers[i].hospital_info
|
|
for (var j = 0; j < hospitalInfo.length; j++) {
|
|
var datestr = new Date(hospitalInfo[j].last_visit_time.replaceAll('-', "/"));
|
|
var timestamp = Math.floor(datestr)/1000;
|
|
var visitTimeDayTotal = Math.floor((timestampService-timestamp)/3600/24)
|
|
if(visitTimeDayTotal>0 && visitTimeDayTotal < 7) hospitalInfo[j].expire_day = visitTimeDayTotal+'天'
|
|
if(visitTimeDayTotal>=7) hospitalInfo[j].expire_day = Math.floor(visitTimeDayTotal/7)+'周'
|
|
if(visitTimeDayTotal>=365) hospitalInfo[j].expire_day = Math.floor(visitTimeDayTotal/365)+'年'
|
|
if(!hospitalInfo[j].expire_day) {
|
|
var visitTimeMinute = Math.floor((timestampService-timestamp)/60)
|
|
if(visitTimeMinute <= 0) hospitalInfo[j].expire_day = (timestampService-timestamp)+'秒'
|
|
if(visitTimeMinute >= 1 && visitTimeMinute<60) hospitalInfo[j].expire_day = Math.floor((timestampService-timestamp)/60)+'分'
|
|
if(visitTimeMinute>=60) hospitalInfo[j].expire_day = Math.floor((visitTimeMinute)/60)+'小时'
|
|
}
|
|
|
|
if(!hospitalInfo[j].hospital_state) continue
|
|
|
|
var popobj = new Object()
|
|
popobj.popShowCancel = false
|
|
if(hospitalInfo[j].is_expire){
|
|
popobj.popContent = this.visitUsers[i].real_name+'已<span style="color:red;">'+hospitalInfo[j].expire_day+'</span>没有来'+hospitalInfo[j].hospital_name+hospitalInfo[j].hospital_dept+'针灸。如还需要,请尽快安排'
|
|
popobj.popTitle = "提醒"
|
|
}
|
|
|
|
if(hospitalInfo[j].times < 0){
|
|
popobj.popContent = this.visitUsers[i].real_name+'在'+hospitalInfo[j].hospital_name+hospitalInfo[j].hospital_dept+'须补挂号啦,请挂号缴费后告知医生'
|
|
popobj.popTitle = "挂号提醒"
|
|
}
|
|
popmsgIndex = this.popMsgs.length
|
|
this.visitUsers[i].hospital_info[j].popmsgIndex = popmsgIndex
|
|
this.popMsgs.push(popobj)
|
|
}
|
|
}catch(et){
|
|
}
|
|
}
|
|
|
|
if(this.popMsgs.length > 0 && !uni.getStorageSync('has_noticed')){
|
|
this.popIndex = 0
|
|
var popinfo = this.popMsgs[this.popIndex]
|
|
this.popContent = popinfo.popContent
|
|
this.popTitle = popinfo.popTitle
|
|
this.popIndex = popinfo.popIndex
|
|
this.popShowCancel = popinfo.popShowCancel
|
|
this.showPopCom()
|
|
}
|
|
});
|
|
},
|
|
showPopCom() {
|
|
this.$refs.popcom.open()
|
|
},
|
|
closePopCom() {
|
|
this.$refs.popcom.close()
|
|
},
|
|
popConfirm(e, index){
|
|
if(!uni.getStorageSync('has_noticed')){
|
|
if(this.popMsgs.length > 0 && index<(this.popMsgs.length-1)){
|
|
this.popIndex = index+1
|
|
var popinfo = this.popMsgs[this.popIndex]
|
|
this.popContent = popinfo.popContent
|
|
this.popTitle = popinfo.popTitle
|
|
this.popShowCancel = popinfo.popShowCancel
|
|
this.showPopCom()
|
|
}else{
|
|
uni.setStorageSync('has_noticed', 1)
|
|
this.closePopCom()
|
|
}
|
|
}
|
|
},
|
|
showNotice(popmshIndex){
|
|
var popinfo = this.popMsgs[popmshIndex]
|
|
this.popContent = popinfo.popContent
|
|
this.popTitle = popinfo.popTitle
|
|
this.popShowCancel = popinfo.popShowCancel
|
|
this.showPopCom()
|
|
},
|
|
popCancel(e){
|
|
},
|
|
addVisitor(){
|
|
uni.navigateTo({
|
|
url:"/pages/modify_visitor/modify_visitor?type="+this.type
|
|
})
|
|
},
|
|
toPrebook(){
|
|
if(this.selectCount <= 0){
|
|
this.$pop.modelShow('请选择就诊人')
|
|
return
|
|
}
|
|
|
|
this.activeVisitors = []
|
|
for (var i = 0; i < this.visitUsers.length; i++) {
|
|
if(this.visitUsers[i].select) this.activeVisitors.push(this.visitUsers[i])
|
|
}
|
|
|
|
uni.setStorageSync('active_visitors', JSON.stringify(this.activeVisitors))
|
|
uni.navigateTo({
|
|
url:"/pages/prebook/prebook"
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.add-visitor-page{
|
|
overflow: hidden;
|
|
.block{
|
|
width: 714rpx;
|
|
background: #FFFFFF;
|
|
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0,0,0,0.03);
|
|
border-radius: 12rpx;
|
|
margin: 20rpx auto 0;
|
|
}
|
|
.header{
|
|
justify-content: center;
|
|
height: 96rpx;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
color: #666666;
|
|
img{
|
|
width: 44rpx;
|
|
height: 44rpx;
|
|
margin-right: 16rpx;
|
|
}
|
|
}
|
|
.list-wrapper{
|
|
height: 70vh;
|
|
padding-bottom: 20rpx;
|
|
overflow-y: auto;
|
|
box-sizing: border-box;
|
|
.item{
|
|
padding: 34rpx 24rpx;
|
|
box-sizing: border-box;
|
|
height: 196rpx;
|
|
position: relative;
|
|
.top{
|
|
line-height: 50rpx;
|
|
height: 50rpx;
|
|
align-items: center;
|
|
.name{
|
|
font-size: 38rpx;
|
|
color: #333333;
|
|
letter-spacing: 3rpx;
|
|
}
|
|
.aam_times{
|
|
min-width: 134rpx;
|
|
color: #79624A;
|
|
text-align: center;
|
|
font-size: 28rpx;
|
|
background: rgba(254, 232, 198, 0.66);
|
|
border-radius: 6rpx;
|
|
height: 44rpx;
|
|
padding: 0 10rpx;
|
|
line-height: 44rpx;
|
|
margin-left: 56rpx;
|
|
}
|
|
}
|
|
.bot{
|
|
margin-top: 32rpx;
|
|
font-size: 30rpx;
|
|
color: #949699;
|
|
}
|
|
img{
|
|
position: absolute;
|
|
}
|
|
&.active{
|
|
border: 2rpx solid #39D067;
|
|
.status{
|
|
display: block;
|
|
}
|
|
}
|
|
.status{
|
|
right: 0;
|
|
top: 0;
|
|
width: 98rpx;
|
|
height: 98rpx;
|
|
display: none;
|
|
}
|
|
.bg{
|
|
bottom: 0;
|
|
right: 0;
|
|
width: 162rpx;
|
|
height: 78rpx;
|
|
}
|
|
}
|
|
}
|
|
.submit{
|
|
position: fixed;
|
|
width: 100%;
|
|
top: 82.41%;
|
|
.submitbtn{
|
|
width: 646rpx;
|
|
margin: 0 auto;
|
|
}
|
|
.tip{
|
|
text-align: center;
|
|
font-size: 28rpx;
|
|
color: #B3B4BC;
|
|
margin-top: 33rpx;
|
|
}
|
|
}
|
|
.list-wrapper2{
|
|
.item{
|
|
.top{
|
|
background: #5CD378;
|
|
width: 100%;
|
|
height: 118rpx;
|
|
line-height: 118rpx;
|
|
box-sizing: border-box;
|
|
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0,0,0,0.03), 0rpx 2rpx 24rpx 0rpx rgba(0,0,0,0.03);
|
|
border-radius: 8rpx 8rpx 0rpx 0rpx;
|
|
padding: 0 24rpx 0 24rpx;
|
|
justify-content: space-between;
|
|
color: #FFFFFF;
|
|
view:first-of-type{
|
|
font-size: 38rpx;
|
|
letter-spacing: 3rpx;
|
|
}
|
|
view:last-of-type{
|
|
font-size: 28rpx;
|
|
letter-spacing: 2rpx;
|
|
}
|
|
}
|
|
.bt{
|
|
padding: 30rpx;
|
|
min-height: 118rpx;
|
|
box-sizing: border-box;
|
|
.bt-item{
|
|
min-height: 55rpx;
|
|
align-items: flex-end;
|
|
align-items:center;
|
|
margin-bottom: 24rpx;
|
|
.left{
|
|
max-width: 580rpx;
|
|
align-items:center;
|
|
view:first-of-type{
|
|
min-height: 40rpx;
|
|
line-height: 40rpx;
|
|
font-size: 28rpx;
|
|
color: #949699;
|
|
letter-spacing: 2rpx;
|
|
max-width: 250rpx;
|
|
align-items: flex-end;
|
|
}
|
|
|
|
.status2{
|
|
height: 38rpx;
|
|
background: #FFE9E9;
|
|
line-height: 38rpx;
|
|
padding: 0 7rpx;
|
|
font-size: 28rpx;
|
|
color: #FD0000;
|
|
margin-left: 8rpx;
|
|
}
|
|
}
|
|
.right{
|
|
flex-grow: 1;
|
|
&.more{
|
|
font-size: 28rpx;
|
|
color: #949699;
|
|
letter-spacing: 2rpx;
|
|
text-align: right;
|
|
text{
|
|
font-size: 52rpx;
|
|
color: #000000;
|
|
letter-spacing: 3rpx;
|
|
}
|
|
}
|
|
&.owe{
|
|
text-align: right;
|
|
font-size: 28rpx;
|
|
color: #FD0000;
|
|
letter-spacing: 2rpx;
|
|
line-height: 52rpx;
|
|
text{
|
|
font-size: 52rpx;
|
|
color: #FD0000;
|
|
line-height: 52rpx;
|
|
letter-spacing: 3rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|