index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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. position: relative;
  175. min-height: calc(100vh - 80px - 80px);
  176. background-color: #fff;
  177. }
  178. .page-top {
  179. height: 420px;
  180. @include themify($themes) {
  181. background: themed('pc-banner-club');
  182. }
  183. background-size: auto 420px;
  184. .logo {
  185. display: block;
  186. width: 120px;
  187. height: 120px;
  188. border-radius: 50%;
  189. background: #fff;
  190. }
  191. .name {
  192. font-size: 30px;
  193. color: #fff;
  194. }
  195. .logo,
  196. .name {
  197. transform: translateY(-60px);
  198. }
  199. }
  200. .page-content {
  201. width: 1200px;
  202. margin: 0 auto;
  203. .search {
  204. position: absolute;
  205. left: 50%;
  206. top: 260px;
  207. transform: translateX(-50%);
  208. }
  209. .city {
  210. position: absolute;
  211. left: 50%;
  212. top: 320px;
  213. transform: translateX(-50%);
  214. z-index: 9;
  215. }
  216. .title {
  217. font-size: 16px;
  218. color: #404040;
  219. span {
  220. @include themify($themes) {
  221. color: themed('color');
  222. }
  223. }
  224. }
  225. .list {
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. flex-wrap: wrap;
  230. .empty {
  231. width: 390px;
  232. }
  233. .section {
  234. width: 390px;
  235. height: 108px;
  236. background-color: #f3f5f6;
  237. border-radius: 4px;
  238. box-sizing: border-box;
  239. padding: 12px;
  240. cursor: pointer;
  241. transition: all 0.4s;
  242. &:hover {
  243. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  244. }
  245. .cover {
  246. display: block;
  247. width: 84px;
  248. height: 84px;
  249. }
  250. .info {
  251. position: relative;
  252. margin-left: 12px;
  253. .name {
  254. width: 200px;
  255. font-size: 16px;
  256. color: #101010;
  257. font-weight: bold;
  258. margin-bottom: 16px;
  259. text-overflow: ellipsis;
  260. white-space: nowrap;
  261. overflow: hidden;
  262. }
  263. .mobile,
  264. .address {
  265. width: 268px;
  266. position: relative;
  267. font-size: 14px;
  268. color: #404040;
  269. padding-left: 24px;
  270. line-height: 24px;
  271. text-overflow: ellipsis;
  272. white-space: nowrap;
  273. overflow: hidden;
  274. &::after {
  275. content: '';
  276. display: block;
  277. width: 16px;
  278. height: 16px;
  279. position: absolute;
  280. left: 0;
  281. top: 50%;
  282. transform: translateY(-50%);
  283. background-size: 16px;
  284. background-repeat: no-repeat;
  285. }
  286. }
  287. .mobile {
  288. &::after {
  289. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  290. }
  291. }
  292. .address {
  293. &::after {
  294. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  295. }
  296. }
  297. .distance {
  298. position: absolute;
  299. font-size: 12px;
  300. color: #404040;
  301. top: 2px;
  302. right: 0;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. // 移动 端
  310. @media screen and (max-width: 768px) {
  311. .page-top {
  312. height: 46vw;
  313. @include themify($themes) {
  314. background: themed('h5-banner-club');
  315. }
  316. background-size: auto 46vw;
  317. .logo {
  318. display: block;
  319. width: 14.8vw;
  320. height: 14.8vw;
  321. border-radius: 50%;
  322. background: #fff;
  323. }
  324. .name {
  325. font-size: 4vw;
  326. color: #fff;
  327. }
  328. }
  329. .page-content {
  330. position: relative;
  331. .search {
  332. position: absolute;
  333. left: 50%;
  334. top: 0;
  335. transform: translate(-50%, -50%);
  336. }
  337. .city {
  338. position: relative;
  339. z-index: 9;
  340. padding-top: 12vw;
  341. }
  342. .title {
  343. font-size: 3.4vw;
  344. color: #404040;
  345. span {
  346. @include themify($themes) {
  347. color: themed('color');
  348. }
  349. }
  350. }
  351. .list {
  352. display: flex;
  353. align-items: center;
  354. flex-direction: column;
  355. .section {
  356. width: 93.6vw;
  357. height: 26vw;
  358. background-color: #f3f5f6;
  359. border-radius: 4px;
  360. box-sizing: border-box;
  361. padding: 3.2vw;
  362. .cover {
  363. display: block;
  364. width: 19.6vw;
  365. height: 19.6vw;
  366. }
  367. .info {
  368. position: relative;
  369. margin-left: 3.2vw;
  370. .name {
  371. width: 48vw;
  372. font-size: 4vw;
  373. color: #101010;
  374. font-weight: bold;
  375. margin-bottom: 4vw;
  376. text-overflow: ellipsis;
  377. white-space: nowrap;
  378. overflow: hidden;
  379. }
  380. .mobile,
  381. .address {
  382. width: 66vw;
  383. position: relative;
  384. font-size: 3vw;
  385. color: #404040;
  386. padding-left: 5vw;
  387. line-height: 5vw;
  388. text-overflow: ellipsis;
  389. white-space: nowrap;
  390. overflow: hidden;
  391. &::after {
  392. content: '';
  393. display: block;
  394. width: 4vw;
  395. height: 4vw;
  396. position: absolute;
  397. left: 0;
  398. top: 50%;
  399. transform: translateY(-50%);
  400. background-size: 4vw 4vw;
  401. background-repeat: no-repeat;
  402. }
  403. }
  404. .mobile {
  405. &::after {
  406. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  407. }
  408. }
  409. .address {
  410. &::after {
  411. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  412. }
  413. }
  414. .distance {
  415. position: absolute;
  416. font-size: 3vw;
  417. color: #404040;
  418. top: 0.8vw;
  419. right: 0;
  420. }
  421. }
  422. }
  423. }
  424. }
  425. }
  426. </style>