Compare commits

..

No commits in common. "0a71636436147821ecc9eee664c53bb045c4d8f7" and "d803aeff4c0a74ec6b92179bac1fcf1b0668d48f" have entirely different histories.

2 changed files with 45 additions and 14 deletions

View File

@ -267,7 +267,6 @@ export default {
}).then(res => {
console.log(res);
this.info = res
//
res.commodity_goods_info_list.forEach(item => {
item.goods_detail_pic = item.goods_detail_pic.split(',')
item.goods_carousel = item.goods_carousel.split(',')
@ -291,8 +290,14 @@ export default {
});
},
// changeGG2(item, index) {
// request(apiArr.addCar,"POST",{
// goods_id:item.id,
// count:1
// })
// },
//
changeGG(item, index) {
this.currentGG = item
this.currentGGIndex = index
@ -314,7 +319,7 @@ export default {
})
},
//( id )
//
getShopCarList() {
request(apiArr.getCar, 'POST', {}).then(res => {
this.carOrderList = res.commodity_cart_list
@ -322,41 +327,67 @@ export default {
},
addCar() {
let that = this
//
let goods_id_and_count = []
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = { count: 1 }
this.info.commodity_goods_info_list.forEach(item => {
console.log(item);
goods_id_and_count.push({
goods_id: item.id,
count: 1
count: item.cart_count.count
})
})
// update
request(apiArr.updateCar, "POST", {
goods_id_and_count
}).then(res => {
that.getShopCar()
that.getShopCarList()
})
// let flag = false
// this.carOrderList.forEach(item => {
// if (item.goods_id == this.info.commodity_goods_info_list[this.currentGGIndex].id) {
// flag = true
// }
// })
// console.log(flag);
// if (flag) {
// this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = { count: 1 }
// let carNum = 0
// this.info.commodity_goods_info_list.forEach(item => {
// carNum += item.cart_count.count
// })
// this.carNum = carNum
// } else {
// }
},
//
changeCar(newValue) {
//
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
//
this.carOrderList.forEach(item=>{
if(item.commodity_goods_info.id == this.info.commodity_goods_info_list[this.currentGGIndex].id){
console.log(item,'item');
item.count = newValue.value
}
})
//
let carNum = 0
this.carOrderList.forEach(item=>{
carNum += item.count
})
// let carNum = 0
// this.info.commodity_goods_info_list.forEach(item => {
// if (item.cart_count) {
// carNum += item.cart_count.count
// }
// })
this.carNum = carNum
},

View File

@ -8,15 +8,15 @@
"miniprogram": {
"list": [
{
"name": "packages/shop/goods/index",
"pathName": "packages/shop/goods/index",
"query": "id=30",
"name": "packages/shop/address/index",
"pathName": "packages/shop/address/index",
"query": "",
"scene": null,
"launchMode": "default"
},
{
"name": "packages/shop/shopCar/index",
"pathName": "packages/shop/shopCar/index",
"name": "packages/shop/addAddress/index",
"pathName": "packages/shop/addAddress/index",
"query": "",
"launchMode": "default",
"scene": null