45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
|
|
// 返回购物车未下单的数据
|
|
export function getNowCart(carItem,goodsList,user) {
|
|
// console.log("carItem===",carItem)
|
|
// console.log("goodsList===",goodsList)
|
|
// const nowCart = records.find(v => v.placeNum == 0)
|
|
const arr = []
|
|
if( carItem.is_temporary != 1 ){
|
|
carItem.isGrounding = false;
|
|
goodsList.map(goodsItem => {
|
|
if(carItem.product_id == goodsItem.id){
|
|
goodsItem.skuList.map(item=>{
|
|
if(carItem.sku_id == item.id){
|
|
carItem.lowPrice = item.salePrice
|
|
carItem.lowMemberPrice = item.memberPrice
|
|
carItem.specInfo = item.specInfo
|
|
carItem.suitNum = item.suitNum
|
|
|
|
if( uni.getStorageSync('shopInfo').isMemberPrice && user && user.id && user.isVip ){
|
|
carItem.salePrice = item.memberPrice
|
|
} else {
|
|
carItem.salePrice = item.salePrice
|
|
}
|
|
|
|
}
|
|
})
|
|
carItem.name = goodsItem.name
|
|
carItem.coverImg = goodsItem.coverImg
|
|
carItem.packFee = goodsItem.packFee
|
|
carItem.groupType = goodsItem.groupType
|
|
carItem.type = goodsItem.type
|
|
carItem.isGrounding = true;
|
|
}
|
|
carItem.number = parseFloat(carItem.number)
|
|
})
|
|
} else {
|
|
// 临时菜
|
|
carItem.number = parseFloat(carItem.number)
|
|
carItem.name = carItem.product_name
|
|
carItem.lowPrice = carItem.discount_sale_amount
|
|
carItem.discount_sale_amount = 0
|
|
}
|
|
|
|
return carItem
|
|
} |