myDoctorList.vue 5.3 KB

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