商家分类修改

This commit is contained in:
Daniel Kou 2026-07-10 11:16:22 +08:00
parent bf2c2f5fbf
commit 7f94a55cbe

View File

@ -69,12 +69,14 @@
</view>
<!-- 分类条移到瀑布上方上滑时吸顶(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" v-for="(item, index) in lifeCircleList" :key="index"
:class="{ on: currentTab === item.title }" @tap="selectCircle(item)">
{{ item.title }}
<!-- 分类条改用商家分类表数据(categoryList)与下方好店(merchant_cate_id)一一对应 -->
<view class="hd-cate-item" v-for="(item, index) in categoryList" :key="index"
:class="{ on: currentTab === item.id }" @tap="selectCircle(item)">
{{ item.cate_name }}
</view>
<view class="hd-cate-item" @tap="goMoreLocalLife">更多</view>
</scroll-view>
<!-- 好店瀑布两列图片按原始宽高比制造瀑布效果 -->
@ -201,7 +203,6 @@ export default {
serverRightList: [],
// 6-11
lifeCircleList: [],
currentTab: 'recommend', // 'recommend'
//
@ -293,35 +294,27 @@ export default {
// #endif
},
// id
// id
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
},
//
// ()
async selectRecommend() {
this.currentTab = 'recommend'
const id = this.recommendCateId()
if (id) await this.switchCategory(id)
},
//
// (merchant_cate_id = id)
async selectCircle(item) {
if (item.title == '更多') {
return NavgateTo('/packages/localLife/index/index', { isLogin: false })
}
const cate = this.categoryList.find(c => c.cate_name === item.title)
if (cate && cate.id) {
this.currentTab = item.title
await this.switchCategory(cate.id)
} else {
uni.showToast({ title: '暂无「' + item.title + '」相关好店', icon: 'none' })
}
this.currentTab = item.id
await this.switchCategory(item.id)
},
//
goMoreLocalLife() {
NavgateTo('/packages/localLife/index/index', { isLogin: false })
},
async headershopEnterClick() {
@ -370,17 +363,15 @@ export default {
// 广1-11 getHomeXxx
await this.prefetchBannerGroups()
const [bannerList, serverLeft, serverRightList, lifeCircleList, tabList] = await Promise.all([
const [bannerList, serverLeft, serverRightList, tabList] = await Promise.all([
this.getHomeBanner(),
this.getServerLeft(),
this.getServerRight(),
this.getLifeCircle(), // 6-11
this.getButtonNum(), //
])
this.bannerList = bannerList
this.serverLeft = serverLeft
this.serverRightList = serverRightList
this.lifeCircleList = lifeCircleList
this.tabList = tabList
// //广/
@ -498,15 +489,6 @@ export default {
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() {
const res = await request(apiArr2.getButtonNum, 'POST', {}, { slice: false })