修复团购列表页面和详情页规格 数据不一致问题
This commit is contained in:
parent
15afc855fc
commit
03ef856fd3
@ -328,6 +328,7 @@ export default {
|
|||||||
boxshadow1: false,
|
boxshadow1: false,
|
||||||
boxshadow2: false,
|
boxshadow2: false,
|
||||||
id: "",
|
id: "",
|
||||||
|
groupById: "",
|
||||||
info: "",
|
info: "",
|
||||||
currentIndex: "1", //当前轮播图
|
currentIndex: "1", //当前轮播图
|
||||||
|
|
||||||
@ -568,9 +569,11 @@ export default {
|
|||||||
},
|
},
|
||||||
//商品详情
|
//商品详情
|
||||||
getGoodsInfo() {
|
getGoodsInfo() {
|
||||||
request(apiArr.getGoodsInfo, "POST", {
|
const params = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
}).then((res) => {
|
group_buy_activity_id: this.groupById
|
||||||
|
}
|
||||||
|
request(apiArr.getGoodsInfo, "POST", params).then((res) => {
|
||||||
// 分割图片
|
// 分割图片
|
||||||
res.commodity_goods_info_list.forEach((item) => {
|
res.commodity_goods_info_list.forEach((item) => {
|
||||||
item.goods_detail_pic = item.goods_detail_pic ? item.goods_detail_pic.split(",") : [];
|
item.goods_detail_pic = item.goods_detail_pic ? item.goods_detail_pic.split(",") : [];
|
||||||
@ -590,10 +593,14 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentTime = new Date().getTime();
|
||||||
|
|
||||||
// 过滤掉group_buy_activity_info为空的数据
|
// 过滤掉group_buy_activity_info为空的数据
|
||||||
if (res.commodity_goods_info_list && Array.isArray(res.commodity_goods_info_list)) {
|
if (res.commodity_goods_info_list && Array.isArray(res.commodity_goods_info_list)) {
|
||||||
res.commodity_goods_info_list = res.commodity_goods_info_list.filter(item => {
|
res.commodity_goods_info_list = res.commodity_goods_info_list.filter(item => {
|
||||||
return item.group_buy_activity_info !== null
|
const startTime = new Date(item.group_buy_goods_activity.group_buy_activity_info?.start_time).getTime();
|
||||||
|
const endTime = new Date(item.group_buy_goods_activity.group_buy_activity_info?.end_time).getTime();
|
||||||
|
return item.group_buy_activity_info !== null && currentTime >= startTime && currentTime <= endTime
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,6 +816,7 @@ export default {
|
|||||||
this.top = meun.top;
|
this.top = meun.top;
|
||||||
this.localHeight = meun.height;
|
this.localHeight = meun.height;
|
||||||
this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id;
|
this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id;
|
||||||
|
this.groupById = this.itemObj.groupById
|
||||||
if (this.itemObj.commodity_id) {
|
if (this.itemObj.commodity_id) {
|
||||||
this.endTime = this.itemObj.group_buy_activity_info.end_time
|
this.endTime = this.itemObj.group_buy_activity_info.end_time
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user