Commit 6b0dd959 by 李伟康

refactor(boutique): 优化接待页面标签切换逻辑

- 修改 changeTab 方法增加 changeCar 参数控制车辆切换
- 更新 computed 属性 showActivity 的判断逻辑
- 调整标签切换时的商品组件车辆切换条件
- 优化 afterActivity 监听器中的标签切换参数传递
1 parent db94a6fa
...@@ -187,7 +187,7 @@ export default { ...@@ -187,7 +187,7 @@ export default {
deep: true, deep: true,
handler(newval) { handler(newval) {
let { tabListId } = this let { tabListId } = this
if (newval && tabListId != 0) this.changeTab(0, true) if (newval && tabListId != 0) this.changeTab(0, true, false)
} }
}, },
hasAfterActivity: { hasAfterActivity: {
...@@ -195,18 +195,15 @@ export default { ...@@ -195,18 +195,15 @@ export default {
deep: true, deep: true,
handler(newval) { handler(newval) {
let { tabListId, hasBeforeActivity } = this let { tabListId, hasBeforeActivity } = this
if (newval && tabListId != 1 && !hasBeforeActivity) this.changeTab(0, true) if (newval && tabListId != 1 && !hasBeforeActivity) this.changeTab(0, true, false)
} }
}, },
}, },
computed: { computed: {
showActivity() { showActivity() {
let { hasBeforeActivity, hasAfterActivity, tabIndex } = this, let { tabListId } = this
skuIndex = 0 return [0, 1].includes(tabListId)
if (hasBeforeActivity || hasAfterActivity) skuIndex = 1
if (hasBeforeActivity && hasAfterActivity) skuIndex = 2
return tabIndex != skuIndex
}, },
watchStatus() { watchStatus() {
return this.$store.state.user.historyStatus; return this.$store.state.user.historyStatus;
...@@ -363,18 +360,18 @@ export default { ...@@ -363,18 +360,18 @@ export default {
clearCanvas() { clearCanvas() {
this.$refs.receptionCanvas.clearBoard() this.$refs.receptionCanvas.clearBoard()
}, },
changeTab(index, force = false) { changeTab(index, force = false, changeCar = true) {
if (this.tabIndex == index && !force) return if (this.tabIndex == index && !force) return
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.carModelName) this.previewLeave(this.currentItem)
let goods = this.$refs.goodsBox
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 (this.$refs.goodsBox) this.$refs.goodsBox.changeCar(this.currentCarId) if (changeCar && goods && [0, 1].includes(this.tabListId)) goods.changeCar(this.currentCarId)
if (index == skuIndex) 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!