Commit 105d3947 by wangzhihui

修复多规格

1 parent 5b7184e8
......@@ -89,7 +89,7 @@ Component({
let active = goodsList[index].active
console.log(active, goodsList[index])
//规格全部选中逻辑处理
if (!active) {
if (result) {
let arr = []
goodsList[index].multipleSpecificationsGoods.specificationList.forEach(spec => {
......@@ -100,9 +100,41 @@ Component({
goodsList[index].active = true
// strTemp用来存储上一次选中的值,判断规格是否重新选择 ,避免页面交互闪烁
// if (type && str != strTemp) {
goodsList[index].multipleSpecificationsGoods.goods = goodsList[index].multipleSpecificationsGoods.specificationGoodsMap[str]
goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId
goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(';~;', '/')
if( goodsList[index].multipleSpecificationsGoods.specificationGoodsMap[str]){
goodsList[index].multipleSpecificationsGoods.goods = goodsList[index].multipleSpecificationsGoods.specificationGoodsMap[str]
goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId
goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(';~;', '/')
recordList.forEach(record => {
if (record.goodsFlag == 2) {
if (goodsList[index].multipleSpecificationsGoods.id ==record.multipleSpecificationsGoods.id) {
record.active=true
record.multipleSpecificationsGoods = goodsList[index].multipleSpecificationsGoods
}
}
})
}else{
wx.$util.showToast('暂无该规格商品')
goodsList[index].active=false
goodsList[index].multipleSpecificationsGoods.goods = ''
goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => {
item.value = ''
})
recordList.forEach(record => {
if (record.goodsFlag == 2) {
if (goodsList[index].multipleSpecificationsGoods.id ==record.multipleSpecificationsGoods.id) {
record.active=false
record.multipleSpecificationsGoods = goodsList[index].multipleSpecificationsGoods
}
}
})
this.setData({
goodsList,
recordList
})
}
// }
this.setData({
......@@ -115,7 +147,8 @@ Component({
})
}
} else {
if(active&&!type){
goodsList[index].multipleSpecificationsGoods.goods = ''
goodsList[index].multipleSpecificationsGoods.specificationList.forEach(item => {
item.value = ''
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!