From 7eab4acb4bb2060970f81840e5d2b72f259b07cb Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期四, 28 三月 2024 11:40:19 +0800 Subject: [PATCH] yangshu --- packageBookService/pages/bookServices/detail/buyResource/index.js | 79 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 75 insertions(+), 4 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.js b/packageBookService/pages/bookServices/detail/buyResource/index.js index bc7e7eb..c0e5b0d 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.js +++ b/packageBookService/pages/bookServices/detail/buyResource/index.js @@ -14,12 +14,16 @@ loading: false, shoppingList: [], shoppingCartGetId: [], + methodId: [], + paymentPage: false, + superior: false }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { + const systInfo = wx.getSystemInfoSync(); const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� @@ -329,12 +333,12 @@ for (let i = 0; i < data.length; i++) { if (index < 3) { const item = data[i] - if (item.childrenFolderCount > 0) { + if (item.children && item.children.length > 0) { result.push(item.id) for (let j = 0; j < item.children.length; j++) { if (index < 3) { const childrenItme = item.children[j] - if (item.childrenCount > 0) { + if (item.children && item.children.length > 0) { result.push(childrenItme.id) index += 1 } @@ -342,7 +346,7 @@ break } } - } else if (item.childrenCount > 0) { + } else if (item.children && item.children.length > 0) { result.push(item.id) index += 1 } @@ -365,5 +369,72 @@ checkAll() { const child = this.selectComponent('#tree') child.checkAll() - } + }, + //璐拱鎸夐挳 + batchPurchase() { + let saleMethodIds = [] + let requests = [] + let item = [] + const child = this.selectComponent('#tree') + + console.log(child.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); + console.log(child.data.sonPurchaseSaleMethodId, 'child.data'); + item = child.data.superiorPurchaseSaleMethodId + const sonItem = child.data.sonPurchaseSaleMethodId + + if (item) { + console.log(item, 'sadsdasd'); + // 鎷垮埌id + item.forEach(items => { + if (items.saleMethod != 0) { + saleMethodIds.push(items.saleMethod[0].Id) + } + }) + console.log(saleMethodIds, 'saleMethodIds'); + + app.MG.store.initOrder({ + requests: saleMethodIds.map(id => ({ + saleMethodId: id, + count: 1, + })), + }).then(res => { + if (res) { + wx.navigateTo({ + url: '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber, + }) + this.setData({ + superior: true + }) + + } + }) + + + } + + + + + if (item.length == 0 && sonItem) { + + + app.MG.store.initOrder({ + requests: sonItem.map(id => ({ + saleMethodId: id, + count: 1, + })), + }).then(res => { + if (res) { + wx.navigateTo({ + url: '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber, + }) + this.setData({ + paymentPage: true + }) + + } + }) + } + }, + }) \ No newline at end of file -- Gitblit v1.9.1