| | |
| | | isShowCheck: { |
| | | type: Boolean, |
| | | value: false, |
| | | }, |
| | | paymentPage: { |
| | | type: Boolean, |
| | | value: false, |
| | | }, |
| | | superior: { |
| | | type: Boolean, |
| | | value: false, |
| | | } |
| | | }, |
| | | data: { |
| | | |
| | | sonPurchaseSaleMethodId: '', |
| | | superiorPurchaseSaleMethodId: [], |
| | | activeValues: [1, 2], |
| | | webpageSrc: '', |
| | | cloudShoppingCart: [] |
| | | }, |
| | | ready() { |
| | | this.setData({ |
| | | |
| | | }) |
| | | console.log('准备'); |
| | | }, |
| | | onShow() { |
| | | debugger |
| | | this.setData({ |
| | | sonPurchaseSaleMethodId: '' |
| | | }) |
| | | }, |
| | | onLoad() { |
| | | this.setData({ |
| | | sonPurchaseSaleMethodId: '' |
| | | }) |
| | | }, |
| | | observers: { |
| | | 'treeList': function (newValue) { |
| | | |
| | | 'openIds': function (newValue) { |
| | | // var myEventDetail = { |
| | | // } |
| | | // var myEventOption = { |
| | | // bubbles: true, |
| | | // composed: true |
| | | // } |
| | | // this.triggerEvent('handleTree', myEventDetail, myEventOption) |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | |
| | | handleList(tree) { |
| | | for (let index = 0; index < tree.length; index++) { |
| | | const item = tree[index]; |
| | |
| | | }, |
| | | // 节点展开 |
| | | handleChange(e) { |
| | | // console.log(this.properties.treeList, 'this.properties.treeList'); |
| | | this.setData({ |
| | | activeValues: e.detail.value, |
| | | openIds: e.detail.value, |
| | | }); |
| | | // console.log('传递', this.properties.buyIds); |
| | | }, |
| | | handleCheck(data) { |
| | | for (let index = 0; index < data.length; index++) { |
| | |
| | | // 章节勾选 |
| | | checkResourceTitle(e) { |
| | | // 这个时候checked的值是fals |
| | | let checkResourceTitleList = [] |
| | | const item = e.currentTarget.dataset.item |
| | | // |
| | | let list = this.flattenTree([item]) |
| | | let ids = [] |
| | | list.forEach(item => { |
| | | ids.push(item.id) |
| | | }) |
| | | // console.log(list, 'list789'); |
| | | const updatedTreeList = this.findAndUpdateItemsByIds(this.properties.treeList, ids); |
| | | this.setData({ |
| | | treeList: updatedTreeList // 更新 treeList 数据 |
| | | }); |
| | | console.log(list, 'list'); |
| | | |
| | | if (!list.checked) { |
| | | if (this.properties.superior) { |
| | | console.log(852); |
| | | |
| | | this.properties.superior = false |
| | | this.setData({ |
| | | superiorPurchaseSaleMethodId: [] |
| | | }) |
| | | } |
| | | if (!this.properties.superior) { |
| | | this.setData({ |
| | | superiorPurchaseSaleMethodId: list |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // console.log(this.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); |
| | | list.forEach(items => { |
| | | console.log(items.checked, 'itesasd'); |
| | | if (!items.checked) { |
| | |
| | | }) |
| | | } |
| | | }) |
| | | this.onCloudShoppingCart() |
| | | // this.onCloudShoppingCart() |
| | | }, |
| | | // 子项勾选 |
| | | checkResource(e) { |
| | | const citem = e.currentTarget.dataset.item |
| | | console.log(e); |
| | | console.log(citem, '5648'); |
| | | const updataList = this.checkResoucrceInfo(this.properties.treeList, citem.id) |
| | | console.log(updataList); |
| | | console.log(citem.checked, 'citem.checked'); |
| | | if (!citem.checked) { |
| | | //选中的时候添加id |
| | | let sonPurchaseSaleMethodId = this.data.sonPurchaseSaleMethodId || [] |
| | | console.log(this.properties.paymentPage, 'this.properties.paymentPage'); |
| | | if (this.properties.paymentPage) { |
| | | console.log(789987); |
| | | sonPurchaseSaleMethodId = [] |
| | | this.properties.paymentPage = false |
| | | } |
| | | if (!this.properties.paymentPage) { |
| | | sonPurchaseSaleMethodId.push(citem.saleMethod[0].Id) |
| | | } |
| | | |
| | | |
| | | this.setData({ |
| | | sonPurchaseSaleMethodId: sonPurchaseSaleMethodId |
| | | }) |
| | | console.log(this.data.sonPurchaseSaleMethodId); |
| | | } else { |
| | | // 取消选中的时候删除id |
| | | |
| | | } |
| | | |
| | | this.setData({ |
| | | treeList: updataList |
| | | treeList: updataList, |
| | | |
| | | }) |
| | | }, |
| | | // 加入购物车 |
| | |
| | | }, |
| | | }, |
| | | onCheckAllChange(e) { |
| | | debugger |
| | | console.log('checkbox', e.detail.value); |
| | | // debugger |
| | | // console.log('checkbox', e.detail.value); |
| | | // this.setData({ |
| | | // checkAllValues: event.detail, |
| | | // }); |