From 2bac6a700909404037e95004f681752bc0daa60e Mon Sep 17 00:00:00 2001 From: woody Date: Tue, 15 Jul 2025 12:22:03 +0800 Subject: [PATCH] fix(details): fix product detail price undefined --- pages/specialArea/details.vue | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/pages/specialArea/details.vue b/pages/specialArea/details.vue index fbb39eb..4501dc4 100644 --- a/pages/specialArea/details.vue +++ b/pages/specialArea/details.vue @@ -169,7 +169,7 @@ @@ -288,7 +288,7 @@ export default { addCar() { let sum = 0 let selSum = 0 - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { sum += item.quantity item.waresItemsParamsList.forEach(ctem => { selSum += ctem.quantity @@ -309,7 +309,7 @@ export default { productGroup: [], pkCountry: this.pkCountry, } - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { item.waresItemsParamsList.forEach(ctem => { if (ctem.quantity != 0) { carList.productGroup.push({ @@ -385,7 +385,7 @@ export default { this.bannerImgList = this.bannerImgList.filter( item => item && item.trim() ) - this.goodDetail.productParams.forEach((item, index) => { + this.goodDetail.productList.forEach((item, index) => { item.waresItemsParamsList.forEach((ctem, cndex) => { ctem.quantity = 0 ctem.maxNum = 0 @@ -397,7 +397,7 @@ export default { }) }) // 赋初值 - this.goodDetail.productParams.forEach((item, index) => { + this.goodDetail.productList.forEach((item, index) => { item.waresItemsParamsList.forEach((ctem, cndex) => { if (cndex == 0) { this.$set(ctem, 'quantity', item.quantity) @@ -415,7 +415,7 @@ export default { this.$set(this.goodDetail, 'retailPrice', 0) this.$set(this.goodDetail, 'goodsAchive', 0) this.$set(this.goodDetail, 'goodsAssAchive', 0) - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { if (this.specialArea == 31) { if (this.user.isMakerSpace == 0) { this.goodDetail.goodsPrice += parseFloat(item.priceTotal) @@ -446,7 +446,7 @@ export default { }, // 拼接已选 ggString() { - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { item.skuString = '' item.waresItemsParamsList.forEach((ctem, cndex) => { if (ctem.quantity > 0) { @@ -455,7 +455,7 @@ export default { }) }) let skuString = '' - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { skuString += item.productName + item.skuString }) if (skuString.length > 19) { @@ -465,11 +465,10 @@ export default { } }, getNum(index, cndex, { value }) { - this.goodDetail.productParams[index].waresItemsParamsList[ - cndex - ].quantity = value + this.goodDetail.productList[index].waresItemsParamsList[cndex].quantity = + value let ggNum = 0 - this.goodDetail.productParams[index].waresItemsParamsList.forEach( + this.goodDetail.productList[index].waresItemsParamsList.forEach( (item, iindex) => { if (iindex == cndex) { ggNum += value @@ -478,14 +477,14 @@ export default { } } ) - if (this.goodDetail.productParams[index].quantity - value >= 0) { - this.goodDetail.productParams[index].waresItemsParamsList.forEach( + if (this.goodDetail.productList[index].quantity - value >= 0) { + this.goodDetail.productList[index].waresItemsParamsList.forEach( (stem, sndex) => { if (sndex != cndex) { this.$set( stem, 'maxNum', - this.goodDetail.productParams[index].quantity - + this.goodDetail.productList[index].quantity - (ggNum - stem.quantity) ) } @@ -499,7 +498,7 @@ export default { }, calPrice() { if (this.user.pkCountry == 1) { - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { item.waresItemsParamsList.forEach(ctem => { ctem.priceTotal = parseFloat(ctem.price) * ctem.quantity ctem.assAchieveTotal = ctem.assAchieve * ctem.quantity @@ -510,7 +509,7 @@ export default { }) }) } else { - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { item.waresItemsParamsList.forEach(ctem => { ctem.priceTotal = ctem.price * ctem.quantity ctem.achieveTotal = ctem.achieve * ctem.quantity @@ -523,7 +522,7 @@ export default { let retailPrice = 0 let achieve = 0 let assAchieve = 0 - this.goodDetail.productParams.forEach(item => { + this.goodDetail.productList.forEach(item => { item.waresItemsParamsList.forEach(ctem => { price += ctem.priceTotal vipPrice += ctem.vipPriceTotal