select_doctor.vue 11 KB

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