修改购物车删除的bug

This commit is contained in:
赵毅 2025-11-21 17:57:29 +08:00
parent 5a965ccb16
commit b9eaf4c1f1

View File

@ -518,9 +518,14 @@ export default {
// //
deleteCarItem(carItem, goodsIndex, item) { deleteCarItem(carItem, goodsIndex, item) {
const that = this; const that = this;
const currentTime = new Date().getTime();
const isGroupBuyActive = carItem.commodity_goods_info.group_buy_activity_info &&
currentTime >= new Date(carItem.commodity_goods_info.group_buy_activity_info?.start_time).getTime() &&
currentTime <= new Date(carItem.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
request(apiArr.deleteCar, "POST", { request(apiArr.deleteCar, "POST", {
ids: [carItem.id], ids: [carItem.id],
goods_cate: 1, goods_cate: isGroupBuyActive ? 2 : 1,
}).then((res) => { }).then((res) => {
// //
item.splice(goodsIndex, 1); item.splice(goodsIndex, 1);
@ -686,7 +691,7 @@ export default {
request(apiArr.deleteCar, "POST", { request(apiArr.deleteCar, "POST", {
ids, ids,
goods_cate: 1, goods_cate: goods_cate,
}) })
.then((res) => { .then((res) => {
uni.showToast({ uni.showToast({