doctorList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view>
  3. <u-sticky class="top-fixed">
  4. <view class="search-cont">
  5. <view class="inner">
  6. <image class="icon-search" src="/static/images/icon_search.png" mode=""></image>
  7. <input type="text" v-model="keyword" placeholder="输入医生姓名搜索" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  8. </view>
  9. </view>
  10. <u-tabs
  11. :current="tabIndex"
  12. :scrollable="true"
  13. :list="tabs"
  14. lineColor="#FF5C03"
  15. @change="deptChange">
  16. </u-tabs>
  17. </u-sticky>
  18. <view class="content">
  19. <mescroll-body top="0" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  20. <view class="doctors" v-if="dataList.length>0">
  21. <view class="doctor-box">
  22. <view class="doctor" @click="navTo('/pages/doctor/doctorDetails?doctorId='+item.doctorId)" v-for="(item,index) in dataList">
  23. <view class="item">
  24. <view class="left">
  25. <view class="head-box">
  26. <image mode="aspectFill" class="doc-img" :src="item.avatar"></image>
  27. <view class="isline" v-if="item.workStatus==1">
  28. <view class="img">
  29. <image src="../../static/images/isline.png"></image>
  30. <view class="name">在线</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="right">
  36. <view class="doc-box">
  37. <view class="doc-name">
  38. {{item.doctorName}}
  39. </view>
  40. <view class="doc-position">{{item.position}}</view>
  41. <view class="doc-dept">{{item.deptName}}</view>
  42. </view>
  43. <view class="hospital-box">
  44. <!-- <view class="tag" v-if="item.hospitalLevel!=null">
  45. <text>{{$getDictLabelName(hosLevelOptions,item.hospitalLevel)}}</text>
  46. </view> -->
  47. <view class="name">{{item.hospitalName}} </view>
  48. </view>
  49. <view class="doc-spec">
  50. <view class="spec ellipsis2">{{item.speciality}}</view>
  51. </view>
  52. <view class="doc-count">
  53. <view class="name">好评:</view>
  54. <view class="count">{{item.pingStar}}分</view>
  55. <view class="name">接诊量:</view>
  56. <view class="count">{{item.orderNumber}}</view>
  57. <view class="name">平均响应:</view>
  58. <view class="count">{{item.speed}}分钟</view>
  59. </view>
  60. <view class="doc-price" >
  61. <view class="btn">
  62. 咨询医生¥
  63. <text v-for="(price,index) in item.prices">
  64. {{price.price ? price.price.toFixed(2) : '0.00'}} <text v-if="index==0">/</text>
  65. </text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </mescroll-body>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  79. import {getDoctorList} from '@/api/doctor.js'
  80. import {getDepartmentList} from '@/api/department.js'
  81. import {getDictByKey} from '@/api/common.js'
  82. export default {
  83. mixins: [MescrollMixin], // 使用mixin
  84. data() {
  85. return {
  86. keyword: '',
  87. hosLevelOptions:[],
  88. tabIndex:0,
  89. tabs:[
  90. {name:"全部",deptId:0}
  91. ],
  92. deptId:0,
  93. mescroll:null,
  94. downOption: { //下拉刷新
  95. use:true,
  96. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  97. },
  98. upOption: {
  99. onScroll:false,
  100. use: true, // 是否启用上拉加载; 默认true
  101. page: {
  102. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  103. size: 10 // 每页数据的数量,默认10
  104. },
  105. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  106. textNoMore:"已经到底了",
  107. empty: {
  108. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  109. tip: '暂无数据'
  110. }
  111. },
  112. dataList: []
  113. }
  114. },
  115. onLoad(options) {
  116. if(options.deptId!=null){
  117. this.deptId=options.deptId;
  118. }
  119. if(options.keyword!=null){
  120. this.keyword=options.keyword;
  121. }
  122. this.getDictByKey("sys_hospital_level");
  123. this.getDepartmentList()
  124. },
  125. onShow() {
  126. },
  127. methods: {
  128. doSearch(){
  129. this.mescroll.resetUpScroll()
  130. },
  131. getDictByKey(key){
  132. var data={key:key}
  133. getDictByKey(data).then(
  134. res => {
  135. if(res.code==200){
  136. if(key=="sys_hospital_level"){
  137. this.hosLevelOptions=res.data;
  138. }
  139. }
  140. },
  141. err => {
  142. }
  143. );
  144. },
  145. getDepartmentList(page) {
  146. var that = this;
  147. var data = {
  148. };
  149. getDepartmentList(data).then(res => {
  150. if(res.code==200){
  151. res.data.forEach(function(value,index,array){
  152. var data={name:value.deptName,deptId:value.deptId}
  153. that.tabs.push(data);
  154. if(value.deptId==that.deptId){
  155. that.tabIndex=index+1;
  156. console.log(that.tabIndex)
  157. }
  158. });
  159. }else{
  160. uni.showToast({
  161. icon:'none',
  162. title: "请求失败",
  163. });
  164. }
  165. });
  166. },
  167. deptChange(item){
  168. this.deptId=item.deptId
  169. this.mescroll.resetUpScroll()
  170. },
  171. navTo(url){
  172. uni.navigateTo({
  173. url: url
  174. })
  175. },
  176. mescrollInit(mescroll) {
  177. this.mescroll = mescroll;
  178. },
  179. /*下拉刷新的回调 */
  180. downCallback() {
  181. this.mescroll.resetUpScroll()
  182. },
  183. /*上拉加载的回调*/
  184. upCallback(page) {
  185. //联网加载数据
  186. var that = this;
  187. var data = {
  188. keyword:this.keyword,
  189. deptId:this.deptId,
  190. pageNum: page.num,
  191. pageSize: page.size
  192. };
  193. getDoctorList(data).then(res => {
  194. if(res.code==200){
  195. if (page.num == 1) {
  196. res.data.list.forEach(function(value,index,array){
  197. value.prices=JSON.parse(value.priceJson)
  198. });
  199. that.dataList = res.data.list;
  200. } else {
  201. that.dataList = that.dataList.concat(res.data.list);
  202. }
  203. that.mescroll.endBySize(res.data.list.length, res.data.total);
  204. }else{
  205. uni.showToast({
  206. icon:'none',
  207. title: "请求失败",
  208. });
  209. that.dataList = null;
  210. that.mescroll.endErr();
  211. }
  212. });
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss">
  218. page{
  219. height: 100%;
  220. background: #f6f6f6;
  221. }
  222. </style>
  223. <style scoped lang="scss">
  224. .search-cont{
  225. // position:fixed;
  226. height: 88upx;
  227. // top: 88upx;
  228. // left: 0;
  229. // z-index: 10;
  230. width: 100%;
  231. padding: 16upx 30upx;
  232. background-color: #FFFFFF;
  233. .inner{
  234. box-sizing: border-box;
  235. width: 100%;
  236. height: 72upx;
  237. background: #F7F7F7;
  238. border-radius: 36upx;
  239. display: flex;
  240. align-items: center;
  241. padding: 0 30upx;
  242. .icon-search{
  243. width: 28upx;
  244. height: 28upx;
  245. margin-right: 20upx;
  246. }
  247. input{
  248. height: 60upx;
  249. line-height: 60upx;
  250. flex: 1;
  251. }
  252. }
  253. }
  254. .top-fixed{
  255. width: 100%;
  256. height: 176rpx;
  257. background-color: #fff !important;
  258. }
  259. .content{
  260. height: 100%;
  261. padding: 0rpx 20rpx;
  262. box-sizing: border-box;
  263. .doctors{
  264. margin: 15rpx 0rpx;
  265. padding: 15rpx;
  266. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  267. background-color: #fff;
  268. border-radius: 15rpx;
  269. .title-box{
  270. display: flex;
  271. flex-direction: row;
  272. align-items: center;
  273. justify-content: flex-start;
  274. .title{
  275. font-size: 32upx;
  276. font-family: PingFang SC;
  277. font-weight: bold;
  278. color: #111111;
  279. }
  280. .line{
  281. margin-right: 15rpx;
  282. height: 30rpx;
  283. width: 6rpx;
  284. background-color: #C39A58;
  285. }
  286. }
  287. }
  288. }
  289. </style>