| | |
| | | const app = getApp(); |
| | | // import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import { getPublicImage } from '../../assets/js/middleGround/tool'; |
| | | import Toast from 'tdesign-miniprogram/toast/index'; |
| | | |
| | | Page({ |
| | | data: { |
| | |
| | | checkAll: false, |
| | | checkedList: [], |
| | | selectedCount: 0, |
| | | totalPrice: 0.00 |
| | | totalPrice: 0.00, |
| | | type: '' |
| | | }, |
| | | |
| | | onLoad(options) { |
| | |
| | | app.MG.store.getShoppingCartProductList(query).then(res => { |
| | | res.datas.forEach(item => { |
| | | item.imgUrl = getPublicImage(item.productMonWithLinkDto.product.icon, '', '160'); |
| | | console.log(item); |
| | | console.log(item.saleMethod.type, 'item.saleMethod.type') |
| | | this.setData({ |
| | | type: item.saleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product' |
| | | }) |
| | | |
| | | }); |
| | | |
| | | this.setData({ |
| | |
| | | |
| | | |
| | | const selectedItems = this.data.shoppingCartData.filter(item => item.checked); |
| | | console.log(selectedItems, 789); |
| | | // console.log(selectedItems, 789); |
| | | const selectedIds = selectedItems.map(item => item.id); |
| | | console.log('选中的商品 id:', selectedIds); |
| | | |
| | | if (selectedIds.length) { |
| | | app.MG.store.shoppingCartCreateOrder({ linkIds: selectedIds }).then(res => { |
| | | console.log(res.orderNumber, 456); |
| | | const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber |
| | |
| | | |
| | | |
| | | }) |
| | | } else { |
| | | |
| | | Toast({ |
| | | context: this, |
| | | selector: '#t-toast', |
| | | message: '请选择商品', |
| | | theme: 'warning', |
| | | direction: 'column', |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | } |