Commit e8492316 by 李伟康

feat(boutique): 添加精品活动数据状态管理

- 在store中新增boutiqueActivityData状态用于存储活动数据
- 修改HomeFrame组件将活动数据同步到store状态中
- 更新Reception组件移除重复的数据获取逻辑
- 添加boutiqueActivityData计算属性和监听器
- 优化组件间数据传递方式提高性能
1 parent 7c969686
......@@ -823,6 +823,7 @@ export default {
]
this.activityProductList = res
// console.log('查询当前进行中的营销活动商品列表:', res)
this.$store.state.boutique.boutiqueActivityData = res
},
/**
......
......@@ -155,17 +155,8 @@ export default {
},
show: {
immediate: true,
async handler(newval) {
handler(newval) {
if (newval) {
if (!this.activityData.length) {
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo,
data = await uni.$api.activityApi.getActivityProductListAPI({
merchantId: shopMerchantId
})
this.activityData = data
if (data.length) this.currentItem = null
}
this.isSelect = false
let index = 0
if (this.hasBeforeActivity || this.hasAfterActivity) {
......@@ -175,7 +166,15 @@ export default {
if (newval && this.currentItem && this.tabIndex == index) this.changePreView(this.currentItem, false, false)
}
}
},
boutiqueActivityData: {
immediate: true,
deep: true,
handler(newval) {
this.activityData = newval || []
if (newval.length) this.currentItem = null
}
},
},
computed: {
......@@ -210,6 +209,9 @@ export default {
boutiqueMediaConfig() {
return this.$store.state.user.boutiqueMediaConfig
},
boutiqueActivityData() {
return this.$store.state.boutique.boutiqueActivityData || []
},
/**是否有选装项目 */
hasOptionals() {
let flag = false
......
export default {
state() {
return {
baseConfigData:{}
baseConfigData:{},
boutiqueActivityData: [],
}
},
mutations: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!