修复团购列表页面和详情页规格 数据不一致问题

This commit is contained in:
赵毅 2025-09-05 14:35:38 +08:00
parent 15afc855fc
commit 03ef856fd3

View File

@ -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 {