select_doctor.vue 13 KB

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