index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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. }, false)
  323. if (res.status == 0) {
  324. // this.doctorList = res.data.data
  325. if (this.pageindex > res.data.last_page) {
  326. } else {
  327. this.doctorList = this.doctorList.concat(res.data.data)
  328. this.pageindex++
  329. }
  330. }
  331. },
  332. submitCollect: async function(e) {
  333. if (this.hasLogin) {
  334. let res = await this.$request.post("/api/v1/collection/submitCollect", {
  335. type: 1,
  336. relation_id: e.currentTarget.dataset.id
  337. }, false)
  338. if (res.status == 0) {
  339. if (res.data.is_collect == 0) {
  340. uni.showToast({
  341. title: "取消成功",
  342. icon: "none"
  343. })
  344. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  345. } else {
  346. uni.showToast({
  347. title: "关注成功",
  348. icon: "none"
  349. })
  350. this.doctorList[e.currentTarget.dataset.index].is_collect = res.data.is_collect
  351. }
  352. }
  353. } else {
  354. uni.showModal({
  355. title: "提示",
  356. content: "暂未登录,请前往登录",
  357. success: (res) => {
  358. if (res.confirm) {
  359. uni.navigateTo({
  360. url: "../login/login"
  361. })
  362. }
  363. }
  364. })
  365. }
  366. },
  367. servicepacks() {
  368. uni.navigateTo({
  369. url: "../service_packs/introduce"
  370. })
  371. },
  372. searchvalue(value) {
  373. uni.navigateTo({
  374. url: "../doctor_related/select_doctor?value=" + value
  375. })
  376. },
  377. childcare() {
  378. if (this.hasLogin) {
  379. uni.navigateTo({
  380. url: "../childcare/child_care"
  381. })
  382. } else {
  383. uni.showModal({
  384. title: "提示",
  385. content: "暂未登录,请前往登录",
  386. success: (res) => {
  387. if (res.confirm) {
  388. uni.navigateTo({
  389. url: "../login/login"
  390. })
  391. }
  392. }
  393. })
  394. }
  395. },
  396. vaccines() {
  397. if (this.hasLogin) {
  398. uni.navigateTo({
  399. url: "../vaccines/vaccines_info"
  400. })
  401. } else {
  402. uni.showModal({
  403. title: "提示",
  404. content: "暂未登录,请前往登录",
  405. success: (res) => {
  406. if (res.confirm) {
  407. uni.navigateTo({
  408. url: "../login/login"
  409. })
  410. }
  411. }
  412. })
  413. }
  414. },
  415. getconfigData: async function() {
  416. let res = await this.$request.post("/api/v1/common/configList", {}, false)
  417. console.log(res)
  418. if (res.status == 0) {
  419. this.configInfo = res.data
  420. this.hotlist = res.data.banners.filter(item => item.type == 1)
  421. this.ordinary = res.data.banners.filter(item => item.type == 2)
  422. }
  423. },
  424. //获取当前地址
  425. GetCurrentAddress() {
  426. getLocation().then(res => {
  427. this.latitude = res.latitude
  428. this.longitude = res.longitude
  429. uni.setStorageSync("latitude", res.latitude)
  430. uni.setStorageSync("longitude", res.longitude)
  431. }).catch(res => {
  432. })
  433. },
  434. }
  435. };
  436. </script>
  437. <style scoped lang="scss">
  438. .main {
  439. padding-top: 10rpx;
  440. padding-left: 20rpx;
  441. padding-right: 20rpx;
  442. }
  443. .dots {
  444. position: absolute;
  445. left: 0;
  446. right: 0;
  447. bottom: 30rpx;
  448. display: flex;
  449. justify-content: center;
  450. }
  451. .dots .dot {
  452. margin: 0 8rpx;
  453. width: 10rpx;
  454. height: 10rpx;
  455. background: rgba(0, 0, 0, .3);
  456. border-radius: 8rpx;
  457. transition: all .6s;
  458. }
  459. .dots .dot.active {
  460. width: 24rpx;
  461. height: 10rpx;
  462. background: #fff;
  463. }
  464. .gridstyle {
  465. height: 450rpx;
  466. background-color: #fff;
  467. border-radius: 15rpx;
  468. display: flex;
  469. align-items: center;
  470. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  471. margin-top: 20rpx;
  472. }
  473. .doctor_style {
  474. color: rgba(0, 0, 0, 0.54);
  475. }
  476. .doctor_style_item {
  477. overflow: hidden;
  478. text-overflow: ellipsis;
  479. display: -webkit-box;
  480. -webkit-line-clamp: 2;
  481. -webkit-box-orient: vertical;
  482. }
  483. .jisu {
  484. color: rgb(238, 170, 63);
  485. }
  486. .follow_style {
  487. position: absolute;
  488. bottom: 76rpx;
  489. left: 37rpx;
  490. z-index: 1;
  491. width: 106rpx;
  492. height: 40rpx;
  493. padding: 4rpx 0;
  494. background-color: rgb(208, 105, 150);
  495. box-sizing: border-box;
  496. color: #fff;
  497. text-align: center;
  498. border-radius: 60rpx;
  499. font-size: 24rpx;
  500. display: flex;
  501. justify-content: center;
  502. align-items: center;
  503. }
  504. .base_item {
  505. // position: absolute;
  506. // top: 0;
  507. // left: 0;
  508. // right: 0;
  509. // z-index: 1;
  510. width: 100%;
  511. height: auto;
  512. box-sizing: border-box;
  513. }
  514. .base_item_zi {
  515. // padding-top: 20rpx;
  516. // margin: 20rpx 20rpx;
  517. position: relative;
  518. box-sizing: border-box;
  519. }
  520. .base_item_zi_items {
  521. box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
  522. background-color: #fff;
  523. position: relative;
  524. border-radius: 8rpx;
  525. box-sizing: border-box;
  526. }
  527. .base_item_zi_content {
  528. display: flex;
  529. justify-content: center;
  530. padding: 30rpx 30rpx;
  531. overflow: hidden;
  532. position: relative;
  533. width: 100%;
  534. box-sizing: border-box;
  535. }
  536. .text_style {
  537. display: flex;
  538. justify-content: center;
  539. align-items: center;
  540. font-weight: 400;
  541. margin-left: 15rpx;
  542. background-color: #E5F5FF;
  543. color: #0B73B9;
  544. // width: 100rpx;
  545. height: 28rpx;
  546. font-size: 20rpx;
  547. border-radius: 10rpx;
  548. }
  549. .m_gray_small {
  550. white-space: nowrap;
  551. overflow: hidden;
  552. text-overflow: ellipsis;
  553. color: rgba(0, 0, 0, 0.54);
  554. margin-top: 20rpx;
  555. font-size: 28rpx;
  556. }
  557. .content_right {
  558. flex: 1;
  559. margin-left: 20rpx;
  560. overflow: hidden;
  561. position: relative;
  562. box-sizing: border-box;
  563. }
  564. .foot_item {
  565. background-color: #F7F7F7;
  566. box-sizing: border-box;
  567. }
  568. .grid-text {
  569. font-size: 28rpx;
  570. margin-top: 4rpx;
  571. color: $u-type-info;
  572. }
  573. .tltleStyle {
  574. padding: 30rpx 30rpx 15rpx 15rpx;
  575. // font-weight: bold;
  576. // font-size: 40rpx;
  577. }
  578. </style>