Commit 6b0dd959 by 李伟康

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

- 修改 changeTab 方法增加 changeCar 参数控制车辆切换
- 更新 computed 属性 showActivity 的判断逻辑
- 调整标签切换时的商品组件车辆切换条件
- 优化 afterActivity 监听器中的标签切换参数传递
1 parent db94a6fa
......@@ -187,7 +187,7 @@ export default {
deep: true,
handler(newval) {
let { tabListId } = this
if (newval && tabListId != 0) this.changeTab(0, true)
if (newval && tabListId != 0) this.changeTab(0, true, false)
}
},
hasAfterActivity: {
......@@ -195,18 +195,15 @@ export default {
deep: true,
handler(newval) {
let { tabListId, hasBeforeActivity } = this
if (newval && tabListId != 1 && !hasBeforeActivity) this.changeTab(0, true)
if (newval && tabListId != 1 && !hasBeforeActivity) this.changeTab(0, true, false)
}
},
},
computed: {
showActivity() {
let { hasBeforeActivity, hasAfterActivity, tabIndex } = this,
skuIndex = 0
if (hasBeforeActivity || hasAfterActivity) skuIndex = 1
if (hasBeforeActivity && hasAfterActivity) skuIndex = 2
return tabIndex != skuIndex
let { tabListId } = this
return [0, 1].includes(tabListId)
},
watchStatus() {
return this.$store.state.user.historyStatus;
......@@ -363,18 +360,18 @@ export default {
clearCanvas() {
this.$refs.receptionCanvas.clearBoard()
},
changeTab(index, force = false) {
changeTab(index, force = false, changeCar = true) {
if (this.tabIndex == index && !force) return
let skuIndex = 0
if (this.hasBeforeActivity || this.hasAfterActivity) skuIndex = 1
if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2
if (this.tabIndex == skuIndex && this.currentItem.carModelName) this.previewLeave(this.currentItem)
let goods = this.$refs.goodsBox
this.tabIndex = index
this.currentItem = null
this.tabListId = this.tabs[index].id
setTimeout(() => {
if (this.$refs.goodsBox) this.$refs.goodsBox.changeCar(this.currentCarId)
if (index == skuIndex) this.$refs.sku.changeCar(this.currentCarId)
if (changeCar && goods && [0, 1].includes(this.tabListId)) goods.changeCar(this.currentCarId)
this.clearCanvas()
}, 100)
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!