商家分类修改
This commit is contained in:
parent
bf2c2f5fbf
commit
7f94a55cbe
@ -69,12 +69,14 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 分类条:移到瀑布上方,上滑时吸顶(top=页头高度),仅瀑布在其下滚动 -->
|
<!-- 分类条:移到瀑布上方,上滑时吸顶(top=页头高度),仅瀑布在其下滚动 -->
|
||||||
<scroll-view scroll-x class="hd-cate" v-if="lifeCircleList.length" :style="{ top: cateTop + 'px' }">
|
<scroll-view scroll-x class="hd-cate" v-if="categoryList.length" :style="{ top: cateTop + 'px' }">
|
||||||
<view class="hd-cate-item" :class="{ on: currentTab === 'recommend' }" @tap="selectRecommend">附近</view>
|
<view class="hd-cate-item" :class="{ on: currentTab === 'recommend' }" @tap="selectRecommend">附近</view>
|
||||||
<view class="hd-cate-item" v-for="(item, index) in lifeCircleList" :key="index"
|
<!-- 分类条改用商家分类表数据(categoryList),与下方好店(merchant_cate_id)一一对应 -->
|
||||||
:class="{ on: currentTab === item.title }" @tap="selectCircle(item)">
|
<view class="hd-cate-item" v-for="(item, index) in categoryList" :key="index"
|
||||||
{{ item.title }}
|
:class="{ on: currentTab === item.id }" @tap="selectCircle(item)">
|
||||||
|
{{ item.cate_name }}
|
||||||
</view>
|
</view>
|
||||||
|
<view class="hd-cate-item" @tap="goMoreLocalLife">更多</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<!-- 好店瀑布(两列,图片按原始宽高比制造瀑布效果) -->
|
<!-- 好店瀑布(两列,图片按原始宽高比制造瀑布效果) -->
|
||||||
@ -201,7 +203,6 @@ export default {
|
|||||||
serverRightList: [],
|
serverRightList: [],
|
||||||
|
|
||||||
// 分类条:生活圈(位6-11)
|
// 分类条:生活圈(位6-11)
|
||||||
lifeCircleList: [],
|
|
||||||
currentTab: 'recommend', // 当前分类条选中项:'recommend' 或某生活圈标题
|
currentTab: 'recommend', // 当前分类条选中项:'recommend' 或某生活圈标题
|
||||||
|
|
||||||
// 分类(驱动好店列表)
|
// 分类(驱动好店列表)
|
||||||
@ -293,35 +294,27 @@ export default {
|
|||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
|
||||||
// 「附近」对应的商品分类 id:暂取美食圈(无则取第一个生活圈,再无则第一个分类)
|
// 「附近」对应的分类 id:取商家分类表第一个
|
||||||
recommendCateId() {
|
recommendCateId() {
|
||||||
const target = this.lifeCircleList.find(c => c.title === '美食圈') || this.lifeCircleList[0]
|
|
||||||
if (target) {
|
|
||||||
const cate = this.categoryList.find(c => c.cate_name === target.title)
|
|
||||||
if (cate) return cate.id
|
|
||||||
}
|
|
||||||
return this.categoryList.length ? this.categoryList[0].id : null
|
return this.categoryList.length ? this.categoryList[0].id : null
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击「附近」:暂时显示美食圈内容
|
// 点击「附近」:显示默认(第一个)分类内容
|
||||||
async selectRecommend() {
|
async selectRecommend() {
|
||||||
this.currentTab = 'recommend'
|
this.currentTab = 'recommend'
|
||||||
const id = this.recommendCateId()
|
const id = this.recommendCateId()
|
||||||
if (id) await this.switchCategory(id)
|
if (id) await this.switchCategory(id)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击某生活圈:只显示该圈对应分类的好店瀑布
|
// 点击某商家分类:显示该分类对应的好店瀑布(merchant_cate_id = 该分类 id)
|
||||||
async selectCircle(item) {
|
async selectCircle(item) {
|
||||||
if (item.title == '更多') {
|
this.currentTab = item.id
|
||||||
return NavgateTo('/packages/localLife/index/index', { isLogin: false })
|
await this.switchCategory(item.id)
|
||||||
}
|
},
|
||||||
const cate = this.categoryList.find(c => c.cate_name === item.title)
|
|
||||||
if (cate && cate.id) {
|
// 「更多」:进入本地生活完整列表
|
||||||
this.currentTab = item.title
|
goMoreLocalLife() {
|
||||||
await this.switchCategory(cate.id)
|
NavgateTo('/packages/localLife/index/index', { isLogin: false })
|
||||||
} else {
|
|
||||||
uni.showToast({ title: '暂无「' + item.title + '」相关好店', icon: 'none' })
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async headershopEnterClick() {
|
async headershopEnterClick() {
|
||||||
@ -370,17 +363,15 @@ export default {
|
|||||||
|
|
||||||
// 一次拉取各广告位(1-11),后续各 getHomeXxx 读缓存
|
// 一次拉取各广告位(1-11),后续各 getHomeXxx 读缓存
|
||||||
await this.prefetchBannerGroups()
|
await this.prefetchBannerGroups()
|
||||||
const [bannerList, serverLeft, serverRightList, lifeCircleList, tabList] = await Promise.all([
|
const [bannerList, serverLeft, serverRightList, tabList] = await Promise.all([
|
||||||
this.getHomeBanner(),
|
this.getHomeBanner(),
|
||||||
this.getServerLeft(),
|
this.getServerLeft(),
|
||||||
this.getServerRight(),
|
this.getServerRight(),
|
||||||
this.getLifeCircle(), // 生活圈 6-11 → 分类条
|
|
||||||
this.getButtonNum(), // 金刚区
|
this.getButtonNum(), // 金刚区
|
||||||
])
|
])
|
||||||
this.bannerList = bannerList
|
this.bannerList = bannerList
|
||||||
this.serverLeft = serverLeft
|
this.serverLeft = serverLeft
|
||||||
this.serverRightList = serverRightList
|
this.serverRightList = serverRightList
|
||||||
this.lifeCircleList = lifeCircleList
|
|
||||||
this.tabList = tabList
|
this.tabList = tabList
|
||||||
|
|
||||||
// 先渲染首屏(轮播/金刚/广告/分类条),好店瀑布再异步加载填充,
|
// 先渲染首屏(轮播/金刚/广告/分类条),好店瀑布再异步加载填充,
|
||||||
@ -498,15 +489,6 @@ export default {
|
|||||||
return !!(item && item.pic_src)
|
return !!(item && item.pic_src)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 生活圈:中部 6-11,取各位第一条已发布,作为顶部分类条
|
|
||||||
async getLifeCircle() {
|
|
||||||
const list = await this.getBannersAt([
|
|
||||||
AD_POS.MID_CENTER_TOP, AD_POS.MID_CENTER, AD_POS.MID_CENTER_BOTTOM,
|
|
||||||
AD_POS.MID_RIGHT_TOP, AD_POS.MID_RIGHT_CENTER, AD_POS.MID_RIGHT_BOTTOM,
|
|
||||||
])
|
|
||||||
return list.filter(Boolean).filter(item => item.title)
|
|
||||||
},
|
|
||||||
|
|
||||||
/* ---------- 金刚区 ---------- */
|
/* ---------- 金刚区 ---------- */
|
||||||
async getButtonNum() {
|
async getButtonNum() {
|
||||||
const res = await request(apiArr2.getButtonNum, 'POST', {}, { slice: false })
|
const res = await request(apiArr2.getButtonNum, 'POST', {}, { slice: false })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user