index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="loadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="fetchClubList"
  9. >
  10. <div class="page-top flex flex-col justify-center items-center" @click="toActivity"></div>
  11. <div class="page-content">
  12. <div
  13. class="navbar flex items-center flex-col"
  14. :style="{ top: offsetTop }"
  15. >
  16. <nuxt-link
  17. :to="routePrefix + '/approve/device'"
  18. class="link flex items-center flex-col"
  19. >
  20. <span class="icon icon-device"></span>
  21. <span class="text">设备认证</span>
  22. </nuxt-link>
  23. <!-- <nuxt-link
  24. :to="routePrefix + '/approve/personnel/operate'"
  25. class="link flex items-center flex-col md:mt-6 mt-4"
  26. >
  27. <span class="icon icon-doctor"></span>
  28. <span class="text">体疗师认证</span>
  29. </nuxt-link> -->
  30. </div>
  31. <div class="filter">
  32. <div class="search">
  33. <el-input
  34. placeholder="搜索机构"
  35. v-model="listQuery.authParty"
  36. @change="filterClubList"
  37. >
  38. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  39. </el-input>
  40. </div>
  41. <div class="area">
  42. <RossSelectGroup @change="onCityChange" ref="citySelect" />
  43. </div>
  44. </div>
  45. <!-- 明星机构 -->
  46. <template v-if="starList.length > 0">
  47. <div class="title flex justify-between px-4 pt-8 pb-6 md:px-0">
  48. <div>明星机构</div>
  49. <nuxt-link :to="routePrefix + '/approve/club/star-list'"
  50. >更多<i class="el-icon-arrow-right"></i
  51. ></nuxt-link>
  52. </div>
  53. <!-- 列表 -->
  54. <div class="list">
  55. <template v-for="item in starList">
  56. <div
  57. class="section flex justify-between mb-4"
  58. :key="item.authId"
  59. @click="toDetail(item)"
  60. >
  61. <img
  62. class="cover"
  63. :src="item.logo || drawLogo(item.authParty)"
  64. />
  65. <div class="info">
  66. <div class="name" v-text="item.authParty"></div>
  67. <div class="mobile">{{ item.mobile || '暂无' }}</div>
  68. <div class="address">
  69. {{ formatAddress(item.area, item.address) }}
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. </div>
  75. </template>
  76. <!-- 标题 -->
  77. <div class="title flex justify-between px-4 pt-8 pb-6 md:px-0">
  78. <div>距您最近...</div>
  79. <div>共<span v-text="total" class="font-bold"></span>家授权机构</div>
  80. </div>
  81. <!-- 列表 -->
  82. <div class="list">
  83. <template v-for="item in list">
  84. <div
  85. class="section flex justify-between mb-4"
  86. :key="item.authId"
  87. @click="toDetail(item)"
  88. >
  89. <img class="cover" :src="item.logo || drawLogo(item.authParty)" />
  90. <div class="info">
  91. <div class="name" v-text="item.authParty"></div>
  92. <div class="mobile">{{ item.mobile || '暂无' }}</div>
  93. <div class="address">
  94. {{ formatAddress(item.area, item.address) }}
  95. </div>
  96. <div
  97. class="distance"
  98. v-text="formatDistance(item.distance)"
  99. v-if="item.distance && item.distance !== 99999"
  100. ></div>
  101. </div>
  102. </div>
  103. </template>
  104. </div>
  105. <!-- 列表为空 -->
  106. <SimpleEmpty
  107. v-if="!total && !isRequest"
  108. name="icon-empty-club.png"
  109. description="敬请期待~"
  110. ></SimpleEmpty>
  111. </div>
  112. </van-list>
  113. </div>
  114. </template>
  115. <script>
  116. import { mapGetters } from 'vuex'
  117. import clubListMixin from '@/mixins/clubList'
  118. import { objectCover } from '@/utils'
  119. export default {
  120. layout: 'app-hyt',
  121. mixins: [clubListMixin],
  122. data() {
  123. return {
  124. scrollTop: 0,
  125. banner: {},
  126. screenWidth: ""
  127. }
  128. },
  129. computed: {
  130. ...mapGetters(['screenWidth', 'isPc']),
  131. offsetTop() {
  132. if (this.scrollTop <= window.innerHeight / 2) return '240px'
  133. return 240 + this.scrollTop - window.innerHeight / 2 + 'px'
  134. },
  135. },
  136. watch: {
  137. screenWidth: {
  138. handler(val) {
  139. const changeBanner = document.getElementsByClassName('page-top')[0]
  140. if (changeBanner) {
  141. if (val > 768) {
  142. if(this.banner.headPcBanner) {
  143. changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')'
  144. }
  145. }else {
  146. if(this.banner.headAppBanner) {
  147. changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')'
  148. }
  149. }
  150. }
  151. },
  152. immediate: true,
  153. deep: true
  154. }
  155. },
  156. mounted() {
  157. window.addEventListener('scroll', () => {
  158. this.scrollTop = document.documentElement.scrollTop
  159. })
  160. window.addEventListener('scroll', () => {
  161. this.scrollTop = document.documentElement.scrollTop
  162. })
  163. this.getBanner() // 获取轮播图
  164. // 监听页面尺寸变化
  165. this.screenWidth = document.body.clientWidth
  166. window.onresize = () => {
  167. return (() => {
  168. this.screenWidth = document.body.clientWidth
  169. })()
  170. }
  171. },
  172. beforeDestroy() {
  173. window.removeEventListener('scroll', () => {})
  174. },
  175. methods: {
  176. // 抖音挑战赛
  177. toActivity() {
  178. this.banner.jumpLink && this.$router.push(this.banner.jumpLink)
  179. },
  180. // 从缓存中获取数据
  181. initFromCache(cacheData) {
  182. const data = objectCover(this, cacheData)
  183. console.log(data)
  184. this.$nextTick(() => {
  185. this.$refs.citySelect.initSelectValue({
  186. provinceId: data.provinceId,
  187. cityId: data.cityId,
  188. townId: data.townId,
  189. })
  190. })
  191. },
  192. // 城市变化
  193. onCityChange(valueMap) {
  194. const { provinceId, cityId, townId } = valueMap
  195. this.listQuery.provinceId = provinceId
  196. this.listQuery.cityId = cityId
  197. this.listQuery.townId = townId
  198. this.filterClubList()
  199. },
  200. // banner
  201. async getBanner() {
  202. const { data } = await this.$http.api.bannerImg(this.authUserId)
  203. this.banner = data
  204. const changeBanner = document.getElementsByClassName('page-top')[0]
  205. if (this.screenWidth > 768) {
  206. this.banner.headPcBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headPcBanner+ ')')
  207. }else {
  208. this.banner.headAppBanner && (changeBanner.style.backgroundImage = 'url('+ this.banner.headAppBanner+ ')')
  209. }
  210. },
  211. },
  212. }
  213. </script>
  214. <style scoped lang="scss">
  215. .el-input {
  216. ::v-deep {
  217. & > {
  218. .el-input.is-active .el-input__inner,
  219. .el-input__inner:focus {
  220. border-color: #4093b5;
  221. }
  222. }
  223. }
  224. }
  225. // pc 端
  226. @media screen and (min-width: 768px) {
  227. .page {
  228. position: relative;
  229. // min-height: calc(100vh - 80px);
  230. min-height: 120vh;
  231. background-color: #fff;
  232. }
  233. .page-top {
  234. height: 530px;
  235. background-image: url(~assets/theme-images/hyt/pc/banner-club.jpg);
  236. background-size: cover;
  237. background-position: center;
  238. }
  239. .page-content {
  240. position: relative;
  241. width: 1000px;
  242. margin: 0 auto;
  243. .title {
  244. font-size: 16px;
  245. color: #404040;
  246. span {
  247. color: #4093b5;
  248. }
  249. }
  250. .filter {
  251. padding: 48px 0 105px;
  252. .search {
  253. width: 640px;
  254. margin: 0 auto;
  255. .el-input {
  256. height: 46px;
  257. font-size: 16px;
  258. .el-input__icon {
  259. font-size: 24px;
  260. line-height: 46px;
  261. margin-left: 12px;
  262. }
  263. ::v-deep {
  264. & > .el-input__inner {
  265. height: 46px;
  266. padding-left: 55px;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. .navbar {
  273. position: absolute;
  274. top: 240px;
  275. right: -168px;
  276. width: 120px;
  277. border-radius: 16px;
  278. background: #fff;
  279. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  280. padding: 24px 0;
  281. box-sizing: border-box;
  282. z-index: 2;
  283. .link {
  284. &:hover {
  285. .icon {
  286. &.icon-device {
  287. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  288. no-repeat center center,
  289. linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  290. background-size: 48px, 100%;
  291. }
  292. &.icon-doctor {
  293. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  294. no-repeat center center,
  295. linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  296. background-size: 48px, 100%;
  297. }
  298. }
  299. .text {
  300. color: #4093b5;
  301. }
  302. }
  303. span {
  304. display: block;
  305. }
  306. .icon {
  307. width: 72px;
  308. height: 72px;
  309. background: linear-gradient(180deg, #f6f6f7 0%, #f6f6f7 100%);
  310. border-radius: 12px;
  311. transition: all 0.2s;
  312. &.icon-device {
  313. background: url(~assets/theme-images/hyt/pc/nav-entry-device.png)
  314. no-repeat center center #f6f6f7;
  315. background-size: 48px;
  316. }
  317. &.icon-doctor {
  318. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor.png)
  319. no-repeat center center #f6f6f7;
  320. background-size: 48px;
  321. }
  322. }
  323. .text {
  324. font-size: 16px;
  325. color: #404040;
  326. margin-top: 8px;
  327. }
  328. }
  329. }
  330. .list {
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. flex-wrap: wrap;
  335. .empty {
  336. width: 390px;
  337. }
  338. .section {
  339. width: 490px;
  340. height: 136px;
  341. background-color: #f3f5f6;
  342. border-radius: 4px;
  343. box-sizing: border-box;
  344. padding: 16px;
  345. cursor: pointer;
  346. transition: all 0.4s;
  347. &:hover {
  348. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  349. }
  350. .cover {
  351. display: block;
  352. width: 104px;
  353. height: 104px;
  354. }
  355. .info {
  356. position: relative;
  357. margin-left: 12px;
  358. width: 330px;
  359. .name {
  360. width: 200px;
  361. font-size: 18px;
  362. color: #101010;
  363. font-weight: bold;
  364. margin-bottom: 24px;
  365. text-overflow: ellipsis;
  366. white-space: nowrap;
  367. overflow: hidden;
  368. }
  369. .mobile,
  370. .address {
  371. width: 268px;
  372. position: relative;
  373. font-size: 14px;
  374. color: #404040;
  375. padding-left: 24px;
  376. line-height: 24px;
  377. text-overflow: ellipsis;
  378. white-space: nowrap;
  379. margin-top: 6px;
  380. overflow: hidden;
  381. &::after {
  382. content: '';
  383. display: block;
  384. width: 16px;
  385. height: 16px;
  386. position: absolute;
  387. left: 0;
  388. top: 50%;
  389. transform: translateY(-50%);
  390. background-size: 16px;
  391. background-repeat: no-repeat;
  392. }
  393. }
  394. .mobile {
  395. &::after {
  396. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  397. }
  398. }
  399. .address {
  400. &::after {
  401. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  402. }
  403. }
  404. .distance {
  405. position: absolute;
  406. font-size: 14px;
  407. color: #404040;
  408. top: 2px;
  409. right: 0;
  410. }
  411. }
  412. }
  413. }
  414. }
  415. }
  416. // 移动 端
  417. @media screen and (max-width: 768px) {
  418. .page-top {
  419. height: 100vw;
  420. background-image: url(~assets/theme-images/hyt/h5/banner-club.png);
  421. background-size: 100vw 100vw !important;
  422. background-position: center;
  423. .logo {
  424. display: block;
  425. width: 14.8vw;
  426. height: 14.8vw;
  427. border-radius: 50%;
  428. background: #fff;
  429. }
  430. .name {
  431. font-size: 4vw;
  432. color: #fff;
  433. }
  434. }
  435. .page-content {
  436. position: relative;
  437. .title {
  438. font-size: 3.4vw;
  439. color: #404040;
  440. span {
  441. color: #4093b5;
  442. }
  443. }
  444. .filter {
  445. padding: 6.4vw 3.2vw 12.8vw;
  446. }
  447. .navbar {
  448. position: fixed;
  449. top: 50% !important;
  450. right: 3.2vw;
  451. left: unset !important;
  452. width: 14vw;
  453. border-radius: 1.6vw;
  454. background: #fff;
  455. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  456. padding: 2.8vw 0;
  457. box-sizing: border-box;
  458. z-index: 2;
  459. span {
  460. display: block;
  461. }
  462. .icon {
  463. position: relative;
  464. width: 7.2vw;
  465. height: 7.2vw;
  466. border-radius: 1.2vw;
  467. background: linear-gradient(180deg, #4bb9e6 0%, #4093b5 100%);
  468. &.icon-device,
  469. &.icon-doctor {
  470. &::after {
  471. content: '';
  472. display: block;
  473. width: 4.8vw;
  474. height: 4.8vw;
  475. position: absolute;
  476. left: 50%;
  477. top: 50%;
  478. transform: translate(-50%, -50%);
  479. background-size: 4.8vw !important;
  480. }
  481. }
  482. &.icon-device {
  483. &::after {
  484. background: url(~assets/theme-images/hyt/pc/nav-entry-device-active.png)
  485. no-repeat center;
  486. }
  487. }
  488. &.icon-doctor {
  489. &::after {
  490. background: url(~assets/theme-images/hyt/pc/nav-entry-doctor-active.png)
  491. no-repeat center;
  492. }
  493. }
  494. }
  495. .text {
  496. font-size: 2.4vw;
  497. color: #4093b5;
  498. margin-top: 1.2vw;
  499. }
  500. }
  501. }
  502. .list {
  503. display: flex;
  504. align-items: center;
  505. flex-direction: column;
  506. .section {
  507. width: 93.6vw;
  508. height: 26vw;
  509. background-color: #f3f5f6;
  510. border-radius: 4px;
  511. box-sizing: border-box;
  512. padding: 3.2vw;
  513. .cover {
  514. display: block;
  515. width: 19.6vw;
  516. height: 19.6vw;
  517. }
  518. .info {
  519. position: relative;
  520. margin-left: 3.2vw;
  521. .name {
  522. width: 48vw;
  523. font-size: 4vw;
  524. color: #101010;
  525. font-weight: bold;
  526. margin-bottom: 4vw;
  527. text-overflow: ellipsis;
  528. white-space: nowrap;
  529. overflow: hidden;
  530. }
  531. .mobile,
  532. .address {
  533. width: 66vw;
  534. position: relative;
  535. font-size: 3vw;
  536. color: #404040;
  537. padding-left: 5vw;
  538. line-height: 5vw;
  539. text-overflow: ellipsis;
  540. white-space: nowrap;
  541. overflow: hidden;
  542. &::after {
  543. content: '';
  544. display: block;
  545. width: 4vw;
  546. height: 4vw;
  547. position: absolute;
  548. left: 0;
  549. top: 50%;
  550. transform: translateY(-50%);
  551. background-size: 4vw 4vw;
  552. background-repeat: no-repeat;
  553. }
  554. }
  555. .mobile {
  556. &::after {
  557. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  558. }
  559. }
  560. .address {
  561. &::after {
  562. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  563. }
  564. }
  565. .distance {
  566. position: absolute;
  567. font-size: 3vw;
  568. color: #404040;
  569. top: 0.8vw;
  570. right: 0;
  571. }
  572. }
  573. }
  574. }
  575. }
  576. </style>