perry-mall/pagesB/doctor/doctor.vue

178 lines
5.9 KiB
Vue
Raw Normal View History

2022-02-12 11:33:47 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'医生'" :statusTitle="true"></status-nav>
<!-- 自定义二级分类 -->
<!-- 列表 -->
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30">
<view class="radius20 fon28 col3 mar-s20">
<view class="disac">
<view class="disjbac width100 radius10 pad-zy20 xialak bacf">
<input class="fon28 width100" @confirm="searchEv" type="text" v-model="keyword" placeholder="请输入问题/病种/医生姓名" placeholder-style="color: #B3B3B3;" />
</view>
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
</view>
</view>
</view>
<view class="pad-zy20 mar-sx30 pad-x180">
<!-- 列表 -->
<view class="fon28 col3 bold qdoctor disac">全部医生</view>
<view class="mar-s30" v-if="dataList.length!=0">
<!-- 医生列表 -->
<list-doctor :list="dataList"></list-doctor>
</view>
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 50%;">
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
<view v-if="keyword!=''" class="fon24 col3"></view>
<view v-if="keyword==''" class="fon24 col3"></view>
</view>
<!-- 返回顶部 -->
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
</view>
<!-- 底部客服 -->
<!-- <public-customer :nbottom="120"></public-customer> -->
<!-- 弹框授权 -->
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
<!-- 弹框 -->
<auth-phone v-if="isShowP"></auth-phone>
<!-- 底部导航 -->
<view class="posixzy">
<bottom-tab></bottom-tab>
</view>
</view>
</template>
<script>
import listDoctor from '@/components/list-doctor.vue';
import bottomTab from '@/components/bottom-tab.vue';
export default {
components:{
listDoctor,
bottomTab
},
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),//主题颜色
dataList:[
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
],
showTop:false,
page:1,
size:20,
total:'',//总数
isZanw:true,
keyword:'',
vision:false,
isShowP:false,
}
},
onShareAppMessage() {
var shareObj = {
path: `/pagesB/doctor/doctor?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
};
return shareObj;
},
onPageScroll(e) {
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
},
onReachBottom() {//触底事件
if(this.total!=this.dataList.length){
this.page++
this.checkDor()//调用自主预约列表事件
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
this.isZanw = false
}
},
onShow() {
},
onLoad(options) {
if(uni.getStorageSync('is_active')!=1){this.vision = true;} else {this.$toolAll.tools.isLogin()}
if(options.invite_code!='' && options.invite_code!=undefined){
this.loginEv(options.invite_code);
} else if(options.source_code!='' && options.source_code!=undefined){
this.loginEv('',options.source_code,options.channel);
}
this.checkDor()
},
methods: {
loginEv(invite_code='',source='',channel=''){
uni.login({
provider: 'weixin',
success: (res)=> {
if (res.code) {
var params = {
code:res.code,
invite_code:invite_code,//用户邀请码
source_code:source,
channel:channel
}
this.$requst.post('user/login',params).then(res => {
if(res.data.token!=''){
if(res.data.is_active==0) {
this.haveImg = false;
this.vision = true;
}
}
},error => {})
}
},
});
},
buttonH(e){//授权成功
this.haveImg = e
if(e) {
this.vision = false
this.isShowP = true
}
},
checkDor(){//查询医生列表事件
this.$requst.post('user/doctor-list',{page:this.page,size:this.size,keyword:this.keyword}).then(res=>{
// console.log('医生列表:',res);
if(res.code==0){
if(this.page==1) this.dataList = []
if(res.data.list.length!=0){
this.total = res.data.total
res.data.list.forEach(item=>{
let newG = item.diseases
let ndeptName = ''
if(item.doctor_extra.dept_name==undefined || item.doctor_extra.dept_name=='') ndeptName = item.dept_name
else ndeptName = item.doctor_extra.dept_name
let dObj = {
id:item.id,
imgSrc:item.doctor_extra.headimg,//医生头像
name:item.doctor_extra.name,//医生姓名
cyear:parseFloat(item.doctor_extra.work_time),//工作年限
bmen:ndeptName,//部门
zcheng:'主任医师',
goodAt:item.diseases,
show_detail:item.doctor_extra.show_detail//是否可查看详情1是0否
}
this.dataList.push(dObj)
})
}
}
},error=>{})
},
backTop(){//回到顶部事件
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
searchEv(){
this.checkDor()
}
}
}
</script>
<style>
</style>