From d19d4d7523eaf8e0a0d00467681a55c0c49c2d3d Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期三, 03 四月 2024 18:02:42 +0800 Subject: [PATCH] 书目 --- packageBookService/pages/bookServices/detail/components/tree/index.js | 56 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 34 insertions(+), 22 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index 079d169..f87d087 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -1,5 +1,7 @@ const util = require("./components/util"); // 寮曞叆灏佽杩囩殑鍔犺浇鎻愮ず -import { loginInfo } from "../../../../../../assets/js/login"; +import { + loginInfo +} from "../../../../../../assets/js/login"; const app = getApp(); Component({ // checked: false, @@ -40,6 +42,9 @@ superior: { type: Boolean, value: false, + }, + checkAllState: { + type: Boolean, }, }, data: { @@ -84,8 +89,7 @@ handleList(tree) { for (let index = 0; index < tree.length; index++) { const item = tree[index]; - if (item.sysType == "CmsItem" && !item.checked) { - } + if (item.sysType == "CmsItem" && !item.checked) {} if (item.children && item.children.length > 0) { this.handleList(item.children); } @@ -307,16 +311,9 @@ ids.push(item.id); checked = item.checked; }); - const flag = - list.findIndex((item) => item.checked == false) > -1 ? true : false; - var myEventDetail = { - value: flag, - }; // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - var myEventOption = { - bubbles: true, - composed: true, - }; // 瑙﹀彂浜嬩欢鐨勯�夐」 - this.triggerEvent("changeCheckAll", myEventDetail, myEventOption); + // const flag = + // list.findIndex((item) => item.checked == false) > -1 ? true : false; + const flag = this.properties.checkAllState; const updataList = this.findAndUpdateItemsByIds( this.properties.treeList, ids, @@ -331,6 +328,14 @@ this.setData({ treeList: updataList, }); + var myEventDetail = { + value: !flag, + }; // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + var myEventOption = { + bubbles: true, + composed: true, + }; // 瑙﹀彂浜嬩欢鐨勯�夐」 + this.triggerEvent("changeCheckAll", myEventDetail, myEventOption); }, // 绔犺妭鍕鹃�� @@ -422,6 +427,8 @@ }); if (shoppingCartGetId.includes(saleMethodId)) { console.log(111); + // this.data.updateShoppingCartHidden(); + // this.data.updateCloudLearning(); wx.showToast({ icon: "error", @@ -432,13 +439,11 @@ }); } else { let query = { - requests: [ - { - saleMethodId: saleMethodId, - storeEventId: null, - // agentCode: '鐢靛瓙涔�' - }, - ], + requests: [{ + saleMethodId: saleMethodId, + storeEventId: null, + // agentCode: '鐢靛瓙涔�' + }, ], }; const addRes = await app.MG.store.addShoppingCart(query); console.log(addRes, "addRes"); @@ -448,7 +453,14 @@ }); } }, + sadd() { + this.triggerEvent('updateShoppingCartHidden'); + this.triggerEvent('updateCloudLearning'); + console.log(789); + }, + }, - catchtap() {}, -}); + + catchtap() {} +}) \ No newline at end of file -- Gitblit v1.9.1