Commit 17d764e0 by 李伟康

fix(OrderPopup): 修复搜索状态下商品规格选择的问题

- 移除了 searchStatus 相关的逻辑,统一使用 this.list 来存储商品数据
- 优化了规格选择后的数据更新逻辑,确保正确更新商品列表
- 在 SkuPopup 组件中添加了 icon 属性,优化了用户提示的显示效果
1 parent 3e982987
......@@ -255,11 +255,10 @@ export default {
handlePickerChange (e, {
item, list, parent, index
}) {
let { searchStatus } = this
let { value } = e.detail
item.value = list[value]
parent.key = Date.now()
this.$set(searchStatus ? this.searchList : this.list, index, parent)
this.$set(this.list, index, parent)
this.watchAllChose(index)
},
replaceItemText (item, key) {
......@@ -270,7 +269,6 @@ export default {
async watchAllChose (index, cancel) {
let {
list: goodsList,
searchStatus,
} = this;
let result = goodsList[index].multipleSpecificationsGoods.specificationList.every(item => item.value)
if (result) {
......@@ -304,7 +302,7 @@ export default {
})
goodsList[index].multipleSpecificationsGoods.skuGoodsList = goodsArr
this.$emit('openSkuPopup', goodsList[index], this.chooseList)
this.$set(searchStatus ? this.searchList : this.list, index, goodsList[index])
this.$set(this.list, index, goodsList[index])
}
} else {
uni.showToast({
......@@ -316,8 +314,15 @@ export default {
goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => {
item.value = ''
})
let { chooseList } = this
chooseList.forEach((item, ind) => {
if (item.multipleSpecificationsGoods.id === goodsList[index].multipleSpecificationsGoods.id) {
chooseList.splice(ind, 1)
}
})
this.$emit('choose', this.chooseList)
}
this.$set(searchStatus ? this.searchList : this.list, index, goodsList[index])
this.$set(this.list, index, goodsList[index])
} else {
if (goodsList[index].active) {
goodsList[index].active = false
......@@ -332,7 +337,7 @@ export default {
}
})
this.$emit('choose', this.chooseList)
this.$set(searchStatus ? this.searchList : this.list, index, goodsList[index])
this.$set(this.list, index, goodsList[index])
}
}
}
......
......@@ -100,6 +100,7 @@ export default {
let { currentId, data } = this
if (!currentId || !data) return uni.showToast({
title: '请勾选商品',
icon: 'none',
})
let { baseGoodsName, id, specificationGoodsMap, specificationList, skuGoodsList } = data.multipleSpecificationsGoods
let goods = skuGoodsList.find(e => e.goodsId == currentId)
......@@ -115,7 +116,7 @@ export default {
specificationList,
goods
}
})
}, true)
this.close()
},
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!