购物车调试

This commit is contained in:
Xulinchuan 2025-06-25 14:17:21 +08:00
parent 16654b14cf
commit 6da2117f17

View File

@ -55,7 +55,7 @@
</div>
<div class="good-price-num">
<div class="good-price-num-pos">
<div class="price" @click="toCheckGood(index, indexg)">{{ g.netWeightInfoVO.goodSpecs }}</div>
<div class="price" @click="toCheckGood(index, indexg)">{{ g.netWeightInfoVO?.goodSpecs }}</div>
<div class="total" @click="toCheckGood(index, indexg)">{{ (g.price * g.quantity).toFixed(2) }}</div>
<div class="num">
<div class="right-item">
@ -171,28 +171,46 @@ const pagination = (value) => {
};
function addIsCheckProperty(data) {
if (!data) return;
if (Array.isArray(data)) {
data.forEach((item) => {
item.ischeck = false; //
if (item.cartDetails) {
//
addIsCheckProperty(item.cartDetails);
}
if (item.records) {
//
addIsCheckProperty(item.records);
}
item.ischeck = false;
//
item.cartDetails && addIsCheckProperty(item.cartDetails);
item.records && addIsCheckProperty(item.records);
});
} else if (typeof data === 'object' && data !== null) {
} else if (typeof data === 'object') {
data.ischeck = false;
for (let key in data) {
if (typeof data[key] === 'object') {
addIsCheckProperty(data[key]); //
}
}
//
data.cartDetails && addIsCheckProperty(data.cartDetails);
data.records && addIsCheckProperty(data.records);
}
}
// function addIsCheckProperty(data) {
// if (Array.isArray(data)) {
// data.forEach((item) => {
// item.ischeck = false; //
// if (item.cartDetails) {
// //
// addIsCheckProperty(item.cartDetails);
// }
// if (item.records) {
// //
// addIsCheckProperty(item.records);
// }
// });
// } else if (typeof data === 'object' && data !== null) {
// data.ischeck = false;
// for (let key in data) {
// if (typeof data[key] === 'object') {
// addIsCheckProperty(data[key]); //
// }
// }
// }
// }
const numberChange = (value, index, indexg) => {
console.log(value, index, indexg);
setGoodsCount({ goodsId: data.value[index].cartDetails[indexg].id, count: value });
@ -612,6 +630,7 @@ function removeCheckedItems(data) {
}
.price {
font-weight: 400;
width: 200px;
}
.total {
font-weight: 700;
@ -623,6 +642,7 @@ function removeCheckedItems(data) {
.good-del {
font-size: 16px;
color: $color-999;
width: 44px;
}
}
}