2023-3-17

消息通知
This commit is contained in:
2023-03-17 17:39:03 +08:00
parent 9afc113da3
commit a049d9905c
9 changed files with 163 additions and 83 deletions

View File

@@ -252,11 +252,13 @@
};
let data = await Api.apiCall('get', Api.goods.goodsDetail, params);
this.logining = false;
if (data) {
let detailData = data.goods;
let goods = detailData.goods;
this.goods = goods;
console.log("goods》》》》》",goods)
console.log("goods.price》》》》》",goods.price)
this.favorite = data.favorite;
this.typeGoodsList = detailData.typeGoodsList;
var subImages = goods.albumPics;
@@ -316,41 +318,41 @@
this.couponList = couponList1;
}
//规格 默认选中第一条
if (this.specList) {
var specs = '';
this.specList.forEach(item => {
for (let cItem of this.specChildList) {
if (cItem.pid === item.id) {
this.$set(cItem, 'selected', true);
this.specSelected.push(cItem);
specs = cItem.name + ',' + specs;
break; //forEach不能使用break
}
}
});
let valuesA = specs.substr(0, specs.length - 1).split(',');
// //规格 默认选中第一条
// if (this.specList) {
// var specs = '';
// this.specList.forEach(item => {
// for (let cItem of this.specChildList) {
// if (cItem.pid === item.id) {
// this.$set(cItem, 'selected', true);
// this.specSelected.push(cItem);
// specs = cItem.name + ',' + specs;
// break; //forEach不能使用break
// }
// }
// });
// let valuesA = specs.substr(0, specs.length - 1).split(',');
this.skuList.forEach(item => {
if (valuesA.length == 1 && item.sp1 == valuesA[0]) {
this.sku = item;
}
if (valuesA.length == 2 && item.sp2 == valuesA[0] && item.sp1 == valuesA[1]) {
this.sku = item;
}
if (valuesA.length == 3 && item.sp3 == valuesA[0] && item.sp2 == valuesA[1] && item.sp1 ==
valuesA[2]) {
this.sku = item;
}
if (!this.sku.pic) {
this.sku.pic = this.goods.pic;
}
if (!this.sku.stock) {
this.sku.stock = 0;
}
this.goods.price = this.sku.price;
});
}
// this.skuList.forEach(item => {
// if (valuesA.length == 1 && item.sp1 == valuesA[0]) {
// this.sku = item;
// }
// if (valuesA.length == 2 && item.sp2 == valuesA[0] && item.sp1 == valuesA[1]) {
// this.sku = item;
// }
// if (valuesA.length == 3 && item.sp3 == valuesA[0] && item.sp2 == valuesA[1] && item.sp1 ==
// valuesA[2]) {
// this.sku = item;
// }
// if (!this.sku.pic) {
// this.sku.pic = this.goods.pic;
// }
// if (!this.sku.stock) {
// this.sku.stock = 0;
// }
// this.goods.price = this.sku.price;
// });
// }
},
computed: {
...mapState(['hasLogin', 'userInfo'])