| | |
| | | // 修改后方法 |
| | | const checkData = this.handleTreeData(this.data.learn).filter(item => item.checked == true) |
| | | console.log('选中', checkData); |
| | | // let saleMethodIds = []; |
| | | // let requests = []; |
| | | // let item = []; |
| | | // let selectAllId = []; |
| | | // const child = this.selectComponent("#tree"); |
| | | // item = child.data.superiorPurchaseSaleMethodId; |
| | | // const sonItem = child.data.sonPurchaseSaleMethodId; |
| | | // let selectAll = child.data.selectAll; |
| | | // if (selectAll.length) { |
| | | // selectAll.forEach((item) => { |
| | | // if (item.saleMethod != 0) { |
| | | // selectAllId.push(item.saleMethod[0].Id); |
| | | // } |
| | | // }); |
| | | // 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) { |
| | | // // 拿到id |
| | | // item.forEach((items) => { |
| | | // if (items.saleMethod != 0) { |
| | | // saleMethodIds.push(items.saleMethod[0].Id); |
| | | // } |
| | | // }); |
| | | // 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数据 |
| | | // }); |
| | | // } |
| | | // }); |
| | | // } |
| | | if (!checkData.length) return wx.showToast({ |
| | | icon: 'error', |
| | | title: '请勾选资源', |
| | | }) |
| | | let saleMethodIds = []; |
| | | checkData.forEach((items) => { |
| | | if (items.saleMethod.length) { |
| | | saleMethodIds.push(items.saleMethod.find(citem => citem.SaleType == 'Normal').Id); |
| | | } |
| | | }); |
| | | 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, |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 章节勾选方法 |