xinelu-applet-ui/pagesC/choosedoctor/choosedoctor.vue
2023-10-16 11:28:16 +08:00

121 lines
2.8 KiB
Vue

<template>
<view class="app">
<view class="inputs">
<i class="icon"></i>
<input type="text" name="" id="" class="input" placeholder="请输入医生姓名" v-model="realname">
</view>
<view class="list">
<view class="item" v-for="item in doctorlist" @tap='emitdata(item)'>
<image src="../../static/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>
</template>
<script>
import {
getDoctorList
} from '@/api/pagesC/choosedoctor/index.js'
import {
getDoctorListtwo
} from '@/api/pagesB/myfamilydoctorteam/index.js'
export default {
data() {
return {
orgNo: null,
userNo: null,
teamNo: null,
realname: '',
doctorlist: [],
doctortotal: 0,
pageNum: 1,
};
},
watch: {
realname: {
handler(newval, oldval) {
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) {
uni.$emit('doctordata', {
data: JSON.stringify(item),
})
uni.navigateBack({
delta: 1
});
},
},
onLoad(options) {
if (options.orgNo) {
this.orgNo = options.orgNo
this.userNo = options.userNo
} else {
// this.teamNo = uni.getStorageSync('userinfo').teamNo
this.teamNo = "00bf7f5a02f3460aa975721ff9f5e533"
}
this.getDoctorListinfo();
},
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>