Commit daa9c24d by 李伟康

fix(boutique): 修复接待页面活动显示逻辑和组件引用问题

- 移除 SKU 组件中的 showActivity 条件判断
- 添加当前项目存在性检查以避免空指针错误
- 为第一个标签页添加活动状态检查逻辑
- 注释掉 SKU 组件的 changeCar 方法调用以防止重复执行
1 parent 833749e4
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
<template v-else> <template v-else>
<view :class="['sku-box', isPreview ? 'preview' : '']"> <view :class="['sku-box', isPreview ? 'preview' : '']">
<sku-box :currentCar="currentCarId" :defaultTabId="tabId" <sku-box :currentCar="currentCarId" :defaultTabId="tabId"
:show="show && !showActivity && (tabIndex != tabs.length - 1)" @changePreView="changePreView" :show="show && (tabIndex != tabs.length - 1)" @changePreView="changePreView" ref="sku" />
ref="sku" />
</view> </view>
</template> </template>
<view class="coupon-btn flex" v-if="!isPreview" @click="couponPopupRef.open(customerType, customerInfo)"> <view class="coupon-btn flex" v-if="!isPreview" @click="couponPopupRef.open(customerType, customerInfo)">
...@@ -287,6 +286,7 @@ export default { ...@@ -287,6 +286,7 @@ export default {
this.isSelect = false this.isSelect = false
this.updateViewKey = Date.now() this.updateViewKey = Date.now()
this.clearCanvas() this.clearCanvas()
if (this.tabIndex == 0 && !this.hasBeforeActivity && !this.hasAfterActivity) this.changeTab(0, true, false)
}, },
changePreView(e, leave = true, clearBoard = true) { changePreView(e, leave = true, clearBoard = true) {
let { currentItem } = this, let { currentItem } = this,
...@@ -365,13 +365,15 @@ export default { ...@@ -365,13 +365,15 @@ export default {
let skuIndex = 0 let skuIndex = 0
if (this.hasBeforeActivity || this.hasAfterActivity) skuIndex = 1 if (this.hasBeforeActivity || this.hasAfterActivity) skuIndex = 1
if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2 if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2
if (this.tabIndex == skuIndex && this.currentItem.carModelName) this.previewLeave(this.currentItem) if (this.tabIndex == skuIndex && this.currentItem && this.currentItem.carModelName) this.previewLeave(this.currentItem)
let goods = this.$refs.goodsBox let goods = this.$refs.goodsBox
let skuRef = this.$refs.sku
this.tabIndex = index this.tabIndex = index
this.currentItem = null this.currentItem = null
this.tabListId = this.tabs[index].id this.tabListId = this.tabs[index].id
setTimeout(() => { setTimeout(() => {
if (changeCar && goods && [0, 1].includes(this.tabListId)) goods.changeCar(this.currentCarId) if (changeCar && goods && [0, 1].includes(this.tabListId)) goods.changeCar(this.currentCarId)
// if (skuRef && skuIndex == index) skuRef.changeCar(this.currentCarId)
this.clearCanvas() this.clearCanvas()
}, 100) }, 100)
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!