select_doctor.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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>平均响应时长1分钟
  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.gettime()
  127. this.getDoctorList()
  128. this.getareaList()
  129. },
  130. mounted() {},
  131. data() {
  132. return {
  133. scrollTop: 0,
  134. keyword: "",
  135. test: [1, 2, 3, 4, 5],
  136. value1: 0,
  137. value2: 0,
  138. value3: 0,
  139. options1: [{
  140. label: '全部服务',
  141. value: 0,
  142. }, {
  143. label: '电话咨询',
  144. value: 1,
  145. },
  146. {
  147. label: '图文咨询',
  148. value: 2,
  149. },
  150. {
  151. label: '门诊预约',
  152. value: 3,
  153. }
  154. ],
  155. options2: [],
  156. options3: [{
  157. label: '推荐排序',
  158. value: 0,
  159. }, {
  160. label: '距离最近',
  161. value: 1,
  162. },
  163. {
  164. label: '好评最多',
  165. value: 2,
  166. },
  167. {
  168. label: '服务最多',
  169. value: 3,
  170. },
  171. ],
  172. doctorList: [],
  173. timeday: "", //年月日
  174. timehour: "", //时分
  175. multiSelector: [],
  176. params: {
  177. year: false,
  178. month: true,
  179. day: true,
  180. hour: true,
  181. minute: true,
  182. second: false
  183. },
  184. show: false,
  185. istime: false,
  186. showtime: "",
  187. pageindex: 1,
  188. }
  189. },
  190. watch: {
  191. keyword: function(newtext, jiu) {
  192. if (typeof newtext === 'string') {
  193. if (newtext.trim().length !== 0) {
  194. this.debounce(this.changeStr, 2000);
  195. } else {}
  196. }
  197. if (newtext == "") {
  198. this.list = []
  199. }
  200. }
  201. },
  202. onReachBottom() {
  203. this.getDoctorList()
  204. },
  205. methods: {
  206. //监听滚动
  207. onPageScroll(e) {
  208. this.scrollTop = e.scrollTop;
  209. },
  210. debounce(fn, wait) {
  211. if (this.fun !== null) {
  212. clearTimeout(this.fun)
  213. }
  214. this.fun = setTimeout(fn, wait)
  215. },
  216. allserive(value) {
  217. this.value1 = value
  218. if (this.value1 == 3) {
  219. this.istime = true
  220. } else {
  221. this.istime = false
  222. }
  223. this.timeday = ""
  224. this.timehour = ""
  225. this.pageindex = 1
  226. this.doctorList = []
  227. this.getDoctorList()
  228. },
  229. city(value) {
  230. console.log(value)
  231. this.value2 = value
  232. this.timeday = ""
  233. this.timehour = ""
  234. this.pageindex = 1
  235. this.doctorList = []
  236. this.getDoctorList()
  237. },
  238. recommend(value) {
  239. this.value3 = value
  240. this.timeday = ""
  241. this.timehour = ""
  242. this.pageindex = 1
  243. this.doctorList = []
  244. this.getDoctorList()
  245. },
  246. gotoinfo(e) {
  247. uni.navigateTo({
  248. url: "./doctor_info?id=" + e.currentTarget.dataset.id + "&time=" + this.showtime + "&index=" + this.value1
  249. })
  250. },
  251. submitCollect: async function(e) {
  252. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  253. type: 1,
  254. relation_id: e.currentTarget.dataset.id,
  255. })
  256. if (res.status == 0) {
  257. if (res.data.is_collect == 0) {
  258. uni.showToast({
  259. title: "取消成功",
  260. icon: "none"
  261. })
  262. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  263. } else {
  264. uni.showToast({
  265. title: "关注成功",
  266. icon: "none"
  267. })
  268. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  269. }
  270. }
  271. },
  272. getDoctorList: async function() {
  273. let area = ""
  274. if (this.options2.length != 0) {
  275. area = this.options2[this.value2].id
  276. }
  277. let res = await this.$request.post("/api/v1/docter/docterList", {
  278. page: this.pageindex,
  279. list_type: this.value1,
  280. name: this.keyword,
  281. city_id: area,
  282. sort_type: this.value3,
  283. latitude: uni.getStorageSync("latitude"),
  284. longitude: uni.getStorageSync("longitude"),
  285. schedule_date: this.timeday,
  286. time_period_id: this.timehour
  287. }, )
  288. console.log(res, this.value1)
  289. if (res.status == 0) {
  290. if (this.pageindex > res.data.last_page) {
  291. uni.showToast({
  292. title: "没有更多了",
  293. icon: "none"
  294. })
  295. } else {
  296. this.doctorList = this.doctorList.concat(res.data.data)
  297. this.pageindex++
  298. }
  299. }
  300. },
  301. gettime: async function() {
  302. let res = await this.$request.post("/api/v1/docter/timePeriodList")
  303. console.log(res)
  304. let status = user.islogin(res)
  305. if (status) {
  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>