select_doctor.vue 14 KB

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