index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. .name {
  250. width: 200px;
  251. font-size: 16px;
  252. color: #101010;
  253. font-weight: bold;
  254. margin-bottom: 16px;
  255. text-overflow: ellipsis;
  256. white-space: nowrap;
  257. overflow: hidden;
  258. }
  259. .mobile,
  260. .address {
  261. width: 268px;
  262. position: relative;
  263. font-size: 14px;
  264. color: #404040;
  265. padding-left: 24px;
  266. line-height: 24px;
  267. text-overflow: ellipsis;
  268. white-space: nowrap;
  269. overflow: hidden;
  270. &::after {
  271. content: '';
  272. display: block;
  273. width: 16px;
  274. height: 16px;
  275. position: absolute;
  276. left: 0;
  277. top: 50%;
  278. transform: translateY(-50%);
  279. background-size: 16px;
  280. background-repeat: no-repeat;
  281. }
  282. }
  283. .mobile {
  284. &::after {
  285. background-image: url(~assets/theme-images/common/pc-icon-mobile.png);
  286. }
  287. }
  288. .address {
  289. &::after {
  290. background-image: url(~assets/theme-images/common/pc-icon-address.png);
  291. }
  292. }
  293. .distance {
  294. position: absolute;
  295. font-size: 12px;
  296. color: #404040;
  297. top: 2px;
  298. right: 0;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. }
  305. }
  306. }
  307. // 移动 端
  308. @media screen and (max-width: 768px) {
  309. .page {
  310. @include useTheme() {
  311. .page-top {
  312. height: 46vw;
  313. background: fetch('h5-banner-club');
  314. background-size: auto 46vw;
  315. .logo {
  316. display: block;
  317. width: 14.8vw;
  318. height: 14.8vw;
  319. border-radius: 50%;
  320. background: #fff;
  321. }
  322. .name {
  323. font-size: 4vw;
  324. color: #fff;
  325. }
  326. }
  327. .page-content {
  328. position: relative;
  329. .search {
  330. position: absolute;
  331. left: 50%;
  332. top: 0;
  333. transform: translate(-50%, -50%);
  334. }
  335. .city {
  336. position: relative;
  337. z-index: 9;
  338. padding-top: 12vw;
  339. }
  340. .title {
  341. font-size: 3.4vw;
  342. color: #404040;
  343. span {
  344. color: fetch('color');
  345. }
  346. }
  347. .list {
  348. display: flex;
  349. align-items: center;
  350. flex-direction: column;
  351. .section {
  352. width: 93.6vw;
  353. height: 26vw;
  354. background-color: #f3f5f6;
  355. border-radius: 4px;
  356. box-sizing: border-box;
  357. padding: 3.2vw;
  358. .cover {
  359. display: block;
  360. width: 19.6vw;
  361. height: 19.6vw;
  362. }
  363. .info {
  364. position: relative;
  365. margin-left: 3.2vw;
  366. .name {
  367. width: 48vw;
  368. font-size: 4vw;
  369. color: #101010;
  370. font-weight: bold;
  371. margin-bottom: 4vw;
  372. text-overflow: ellipsis;
  373. white-space: nowrap;
  374. overflow: hidden;
  375. }
  376. .mobile,
  377. .address {
  378. width: 66vw;
  379. position: relative;
  380. font-size: 3vw;
  381. color: #404040;
  382. padding-left: 5vw;
  383. line-height: 5vw;
  384. text-overflow: ellipsis;
  385. white-space: nowrap;
  386. overflow: hidden;
  387. &::after {
  388. content: '';
  389. display: block;
  390. width: 4vw;
  391. height: 4vw;
  392. position: absolute;
  393. left: 0;
  394. top: 50%;
  395. transform: translateY(-50%);
  396. background-size: 4vw 4vw;
  397. background-repeat: no-repeat;
  398. }
  399. }
  400. .mobile {
  401. &::after {
  402. background-image: url(~assets/theme-images/common/h5-icon-mobile.png);
  403. }
  404. }
  405. .address {
  406. &::after {
  407. background-image: url(~assets/theme-images/common/h5-icon-address.png);
  408. }
  409. }
  410. .distance {
  411. position: absolute;
  412. font-size: 3vw;
  413. color: #404040;
  414. top: 0.8vw;
  415. right: 0;
  416. }
  417. }
  418. }
  419. }
  420. }
  421. }
  422. }
  423. }
  424. </style>