商家分类修改

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> </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 })