index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <view class="main">
  3. <view class="">
  4. <u-search :clearabled="true" shape="round" search-icon-color="#EEAA3F" @custom="searchvalue"
  5. :show-action="true" placeholder="搜索医生" v-model="keyword"></u-search>
  6. </view>
  7. <view class="margin-top-sm margin-bottom-sm">
  8. <official-account></official-account>
  9. </view>
  10. <view class="indexswiper" style="margin-top: 10rpx;">
  11. <u-swiper :list="ordinary" :imghos="imghos" mode="dot" @click="gotoarticle"></u-swiper>
  12. </view>
  13. <view class="tltleStyle">
  14. <u-section title="精选服务" font-size="40" line-color="#0B73BA" :bold="true" :right="false"></u-section>
  15. </view>
  16. <view class="gridstyle">
  17. <u-grid :col="3" :border="false">
  18. <view @click="gotoxuanze(item)" data-index="1" v-for="(item,index) in icons" :key="index">
  19. <u-grid-item>
  20. <u-image width="120rpx" height="120rpx" :src="item.image" shape="circle"></u-image>
  21. <view class="grid-text">{{item.name}}</view>
  22. </u-grid-item>
  23. </view>
  24. <!-- <view class="" @click="gotoxuanze" data-index="2">
  25. <u-grid-item>
  26. <u-image width="120rpx" height="120rpx" src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/toolimg/indextu.png"
  27. shape="circle"></u-image>
  28. <view class="grid-text">图文咨询</view>
  29. </u-grid-item>
  30. </view> -->
  31. <!-- <view class="" @click="gotoxuanze" data-index="3">
  32. <u-grid-item>
  33. <u-image width="120rpx" height="120rpx" src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/toolimg/indexmen.png"
  34. shape="circle"></u-image>
  35. <view class="grid-text">门诊预约</view>
  36. </u-grid-item>
  37. </view> -->
  38. <!-- <view class="" @click="vaccines">
  39. <u-grid-item>
  40. <u-image width="120rpx" height="120rpx" src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/toolimg/indexyimiao.png"
  41. shape="circle"></u-image>
  42. <view class="grid-text">疫苗接种</view>
  43. </u-grid-item>
  44. </view> -->
  45. <!-- <view class="" @click="childcare">
  46. <u-grid-item>
  47. <u-image width="120rpx" height="120rpx" src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/toolimg/indexerbao.png"
  48. shape="circle"></u-image>
  49. <view class="grid-text">儿保预约</view>
  50. </u-grid-item>
  51. </view> -->
  52. <!-- <view class="" @click="servicepacks">
  53. <u-grid-item>
  54. <u-image width="120rpx" height="120rpx" src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/toolimg/indexservice.png"
  55. shape="circle"></u-image>
  56. <view class="grid-text">服务包</view>
  57. </u-grid-item>
  58. </view> -->
  59. </u-grid>
  60. </view>
  61. <view class="margin-top-sm">
  62. <u-notice-bar type="error" bg-color="white" color="black" border-radius="15" :list="configInfo.notices"
  63. mode="vertical"></u-notice-bar>
  64. </view>
  65. <view class="tltleStyle">
  66. <u-section title="热门推荐" font-size="40" line-color="#0B73BA" :bold="true" :right="false"></u-section>
  67. </view>
  68. <view class="cu-card case"
  69. style="margin-top: 20rpx;background-color: transparent;border-radius: 16rpx;position: relative;">
  70. <swiper @change="swiperChange" :indicator-dots="false"
  71. style="height: 426rpx;border-radius:16rpx;background-color: transparent;" :autoplay="true"
  72. :interval="3000" :duration="1000" :current="itemcurrent">
  73. <swiper-item style="background-color: transparent;" v-for="(item,index) in hotlist" :key="index">
  74. <view class="cu-item shadow" style="margin: 0;background-color: transparent;height: 100%;"
  75. @click="gotojournalism(index)">
  76. <view class="image">
  77. <image :src="imghos+item.image" style="height: 426rpx;" mode="heightFix"></image>
  78. <!-- <view class="cu-bar bg-shadeBottom" style="background-image: linear-gradient(rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0));bottom:44rpx ;">
  79. <text class="text-cut">我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。</text>
  80. </view> -->
  81. </view>
  82. </view>
  83. </swiper-item>
  84. </swiper>
  85. <view class="dots">
  86. <view :class="index==itemcurrent?'dot active':'dot'" v-for="(item,index) in hotlist" :key="index">
  87. </view>
  88. </view>
  89. </view>
  90. <view class="tltleStyle">
  91. <u-section title="推荐医生" font-size="40" line-color="#0B73BA" :bold="true" :right="false"></u-section>
  92. </view>
  93. <view style="width: 100%;">
  94. <view class="recommendstyle margin-top-sm" v-for="(item,index) in doctorList" :key="index">
  95. <view class="base_item">
  96. <view class="base_item_zi" @click.stop="gotoinfo" :data-id="item.id">
  97. <view class="base_item_zi_items">
  98. <view class="base_item_zi_content" style="height: 241rpx;background-color:#FBFBFB;">
  99. <image style="width: 120rpx;height: 120rpx;border-radius: 50%;" :src="item.avatar">
  100. </image>
  101. <view class="follow_style" @click.stop="submitCollect" :data-index="index"
  102. :data-id="item.id" v-if="item.is_collect==0">
  103. 关注
  104. </view>
  105. <view class="follow_style" @click.stop="submitCollect" :data-index="index"
  106. :data-id="item.id"
  107. style="background-color: #fff;color: rgb(208, 105, 150);border:2rpx solid rgb(208, 105, 150);"
  108. v-else>
  109. 已关注
  110. </view>
  111. <view class="content_right">
  112. <view class="" style="display: flex;align-items: center;">
  113. <text style="font-size: 32rpx; font-weight: bold;">{{item.name}}</text>
  114. <text class="text_style" v-for="(itm,index) in item.label_texts"
  115. :key="index">{{itm.label_name}}</text>
  116. </view>
  117. <view class="m_gray_small">
  118. 科室:{{item.office.name||'暂无'}} {{item.qualification.name||'暂无'}}
  119. </view>
  120. <view class="flex justify-start align-center flex-wrap" style="position: relative;">
  121. <u-tag bg-color="#F2F2F2" color="#666666" border-color="#F2F2F2"
  122. v-if="item.is_chat==1" style="margin-top:20rpx ; margin-right: 20rpx;"
  123. text="图文" shape="circle" />
  124. <u-tag bg-color="#F2F2F2" color="#666666" border-color="#F2F2F2"
  125. v-if="item.is_phone==1" style="margin-top:20rpx ; margin-right: 20rpx;"
  126. text="电话" shape="circle" />
  127. <u-tag bg-color="#F2F2F2" color="#666666" border-color="#F2F2F2"
  128. v-if="item.is_appoint==1" style="margin-top:20rpx ; margin-right: 20rpx;"
  129. text="门诊" shape="circle" />
  130. </view>
  131. </view>
  132. </view>
  133. <view class="foot_juli padding-sm">
  134. <u-line color="#f6f6f6" />
  135. <view class="flex justify-center margin-top-sm" style="color: rgba(0,0,0,0.54);">
  136. <view class="text-sm" style="flex: 1; text-align: left;">
  137. 评分:
  138. <text style="color: #FF7B72;">{{item.score}}</text>
  139. </view>
  140. <view class="text-sm" style="flex: 1; text-align: center;">
  141. 服务:
  142. <text style="color: #FF7B72;">{{item.service_persons}}</text>
  143. </view>
  144. <view class="text-sm" style="flex: 1; text-align: right;">
  145. 距离:
  146. <text
  147. style="color: #FF7B72;">{{item.distance!='未知'?parseInt(item.distance/1000)+'km':'未知'}}</text>
  148. </view>
  149. </view>
  150. <view class="doctor_style margin-top-sm">
  151. <view class="doctor_style_item">
  152. {{item.intro}}
  153. </view>
  154. <view class="text-black flex justify-between align-center margin-top-sm"
  155. style="font-size: 30rpx;">
  156. <view class="jisu flex align-center">
  157. <image src="../../static/img/speed.png"
  158. style="width: 30rpx;height: 30rpx;margin-right: 10rpx;margin-top: 6rpx;"
  159. mode=""></image>急速响应
  160. </view>
  161. <view class="">
  162. 服务
  163. <text class="text-red text-bold text-xl"
  164. style="margin-right: 10rpx;">¥{{getpricemin([item.phone_price,item.chat_price,item.appoint_price])/100}}</text>
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. </view>
  174. <view class="margin-tb padding-tb-xs">
  175. <u-loadmore :status="nomore" :load-text="loadText" :icon-type="flower" />
  176. </view>
  177. <u-back-top :scroll-top="scrollTop" bottom="80" top="400"></u-back-top>
  178. <u-no-network></u-no-network>
  179. </view>
  180. </template>
  181. <script>
  182. import {
  183. getLocation
  184. } from "../../common/authorize.js"
  185. var user = require('../../common/user.js');
  186. import {
  187. mapState,
  188. mapMutations,
  189. mapGetters,
  190. mapActions
  191. } from 'vuex';
  192. import store from '@/store'
  193. export default {
  194. computed: {
  195. ...mapGetters({
  196. hasLogin: 'verifyJwt'
  197. }),
  198. ...mapState(['user'])
  199. },
  200. onShow() {
  201. this.GetCurrentAddress()
  202. this.getDoctorList()
  203. this.getindexImg()
  204. this.hasLogin = store.getters['verifyJwt']
  205. },
  206. onLoad(options) {
  207. this.getconfigData()
  208. this.imghos = this.$imgHost
  209. },
  210. data() {
  211. return {
  212. itemcurrent: 0,
  213. scrollTop: 0,
  214. keyword: "",
  215. loadText: {
  216. nomore: '暂无更多医生推荐'
  217. },
  218. doctorList: [],
  219. latitude: 0,
  220. longitude: 0,
  221. pageindex: 1,
  222. configInfo: {},
  223. icons: [],
  224. imghos: "",
  225. hotlist: [],
  226. ordinary: []
  227. }
  228. },
  229. onHide() {
  230. this.pageindex = 1
  231. this.doctorList = []
  232. },
  233. onReachBottom() {
  234. this.getDoctorList()
  235. },
  236. onShareAppMessage() {
  237. return {
  238. title: "熙宝健康",
  239. success: res => {
  240. console.log(res)
  241. }
  242. }
  243. },
  244. methods: {
  245. gotoarticle(index) {
  246. uni.navigateTo({
  247. url: './article?url=' + this.ordinary[index].url
  248. })
  249. },
  250. gotojournalism(index) {
  251. uni.navigateTo({
  252. url: './article?url=' + this.hotlist[index].url
  253. })
  254. },
  255. //取服务价格最小值
  256. getpricemin(arr) {
  257. arr = arr.filter(item => item != 0)
  258. return Math.min(...arr)
  259. },
  260. getindexImg: async function() {
  261. let res = await this.$request.post("/api/v1/common/icons", {
  262. type: 1
  263. })
  264. if (res.status == 200) {
  265. this.icons = res.data
  266. }
  267. },
  268. swiperChange(e) {
  269. this.itemcurrent = e.detail.current
  270. },
  271. catchTouchMove() {
  272. return false
  273. },
  274. //监听滚动
  275. onPageScroll(e) {
  276. this.scrollTop = e.scrollTop;
  277. },
  278. gotoxuanze(item) {
  279. if (this.hasLogin) {
  280. if (item.id == 4) {
  281. uni.navigateTo({
  282. url: "../vaccines/vaccines_info"
  283. })
  284. return false
  285. }
  286. if (item.id == 5) {
  287. uni.navigateTo({
  288. url: "../childcare/child_care"
  289. })
  290. return false
  291. }
  292. if (item.id == 6) {
  293. uni.navigateTo({
  294. url: "../service_packs/introduce"
  295. })
  296. return false
  297. }
  298. uni.navigateTo({
  299. url: '../doctor_related/select_doctor?index=' + item.id
  300. })
  301. } else {
  302. uni.showModal({
  303. title: "提示",
  304. content: "暂未登录,请前往登录",
  305. success: (res) => {
  306. if (res.confirm) {
  307. uni.navigateTo({
  308. url: "../login/login"
  309. })
  310. }
  311. }
  312. })
  313. }
  314. },
  315. gotoinfo(e) {
  316. if (this.hasLogin) {
  317. uni.navigateTo({
  318. url: "../doctor_related/doctor_info?id=" + e.currentTarget.dataset.id + "&index=1"
  319. })
  320. } else {
  321. uni.showModal({
  322. title: "提示",
  323. content: "暂未登录,请前往登录",
  324. success: (res) => {
  325. if (res.confirm) {
  326. uni.navigateTo({
  327. url: "../login/login"
  328. })
  329. }
  330. }
  331. })
  332. }
  333. },
  334. getDoctorList: async function() {
  335. let res = await this.$request.post("/api/v1/docter/docterList", {
  336. page: this.pageindex,
  337. latitude: this.latitude,
  338. longitude: this.longitude,
  339. sort_type: 1
  340. }, false)
  341. if (res.status == 0) {
  342. // this.doctorList = res.data.data
  343. if (this.pageindex > res.data.last_page) {
  344. } else {
  345. this.doctorList = this.doctorList.concat(res.data.data)
  346. this.pageindex++
  347. }
  348. }
  349. },
  350. submitCollect: async function(e) {
  351. if (this.hasLogin) {
  352. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  353. type: 1,
  354. relation_id: e.currentTarget.dataset.id
  355. }, false)
  356. if (res.status == 0) {
  357. if (res.data.is_collect == 0) {
  358. uni.showToast({
  359. title: "取消成功",
  360. icon: "none"
  361. })
  362. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  363. } else {
  364. uni.showToast({
  365. title: "关注成功",
  366. icon: "none"
  367. })
  368. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  369. }
  370. }
  371. } else {
  372. uni.showModal({
  373. title: "提示",
  374. content: "暂未登录,请前往登录",
  375. success: (res) => {
  376. if (res.confirm) {
  377. uni.navigateTo({
  378. url: "../login/login"
  379. })
  380. }
  381. }
  382. })
  383. }
  384. },
  385. servicepacks() {
  386. uni.navigateTo({
  387. url: "../service_packs/introduce"
  388. })
  389. },
  390. searchvalue(value) {
  391. uni.navigateTo({
  392. url: "../doctor_related/select_doctor?value=" + value
  393. })
  394. },
  395. childcare() {
  396. if (this.hasLogin) {
  397. uni.navigateTo({
  398. url: "../childcare/child_care"
  399. })
  400. } else {
  401. uni.showModal({
  402. title: "提示",
  403. content: "暂未登录,请前往登录",
  404. success: (res) => {
  405. if (res.confirm) {
  406. uni.navigateTo({
  407. url: "../login/login"
  408. })
  409. }
  410. }
  411. })
  412. }
  413. },
  414. vaccines() {
  415. if (this.hasLogin) {
  416. uni.navigateTo({
  417. url: "../vaccines/vaccines_info"
  418. })
  419. } else {
  420. uni.showModal({
  421. title: "提示",
  422. content: "暂未登录,请前往登录",
  423. success: (res) => {
  424. if (res.confirm) {
  425. uni.navigateTo({
  426. url: "../login/login"
  427. })
  428. }
  429. }
  430. })
  431. }
  432. },
  433. getconfigData: async function() {
  434. let res = await this.$request.post("/api/v1/common/configList", {}, false)
  435. console.log(res)
  436. if (res.status == 0) {
  437. this.configInfo = res.data
  438. this.hotlist = res.data.banners.filter(item => item.type == 1)
  439. this.ordinary = res.data.banners.filter(item => item.type == 2)
  440. }
  441. },
  442. //获取当前地址
  443. GetCurrentAddress() {
  444. getLocation().then(res => {
  445. this.latitude = res.latitude
  446. this.longitude = res.longitude
  447. uni.setStorageSync("latitude", res.latitude)
  448. uni.setStorageSync("longitude", res.longitude)
  449. }).catch(res => {
  450. })
  451. },
  452. }
  453. };
  454. </script>
  455. <style scoped lang="scss">
  456. .main {
  457. padding-top: 10rpx;
  458. padding-left: 20rpx;
  459. padding-right: 20rpx;
  460. }
  461. .dots {
  462. position: absolute;
  463. left: 0;
  464. right: 0;
  465. bottom: 30rpx;
  466. display: flex;
  467. justify-content: center;
  468. }
  469. .dots .dot {
  470. margin: 0 8rpx;
  471. width: 10rpx;
  472. height: 10rpx;
  473. background: rgba(0, 0, 0, .3);
  474. border-radius: 8rpx;
  475. transition: all .6s;
  476. }
  477. .dots .dot.active {
  478. width: 24rpx;
  479. height: 10rpx;
  480. background: #fff;
  481. }
  482. .gridstyle {
  483. height: 450rpx;
  484. background-color: #fff;
  485. border-radius: 15rpx;
  486. display: flex;
  487. align-items: center;
  488. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  489. margin-top: 20rpx;
  490. }
  491. .doctor_style {
  492. color: rgba(0, 0, 0, 0.54);
  493. }
  494. .doctor_style_item {
  495. overflow: hidden;
  496. text-overflow: ellipsis;
  497. display: -webkit-box;
  498. -webkit-line-clamp: 2;
  499. -webkit-box-orient: vertical;
  500. }
  501. .jisu {
  502. color: rgb(238, 170, 63);
  503. }
  504. .follow_style {
  505. position: absolute;
  506. bottom: 76rpx;
  507. left: 37rpx;
  508. z-index: 1;
  509. width: 106rpx;
  510. height: 40rpx;
  511. padding: 4rpx 0;
  512. background-color: rgb(208, 105, 150);
  513. box-sizing: border-box;
  514. color: #fff;
  515. text-align: center;
  516. border-radius: 60rpx;
  517. font-size: 24rpx;
  518. display: flex;
  519. justify-content: center;
  520. align-items: center;
  521. }
  522. .base_item {
  523. // position: absolute;
  524. // top: 0;
  525. // left: 0;
  526. // right: 0;
  527. // z-index: 1;
  528. width: 100%;
  529. height: auto;
  530. box-sizing: border-box;
  531. }
  532. .base_item_zi {
  533. // padding-top: 20rpx;
  534. // margin: 20rpx 20rpx;
  535. position: relative;
  536. box-sizing: border-box;
  537. }
  538. .base_item_zi_items {
  539. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  540. background-color: #fff;
  541. position: relative;
  542. border-radius: 8rpx;
  543. box-sizing: border-box;
  544. }
  545. .base_item_zi_content {
  546. display: flex;
  547. justify-content: center;
  548. padding: 30rpx 30rpx;
  549. overflow: hidden;
  550. position: relative;
  551. width: 100%;
  552. box-sizing: border-box;
  553. }
  554. .text_style {
  555. display: flex;
  556. justify-content: center;
  557. align-items: center;
  558. font-weight: 400;
  559. margin-left: 15rpx;
  560. background-color: #E5F5FF;
  561. color: #0B73B9;
  562. // width: 100rpx;
  563. height: 28rpx;
  564. font-size: 20rpx;
  565. border-radius: 10rpx;
  566. }
  567. .m_gray_small {
  568. white-space: nowrap;
  569. overflow: hidden;
  570. text-overflow: ellipsis;
  571. color: rgba(0, 0, 0, 0.54);
  572. margin-top: 20rpx;
  573. font-size: 28rpx;
  574. }
  575. .content_right {
  576. flex: 1;
  577. margin-left: 20rpx;
  578. overflow: hidden;
  579. position: relative;
  580. box-sizing: border-box;
  581. }
  582. .foot_item {
  583. background-color: #F7F7F7;
  584. box-sizing: border-box;
  585. }
  586. .grid-text {
  587. font-size: 28rpx;
  588. margin-top: 4rpx;
  589. color: $u-type-info;
  590. }
  591. .tltleStyle {
  592. padding: 30rpx 30rpx 15rpx 15rpx;
  593. // font-weight: bold;
  594. // font-size: 40rpx;
  595. }
  596. </style>