修复团购列表页面和详情页规格 数据不一致问题
This commit is contained in:
parent
15afc855fc
commit
03ef856fd3
@ -328,6 +328,7 @@ export default {
|
||||
boxshadow1: false,
|
||||
boxshadow2: false,
|
||||
id: "",
|
||||
groupById: "",
|
||||
info: "",
|
||||
currentIndex: "1", //当前轮播图
|
||||
|
||||
@ -568,9 +569,11 @@ export default {
|
||||
},
|
||||
//商品详情
|
||||
getGoodsInfo() {
|
||||
request(apiArr.getGoodsInfo, "POST", {
|
||||
const params = {
|
||||
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) => {
|
||||
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为空的数据
|
||||
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 => {
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
@ -806,9 +813,10 @@ export default {
|
||||
onLoad(options) {
|
||||
this.itemObj = JSON.parse(decodeURIComponent(options.item));
|
||||
const meun = menuButtonInfo();
|
||||
this.top = meun.top;
|
||||
this.localHeight = meun.height;
|
||||
this.top = meun.top;
|
||||
this.localHeight = meun.height;
|
||||
this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id;
|
||||
this.groupById = this.itemObj.groupById
|
||||
if (this.itemObj.commodity_id) {
|
||||
this.endTime = this.itemObj.group_buy_activity_info.end_time
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user