index.vue 17 KB

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