diff --git a/src/pages/order/cart.vue b/src/pages/order/cart.vue index e53e1f8..a8e8c09 100644 --- a/src/pages/order/cart.vue +++ b/src/pages/order/cart.vue @@ -72,6 +72,7 @@ import WidgetCheckBox from "@/components/widgets/checkbox"; import WidgetCountModify from "@/components/widgets/count-modify"; import WidgetLoadMore from "@/components/widgets/loadmore"; import ServicePreviewItem from "@/components/service/preview-item"; +import { set } from "vue"; export default { name: "order-cart", data() { @@ -139,17 +140,21 @@ export default { return newList; }, clickGroup(parentIndex) { + let state = !this.list[parentIndex].checked; this.list[parentIndex].list.forEach((item, itemIndex) => { - this.checkedItem(parentIndex, itemIndex); + this.checkedItem(parentIndex, itemIndex, state); }); }, clickItem(parentIndex, itemIndex) { this.checkedItem(parentIndex, itemIndex); }, // 选中单项 - checkedItem(parentIndex, itemIndex) { + checkedItem(parentIndex, itemIndex, state) { this.list[parentIndex].list[itemIndex].checked = - !this.list[parentIndex].list[itemIndex].checked; + typeof state === "undefined" + ? !this.list[parentIndex].list[itemIndex].checked + : state; + // 判断是否需要选中组 let allChecked = true; this.list[parentIndex].list.forEach((item, index) => { if (!item.checked) {