index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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-normal',
  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: #bc1724;
  221. }
  222. }
  223. }
  224. }
  225. // pc 端
  226. @media screen and (min-width: 768px) {
  227. .page {
  228. position: relative;
  229. min-height: calc(100vh - 80px - 80px);
  230. background-color: #fff;
  231. }
  232. .page-top {
  233. height: 530px;
  234. background-image: url(~assets/theme-images/normal/pc/banner-club.png);
  235. background-size: cover;
  236. background-position: center;
  237. }
  238. .page-content {
  239. position: relative;
  240. width: 1000px;
  241. margin: 0 auto;
  242. .title {
  243. font-size: 16px;
  244. color: #404040;
  245. span {
  246. color: #bc1724;
  247. }
  248. }
  249. .filter {
  250. padding: 48px 0 105px;
  251. .search {
  252. width: 640px;
  253. margin: 0 auto;
  254. .el-input {
  255. height: 46px;
  256. font-size: 16px;
  257. .el-input__icon {
  258. font-size: 24px;
  259. line-height: 46px;
  260. margin-left: 12px;
  261. }
  262. ::v-deep {
  263. & > .el-input__inner {
  264. height: 46px;
  265. padding-left: 55px;
  266. }
  267. }
  268. }
  269. }
  270. }
  271. .navbar {
  272. position: absolute;
  273. top: 240px;
  274. right: -168px;
  275. width: 120px;
  276. border-radius: 16px;
  277. background: #fff;
  278. box-shadow: 0px 6px 20px rgba(40, 40, 40, 0.1);
  279. padding: 24px 0;
  280. box-sizing: border-box;
  281. z-index: 2;
  282. .link {
  283. &:hover {
  284. .icon {
  285. &.icon-device {
  286. background: url(~assets/theme-images/normal/pc/nav-entry-device-active.png)
  287. no-repeat center center,
  288. linear-gradient(180deg, #e41d2d 0%, #bc1724 100%);
  289. background-size: 48px, 100%;
  290. }
  291. &.icon-doctor {
  292. background: url(~assets/theme-images/normal/pc/nav-entry-doctor-active.png)
  293. no-repeat center center,
  294. linear-gradient(180deg, #e41d2d 0%, #bc1724 100%);
  295. background-size: 48px, 100%;
  296. }
  297. }
  298. .text {
  299. color: #bc1724;
  300. }
  301. }
  302. span {
  303. display: block;
  304. }
  305. .icon {
  306. width: 72px;
  307. height: 72px;
  308. background: linear-gradient(180deg, #f6f6f7 0%, #f6f6f7 100%);
  309. border-radius: 12px;
  310. transition: all 0.2s;
  311. &.icon-device {
  312. background: url(~assets/theme-images/normal/pc/nav-entry-device.png)
  313. no-repeat center center #f6f6f7;
  314. background-size: 48px;
  315. }
  316. &.icon-doctor {
  317. background: url(~assets/theme-images/normal/pc/nav-entry-doctor.png)
  318. no-repeat center center #f6f6f7;
  319. background-size: 48px;
  320. }
  321. }
  322. .text {
  323. font-size: 16px;
  324. color: #404040;
  325. margin-top: 8px;
  326. }
  327. }
  328. }
  329. .list {
  330. display: flex;
  331. align-items: center;
  332. justify-content: space-between;
  333. flex-wrap: wrap;
  334. .empty {
  335. width: 390px;
  336. }
  337. .section {
  338. width: 490px;
  339. height: 136px;
  340. background-color: #f3f5f6;
  341. border-radius: 4px;
  342. box-sizing: border-box;
  343. padding: 16px;
  344. cursor: pointer;
  345. transition: all 0.4s;
  346. &:hover {
  347. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  348. }
  349. .cover {
  350. display: block;
  351. width: 104px;
  352. height: 104px;
  353. }
  354. .info {
  355. position: relative;
  356. margin-left: 12px;
  357. width: 330px;
  358. .name {
  359. width: 200px;
  360. font-size: 18px;
  361. color: #101010;
  362. font-weight: bold;
  363. margin-bottom: 24px;
  364. text-overflow: ellipsis;
  365. white-space: nowrap;
  366. overflow: hidden;
  367. }
  368. .mobile,
  369. .address {
  370. width: 268px;
  371. position: relative;
  372. font-size: 14px;
  373. color: #404040;
  374. padding-left: 24px;
  375. line-height: 24px;
  376. text-overflow: ellipsis;
  377. white-space: nowrap;
  378. margin-top: 6px;
  379. overflow: hidden;
  380. &::after {
  381. content: '';
  382. display: block;
  383. width: 16px;
  384. height: 16px;
  385. position: absolute;
  386. left: 0;
  387. top: 50%;
  388. transform: translateY(-50%);
  389. background-size: 16px;
  390. background-repeat: no-repeat;
  391. }
  392. }
  393. .mobile {
  394. &::after {
  395. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  396. }
  397. }
  398. .address {
  399. &::after {
  400. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  401. }
  402. }
  403. .distance {
  404. position: absolute;
  405. font-size: 14px;
  406. color: #404040;
  407. top: 2px;
  408. right: 0;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }
  415. // 移动 端
  416. @media screen and (max-width: 768px) {
  417. .page-top {
  418. height: 100vw;
  419. background-image: url(~assets/theme-images/normal/h5/banner-club.png);
  420. background-size: 100vw 100vw !important;
  421. background-position: center;
  422. .logo {
  423. display: block;
  424. width: 14.8vw;
  425. height: 14.8vw;
  426. border-radius: 50%;
  427. background: #fff;
  428. }
  429. .name {
  430. font-size: 4vw;
  431. color: #fff;
  432. }
  433. }
  434. .page-content {
  435. position: relative;
  436. .title {
  437. font-size: 3.4vw;
  438. color: #404040;
  439. span {
  440. color: #bc1724;
  441. }
  442. }
  443. .filter {
  444. padding: 6.4vw 3.2vw 12.8vw;
  445. }
  446. .navbar {
  447. position: fixed;
  448. top: 50% !important;
  449. right: 3.2vw;
  450. left: unset !important;
  451. width: 14vw;
  452. border-radius: 1.6vw;
  453. background: #fff;
  454. box-shadow: 0px 0.6vw 2vw rgba(40, 40, 40, 0.1);
  455. padding: 2.8vw 0;
  456. box-sizing: border-box;
  457. z-index: 2;
  458. span {
  459. display: block;
  460. }
  461. .icon {
  462. position: relative;
  463. width: 7.2vw;
  464. height: 7.2vw;
  465. border-radius: 1.2vw;
  466. background: linear-gradient(180deg, #e41d2d 0%, #bc1724 100%);
  467. &.icon-device,
  468. &.icon-doctor {
  469. &::after {
  470. content: '';
  471. display: block;
  472. width: 4.8vw;
  473. height: 4.8vw;
  474. position: absolute;
  475. left: 50%;
  476. top: 50%;
  477. transform: translate(-50%, -50%);
  478. background-size: 4.8vw !important;
  479. }
  480. }
  481. &.icon-device {
  482. &::after {
  483. background: url(~assets/theme-images/normal/pc/nav-entry-device-active.png)
  484. no-repeat center;
  485. }
  486. }
  487. &.icon-doctor {
  488. &::after {
  489. background: url(~assets/theme-images/normal/pc/nav-entry-doctor-active.png)
  490. no-repeat center;
  491. }
  492. }
  493. }
  494. .text {
  495. font-size: 2.4vw;
  496. color: #bc1724;
  497. margin-top: 1.2vw;
  498. }
  499. }
  500. }
  501. .list {
  502. display: flex;
  503. align-items: center;
  504. flex-direction: column;
  505. .section {
  506. width: 93.6vw;
  507. height: 26vw;
  508. background-color: #f3f5f6;
  509. border-radius: 4px;
  510. box-sizing: border-box;
  511. padding: 3.2vw;
  512. .cover {
  513. display: block;
  514. width: 19.6vw;
  515. height: 19.6vw;
  516. }
  517. .info {
  518. position: relative;
  519. margin-left: 3.2vw;
  520. .name {
  521. width: 48vw;
  522. font-size: 4vw;
  523. color: #101010;
  524. font-weight: bold;
  525. margin-bottom: 4vw;
  526. text-overflow: ellipsis;
  527. white-space: nowrap;
  528. overflow: hidden;
  529. }
  530. .mobile,
  531. .address {
  532. width: 66vw;
  533. position: relative;
  534. font-size: 3vw;
  535. color: #404040;
  536. padding-left: 5vw;
  537. line-height: 5vw;
  538. text-overflow: ellipsis;
  539. white-space: nowrap;
  540. overflow: hidden;
  541. &::after {
  542. content: '';
  543. display: block;
  544. width: 4vw;
  545. height: 4vw;
  546. position: absolute;
  547. left: 0;
  548. top: 50%;
  549. transform: translateY(-50%);
  550. background-size: 4vw 4vw;
  551. background-repeat: no-repeat;
  552. }
  553. }
  554. .mobile {
  555. &::after {
  556. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  557. }
  558. }
  559. .address {
  560. &::after {
  561. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  562. }
  563. }
  564. .distance {
  565. position: absolute;
  566. font-size: 3vw;
  567. color: #404040;
  568. top: 0.8vw;
  569. right: 0;
  570. }
  571. }
  572. }
  573. }
  574. }
  575. </style>