3
0
Fork 0

fix(details): fix product detail price undefined

This commit is contained in:
woody 2025-07-15 12:22:03 +08:00
parent 0047c2843a
commit 2bac6a7009
1 changed files with 17 additions and 18 deletions

View File

@ -169,7 +169,7 @@
<view class="zhan"></view> <view class="zhan"></view>
<view class="pop"> <view class="pop">
<view <view
v-for="(item, index) in goodDetail.productParams" v-for="(item, index) in goodDetail.productList"
:key="item.productId" :key="item.productId"
class="pop_c" class="pop_c"
> >
@ -288,7 +288,7 @@ export default {
addCar() { addCar() {
let sum = 0 let sum = 0
let selSum = 0 let selSum = 0
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
sum += item.quantity sum += item.quantity
item.waresItemsParamsList.forEach(ctem => { item.waresItemsParamsList.forEach(ctem => {
selSum += ctem.quantity selSum += ctem.quantity
@ -309,7 +309,7 @@ export default {
productGroup: [], productGroup: [],
pkCountry: this.pkCountry, pkCountry: this.pkCountry,
} }
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
item.waresItemsParamsList.forEach(ctem => { item.waresItemsParamsList.forEach(ctem => {
if (ctem.quantity != 0) { if (ctem.quantity != 0) {
carList.productGroup.push({ carList.productGroup.push({
@ -385,7 +385,7 @@ export default {
this.bannerImgList = this.bannerImgList.filter( this.bannerImgList = this.bannerImgList.filter(
item => item && item.trim() item => item && item.trim()
) )
this.goodDetail.productParams.forEach((item, index) => { this.goodDetail.productList.forEach((item, index) => {
item.waresItemsParamsList.forEach((ctem, cndex) => { item.waresItemsParamsList.forEach((ctem, cndex) => {
ctem.quantity = 0 ctem.quantity = 0
ctem.maxNum = 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) => { item.waresItemsParamsList.forEach((ctem, cndex) => {
if (cndex == 0) { if (cndex == 0) {
this.$set(ctem, 'quantity', item.quantity) this.$set(ctem, 'quantity', item.quantity)
@ -415,7 +415,7 @@ export default {
this.$set(this.goodDetail, 'retailPrice', 0) this.$set(this.goodDetail, 'retailPrice', 0)
this.$set(this.goodDetail, 'goodsAchive', 0) this.$set(this.goodDetail, 'goodsAchive', 0)
this.$set(this.goodDetail, 'goodsAssAchive', 0) this.$set(this.goodDetail, 'goodsAssAchive', 0)
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
if (this.specialArea == 31) { if (this.specialArea == 31) {
if (this.user.isMakerSpace == 0) { if (this.user.isMakerSpace == 0) {
this.goodDetail.goodsPrice += parseFloat(item.priceTotal) this.goodDetail.goodsPrice += parseFloat(item.priceTotal)
@ -446,7 +446,7 @@ export default {
}, },
// //
ggString() { ggString() {
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
item.skuString = '' item.skuString = ''
item.waresItemsParamsList.forEach((ctem, cndex) => { item.waresItemsParamsList.forEach((ctem, cndex) => {
if (ctem.quantity > 0) { if (ctem.quantity > 0) {
@ -455,7 +455,7 @@ export default {
}) })
}) })
let skuString = '' let skuString = ''
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
skuString += item.productName + item.skuString skuString += item.productName + item.skuString
}) })
if (skuString.length > 19) { if (skuString.length > 19) {
@ -465,11 +465,10 @@ export default {
} }
}, },
getNum(index, cndex, { value }) { getNum(index, cndex, { value }) {
this.goodDetail.productParams[index].waresItemsParamsList[ this.goodDetail.productList[index].waresItemsParamsList[cndex].quantity =
cndex value
].quantity = value
let ggNum = 0 let ggNum = 0
this.goodDetail.productParams[index].waresItemsParamsList.forEach( this.goodDetail.productList[index].waresItemsParamsList.forEach(
(item, iindex) => { (item, iindex) => {
if (iindex == cndex) { if (iindex == cndex) {
ggNum += value ggNum += value
@ -478,14 +477,14 @@ export default {
} }
} }
) )
if (this.goodDetail.productParams[index].quantity - value >= 0) { if (this.goodDetail.productList[index].quantity - value >= 0) {
this.goodDetail.productParams[index].waresItemsParamsList.forEach( this.goodDetail.productList[index].waresItemsParamsList.forEach(
(stem, sndex) => { (stem, sndex) => {
if (sndex != cndex) { if (sndex != cndex) {
this.$set( this.$set(
stem, stem,
'maxNum', 'maxNum',
this.goodDetail.productParams[index].quantity - this.goodDetail.productList[index].quantity -
(ggNum - stem.quantity) (ggNum - stem.quantity)
) )
} }
@ -499,7 +498,7 @@ export default {
}, },
calPrice() { calPrice() {
if (this.user.pkCountry == 1) { if (this.user.pkCountry == 1) {
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
item.waresItemsParamsList.forEach(ctem => { item.waresItemsParamsList.forEach(ctem => {
ctem.priceTotal = parseFloat(ctem.price) * ctem.quantity ctem.priceTotal = parseFloat(ctem.price) * ctem.quantity
ctem.assAchieveTotal = ctem.assAchieve * ctem.quantity ctem.assAchieveTotal = ctem.assAchieve * ctem.quantity
@ -510,7 +509,7 @@ export default {
}) })
}) })
} else { } else {
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
item.waresItemsParamsList.forEach(ctem => { item.waresItemsParamsList.forEach(ctem => {
ctem.priceTotal = ctem.price * ctem.quantity ctem.priceTotal = ctem.price * ctem.quantity
ctem.achieveTotal = ctem.achieve * ctem.quantity ctem.achieveTotal = ctem.achieve * ctem.quantity
@ -523,7 +522,7 @@ export default {
let retailPrice = 0 let retailPrice = 0
let achieve = 0 let achieve = 0
let assAchieve = 0 let assAchieve = 0
this.goodDetail.productParams.forEach(item => { this.goodDetail.productList.forEach(item => {
item.waresItemsParamsList.forEach(ctem => { item.waresItemsParamsList.forEach(ctem => {
price += ctem.priceTotal price += ctem.priceTotal
vipPrice += ctem.vipPriceTotal vipPrice += ctem.vipPriceTotal