|
@@ -1,64 +1,203 @@
|
|
|
<template>
|
|
|
<div class="page">
|
|
|
<div class="page-top flex flex-col justify-center items-center">
|
|
|
- <img class="logo" src="https://picsum.photos/200/200" />
|
|
|
- <span class="name mt-2">上海品辉医疗科技有限公司</span>
|
|
|
+ <img class="logo" :src="supplierInfo.logo" />
|
|
|
+ <div class="mt-2 name">
|
|
|
+ <span v-text="supplierInfo.shopName"></span>
|
|
|
+ <span>官方授权机构</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="page-content">
|
|
|
<!-- 搜索区域 -->
|
|
|
<div class="search">
|
|
|
- <simple-search />
|
|
|
+ <simple-search v-model="listQuery.clubName" @search="onSearch" />
|
|
|
</div>
|
|
|
<!-- 地区选择 -->
|
|
|
- <div class="city bg-red-300">地区选择</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>30</span>家机构</div>
|
|
|
+ <div>距您最近...</div>
|
|
|
+ <div>共<span v-text="total"></span>家机构</div>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
<div class="list">
|
|
|
- <div class="section flex justify-between mb-4">
|
|
|
- <img class="cover" src="https://picsum.photos/400/400" />
|
|
|
- <div class="info">
|
|
|
- <div class="name">丽颜科美复兴广场店</div>
|
|
|
- <div class="mobile">0755-25777189</div>
|
|
|
- <div class="address">
|
|
|
- 上海市黄浦区马当路388号复兴广场夜丽秀夜丽秀
|
|
|
- </div>
|
|
|
- <div class="distance">9999km</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="section flex justify-between mb-4">
|
|
|
- <img class="cover" src="https://picsum.photos/400/400" />
|
|
|
- <div class="info">
|
|
|
- <div class="name">丽颜科美复兴广场店</div>
|
|
|
- <div class="mobile">0755-25777189</div>
|
|
|
- <div class="address">
|
|
|
- 上海市黄浦区马当路388号复兴广场夜丽秀夜丽秀
|
|
|
+ <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">9999km</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="section flex justify-between mb-4">
|
|
|
- <img class="cover" src="https://picsum.photos/400/400" />
|
|
|
- <div class="info">
|
|
|
- <div class="name">丽颜科美复兴广场店</div>
|
|
|
- <div class="mobile">0755-25777189</div>
|
|
|
- <div class="address">
|
|
|
- 上海市黄浦区马当路388号复兴广场夜丽秀夜丽秀
|
|
|
- </div>
|
|
|
- <div class="distance">9999km</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
+ <div class="empty" v-for="i in emptyList" :key="i"></div>
|
|
|
</div>
|
|
|
+ <!-- 列表为空 -->
|
|
|
+ <SimpleEmpty
|
|
|
+ v-if="!total && !isRequest"
|
|
|
+ description="敬请期待~"
|
|
|
+ ></SimpleEmpty>
|
|
|
+ <!-- 页码 -->
|
|
|
+ <SimplePagination
|
|
|
+ v-if="total > listQuery.pageSize"
|
|
|
+ :total="total"
|
|
|
+ :pageItems="listQuery.pageSize"
|
|
|
+ @change="onPagiantionChange"
|
|
|
+ ></SimplePagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
+import { loactionSelf } from '@/utils/map-utils'
|
|
|
+import { drawLogo } from '@/utils'
|
|
|
export default {
|
|
|
layout: 'app',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isRequest: true,
|
|
|
+ list: [],
|
|
|
+ listQuery: {
|
|
|
+ appId: '',
|
|
|
+ lngAndLat: '',
|
|
|
+ clubName: '',
|
|
|
+ provinceId: '',
|
|
|
+ cityId: '',
|
|
|
+ townId: '',
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ total: 0,
|
|
|
+ cityList: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['supplierInfo', 'appId']),
|
|
|
+ emptyList() {
|
|
|
+ return 3 - (this.list.length % 3)
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.initData()
|
|
|
+ this.fetchCityList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 绘制logo的方法
|
|
|
+ drawLogo,
|
|
|
+ // 查看详情
|
|
|
+ toDetail(item) {
|
|
|
+ localStorage.setItem('clubInfo', JSON.stringify(item))
|
|
|
+ this.$router.push('/ph/approve/club/detail')
|
|
|
+ },
|
|
|
+ // 初始化页面数据
|
|
|
+ async initData() {
|
|
|
+ // 自定义加载图标
|
|
|
+ this.$toast.loading({
|
|
|
+ message: '正在获取您附近的机构...',
|
|
|
+ duration: 0,
|
|
|
+ })
|
|
|
+ // 获取定位信息 百度坐标转高德坐标
|
|
|
+ try {
|
|
|
+ const location = await loactionSelf()
|
|
|
+ const result = await this.$http.api.assistant({
|
|
|
+ key: '1bcc97330f6cf517e8dd9d5278957e67',
|
|
|
+ locations: `${location.point.lng},${location.point.lat}`,
|
|
|
+ coordsys: 'baidu',
|
|
|
+ output: 'JSON',
|
|
|
+ })
|
|
|
+ const res = await result.json()
|
|
|
+ this.listQuery.lngAndLat = res.locations
|
|
|
+ } catch (error) {
|
|
|
+ this.$toast.clear()
|
|
|
+ this.$toast('获取定位信息失败,请确保您开启的定位权限并保存网络畅通')
|
|
|
+ this.isRequest = false
|
|
|
+ }
|
|
|
+ this.listQuery.appId = this.appId
|
|
|
+ // 获取机构列表
|
|
|
+ this.fetchList()
|
|
|
+ },
|
|
|
+ // 获取机构列表
|
|
|
+ async fetchList() {
|
|
|
+ try {
|
|
|
+ const res = await this.$http.api.getAuthClubList(this.listQuery)
|
|
|
+ this.total = res.data.total
|
|
|
+ this.list = res.data.list
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ } finally {
|
|
|
+ this.$toast.clear()
|
|
|
+ this.isRequest = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取地址列表
|
|
|
+ fetchCityList() {
|
|
|
+ this.$http.api.fetchAllCityList().then((res) => {
|
|
|
+ this.cityList = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 城市变化
|
|
|
+ onCityChange(selectValue) {
|
|
|
+ this.listQuery.provinceId = ''
|
|
|
+ this.listQuery.cityId = ''
|
|
|
+ this.listQuery.townId = ''
|
|
|
+
|
|
|
+ selectValue.map((item, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ this.listQuery.provinceId = item.id
|
|
|
+ } else if (index === 1) {
|
|
|
+ this.listQuery.cityId = item.id
|
|
|
+ } else {
|
|
|
+ this.listQuery.townId = item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.listQuery.pageNum = 1
|
|
|
+ this.fetchList()
|
|
|
+ },
|
|
|
+ // 搜索
|
|
|
+ onSearch() {
|
|
|
+ this.listQuery.pageNum = 1
|
|
|
+ this.fetchList()
|
|
|
+ },
|
|
|
+ // 页码变化
|
|
|
+ onPagiantionChange(index) {
|
|
|
+ this.listQuery.pageNum = index
|
|
|
+ this.fetchList()
|
|
|
+ },
|
|
|
+ // 格式化地址
|
|
|
+ formatAddress(a1, a2) {
|
|
|
+ let resutl = ''
|
|
|
+ if (typeof a1 === 'string') {
|
|
|
+ resutl += a1
|
|
|
+ }
|
|
|
+ if (typeof a2 === 'string') {
|
|
|
+ resutl += a2
|
|
|
+ }
|
|
|
+ return resutl || '未知'
|
|
|
+ },
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ this.$toast.clear()
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -66,6 +205,7 @@ export default {
|
|
|
// pc 端
|
|
|
@media screen and (min-width: 768px) {
|
|
|
.page {
|
|
|
+ position: relative;
|
|
|
min-height: calc(100vh - 80px - 80px);
|
|
|
background-color: #fff;
|
|
|
}
|
|
@@ -83,18 +223,28 @@ export default {
|
|
|
font-size: 30px;
|
|
|
color: #fff;
|
|
|
}
|
|
|
+
|
|
|
+ .logo,
|
|
|
+ .name {
|
|
|
+ transform: translateY(-60px);
|
|
|
+ }
|
|
|
}
|
|
|
.page-content {
|
|
|
width: 1200px;
|
|
|
margin: 0 auto;
|
|
|
- position: relative;
|
|
|
.search {
|
|
|
- display: none;
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 260px;
|
|
|
+ transform: translateX(-50%);
|
|
|
}
|
|
|
|
|
|
.city {
|
|
|
- padding-top: 12vw;
|
|
|
- display: none;
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 320px;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ z-index: 9;
|
|
|
}
|
|
|
|
|
|
.title {
|
|
@@ -110,6 +260,11 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
+ flex-wrap: wrap;
|
|
|
+
|
|
|
+ .empty {
|
|
|
+ width: 390px;
|
|
|
+ }
|
|
|
|
|
|
.section {
|
|
|
width: 390px;
|
|
@@ -216,6 +371,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
.city {
|
|
|
+ position: relative;
|
|
|
+ z-index: 9;
|
|
|
padding-top: 12vw;
|
|
|
}
|
|
|
|