select_doctor.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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" search-icon-color="#EEAA3F" placeholder="搜索医生姓名、医院名" @custom="searchvalue"
  11. :show-action="true" 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" style="height: 241rpx;background-color:#FBFBFB;">
  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_texts" :key="index">{{itm.label_name}}</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 bg-color="#F2F2F2" color="#666666" border-color="#F2F2F2" v-if="item.is_chat==1" style="margin-top:20rpx ; margin-right: 20rpx;"
  42. text="图文" shape="circle" />
  43. <u-tag bg-color="#F2F2F2" color="#666666" border-color="#F2F2F2" v-if="item.is_phone==1" style="margin-top:20rpx ; margin-right: 20rpx;"
  44. text="电话" shape="circle" />
  45. <u-tag bg-color="#F2F2F2" color="#666666" border-color="#F2F2F2" v-if="item.is_appoint==1" style="margin-top:20rpx ; margin-right: 20rpx;"
  46. text="门诊" shape="circle" />
  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;">{{item.distance!='未知'?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" style="margin-right: 6rpx;">¥{{getpricemin([item.phone_price,item.chat_price,item.appoint_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. import {
  105. getLocation
  106. } from "../../common/authorize.js"
  107. export default {
  108. onLoad(options) {
  109. let date = new Date();
  110. let nian = date.getFullYear()
  111. let yue = date.getMonth() + 1
  112. let ri = date.getDate()
  113. if (options.index) {
  114. this.value1 = options.index
  115. if (this.value1 == 3) {
  116. this.istime = true
  117. this.timehour = 1,
  118. this.timeday = nian + "-" + yue + "-" + ri
  119. } else {
  120. this.istime = false,
  121. this.timehour = "",
  122. this.timeday = ""
  123. }
  124. }
  125. if (options.value != "") {
  126. this.keyword = options.value
  127. }
  128. },
  129. onShow() {
  130. // this.gettime()
  131. this.getareaList()
  132. this.GetCurrentAddress()
  133. // this.getDoctorList()
  134. },
  135. mounted() {
  136. },
  137. data() {
  138. return {
  139. scrollTop: 0,
  140. keyword: "",
  141. test: [1, 2, 3, 4, 5],
  142. value1: 0,
  143. value2: 0,
  144. value3: 0,
  145. options1: [{
  146. label: '全部服务',
  147. value: 0,
  148. }, {
  149. label: '电话咨询',
  150. value: 1,
  151. },
  152. {
  153. label: '图文咨询',
  154. value: 2,
  155. },
  156. {
  157. label: '门诊预约',
  158. value: 3,
  159. }
  160. ],
  161. options2: [],
  162. options3: [{
  163. label: '推荐排序',
  164. value: 0,
  165. }, {
  166. label: '距离最近',
  167. value: 1,
  168. },
  169. {
  170. label: '好评最多',
  171. value: 2,
  172. },
  173. {
  174. label: '服务最多',
  175. value: 3,
  176. },
  177. ],
  178. doctorList: [],
  179. timeday: "", //年月日
  180. timehour: "", //时分
  181. multiSelector: [],
  182. params: {
  183. year: false,
  184. month: true,
  185. day: true,
  186. hour: true,
  187. minute: true,
  188. second: false
  189. },
  190. show: false,
  191. istime: false,
  192. showtime: "",
  193. pageindex: 1,
  194. city_name: ""
  195. }
  196. },
  197. watch: {
  198. // keyword: function(newtext, jiu) {
  199. // if (typeof newtext === 'string') {
  200. // if (newtext.trim().length !== 0) {
  201. // this.debounce(this.changeStr, 2000);
  202. // } else {}
  203. // }
  204. // if (newtext == "") {
  205. // this.list = []
  206. // }
  207. // }
  208. },
  209. onReachBottom() {
  210. this.getDoctorList()
  211. },
  212. methods: {
  213. GetCurrentAddress() {
  214. getLocation().then(res => {
  215. this.city_name = res.address.address_component.city
  216. this.options2.forEach((item, index) => {
  217. if (item.name.indexOf(this.city_name.split('市')[0]) > -1) {
  218. this.value2 = index
  219. console.log(this.value2)
  220. }
  221. })
  222. this.timeday = ""
  223. this.timehour = ""
  224. this.pageindex = 1
  225. this.doctorList = []
  226. this.getDoctorList()
  227. }).catch(res => {})
  228. },
  229. //取服务价格最小值
  230. getpricemin(arr) {
  231. return Math.min(...arr)
  232. },
  233. //监听滚动
  234. onPageScroll(e) {
  235. this.scrollTop = e.scrollTop;
  236. },
  237. // debounce(fn, wait) {
  238. // if (this.fun !== null) {
  239. // clearTimeout(this.fun)
  240. // }
  241. // this.fun = setTimeout(fn, wait)
  242. // },
  243. allserive(value) {
  244. this.value1 = value
  245. if (this.value1 == 3) {
  246. this.istime = true
  247. } else {
  248. this.istime = false
  249. }
  250. this.timeday = ""
  251. this.timehour = ""
  252. this.pageindex = 1
  253. this.doctorList = []
  254. this.getDoctorList()
  255. },
  256. city(value) {
  257. console.log(value)
  258. this.value2 = value
  259. this.timeday = ""
  260. this.timehour = ""
  261. this.pageindex = 1
  262. this.doctorList = []
  263. this.getDoctorList()
  264. },
  265. recommend(value) {
  266. this.value3 = value
  267. this.timeday = ""
  268. this.timehour = ""
  269. this.pageindex = 1
  270. this.doctorList = []
  271. this.getDoctorList()
  272. },
  273. gotoinfo(e) {
  274. let num
  275. if (this.value1 == 0) {
  276. num = 1
  277. } else if (this.value1 == 1) {
  278. num = 1
  279. } else if (this.value1 == 2) {
  280. num = 2
  281. } else if (this.value1 == 3) {
  282. num = 3
  283. }
  284. uni.navigateTo({
  285. url: "./doctor_info?id=" + e.currentTarget.dataset.id + "&time=" + this.showtime + "&index=" + num
  286. })
  287. },
  288. submitCollect: async function(e) {
  289. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  290. type: 1,
  291. relation_id: e.currentTarget.dataset.id,
  292. })
  293. if (res.status == 0) {
  294. if (res.data.is_collect == 0) {
  295. uni.showToast({
  296. title: "取消成功",
  297. icon: "none"
  298. })
  299. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  300. } else {
  301. uni.showToast({
  302. title: "关注成功",
  303. icon: "none"
  304. })
  305. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  306. }
  307. }
  308. },
  309. getDoctorList: async function() {
  310. let area = ""
  311. if (this.options2.length != 0) {
  312. area = this.options2[this.value2].id
  313. }
  314. let res = await this.$request.post("/api/v1/docter/docterList", {
  315. page: this.pageindex,
  316. list_type: this.value1,
  317. name: this.keyword,
  318. city_id: area,
  319. sort_type: this.value3,
  320. latitude: uni.getStorageSync("latitude"),
  321. longitude: uni.getStorageSync("longitude"),
  322. schedule_date: this.timeday,
  323. time_period_id: this.timehour
  324. }, )
  325. console.log(res, this.value1)
  326. if (res.status == 0) {
  327. if (this.pageindex > res.data.last_page) {
  328. } else {
  329. this.doctorList = this.doctorList.concat(res.data.data)
  330. this.pageindex++
  331. }
  332. }
  333. },
  334. gettime: async function() {
  335. this.multiSelector = []
  336. let res = await this.$request.post("/api/v1/docter/timePeriodList")
  337. console.log(res)
  338. let status = user.islogin(res)
  339. if (status) {
  340. res.data.list.forEach(item => {
  341. item.start_time_period = item.start_time_period + '-' + item.end_time_period
  342. })
  343. this.multiSelector.push(res.data.dates)
  344. this.multiSelector.push(res.data.list)
  345. this.showtime = res.data.dates[0] + ' ' + res.data.list[0].start_time_period
  346. }
  347. },
  348. getareaList: async function() {
  349. let res = await this.$request.post("/api/v1/organization/organizationCityList")
  350. if (res.status == 0) {
  351. this.options2 = res.data
  352. this.options2.forEach((item, index) => {
  353. item.label = item.name
  354. item.value = index
  355. })
  356. }
  357. },
  358. searchvalue() {
  359. this.timeday = ""
  360. this.timehour = ""
  361. this.pageindex = 1
  362. this.doctorList = []
  363. this.getDoctorList()
  364. },
  365. xuanzetime() {
  366. this.show = !this.show
  367. },
  368. //返回时间
  369. callbacktime(arr) {
  370. let date = new Date()
  371. let year = date.getFullYear()
  372. this.timeday = year + "-" + this.multiSelector[0][arr[0]]
  373. console.log(this.timeday)
  374. this.timehour = this.multiSelector[1][arr[1]].id
  375. this.showtime = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  376. this.pageindex = 1
  377. this.doctorList = []
  378. this.getDoctorList()
  379. }
  380. }
  381. };
  382. </script>
  383. <style scoped lang="scss">
  384. .main {
  385. padding-top: 10rpx;
  386. padding-left: 20rpx;
  387. padding-right: 20rpx;
  388. }
  389. .gridstyle {
  390. height: 450rpx;
  391. background-color: #fff;
  392. border-radius: 15rpx;
  393. display: flex;
  394. align-items: center;
  395. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  396. margin-top: 20rpx;
  397. }
  398. .doctor_style {
  399. color: rgba(0, 0, 0, 0.54);
  400. }
  401. .doctor_style_item {
  402. overflow: hidden;
  403. text-overflow: ellipsis;
  404. display: -webkit-box;
  405. -webkit-line-clamp: 2;
  406. -webkit-box-orient: vertical;
  407. }
  408. .jisu {
  409. color: rgb(238, 170, 63);
  410. }
  411. .follow_style {
  412. position: absolute;
  413. bottom: 76rpx;
  414. left: 37rpx;
  415. z-index: 1;
  416. width: 106rpx;
  417. height: 40rpx;
  418. padding: 4rpx 0;
  419. background-color: rgb(208, 105, 150);
  420. box-sizing: border-box;
  421. color: #fff;
  422. text-align: center;
  423. border-radius: 60rpx;
  424. font-size: 24rpx;
  425. display: flex;
  426. justify-content: center;
  427. align-items: center;
  428. }
  429. .base_item {
  430. // position: absolute;
  431. // top: 0;
  432. // left: 0;
  433. // right: 0;
  434. // z-index: 1;
  435. width: 100%;
  436. height: auto;
  437. box-sizing: border-box;
  438. }
  439. .base_item_zi {
  440. // padding-top: 20rpx;
  441. // margin: 20rpx 20rpx;
  442. position: relative;
  443. box-sizing: border-box;
  444. }
  445. .base_item_zi_items {
  446. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  447. background-color: #fff;
  448. position: relative;
  449. border-radius: 8rpx;
  450. box-sizing: border-box;
  451. }
  452. .base_item_zi_content {
  453. display: flex;
  454. justify-content: center;
  455. padding: 30rpx 30rpx;
  456. overflow: hidden;
  457. position: relative;
  458. width: 100%;
  459. box-sizing: border-box;
  460. }
  461. .text_style {
  462. display: flex;
  463. justify-content: center;
  464. align-items: center;
  465. font-weight: 400;
  466. margin-left: 15rpx;
  467. background-color: #E5F5FF;
  468. color: #0B73B9;
  469. // width: 100rpx;
  470. height: 28rpx;
  471. font-size: 20rpx;
  472. border-radius: 10rpx;
  473. }
  474. .m_gray_small {
  475. white-space: nowrap;
  476. overflow: hidden;
  477. text-overflow: ellipsis;
  478. color: rgba(0, 0, 0, 0.54);
  479. margin-top: 20rpx;
  480. font-size: 28rpx;
  481. }
  482. .content_right {
  483. flex: 1;
  484. margin-left: 20rpx;
  485. overflow: hidden;
  486. position: relative;
  487. box-sizing: border-box;
  488. }
  489. .foot_item {
  490. background-color: #F7F7F7;
  491. box-sizing: border-box;
  492. }
  493. .grid-text {
  494. font-size: 28rpx;
  495. margin-top: 4rpx;
  496. color: $u-type-info;
  497. }
  498. .tltleStyle {
  499. padding: 30rpx 30rpx 15rpx 15rpx;
  500. // font-weight: bold;
  501. // font-size: 40rpx;
  502. }
  503. </style>