Commit 17d764e0 by 李伟康

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

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