| | |
| | | loading: false, |
| | | shoppingList: [], |
| | | shoppingCartGetId: [], |
| | | methodId: [] |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | |
| | | 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) |
| | | |
| | | |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | |
| | | if (type.refCode == 'jsek_teachingResources' || type.refCode == 'jsek_cloudLearning') { |
| | | if (res.datas.cmsDatas[0].datas.length > 0) { |
| | | res.datas.cmsDatas[0].datas.forEach(item => { |
| | | item.checked = false |
| | | item.checked = false, |
| | | item.checkAll = true |
| | | }) |
| | | const list = await this.getAllResource(res.datas.cmsDatas[0].datas) |
| | | if (type.refCode == 'jsek_teachingResources') { |
| | |
| | | }) |
| | | this.findChildIds(this.data.teach, this.data.openTeachids = []) |
| | | } else if (type.refCode == 'jsek_cloudLearning') { |
| | | const result = [] |
| | | res.datas.cmsDatas[0].datas.forEach(item => { |
| | | item.checked = false |
| | | }) |
| | | const list = await this.getAllResource(res.datas.cmsDatas[0].datas) |
| | | this.findChildIds(list, result) |
| | | this.setData({ |
| | | learn: list, |
| | | loading: false |
| | | loading: false, |
| | | openLearnids: result |
| | | }) |
| | | this.findChildIds(this.data.learn, this.data.openLearnids = []) |
| | | console.log('教学资源', list); |
| | | } |
| | | } else { |
| | | // 无数据 |
| | |
| | | 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 |
| | | } |
| | |
| | | break |
| | | } |
| | | } |
| | | } else if (item.childrenCount > 0) { |
| | | } else if (item.children && item.children.length > 0) { |
| | | result.push(item.id) |
| | | index += 1 |
| | | } |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | checkAll() { |
| | | const child = this.selectComponent('#tree') |
| | | child.checkAll() |
| | | }, |
| | | |
| | | }) |