|
|
@ -1647,10 +1647,32 @@ Page({ |
|
|
|
|
|
|
|
|
// 确认下架(实际执行下架确认的内部方法)
|
|
|
// 确认下架(实际执行下架确认的内部方法)
|
|
|
confirmUnpublish: function() { |
|
|
confirmUnpublish: function() { |
|
|
// 显示规格选择弹窗,让用户选择要下架的规格
|
|
|
const goodsDetail = this.data.goodsDetail; |
|
|
|
|
|
const weightQuantityData = goodsDetail.weightQuantityData || []; |
|
|
|
|
|
|
|
|
|
|
|
// 计算所有未售空的规格索引
|
|
|
|
|
|
let selectedSpecIndices = []; |
|
|
|
|
|
let isSelected = []; |
|
|
|
|
|
|
|
|
|
|
|
// 遍历规格数据,找出所有未售空的规格
|
|
|
|
|
|
weightQuantityData.forEach((item, index) => { |
|
|
|
|
|
// 如果规格状态不是1(未售空),则默认选中
|
|
|
|
|
|
if (item.specStatus !== '1') { |
|
|
|
|
|
selectedSpecIndices.push(index); |
|
|
|
|
|
isSelected[index] = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
isSelected[index] = false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
console.log('默认选中的规格索引:', selectedSpecIndices); |
|
|
|
|
|
console.log('默认选中的状态数组:', isSelected); |
|
|
|
|
|
|
|
|
|
|
|
// 显示规格选择弹窗,默认选中所有未售空的规格
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showSpecUnpublishModal: true, |
|
|
showSpecUnpublishModal: true, |
|
|
selectedSpecIndex: -1 // 重置选中索引
|
|
|
selectedSpecIndices: selectedSpecIndices, |
|
|
|
|
|
isSelected: isSelected |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|