|
@@ -1,81 +1,88 @@
|
|
|
<template>
|
|
|
<div class="page">
|
|
|
- <div class="page-top flex flex-col justify-center items-center">
|
|
|
- <img class="logo" :src="supplierInfo.logo" />
|
|
|
- <div class="mt-2 name">
|
|
|
- <span v-text="supplierInfo.shopName"></span>
|
|
|
- <span>官方授权机构</span>
|
|
|
+ <van-list
|
|
|
+ v-model="isLoadingMore"
|
|
|
+ :finished="finished"
|
|
|
+ :immediate-check="false"
|
|
|
+ :finished-text="total ? '没有更多了' : ''"
|
|
|
+ @load="onLoadMore"
|
|
|
+ >
|
|
|
+ <div class="page-top flex flex-col justify-center items-center">
|
|
|
+ <img class="logo" :src="supplierInfo.logo" />
|
|
|
+ <div class="mt-2 name">
|
|
|
+ <span v-text="supplierInfo.shopName"></span>
|
|
|
+ <span>官方授权机构</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="page-content">
|
|
|
- <!-- 搜索区域 -->
|
|
|
- <div class="search">
|
|
|
- <simple-search v-model="listQuery.clubName" @search="onSearch" />
|
|
|
- </div>
|
|
|
- <!-- 地区选择 -->
|
|
|
- <div class="city">
|
|
|
- <SimpleCity
|
|
|
- @change="onCityChange"
|
|
|
- :options="cityList"
|
|
|
- labelName="name"
|
|
|
- valueName="id"
|
|
|
- ></SimpleCity>
|
|
|
- </div>
|
|
|
- <!-- 标题 -->
|
|
|
- <div class="title flex justify-between px-4 pt-8 pb-8 md:px-0">
|
|
|
- <div>距您最近...</div>
|
|
|
- <div>共<span v-text="total"></span>家机构</div>
|
|
|
- </div>
|
|
|
- <!-- 列表 -->
|
|
|
- <div class="list">
|
|
|
- <template v-for="item in list">
|
|
|
- <div
|
|
|
- class="section flex justify-between mb-4"
|
|
|
- :key="item.authId"
|
|
|
- @click="toDetail(item)"
|
|
|
- >
|
|
|
- <img class="cover" :src="item.logo || drawLogo(item.clubName)" />
|
|
|
- <div class="info">
|
|
|
- <div class="name" v-text="item.clubName"></div>
|
|
|
- <div class="mobile">{{ item.mobile || '未知' }}</div>
|
|
|
- <div class="address">
|
|
|
- {{ formatAddress(item.area, item.address) }}
|
|
|
+ <div class="page-content">
|
|
|
+ <!-- 搜索区域 -->
|
|
|
+ <div class="search">
|
|
|
+ <simple-search
|
|
|
+ v-model="listQuery.clubName"
|
|
|
+ @search="onSearch"
|
|
|
+ placeholder="搜索机构"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <!-- 地区选择 -->
|
|
|
+ <div class="city">
|
|
|
+ <SimpleCity
|
|
|
+ @change="onCityChange"
|
|
|
+ :options="cityList"
|
|
|
+ labelName="name"
|
|
|
+ valueName="id"
|
|
|
+ ></SimpleCity>
|
|
|
+ </div>
|
|
|
+ <!-- 标题 -->
|
|
|
+ <div class="title flex justify-between px-4 pt-8 pb-8 md:px-0">
|
|
|
+ <div>距您最近...</div>
|
|
|
+ <div>共<span v-text="total"></span>家机构</div>
|
|
|
+ </div>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <div class="list">
|
|
|
+ <template v-for="item in list">
|
|
|
+ <div
|
|
|
+ class="section flex justify-between mb-4"
|
|
|
+ :key="item.authId"
|
|
|
+ @click="toDetail(item)"
|
|
|
+ >
|
|
|
+ <img class="cover" :src="item.logo || drawLogo(item.clubName)" />
|
|
|
+ <div class="info">
|
|
|
+ <div class="name" v-text="item.clubName"></div>
|
|
|
+ <div class="mobile">{{ item.mobile || '未知' }}</div>
|
|
|
+ <div class="address">
|
|
|
+ {{ formatAddress(item.area, item.address) }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="distance"
|
|
|
+ v-text="item.distance + 'km'"
|
|
|
+ v-if="item.distance && item.distance !== 99999"
|
|
|
+ ></div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="distance"
|
|
|
- v-text="item.distance + 'km'"
|
|
|
- v-if="item.distance && item.distance !== 99999"
|
|
|
- ></div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <div class="empty" v-for="i in emptyList" :key="i"></div>
|
|
|
+ </template>
|
|
|
+ <div class="empty" v-for="i in emptyList" :key="i"></div>
|
|
|
+ </div>
|
|
|
+ <!-- 列表为空 -->
|
|
|
+ <SimpleEmpty
|
|
|
+ v-if="!total && !isRequest"
|
|
|
+ name="icon-empty-approve.png"
|
|
|
+ description="敬请期待~"
|
|
|
+ ></SimpleEmpty>
|
|
|
</div>
|
|
|
- <!-- 列表为空 -->
|
|
|
- <SimpleEmpty
|
|
|
- v-if="!total && !isRequest"
|
|
|
- name="icon-empty-approve.png"
|
|
|
- description="敬请期待~"
|
|
|
- ></SimpleEmpty>
|
|
|
- <!-- 页码 -->
|
|
|
- <SimplePagination
|
|
|
- v-if="total > listQuery.pageSize"
|
|
|
- :total="total"
|
|
|
- :pageItems="listQuery.pageSize"
|
|
|
- @change="onPagiantionChange"
|
|
|
- ></SimplePagination>
|
|
|
- </div>
|
|
|
+ </van-list>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import { loactionSelf } from '@/utils/map-utils'
|
|
|
-import { drawLogo } from '@/utils'
|
|
|
+import { drawLogo, debounce } from '@/utils'
|
|
|
export default {
|
|
|
layout: 'app',
|
|
|
data() {
|
|
|
return {
|
|
|
+ isLoadingMore: true,
|
|
|
+ finished: false,
|
|
|
isRequest: true,
|
|
|
list: [],
|
|
|
listQuery: {
|
|
@@ -138,19 +145,21 @@ export default {
|
|
|
// 获取机构列表
|
|
|
this.fetchList()
|
|
|
},
|
|
|
- // 获取机构列表
|
|
|
- async fetchList() {
|
|
|
+ fetchList: debounce(async function () {
|
|
|
try {
|
|
|
+ this.isLoadingMore = true
|
|
|
const res = await this.$http.api.getAuthClubList(this.listQuery)
|
|
|
this.total = res.data.total
|
|
|
- this.list = res.data.list
|
|
|
+ this.list = [...this.list, ...res.data.list]
|
|
|
+ this.finished = !res.data.hasNextPage
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
} finally {
|
|
|
this.$toast.clear()
|
|
|
this.isRequest = false
|
|
|
+ this.isLoadingMore = false
|
|
|
}
|
|
|
- },
|
|
|
+ }, 400),
|
|
|
// 获取地址列表
|
|
|
fetchCityList() {
|
|
|
this.$http.api.fetchAllCityList().then((res) => {
|
|
@@ -173,11 +182,13 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
this.listQuery.pageNum = 1
|
|
|
+ this.list = []
|
|
|
this.fetchList()
|
|
|
},
|
|
|
// 搜索
|
|
|
onSearch() {
|
|
|
this.listQuery.pageNum = 1
|
|
|
+ this.list = []
|
|
|
this.fetchList()
|
|
|
},
|
|
|
// 页码变化
|
|
@@ -196,6 +207,11 @@ export default {
|
|
|
}
|
|
|
return resutl || '未知'
|
|
|
},
|
|
|
+ // 加载更多
|
|
|
+ onLoadMore() {
|
|
|
+ this.listQuery.pageNum += 1
|
|
|
+ this.fetchList()
|
|
|
+ },
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
this.$toast.clear()
|
|
@@ -290,6 +306,7 @@ export default {
|
|
|
position: relative;
|
|
|
margin-left: 12px;
|
|
|
.name {
|
|
|
+ width: 228px;
|
|
|
font-size: 16px;
|
|
|
color: #101010;
|
|
|
font-weight: bold;
|