myDoctorList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="content">
  3. <u-sticky>
  4. <view class="top-fixed">
  5. <u-tabs
  6. :current="type"
  7. :scrollable="false"
  8. :list="tabs"
  9. lineColor="#2583EB"
  10. @change="typeChange">
  11. </u-tabs>
  12. </view>
  13. </u-sticky>
  14. <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  15. <view class="doctors">
  16. <view class="doctor-box">
  17. <view class="doctor" @click="navTo('/pages/doctor/doctorDetails?doctorId='+item.doctorId)" v-for="(item,index) in dataList">
  18. <view class="item">
  19. <view class="left">
  20. <view class="head-box">
  21. <image mode="aspectFill" class="doc-img" :src="item.avatar"></image>
  22. <view class="isline" v-if="item.workStatus==1">
  23. <view class="img">
  24. <image src="../../static/images/isline.png"></image>
  25. <view class="name">在线</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="right">
  31. <view class="doc-box">
  32. <view class="doc-name">
  33. {{item.doctorName}}
  34. </view>
  35. <view class="doc-position">{{item.position}}</view>
  36. <view class="doc-dept">{{item.deptName}}</view>
  37. </view>
  38. <view class="hospital-box">
  39. <view class="tag">
  40. <text>{{$getDictLabelName(hosLevelOptions,item.hospitalLevel)}}</text>
  41. </view>
  42. <view class="name">{{item.hospitalName}} </view>
  43. </view>
  44. <view class="doc-spec">
  45. <view class="spec ellipsis2">{{item.speciality}}</view>
  46. </view>
  47. <view class="doc-count">
  48. <view class="name">好评:</view>
  49. <view class="count">{{item.pingStar}}分</view>
  50. <view class="name">接诊量:</view>
  51. <view class="count">{{item.pingStar}}</view>
  52. <view class="name">平均响应:</view>
  53. <view class="count"></view>
  54. </view>
  55. <view class="doc-price" >
  56. <view class="btn">
  57. 咨询医生¥
  58. <text v-for="(price,index) in item.prices">
  59. {{price.price.toFixed(2)}} <text v-if="index==0">/</text>
  60. </text>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </mescroll-body>
  69. </view>
  70. </template>
  71. <script>
  72. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  73. import {getMyDoctorList} from '@/api/doctor.js'
  74. import {getDictByKey} from '@/api/common.js'
  75. export default {
  76. mixins: [MescrollMixin], // 使用mixin
  77. data() {
  78. return {
  79. hosLevelOptions:[],
  80. tabs:[
  81. {
  82. index:1,
  83. name:'关注医生'
  84. },
  85. {
  86. index:2,
  87. name:'签约医生'
  88. }
  89. ],
  90. type: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://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/cf4a86b913a04341bb44e34bb4d37aa2.png',
  107. tip: '暂无数据'
  108. }
  109. },
  110. dataList: []
  111. }
  112. },
  113. onLoad(options) {
  114. this.getDictByKey("sys_hospital_level");
  115. },
  116. methods: {
  117. getDictByKey(key){
  118. var data={key:key}
  119. getDictByKey(data).then(
  120. res => {
  121. if(res.code==200){
  122. if(key=="sys_hospital_level"){
  123. this.hosLevelOptions=res.data;
  124. }
  125. }
  126. },
  127. err => {
  128. }
  129. );
  130. },
  131. typeChange(item){
  132. this.type=item.index
  133. console.log(this.type)
  134. this.mescroll.resetUpScroll()
  135. },
  136. navTo(url){
  137. uni.navigateTo({
  138. url: url
  139. })
  140. },
  141. mescrollInit(mescroll) {
  142. this.mescroll = mescroll;
  143. },
  144. /*下拉刷新的回调 */
  145. downCallback() {
  146. this.mescroll.resetUpScroll()
  147. },
  148. /*上拉加载的回调*/
  149. upCallback(page) {
  150. //联网加载数据
  151. var that = this;
  152. var data = {
  153. type:this.type+1,
  154. pageNum: page.num,
  155. pageSize: page.size
  156. };
  157. getMyDoctorList(data).then(res => {
  158. if(res.code==200){
  159. if (page.num == 1) {
  160. res.data.list.forEach(function(value,index,array){
  161. value.prices=JSON.parse(value.priceJson)
  162. });
  163. that.dataList = res.data.list;
  164. } else {
  165. that.dataList = that.dataList.concat(res.data.list);
  166. }
  167. that.mescroll.endBySize(res.data.list.length, res.data.total);
  168. }else{
  169. uni.showToast({
  170. icon:'none',
  171. title: "请求失败",
  172. });
  173. that.dataList = null;
  174. that.mescroll.endErr();
  175. }
  176. });
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="scss">
  182. page{
  183. height: 100%;
  184. background: #f6f6f6;
  185. }
  186. </style>
  187. <style scoped lang="scss">
  188. .content{
  189. // height: 100%;
  190. .top-fixed{
  191. width: 100%;
  192. position: absolute;
  193. top: 0;
  194. left: 0;
  195. z-index: 10;
  196. height: 88upx;
  197. background-color: #fff;
  198. }
  199. }
  200. .doctors{
  201. margin: 15rpx;
  202. padding: 15rpx;
  203. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  204. background-color: #fff;
  205. border-radius: 15rpx;
  206. box-sizing: border-box;
  207. }
  208. </style>