select_doctor.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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. },
  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. label: '成都市',
  157. value: 0,
  158. }, {
  159. label: 'xx市',
  160. value: 1,
  161. },
  162. {
  163. label: 'xx市',
  164. value: 2,
  165. },
  166. ],
  167. options3: [{
  168. label: '推荐排序',
  169. value: 0,
  170. }, {
  171. label: '距离最近',
  172. value: 1,
  173. },
  174. {
  175. label: '好评最多',
  176. value: 2,
  177. },
  178. {
  179. label: '服务最多',
  180. value: 3,
  181. },
  182. ],
  183. doctorList: [],
  184. timeday: "", //年月日
  185. timehour: "", //时分
  186. multiSelector: [],
  187. params: {
  188. year: false,
  189. month: true,
  190. day: true,
  191. hour: true,
  192. minute: true,
  193. second: false
  194. },
  195. show: false,
  196. istime: false,
  197. showtime: "",
  198. pageindex: 1,
  199. }
  200. },
  201. watch: {
  202. keyword: function(newtext, jiu) {
  203. if (typeof newtext === 'string') {
  204. if (newtext.trim().length !== 0) {
  205. this.debounce(this.changeStr, 2000);
  206. } else {}
  207. }
  208. if (newtext == "") {
  209. this.list = []
  210. }
  211. }
  212. },
  213. onReachBottom() {
  214. this.getDoctorList()
  215. },
  216. methods: {
  217. //监听滚动
  218. onPageScroll(e) {
  219. this.scrollTop = e.scrollTop;
  220. },
  221. debounce(fn, wait) {
  222. if (this.fun !== null) {
  223. clearTimeout(this.fun)
  224. }
  225. this.fun = setTimeout(fn, wait)
  226. },
  227. allserive(value) {
  228. this.value1 = value
  229. if (this.value1 == 3) {
  230. this.istime = true
  231. } else {
  232. this.istime = false
  233. }
  234. this.timeday = ""
  235. this.timehour = ""
  236. this.pageindex = 1
  237. this.doctorList = []
  238. this.getDoctorList()
  239. },
  240. city(value) {
  241. this.value2 = value
  242. },
  243. recommend(value) {
  244. this.value3 = value
  245. this.timeday = ""
  246. this.timehour = ""
  247. this.pageindex = 1
  248. this.doctorList = []
  249. this.getDoctorList()
  250. },
  251. gotoinfo(e) {
  252. uni.navigateTo({
  253. url: "./doctor_info?id=" + e.currentTarget.dataset.id + "&time=" + this.showtime
  254. })
  255. },
  256. submitCollect: async function(e) {
  257. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  258. type: 1,
  259. relation_id: e.currentTarget.dataset.id,
  260. })
  261. if (res.status == 0) {
  262. if (res.data.is_collect == 0) {
  263. uni.showToast({
  264. title: "取消成功",
  265. icon: "none"
  266. })
  267. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  268. } else {
  269. uni.showToast({
  270. title: "关注成功",
  271. icon: "none"
  272. })
  273. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  274. }
  275. }
  276. },
  277. getDoctorList: async function() {
  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. 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. if (res.status == 0) {
  305. res.data.list.forEach(item => {
  306. item.start_time_period = item.start_time_period + '-' + item.end_time_period
  307. })
  308. this.multiSelector.push(res.data.dates)
  309. this.multiSelector.push(res.data.list)
  310. this.showtime = res.data.dates[0] + ' ' + res.data.list[0].start_time_period
  311. }
  312. },
  313. changeStr() {
  314. this.timeday = ""
  315. this.timehour = ""
  316. this.pageindex = 1
  317. this.doctorList = []
  318. this.getDoctorList()
  319. },
  320. xuanzetime() {
  321. this.show = !this.show
  322. },
  323. //返回时间
  324. callbacktime(arr) {
  325. let date = new Date()
  326. let year = date.getFullYear()
  327. this.timeday = year + "-" + this.multiSelector[0][arr[0]]
  328. console.log(this.timeday)
  329. this.timehour = this.multiSelector[1][arr[1]].id
  330. this.showtime = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  331. this.pageindex = 1
  332. this.doctorList = []
  333. this.getDoctorList()
  334. }
  335. }
  336. };
  337. </script>
  338. <style scoped lang="scss">
  339. .main {
  340. padding-top: 10rpx;
  341. padding-left: 20rpx;
  342. padding-right: 20rpx;
  343. }
  344. .gridstyle {
  345. height: 450rpx;
  346. background-color: #fff;
  347. border-radius: 15rpx;
  348. display: flex;
  349. align-items: center;
  350. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  351. margin-top: 20rpx;
  352. }
  353. .doctor_style {
  354. color: rgba(0, 0, 0, 0.54);
  355. }
  356. .doctor_style_item {
  357. overflow: hidden;
  358. text-overflow: ellipsis;
  359. display: -webkit-box;
  360. -webkit-line-clamp: 2;
  361. -webkit-box-orient: vertical;
  362. }
  363. .jisu {
  364. color: rgb(238, 170, 63);
  365. }
  366. .follow_style {
  367. position: absolute;
  368. bottom: 60rpx;
  369. left: 38rpx;
  370. z-index: 1;
  371. width: 106rpx;
  372. height: 40rpx;
  373. padding: 4rpx 0;
  374. background-color: rgb(208, 105, 150);
  375. box-sizing: border-box;
  376. color: #fff;
  377. text-align: center;
  378. border-radius: 60rpx;
  379. font-size: 24rpx;
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. }
  384. .base_item {
  385. // position: absolute;
  386. // top: 0;
  387. // left: 0;
  388. // right: 0;
  389. // z-index: 1;
  390. width: 100%;
  391. height: auto;
  392. box-sizing: border-box;
  393. }
  394. .base_item_zi {
  395. // padding-top: 20rpx;
  396. // margin: 20rpx 20rpx;
  397. position: relative;
  398. box-sizing: border-box;
  399. }
  400. .base_item_zi_items {
  401. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  402. background-color: #fff;
  403. position: relative;
  404. border-radius: 8rpx;
  405. box-sizing: border-box;
  406. }
  407. .base_item_zi_content {
  408. display: flex;
  409. justify-content: center;
  410. padding: 30rpx 30rpx;
  411. overflow: hidden;
  412. position: relative;
  413. width: 100%;
  414. box-sizing: border-box;
  415. }
  416. .text_style {
  417. font-weight: 400;
  418. margin-left: 15rpx;
  419. background-color: #E5F5FF;
  420. color: #0B73B9;
  421. width: 100rpx;
  422. height: 28rpx;
  423. font-size: 20rpx;
  424. border-radius: 10rpx;
  425. text-align: center;
  426. align-items: center;
  427. }
  428. .m_gray_small {
  429. white-space: nowrap;
  430. overflow: hidden;
  431. text-overflow: ellipsis;
  432. color: rgba(0, 0, 0, 0.54);
  433. margin-top: 20rpx;
  434. font-size: 28rpx;
  435. }
  436. .content_right {
  437. flex: 1;
  438. margin-left: 20rpx;
  439. overflow: hidden;
  440. position: relative;
  441. box-sizing: border-box;
  442. }
  443. .foot_item {
  444. background-color: #F7F7F7;
  445. box-sizing: border-box;
  446. }
  447. .grid-text {
  448. font-size: 28rpx;
  449. margin-top: 4rpx;
  450. color: $u-type-info;
  451. }
  452. .tltleStyle {
  453. padding: 30rpx 30rpx 15rpx 15rpx;
  454. // font-weight: bold;
  455. // font-size: 40rpx;
  456. }
  457. </style>