doctorList.vue 7.4 KB

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