select_doctor.vue 13 KB

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