|
@@ -855,18 +855,22 @@
|
|
|
},
|
|
|
//specPopup关闭时重置数据
|
|
|
onSpecPopupClose(){
|
|
|
- let colorSpecAttrList = this.productInfo.product_attr.find((spec) => spec.spec_id === 1).attr_list;
|
|
|
- let sizeSpecAttrList = this.productInfo.product_attr.find((spec) => spec.spec_id === 2).attr_list;
|
|
|
+
|
|
|
+ if(this.productInfo.product_attr.length){
|
|
|
+
|
|
|
+ let colorSpecAttrList = this.productInfo.product_attr.find((spec) => spec.spec_id === 1).attr_list;
|
|
|
+ let sizeSpecAttrList = this.productInfo.product_attr.find((spec) => spec.spec_id === 2).attr_list;
|
|
|
+ for (let i in colorSpecAttrList) {
|
|
|
+ colorSpecAttrList[i].active = 0;
|
|
|
+ }
|
|
|
+ // 恢复尺寸规格下属性的原始active状态
|
|
|
+ for (let i in sizeSpecAttrList) {
|
|
|
+ sizeSpecAttrList[i].active = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
//重置上一次规格全部选中
|
|
|
this.hasValidSpecSelected = false;
|
|
|
// 恢复颜色分类规格下属性的原始active状态
|
|
|
- for (let i in colorSpecAttrList) {
|
|
|
- colorSpecAttrList[i].active = 0;
|
|
|
- }
|
|
|
- // 恢复尺寸规格下属性的原始active状态
|
|
|
- for (let i in sizeSpecAttrList) {
|
|
|
- sizeSpecAttrList[i].active = 0;
|
|
|
- }
|
|
|
this.$refs.specPopup.close()
|
|
|
},
|
|
|
//只有一组sku默认规格是否已下架
|