select_doctor.vue 12 KB

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