后端 + 前端:添加到购物车

This commit is contained in:
YunaiV
2019-04-11 19:49:58 +08:00
parent 4300ce141d
commit b807a63966
22 changed files with 541 additions and 177 deletions

View File

@@ -16,12 +16,22 @@
<div>{{addressData.address}}</div>
</template>
</van-cell>
<div style="height:15px;"></div>
<div style="height:15px;"></div>
<div class="card" v-for="(product,i) in products" :key="i">
<product-card :product='product'/>
<!-- <div class="card" v-for="(product,i) in products" :key="i">-->
<!-- <product-card :product='product'/>-->
<!-- </div>-->
<div v-for="(itemGroup, i) in itemGroups" >
<div class="card" v-for="(item, j) in itemGroup.items" :key="j">
<product-card :product='convertProduct(item)'/>
</div>
<div style="height:15px;"></div>
</div>
<div style="height:15px;"></div>
<van-cell-group>
<van-field
@@ -61,7 +71,6 @@
import {createOrder, getConfirmCreateOrder} from '../../api/order';
import {GetDefaultAddress} from '../../api/user';
import orderStore from '../../store/order'
import eventBus from '../eventBus';
export default {
data() {
@@ -141,8 +150,17 @@
remark,
})
},
convertProduct() {
convertProduct(item) {
// debugger;
return {
...item.spu,
quantity: item.buyQuantity,
price: item.price,
sku: {
...item,
spu: undefined,
}
};
}
},
mounted: function() {