select_doctor.vue 13 KB

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