| | |
| | | }); |
| | | 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) |
| | | }, |
| | |
| | | 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 |
| | |
| | | wx.navigateTo({ |
| | | url: '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber, |
| | | }) |
| | | this.setData({ |
| | | superior: true |
| | | }) |
| | | |
| | | child.setData({ |
| | | superiorPurchaseSaleMethodId: [] // 使用setData方法清空sonPurchaseSaleMethodId数据 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (item.length == 0 && sonItem) { |
| | | |
| | | |
| | | app.MG.store.initOrder({ |
| | | requests: sonItem.map(id => ({ |
| | | saleMethodId: id, |
| | |
| | | this.setData({ |
| | | paymentPage: true |
| | | }) |
| | | |
| | | child.setData({ |
| | | sonPurchaseSaleMethodId: [] // 使用setData方法清空sonPurchaseSaleMethodId数据 |
| | | }) |
| | | } |
| | | }) |
| | | } |