index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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">
  11. <!-- <img class="logo" :src="supplierInfo.logo" /> -->
  12. <div class="mt-2 name">
  13. <span v-text="supplierInfo.shopName"></span>
  14. <span>官方授权机构</span>
  15. </div>
  16. </div>
  17. <div class="page-content">
  18. <!-- 搜索区域 -->
  19. <div class="search">
  20. <simple-search
  21. v-model="listQuery.authParty"
  22. @search="filterClubList"
  23. placeholder="搜索机构"
  24. />
  25. </div>
  26. <!-- 地区选择 -->
  27. <div class="city">
  28. <SimpleCity
  29. ref="citySelect"
  30. @change="onCityChange"
  31. :options="cityList"
  32. labelName="name"
  33. valueName="id"
  34. ></SimpleCity>
  35. </div>
  36. <template v-if="starList.length > 0">
  37. <!-- 明星机构 -->
  38. <div class="title flex justify-between px-4 pt-8 pb-8 md:px-0">
  39. <div>明星机构</div>
  40. <nuxt-link :to="routePrefix + '/approve/club/star-list'"
  41. >更多<i class="el-icon-arrow-right"></i
  42. ></nuxt-link>
  43. </div>
  44. <div class="list">
  45. <template v-for="item in starList">
  46. <div
  47. class="section flex justify-between mb-4"
  48. :key="item.authId"
  49. @click="toDetail(item)"
  50. >
  51. <img
  52. class="cover"
  53. :src="item.logo || drawLogo(item.authParty)"
  54. />
  55. <div class="info">
  56. <div class="name" v-text="item.authParty"></div>
  57. <!--<div class="mobile">{{ item.mobile || '暂无' }}</div>-->
  58. <div class="address">
  59. {{ formatAddress(item.area, item.address) }}
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <div
  65. class="empty"
  66. v-for="i in starEmptyList"
  67. :key="'empty-' + i"
  68. ></div>
  69. </div>
  70. </template>
  71. <!-- 标题 -->
  72. <div class="title flex justify-between px-4 pt-8 pb-8 md:px-0">
  73. <div>距您最近...</div>
  74. <div>共<span v-text="total"></span>家机构</div>
  75. </div>
  76. <!-- 列表 -->
  77. <div class="list">
  78. <template v-for="item in list">
  79. <div
  80. class="section flex justify-between mb-4"
  81. :key="item.authId"
  82. @click="toDetail(item)"
  83. >
  84. <img class="cover" :src="item.logo || drawLogo(item.authParty)" />
  85. <div class="info">
  86. <div class="name" v-text="item.authParty"></div>
  87. <!--<div class="mobile">{{ item.mobile || '暂无' }}</div>-->
  88. <div class="address">
  89. {{ formatAddress(item.area, item.address) }}
  90. </div>
  91. <div
  92. class="distance"
  93. v-text="formatDistance(item.distance)"
  94. v-if="item.distance && item.distance !== 99999"
  95. ></div>
  96. </div>
  97. </div>
  98. </template>
  99. <div class="empty" v-for="i in emptyList" :key="'empty-' + i"></div>
  100. </div>
  101. <!-- 列表为空 -->
  102. <SimpleEmpty
  103. v-if="!total && !isRequest"
  104. name="icon-empty-club.png"
  105. description="敬请期待~"
  106. ></SimpleEmpty>
  107. </div>
  108. </van-list>
  109. </div>
  110. </template>
  111. <script>
  112. import { mapGetters } from 'vuex'
  113. import clubListMixin from '@/mixins/clubList'
  114. import { objectCover } from '@/utils'
  115. export default {
  116. layout: 'app-ph',
  117. mixins: [clubListMixin],
  118. data() {
  119. return {
  120. cityList: [],
  121. selectValue: [],
  122. }
  123. },
  124. computed: {
  125. ...mapGetters(['supplierInfo']),
  126. emptyList() {
  127. return 3 - (this.list.length % 3)
  128. },
  129. starEmptyList() {
  130. return 3 - (this.starList.length % 3)
  131. },
  132. },
  133. created() {
  134. this.fetchCityList()
  135. },
  136. methods: {
  137. // 从缓存中获取数据
  138. initFromCache(cacheData) {
  139. const data = objectCover(this, cacheData)
  140. this.$nextTick(() => {
  141. this.$refs.citySelect.setSelectValue(data.selectValue)
  142. })
  143. },
  144. // 获取地址列表
  145. fetchCityList() {
  146. this.$http.api.fetchAllCityList().then((res) => {
  147. this.cityList = res.data
  148. })
  149. },
  150. // 城市变化
  151. onCityChange(selectValue) {
  152. this.listQuery.provinceId = ''
  153. this.listQuery.cityId = ''
  154. this.listQuery.townId = ''
  155. this.selectValue = selectValue
  156. selectValue.map((item, index) => {
  157. if (index === 0) {
  158. this.listQuery.provinceId = item.id
  159. } else if (index === 1) {
  160. this.listQuery.cityId = item.id
  161. } else {
  162. this.listQuery.townId = item.id
  163. }
  164. })
  165. this.filterClubList()
  166. },
  167. },
  168. }
  169. </script>
  170. <style scoped lang="scss">
  171. // pc 端
  172. @media screen and (min-width: 768px) {
  173. .page {
  174. @include useTheme() {
  175. position: relative;
  176. min-height: calc(100vh - 80px - 80px);
  177. background-color: #fff;
  178. .page-top {
  179. height: 420px;
  180. background: fetch('pc-banner-club');
  181. background-size: auto 420px;
  182. .logo {
  183. display: block;
  184. width: 120px;
  185. height: 120px;
  186. border-radius: 50%;
  187. background: #fff;
  188. }
  189. .name {
  190. font-size: 30px;
  191. color: #fff;
  192. }
  193. .logo,
  194. .name {
  195. transform: translateY(-60px);
  196. }
  197. }
  198. .page-content {
  199. width: 1200px;
  200. margin: 0 auto;
  201. .search {
  202. position: absolute;
  203. left: 50%;
  204. top: 260px;
  205. transform: translateX(-50%);
  206. }
  207. .city {
  208. position: absolute;
  209. left: 50%;
  210. top: 320px;
  211. transform: translateX(-50%);
  212. z-index: 9;
  213. }
  214. .title {
  215. font-size: 16px;
  216. color: #404040;
  217. span {
  218. color: fetch('color');
  219. }
  220. }
  221. .list {
  222. display: flex;
  223. align-items: center;
  224. justify-content: space-between;
  225. flex-wrap: wrap;
  226. .empty {
  227. width: 390px;
  228. }
  229. .section {
  230. width: 390px;
  231. height: 108px;
  232. background-color: #f3f5f6;
  233. border-radius: 4px;
  234. box-sizing: border-box;
  235. padding: 12px;
  236. cursor: pointer;
  237. transition: all 0.4s;
  238. &:hover {
  239. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  240. }
  241. .cover {
  242. display: block;
  243. width: 84px;
  244. height: 84px;
  245. }
  246. .info {
  247. position: relative;
  248. margin-left: 12px;
  249. @include flex-column-between;
  250. .name {
  251. width: 200px;
  252. font-size: 16px;
  253. color: #101010;
  254. font-weight: bold;
  255. margin-bottom: 16px;
  256. text-overflow: ellipsis;
  257. white-space: nowrap;
  258. overflow: hidden;
  259. }
  260. .mobile,
  261. .address {
  262. width: 268px;
  263. position: relative;
  264. font-size: 14px;
  265. color: #404040;
  266. padding-left: 24px;
  267. line-height: 24px;
  268. text-overflow: ellipsis;
  269. white-space: nowrap;
  270. overflow: hidden;
  271. &::after {
  272. content: '';
  273. display: block;
  274. width: 16px;
  275. height: 16px;
  276. position: absolute;
  277. left: 0;
  278. top: 50%;
  279. transform: translateY(-50%);
  280. background-size: 16px;
  281. background-repeat: no-repeat;
  282. }
  283. }
  284. .mobile {
  285. &::after {
  286. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  287. }
  288. }
  289. .address {
  290. &::after {
  291. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  292. }
  293. }
  294. .distance {
  295. position: absolute;
  296. font-size: 12px;
  297. color: #404040;
  298. top: 2px;
  299. right: 0;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. // 移动 端
  309. @media screen and (max-width: 768px) {
  310. .page {
  311. @include useTheme() {
  312. .page-top {
  313. height: 46vw;
  314. background: fetch('h5-banner-club');
  315. background-size: auto 46vw;
  316. .logo {
  317. display: block;
  318. width: 14.8vw;
  319. height: 14.8vw;
  320. border-radius: 50%;
  321. background: #fff;
  322. }
  323. .name {
  324. font-size: 4vw;
  325. color: #fff;
  326. }
  327. }
  328. .page-content {
  329. position: relative;
  330. .search {
  331. position: absolute;
  332. left: 50%;
  333. top: 0;
  334. transform: translate(-50%, -50%);
  335. }
  336. .city {
  337. position: relative;
  338. z-index: 9;
  339. padding-top: 12vw;
  340. }
  341. .title {
  342. font-size: 3.4vw;
  343. color: #404040;
  344. span {
  345. color: fetch('color');
  346. }
  347. }
  348. .list {
  349. display: flex;
  350. align-items: center;
  351. flex-direction: column;
  352. .section {
  353. width: 93.6vw;
  354. height: 26vw;
  355. background-color: #f3f5f6;
  356. border-radius: 4px;
  357. box-sizing: border-box;
  358. padding: 3.2vw;
  359. .cover {
  360. display: block;
  361. width: 19.6vw;
  362. height: 19.6vw;
  363. }
  364. .info {
  365. position: relative;
  366. margin-left: 3.2vw;
  367. @include flex-column-between;
  368. .name {
  369. width: 48vw;
  370. font-size: 4vw;
  371. color: #101010;
  372. font-weight: bold;
  373. margin-bottom: 4vw;
  374. text-overflow: ellipsis;
  375. white-space: nowrap;
  376. overflow: hidden;
  377. }
  378. .mobile,
  379. .address {
  380. width: 66vw;
  381. position: relative;
  382. font-size: 3vw;
  383. color: #404040;
  384. padding-left: 5vw;
  385. line-height: 5vw;
  386. text-overflow: ellipsis;
  387. white-space: nowrap;
  388. overflow: hidden;
  389. &::after {
  390. content: '';
  391. display: block;
  392. width: 4vw;
  393. height: 4vw;
  394. position: absolute;
  395. left: 0;
  396. top: 50%;
  397. transform: translateY(-50%);
  398. background-size: 4vw 4vw;
  399. background-repeat: no-repeat;
  400. }
  401. }
  402. .mobile {
  403. &::after {
  404. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  405. }
  406. }
  407. .address {
  408. &::after {
  409. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  410. }
  411. }
  412. .distance {
  413. position: absolute;
  414. font-size: 3vw;
  415. color: #404040;
  416. top: 0.8vw;
  417. right: 0;
  418. }
  419. }
  420. }
  421. }
  422. }
  423. }
  424. }
  425. }
  426. </style>