| | |
| | | |
| | | Page({ |
| | | data: { |
| | | swipeOpened: false, |
| | | onDisabled: false, |
| | | imgUrl: [], |
| | | shoppingCartData: [], |
| | |
| | | start: 1, |
| | | totalSize: '', |
| | | isMore: null, |
| | | bookId: '', |
| | | bookName: '' |
| | | }, |
| | | |
| | | onLoad(options) { |
| | | |
| | | wx.setNavigationBarTitle({ |
| | | title: '购物车' |
| | | }); |
| | | this.shoppingCartGet(); |
| | | console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length'); |
| | | |
| | | this.setData({ |
| | | swipeOpened: true |
| | | }) |
| | | }, |
| | | onShow() { |
| | | this.setData({ |
| | | swipeOpened: false |
| | | }) |
| | | if (typeof this.getTabBar === 'function' && this.getTabBar()) { |
| | | this.getTabBar().setData({ |
| | | active: 3 |
| | |
| | | checkAll: false, |
| | | }) |
| | | }, |
| | | |
| | | |
| | | onDelete(e) { |
| | | const item = e.currentTarget.dataset.item; |
| | | app.MG.store.delShoppingCart({ |
| | |
| | | this.setData({ |
| | | totalSize: res.totalSize |
| | | }) |
| | | |
| | | res.datas.forEach(item => { |
| | | console.log(res); |
| | | |
| | | this.setData({ |
| | | bookId: res.id, |
| | | bookName: res.name |
| | | }) |
| | | item.imgUrl = getPublicImage(item.productMonWithLinkDto.product.icon, '', '160'); |
| | | // this.setData({ |
| | | // type: item.saleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product' |
| | |
| | | shoppingCartData: res.datas |
| | | }); |
| | | console.log(this.data.shoppingCartData, 'shoppingCartData'); |
| | | |
| | | if (this.data.shoppingCartData.length === 0) { |
| | | this.setData({ |
| | | onDisabled: true |
| | |
| | | console.log(978); |
| | | this.shoppingCartGet() |
| | | }, |
| | | |
| | | onBook(e) { |
| | | // console.log(e); |
| | | const item = e.currentTarget.dataset.item |
| | | console.log(item); |
| | | // wx.navigateTo({ |
| | | // url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name |
| | | // }) |
| | | } |
| | | }); |