select_doctor.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <view class="">
  3. <view class="margin-bottom-sm bg-white">
  4. <u-dropdown>
  5. <u-dropdown-item @change="allserive" v-model="value1" :title="options1[value1].label" :options="options1"></u-dropdown-item>
  6. <u-dropdown-item @change="city" v-model="value2" :title="options2[value2].label" :options="options2"></u-dropdown-item>
  7. <u-dropdown-item @change="recommend" v-model="value3" :title="options3[value3].label" :options="options3"></u-dropdown-item>
  8. </u-dropdown>
  9. <view class="main">
  10. <u-search :clearabled="false" shape="round" :show-action="false" placeholder="搜索医生姓名、医院名" v-model="keyword"></u-search>
  11. <view class="margin-top-sm text-df text-bold" @click="xuanzetime" v-if="istime">
  12. 选择时间:{{showtime}}
  13. <u-picker mode="multiSelector" @confirm="callbacktime" v-model="show" :default-selector='[0, 1]' range-key="start_time_period"
  14. :range="multiSelector"></u-picker>
  15. </view>
  16. <view style="width: 100%;">
  17. <view class="recommendstyle margin-top-sm" v-for="(item,index) in doctorList" :key="index">
  18. <view class="base_item" @click="gotoinfo" :data-id="item.id">
  19. <view class="base_item_zi">
  20. <view class="base_item_zi_items">
  21. <view class="base_item_zi_content">
  22. <u-image :fade="true" duration="450" width="120rpx" height="120rpx" :src="item.avatar" shape="circle">
  23. </u-image>
  24. <view class="follow_style" @click.stop="submitCollect" :data-index="index" :data-id="item.id" v-if="item.is_collect==0">
  25. 关注
  26. </view>
  27. <view class="follow_style" @click.stop="submitCollect" :data-index="index" :data-id="item.id" style="background-color: #fff;color: rgb(208, 105, 150);border:2rpx solid rgb(208, 105, 150);"
  28. v-else>
  29. 已关注
  30. </view>
  31. <view class="content_right">
  32. <view class="" style="display: flex;align-items: center;">
  33. <text style="font-size: 32rpx; font-weight: bold;">{{item.name}}</text>
  34. <text class="text_style" v-for="(itm,index) in item.label" :key="index">{{itm}}</text>
  35. </view>
  36. <view class="m_gray_small">
  37. 科室:{{item.office.name}} {{item.qualification.name}}
  38. </view>
  39. <view class="flex justify-start align-center flex-wrap" style="position: relative;">
  40. <u-tag v-if="item.is_chat==1" style="margin-top:20rpx ; margin-right: 20rpx;" text="图文" shape="circle" mode="dark"
  41. type="info" />
  42. <u-tag v-if="item.is_phone==1" style="margin-top:20rpx ; margin-right: 20rpx;" text="电话" shape="circle"
  43. mode="dark" type="info" />
  44. <u-tag v-if="item.is_appoint==1" style="margin-top:20rpx ; margin-right: 20rpx;" text="门诊" shape="circle"
  45. mode="dark" type="info" />
  46. </view>
  47. </view>
  48. </view>
  49. <view class="foot_juli padding-sm">
  50. <u-line color="#f6f6f6" />
  51. <view class="flex justify-center margin-top-sm" style="color: rgba(0,0,0,0.54);">
  52. <view class="text-sm" style="flex: 1; text-align: left;">
  53. 评分:
  54. <text style="color: #FF7B72;">{{item.score}}</text>
  55. </view>
  56. <view class="text-sm" style="flex: 1; text-align: center;">
  57. 服务:
  58. <text style="color: #FF7B72;">{{item.service_persons}}</text>
  59. </view>
  60. <view class="text-sm" style="flex: 1; text-align: right;">
  61. 距离:
  62. <text style="color: #FF7B72;">{{parseInt(item.distance/1000)}}km</text>
  63. </view>
  64. </view>
  65. <view class="doctor_style margin-top-sm">
  66. <view class="doctor_style_item">
  67. {{item.intro}}
  68. </view>
  69. <view class="text-black flex justify-between align-center margin-top-sm" style="font-size: 30rpx;">
  70. <view class="jisu">急速响应</view>
  71. <view class="">
  72. 服务
  73. <text class="text-red text-bold text-xl">¥{{item.phone_price/100}}</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="margin-tb padding-tb-xs">
  86. <u-loadmore :status="nomore" :icon-type="flower" />
  87. </view>
  88. <u-back-top :scroll-top="scrollTop" bottom="80" top="400"></u-back-top>
  89. </view>
  90. </template>
  91. <script>
  92. var user = require('../../common/user.js');
  93. import {
  94. mapState,
  95. mapMutations,
  96. mapGetters,
  97. mapActions
  98. } from 'vuex';
  99. export default {
  100. onLoad(options) {
  101. if (options.index) {
  102. this.value1 = options.index
  103. if (this.value1 == 3) {
  104. this.istime = true
  105. } else {
  106. this.istime = false
  107. }
  108. }
  109. if (options.value != "") {
  110. this.keyword = options.value
  111. }
  112. },
  113. onShow() {
  114. this.getDoctorList()
  115. },
  116. mounted() {
  117. this.gettime()
  118. },
  119. data() {
  120. return {
  121. scrollTop: 0,
  122. keyword: "",
  123. test: [1, 2, 3, 4, 5],
  124. value1: 0,
  125. value2: 0,
  126. value3: 0,
  127. options1: [{
  128. label: '全部服务',
  129. value: 0,
  130. }, {
  131. label: '电话咨询',
  132. value: 1,
  133. },
  134. {
  135. label: '图文咨询',
  136. value: 2,
  137. },
  138. {
  139. label: '门诊预约',
  140. value: 3,
  141. }
  142. ],
  143. options2: [{
  144. label: '成都市',
  145. value: 0,
  146. }, {
  147. label: 'xx市',
  148. value: 1,
  149. },
  150. {
  151. label: 'xx市',
  152. value: 2,
  153. },
  154. ],
  155. options3: [{
  156. label: '推荐排序',
  157. value: 0,
  158. }, {
  159. label: '距离最近',
  160. value: 1,
  161. },
  162. {
  163. label: '好评最多',
  164. value: 2,
  165. },
  166. {
  167. label: '服务最多',
  168. value: 3,
  169. },
  170. ],
  171. doctorList: [],
  172. timeday: "", //年月日
  173. timehour: "", //时分
  174. multiSelector: [],
  175. params: {
  176. year: false,
  177. month: true,
  178. day: true,
  179. hour: true,
  180. minute: true,
  181. second: false
  182. },
  183. show: false,
  184. istime: false,
  185. showtime: "",
  186. pageindex: 1
  187. }
  188. },
  189. watch: {
  190. keyword: function(newtext, jiu) {
  191. if (typeof newtext === 'string') {
  192. if (newtext.trim().length !== 0) {
  193. this.debounce(this.changeStr, 2000);
  194. } else {}
  195. }
  196. if (newtext == "") {
  197. this.list = []
  198. }
  199. }
  200. },
  201. onReachBottom() {
  202. this.getDoctorList()
  203. },
  204. methods: {
  205. //监听滚动
  206. onPageScroll(e) {
  207. this.scrollTop = e.scrollTop;
  208. },
  209. debounce(fn, wait) {
  210. if (this.fun !== null) {
  211. clearTimeout(this.fun)
  212. }
  213. this.fun = setTimeout(fn, wait)
  214. },
  215. allserive(value) {
  216. this.value1 = value
  217. if (this.value1 == 3) {
  218. this.istime = true
  219. } else {
  220. this.istime = false
  221. }
  222. this.timeday = ""
  223. this.timehour = ""
  224. this.pageindex = 1
  225. this.doctorList = []
  226. this.getDoctorList()
  227. },
  228. city(value) {
  229. this.value2 = value
  230. },
  231. recommend(value) {
  232. this.value3 = value
  233. this.timeday = ""
  234. this.timehour = ""
  235. this.pageindex = 1
  236. this.doctorList = []
  237. this.getDoctorList()
  238. },
  239. gotoinfo(e) {
  240. uni.navigateTo({
  241. url: "./doctor_info?id=" + e.currentTarget.dataset.id + "&time=" + this.showtime
  242. })
  243. },
  244. submitCollect: async function(e) {
  245. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  246. type: 1,
  247. relation_id: e.currentTarget.dataset.id,
  248. })
  249. if (res.status == 0) {
  250. if (res.data.is_collect == 0) {
  251. uni.showToast({
  252. title: "取消成功",
  253. icon: "none"
  254. })
  255. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  256. } else {
  257. uni.showToast({
  258. title: "关注成功",
  259. icon: "none"
  260. })
  261. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  262. }
  263. }
  264. },
  265. getDoctorList: async function() {
  266. let res = await this.$request.post("/api/v1/docter/docterList", {
  267. page: this.pageindex,
  268. list_type: this.value1,
  269. name: this.keyword,
  270. sort_type: this.value3,
  271. latitude: uni.getStorageSync("latitude"),
  272. longitude: uni.getStorageSync("longitude"),
  273. schedule_date: this.timeday,
  274. time_period_id: this.timehour
  275. }, )
  276. if (res.status == 0) {
  277. if (this.pageindex > res.data.last_page) {
  278. uni.showToast({
  279. title: "没有更多了",
  280. icon: "none"
  281. })
  282. } else {
  283. this.doctorList = this.doctorList.concat(res.data.data)
  284. this.pageindex++
  285. }
  286. }
  287. },
  288. gettime: async function() {
  289. let res = await this.$request.post("/api/v1/docter/timePeriodList")
  290. console.log(res)
  291. if (res.status == 0) {
  292. res.data.list.forEach(item => {
  293. item.start_time_period = item.start_time_period + '-' + item.end_time_period
  294. })
  295. this.multiSelector.push(res.data.dates)
  296. this.multiSelector.push(res.data.list)
  297. this.showtime = res.data.dates[0] + ' ' + res.data.list[0].start_time_period
  298. }
  299. },
  300. changeStr() {
  301. this.timeday = ""
  302. this.timehour = ""
  303. this.pageindex = 1
  304. this.doctorList = []
  305. this.getDoctorList()
  306. },
  307. xuanzetime() {
  308. this.show = !this.show
  309. },
  310. //返回时间
  311. callbacktime(arr) {
  312. this.timeday = this.multiSelector[0][arr[0]]
  313. this.timehour = this.multiSelector[1][arr[1]].id
  314. this.showtime = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  315. this.pageindex = 1
  316. this.doctorList = []
  317. this.getDoctorList()
  318. }
  319. }
  320. };
  321. </script>
  322. <style scoped lang="scss">
  323. .main {
  324. padding-top: 10rpx;
  325. padding-left: 20rpx;
  326. padding-right: 20rpx;
  327. }
  328. .gridstyle {
  329. height: 450rpx;
  330. background-color: #fff;
  331. border-radius: 15rpx;
  332. display: flex;
  333. align-items: center;
  334. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  335. margin-top: 20rpx;
  336. }
  337. .doctor_style {
  338. color: rgba(0, 0, 0, 0.54);
  339. }
  340. .doctor_style_item {
  341. overflow: hidden;
  342. text-overflow: ellipsis;
  343. display: -webkit-box;
  344. -webkit-line-clamp: 2;
  345. -webkit-box-orient: vertical;
  346. }
  347. .jisu {
  348. color: rgb(238, 170, 63);
  349. }
  350. .follow_style {
  351. position: absolute;
  352. bottom: 60rpx;
  353. left: 38rpx;
  354. z-index: 1;
  355. width: 106rpx;
  356. height: 40rpx;
  357. padding: 4rpx 0;
  358. background-color: rgb(208, 105, 150);
  359. box-sizing: border-box;
  360. color: #fff;
  361. text-align: center;
  362. border-radius: 60rpx;
  363. font-size: 24rpx;
  364. display: flex;
  365. justify-content: center;
  366. align-items: center;
  367. }
  368. .base_item {
  369. // position: absolute;
  370. // top: 0;
  371. // left: 0;
  372. // right: 0;
  373. // z-index: 1;
  374. width: 100%;
  375. height: auto;
  376. box-sizing: border-box;
  377. }
  378. .base_item_zi {
  379. // padding-top: 20rpx;
  380. // margin: 20rpx 20rpx;
  381. position: relative;
  382. box-sizing: border-box;
  383. }
  384. .base_item_zi_items {
  385. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  386. background-color: #fff;
  387. position: relative;
  388. border-radius: 8rpx;
  389. box-sizing: border-box;
  390. }
  391. .base_item_zi_content {
  392. display: flex;
  393. justify-content: center;
  394. padding: 30rpx 30rpx;
  395. overflow: hidden;
  396. position: relative;
  397. width: 100%;
  398. box-sizing: border-box;
  399. }
  400. .text_style {
  401. font-size: 24rpx;
  402. color: rgba(0, 0, 0, .54);
  403. display: block;
  404. margin-left: 10rpx;
  405. }
  406. .m_gray_small {
  407. white-space: nowrap;
  408. overflow: hidden;
  409. text-overflow: ellipsis;
  410. color: rgba(0, 0, 0, 0.54);
  411. margin-top: 20rpx;
  412. font-size: 28rpx;
  413. }
  414. .content_right {
  415. flex: 1;
  416. margin-left: 20rpx;
  417. overflow: hidden;
  418. position: relative;
  419. box-sizing: border-box;
  420. }
  421. .foot_item {
  422. background-color: #F7F7F7;
  423. box-sizing: border-box;
  424. }
  425. .grid-text {
  426. font-size: 28rpx;
  427. margin-top: 4rpx;
  428. color: $u-type-info;
  429. }
  430. .tltleStyle {
  431. padding: 30rpx 30rpx 15rpx 15rpx;
  432. // font-weight: bold;
  433. // font-size: 40rpx;
  434. }
  435. </style>