Commit 1cecd117 by Lin

重构(HomeFrame):更新标签页逻辑并改进数据处理

-- 改变了首页内容标签的显示方式,使用键值而非索引,以提高清晰度和可维护性。
-- 引入了一种方法,可根据营销活动和客户列表数据动态生成首页内容标签。
- 更新了首页内容标签的初始索引,以确保默认显示正确。
-- 清理了不必要的代码,并优化整体结构,提升可读性。
1 parent bd06a53a
......@@ -708,7 +708,6 @@ module.exports = {
...data,
})
},
/**
* 查询门店分类
*
......
......@@ -70,7 +70,7 @@
</template>
</view>
<view
v-show="homeContentTabIndex === 0"
v-show="currentHomeContentTab && currentHomeContentTab.key === 'home'"
class="right-content-box flex right-content-box-scene1"
>
<view class="content-left" style="padding-bottom: 40px;">
......@@ -102,7 +102,7 @@
</view>
</view>
<!-- 限时产品活动 -->
<view v-show="homeContentTabIndex === 1" class="right-content-box flex right-content-box-scene1">
<view v-show="currentHomeContentTab && currentHomeContentTab.key === 'activity'" class="right-content-box flex right-content-box-scene1">
<view class="tab-container">
<ActivityTime @entranceClick="entranceClick" />
<view class="line"></view>
......@@ -110,8 +110,8 @@
</view>
</view>
<!-- 挖掘潜客机会 -->
<view v-show="homeContentTabIndex === 2" class="right-content-box flex right-content-box-scene1 customer-opportunities-box">
<customer-opportunities :show="homeContentTabIndex === 2" />
<view v-show="currentHomeContentTab && currentHomeContentTab.key === 'customer'" class="right-content-box flex right-content-box-scene1 customer-opportunities-box">
<customer-opportunities :show="currentHomeContentTab && currentHomeContentTab.key === 'customer'" />
</view>
</view>
......@@ -348,12 +348,9 @@ export default {
pointComponentName: 'Point',
// userInfo: {},
tabIndex: 0,
homeContentTabs: [
{ label: '首页', key: 'home' },
{ label: '限时产品活动', key: 'activity' },
{ label: '挖掘潜客机会', key: 'customer' }
],
homeContentTabIndex: 1,
marketingActivityHasData: false,
customerListHasData: false,
homeContentTabIndex: 0,
showBeisen: false,
tipsObject: {},
autoplay: true,
......@@ -446,6 +443,19 @@ export default {
const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType
},
homeContentTabs() {
const tabs = []
if (!this.marketingActivityHasData) {
tabs.push({ label: '首页', key: 'home' })
}
if (this.marketingActivityHasData) {
tabs.push({ label: '限时产品活动', key: 'activity' })
}
if (this.customerListHasData) {
tabs.push({ label: '挖掘潜客机会', key: 'customer' })
}
return tabs
},
currentHomeContentTab() {
return this.homeContentTabs[this.homeContentTabIndex] || null
},
......@@ -477,6 +487,8 @@ export default {
* 获取门店场景小分类
*/
this.getStoreBaseSceneCodeList()
this.getStrategyStatus()
},
methods: {
handleHomeContentTabClick(index) {
......@@ -690,6 +702,20 @@ export default {
this.courseInfo = res
}
},
/**
* 查询策略首页数据状态(营销活动和客户列表是否有数据)
*/
async getStrategyStatus() {
// const res = await uni.$api.activityApi.getActivityStatusAPI()
const res = {
"marketingActivityHasData": true,
"customerListHasData": true
}
console.log('查询策略首页数据状态(营销活动和客户列表是否有数据):', res)
this.marketingActivityHasData = !!res.marketingActivityHasData
this.customerListHasData = !!res.customerListHasData
this.homeContentTabIndex = 0
},
handleFooter(val) {
this.footerBox = val
},
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1
const index = 2
/**
*
0本地
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!