Commit fb3cb51c by 李伟康

fix(boutique): 解决可选配置表格渲染异常和SKU组件显示逻辑问题

- 修复OptionalTable组件中optionals为空时的报错问题
- 优化Reception组件中SKU组件的显示条件判断逻辑
- 简化tab切换相关的状态管理代码
- 修复SKU组件在不同标签页间的切换显示问题
- 统一tabListId的状态更新时机以避免渲染异常
1 parent 498dd4e0
...@@ -143,6 +143,7 @@ export default { ...@@ -143,6 +143,7 @@ export default {
init () { init () {
if (!this.show) return if (!this.show) return
let { optionals } = this.boutiqueMediaConfig[this.currentCar] let { optionals } = this.boutiqueMediaConfig[this.currentCar]
if(!optionals) return
optionals.map(e => e.checked = false) optionals.map(e => e.checked = false)
this.optionalsList = optionals this.optionalsList = optionals
console.log(this.optionalsList) console.log(this.optionalsList)
......
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
</template> </template>
<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 && tabListId == 2"
:show="show && (tabIndex != tabs.length - 1)" @changePreView="changePreView" ref="sku" /> @changePreView="changePreView" 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)">
...@@ -159,17 +159,7 @@ export default { ...@@ -159,17 +159,7 @@ export default {
handler(newval) { handler(newval) {
if (newval) { if (newval) {
this.isSelect = false this.isSelect = false
let index = 0, if (newval && this.currentItem && this.tabListId == 2) this.changePreView(this.currentItem, false, false)
tabListId = 2
if (this.hasBeforeActivity || this.hasAfterActivity) {
index = 1
tabListId = 1
}
if (this.hasBeforeActivity && this.hasAfterActivity) {
index = 2
tabListId = 0
}
if (newval && this.currentItem && this.tabIndex == index) this.changePreView(this.currentItem, false, false)
} }
} }
}, },
...@@ -285,8 +275,8 @@ export default { ...@@ -285,8 +275,8 @@ export default {
this.currentCarId = item.carModelId this.currentCarId = item.carModelId
this.isSelect = false this.isSelect = false
this.updateViewKey = Date.now() this.updateViewKey = Date.now()
this.tabListId = this.tabs[0].id
this.clearCanvas() this.clearCanvas()
if ( !this.$refs.sku && !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,
...@@ -367,13 +357,12 @@ export default { ...@@ -367,13 +357,12 @@ export default {
if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2 if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2
if (this.tabIndex == skuIndex && this.currentItem && 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
setTimeout(() => { setTimeout(() => {
this.tabListId = this.tabs[index].id
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) if (this.tabListId == 2) this.$refs.sku.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!