xinelu-applet-ui/pagesC/choosedoctor/choosedoctor.vue
2024-06-25 18:25:50 +08:00

160 lines
3.8 KiB
Vue

<template>
<view class="app">
<view class="inputs" v-if="show==true">
<i class="icon"></i>
<input type="text" name="" id="" class="input" placeholder="请输入医生姓名" v-model="realname">
</view>
<view class="list" v-if="doctorlist.length>0">
<view class="item" v-for="item in doctorlist" @tap='emitdata(item)'>
<image :src="baseurl + '/profile/weChatPicture/docHead.png'" mode=""></image>
<view class="name">
{{item.realname?item.realname:''}}
</view>
<view class="address">
{{item.teamName?item.teamName:''}}
</view>
<view class="title">
{{item.teamMemberTypeName?item.teamMemberTypeName:''}}
</view>
<view class="zixunbtn" v-if="item.userNo==userNo">
已选择
</view>
<view class="zixunbtn nobtn" v-else>
选TA
</view>
</view>
</view>
<view class="list" v-if="list&&list.personName">
<view class="item" @tap='emitdata(item)'>
<image :src="baseurl + '/profile/weChatPicture/docHead.png'" mode=""></image>
<view class="name">
{{list.personName?list.personName:''}}
</view>
<view class="address">
{{list.personPhone?list.personPhone:''}}
</view>
<view class="zixunbtn" v-if="list.userNo==userNo">
已选择
</view>
<view class="zixunbtn nobtn" v-else>
选TA
</view>
</view>
</view>
</view>
</template>
<script>
import {
getDoctorList
} from '@/api/pagesC/choosedoctor/index.js'
import {
getDoctorListtwo
} from '@/api/pagesB/myfamilydoctorteam/index.js'
import baseurl from '../../api/baseurl';
export default {
data() {
return {
show: "",
orgNo: null,
userNo: null,
teamNo: null,
realname: '',
doctorlist: [],
doctortotal: 0,
list: null,
pageNum: 1,
baseurl: '',
};
},
watch: {
realname: {
handler(newval, oldval) {
this.pageNum = 1;
this.getDoctorListinfo();
}
}
},
methods: {
getDoctorListinfo() {
if (this.orgNo) {
getDoctorList(this.pageNum, this.orgNo, this.realname).then(res => {
this.doctorlist = res.rows
this.doctortotal = res.total
})
} else {
// getDoctorListtwo(this.pageNum, 10, this.teamNo, this.realname).then(res => {
// this.doctorlist = res.rows
// this.doctortotal = res.total
// })
}
},
emitdata(item) {
console.log(this.list, '474')
if (item) {
uni.$emit('doctordata', {
data: JSON.stringify(item),
})
uni.navigateBack({
delta: 1
});
} else {
uni.$emit('doctordata', {
data: JSON.stringify(this.list),
})
uni.navigateBack({
delta: 1
});
}
},
},
onLoad(options) {
this.baseurl = baseurl
if (options.static == "1") {
this.show = true
}
if (options.item) {
this.list = JSON.parse(options.item)
} else if (options.orgNo) {
this.orgNo = options.orgNo
this.userNo = options.userNo
this.getDoctorListinfo();
} else {
// this.teamNo = uni.getStorageSync('userinfo').teamNo
this.teamNo = "00bf7f5a02f3460aa975721ff9f5e533"
}
},
onReachBottom() { //上滑加载
if (this.doctorlist.length >= this.doctortotal) {} else {
this.pageNum++;
if (this.orgNo) {
getDoctorList(this.pageNum, this.orgNo, this.realname).then(res => {
res.rows.forEach(e => {
this.doctorlist.push(e)
})
this.doctortotal = res.total
})
} else {
getDoctorListtwo(this.pageNum, 10, this.teamNo, this.realname).then(res => {
res.rows.forEach(e => {
this.doctorlist.push(e)
})
this.doctortotal = res.total
})
}
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
this.getDoctorListinfo()
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
@import './choosedoctor.scss';
</style>