From aa2c08b3be23a01d44205b2c19d21a2bf53f944f Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 01 四月 2024 16:15:38 +0800 Subject: [PATCH] 图书服务列表、详情页bug修改 --- packageBookService/pages/bookServices/detail/buyResource/index.js | 141 +++++++++++++++++++++++++++++++++------------- 1 files changed, 100 insertions(+), 41 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.js b/packageBookService/pages/bookServices/detail/buyResource/index.js index 77e65ca..07134d2 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.js +++ b/packageBookService/pages/bookServices/detail/buyResource/index.js @@ -14,7 +14,9 @@ loading: false, shoppingList: [], shoppingCartGetId: [], - methodId: [] + methodId: [], + paymentPage: false, + superior: false }, /** @@ -32,50 +34,14 @@ }); this.getResourceClass() console.log(options); - this.getResourceData({ productLinkPath: options.productLinkPath, refCode: options.refCode }) + this.getResourceData({ + productLinkPath: options.productLinkPath, + refCode: options.refCode + }) this.getShoppingCartProductGet() this.getBookInfo(options.bookId) }, - batchPurchase() { - let saleMethodIds = [] - let requests = [] - const child = this.selectComponent('#tree') - console.log(child.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); - const item = child.data.superiorPurchaseSaleMethodId - if (item) { - item.forEach(item => { - if (item.saleMethod != 0) { - saleMethodIds = item.saleMethod[0].Id - requests.push({ saleMethodIds, count: 1 }) - } - }) - console.log(requests, 'saleMethodId'); - let query = { - remarks: '浜戝涔�', - requests, - - - - } - - // 鍙戣捣璁㈠崟鍒濆鍖栬姹傚苟绛夊緟缁撴灉 - const res = app.MG.store.initOrder(query) - let bookOrdersId = res.orderNumber - // 妫�鏌ヨ鍗曞彿鏄惁瀛樺湪 - if (bookOrdersId) { - const url = '/pages/cart/paymentPage/index?orderNumber=' + bookOrdersId - wx.navigateTo({ - url - }) - } - } - - // console.log(child.data.sonPurchaseSaleMethodId, 'child.data.'); - // this.data.methodId.push(child.data.sonPurchaseSaleMethodId) - - - }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 */ @@ -406,6 +372,99 @@ checkAll() { const child = this.selectComponent('#tree') child.checkAll() + + }, + //璐拱鎸夐挳 + batchPurchase() { + + + + let saleMethodIds = [] + let requests = [] + let item = [] + let selectAllId = [] + const child = this.selectComponent('#tree') + + console.log(child.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); + console.log(child.data.sonPurchaseSaleMethodId, 'child.data'); + // console.log(child.data.selectAll, 'selectAll'); + item = child.data.superiorPurchaseSaleMethodId + const sonItem = child.data.sonPurchaseSaleMethodId + let selectAll = child.data.selectAll + if (selectAll) { + // console.log(selectAll); + selectAll.forEach(item => { + if (item.saleMethod != 0) { + // console.log(item, 'item'); + selectAllId.push(item.saleMethod[0].Id) + } + }) + console.log(selectAllId); + app.MG.store.initOrder({ + requests: selectAllId.map(id => ({ + saleMethodId: id, + count: 1, + })), + }).then(res => { + if (res) { + wx.navigateTo({ + url: '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber, + }) + selectAllId = [] + child.setData({ + selectAll: [] + }) + + } + }) + } + 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, + }) + + child.setData({ + superiorPurchaseSaleMethodId: [] // 浣跨敤setData鏂规硶娓呯┖sonPurchaseSaleMethodId鏁版嵁 + }) + } + }) + } + 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 + }) + child.setData({ + sonPurchaseSaleMethodId: [] // 浣跨敤setData鏂规硶娓呯┖sonPurchaseSaleMethodId鏁版嵁 + }) + } + }) + } }, }) \ No newline at end of file -- Gitblit v1.9.1