select_doctor.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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.getDoctorList()
  223. }).catch(res => {})
  224. },
  225. //取服务价格最小值
  226. getpricemin(arr) {
  227. return Math.min(...arr)
  228. },
  229. //监听滚动
  230. onPageScroll(e) {
  231. this.scrollTop = e.scrollTop;
  232. },
  233. // debounce(fn, wait) {
  234. // if (this.fun !== null) {
  235. // clearTimeout(this.fun)
  236. // }
  237. // this.fun = setTimeout(fn, wait)
  238. // },
  239. allserive(value) {
  240. this.value1 = value
  241. if (this.value1 == 3) {
  242. this.istime = true
  243. } else {
  244. this.istime = false
  245. }
  246. this.timeday = ""
  247. this.timehour = ""
  248. this.pageindex = 1
  249. this.doctorList = []
  250. this.getDoctorList()
  251. },
  252. city(value) {
  253. console.log(value)
  254. this.value2 = value
  255. this.timeday = ""
  256. this.timehour = ""
  257. this.pageindex = 1
  258. this.doctorList = []
  259. this.getDoctorList()
  260. },
  261. recommend(value) {
  262. this.value3 = value
  263. this.timeday = ""
  264. this.timehour = ""
  265. this.pageindex = 1
  266. this.doctorList = []
  267. this.getDoctorList()
  268. },
  269. gotoinfo(e) {
  270. let num
  271. if (this.value1 == 0) {
  272. num = 1
  273. } else if (this.value1 == 1) {
  274. num = 1
  275. } else if (this.value1 == 2) {
  276. num = 2
  277. } else if (this.value1 == 3) {
  278. num = 3
  279. }
  280. uni.navigateTo({
  281. url: "./doctor_info?id=" + e.currentTarget.dataset.id + "&time=" + this.showtime + "&index=" + num
  282. })
  283. },
  284. submitCollect: async function(e) {
  285. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  286. type: 1,
  287. relation_id: e.currentTarget.dataset.id,
  288. })
  289. if (res.status == 0) {
  290. if (res.data.is_collect == 0) {
  291. uni.showToast({
  292. title: "取消成功",
  293. icon: "none"
  294. })
  295. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  296. } else {
  297. uni.showToast({
  298. title: "关注成功",
  299. icon: "none"
  300. })
  301. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  302. }
  303. }
  304. },
  305. getDoctorList: async function() {
  306. let area = ""
  307. if (this.options2.length != 0) {
  308. area = this.options2[this.value2].id
  309. }
  310. let res = await this.$request.post("/api/v1/docter/docterList", {
  311. page: this.pageindex,
  312. list_type: this.value1,
  313. name: this.keyword,
  314. city_id: area,
  315. sort_type: this.value3,
  316. latitude: uni.getStorageSync("latitude"),
  317. longitude: uni.getStorageSync("longitude"),
  318. schedule_date: this.timeday,
  319. time_period_id: this.timehour
  320. }, )
  321. console.log(res, this.value1)
  322. if (res.status == 0) {
  323. if (this.pageindex > res.data.last_page) {
  324. } else {
  325. this.doctorList = this.doctorList.concat(res.data.data)
  326. this.pageindex++
  327. }
  328. }
  329. },
  330. gettime: async function() {
  331. this.multiSelector = []
  332. let res = await this.$request.post("/api/v1/docter/timePeriodList")
  333. console.log(res)
  334. let status = user.islogin(res)
  335. if (status) {
  336. res.data.list.forEach(item => {
  337. item.start_time_period = item.start_time_period + '-' + item.end_time_period
  338. })
  339. this.multiSelector.push(res.data.dates)
  340. this.multiSelector.push(res.data.list)
  341. this.showtime = res.data.dates[0] + ' ' + res.data.list[0].start_time_period
  342. }
  343. },
  344. getareaList: async function() {
  345. let res = await this.$request.post("/api/v1/organization/organizationCityList")
  346. if (res.status == 0) {
  347. this.options2 = res.data
  348. this.options2.forEach((item, index) => {
  349. item.label = item.name
  350. item.value = index
  351. })
  352. }
  353. },
  354. searchvalue() {
  355. this.timeday = ""
  356. this.timehour = ""
  357. this.pageindex = 1
  358. this.doctorList = []
  359. this.getDoctorList()
  360. },
  361. xuanzetime() {
  362. this.show = !this.show
  363. },
  364. //返回时间
  365. callbacktime(arr) {
  366. let date = new Date()
  367. let year = date.getFullYear()
  368. this.timeday = year + "-" + this.multiSelector[0][arr[0]]
  369. console.log(this.timeday)
  370. this.timehour = this.multiSelector[1][arr[1]].id
  371. this.showtime = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  372. this.pageindex = 1
  373. this.doctorList = []
  374. this.getDoctorList()
  375. }
  376. }
  377. };
  378. </script>
  379. <style scoped lang="scss">
  380. .main {
  381. padding-top: 10rpx;
  382. padding-left: 20rpx;
  383. padding-right: 20rpx;
  384. }
  385. .gridstyle {
  386. height: 450rpx;
  387. background-color: #fff;
  388. border-radius: 15rpx;
  389. display: flex;
  390. align-items: center;
  391. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  392. margin-top: 20rpx;
  393. }
  394. .doctor_style {
  395. color: rgba(0, 0, 0, 0.54);
  396. }
  397. .doctor_style_item {
  398. overflow: hidden;
  399. text-overflow: ellipsis;
  400. display: -webkit-box;
  401. -webkit-line-clamp: 2;
  402. -webkit-box-orient: vertical;
  403. }
  404. .jisu {
  405. color: rgb(238, 170, 63);
  406. }
  407. .follow_style {
  408. position: absolute;
  409. bottom: 76rpx;
  410. left: 37rpx;
  411. z-index: 1;
  412. width: 106rpx;
  413. height: 40rpx;
  414. padding: 4rpx 0;
  415. background-color: rgb(208, 105, 150);
  416. box-sizing: border-box;
  417. color: #fff;
  418. text-align: center;
  419. border-radius: 60rpx;
  420. font-size: 24rpx;
  421. display: flex;
  422. justify-content: center;
  423. align-items: center;
  424. }
  425. .base_item {
  426. // position: absolute;
  427. // top: 0;
  428. // left: 0;
  429. // right: 0;
  430. // z-index: 1;
  431. width: 100%;
  432. height: auto;
  433. box-sizing: border-box;
  434. }
  435. .base_item_zi {
  436. // padding-top: 20rpx;
  437. // margin: 20rpx 20rpx;
  438. position: relative;
  439. box-sizing: border-box;
  440. }
  441. .base_item_zi_items {
  442. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  443. background-color: #fff;
  444. position: relative;
  445. border-radius: 8rpx;
  446. box-sizing: border-box;
  447. }
  448. .base_item_zi_content {
  449. display: flex;
  450. justify-content: center;
  451. padding: 30rpx 30rpx;
  452. overflow: hidden;
  453. position: relative;
  454. width: 100%;
  455. box-sizing: border-box;
  456. }
  457. .text_style {
  458. display: flex;
  459. justify-content: center;
  460. align-items: center;
  461. font-weight: 400;
  462. margin-left: 15rpx;
  463. background-color: #E5F5FF;
  464. color: #0B73B9;
  465. // width: 100rpx;
  466. height: 28rpx;
  467. font-size: 20rpx;
  468. border-radius: 10rpx;
  469. }
  470. .m_gray_small {
  471. white-space: nowrap;
  472. overflow: hidden;
  473. text-overflow: ellipsis;
  474. color: rgba(0, 0, 0, 0.54);
  475. margin-top: 20rpx;
  476. font-size: 28rpx;
  477. }
  478. .content_right {
  479. flex: 1;
  480. margin-left: 20rpx;
  481. overflow: hidden;
  482. position: relative;
  483. box-sizing: border-box;
  484. }
  485. .foot_item {
  486. background-color: #F7F7F7;
  487. box-sizing: border-box;
  488. }
  489. .grid-text {
  490. font-size: 28rpx;
  491. margin-top: 4rpx;
  492. color: $u-type-info;
  493. }
  494. .tltleStyle {
  495. padding: 30rpx 30rpx 15rpx 15rpx;
  496. // font-weight: bold;
  497. // font-size: 40rpx;
  498. }
  499. </style>