|
|
@ -1942,24 +1942,42 @@ Page({ |
|
|
console.log('即将执行的条件分支...'); |
|
|
console.log('即将执行的条件分支...'); |
|
|
|
|
|
|
|
|
if (isSoldOut) { |
|
|
if (isSoldOut) { |
|
|
// 售空状态的商品,只显示规格信息,不显示件数
|
|
|
// 售空状态的商品,显示规格信息和价格
|
|
|
if (weightSpecString) { |
|
|
if (weightSpecString) { |
|
|
// 处理净重/规格字符串,只显示规格信息
|
|
|
// 处理净重/规格字符串,显示规格信息和价格
|
|
|
const weightSpecArray = weightSpecString.split(/[,,、]/).map(item => item.trim()).filter(item => item); |
|
|
const weightSpecArray = weightSpecString.split(/[,,、]/).map(item => item.trim()).filter(item => item); |
|
|
weightQuantityData = weightSpecArray.map(spec => ({ |
|
|
// 获取价格信息
|
|
|
weightSpec: spec.includes('毛重') ? spec : `毛重${spec}`, |
|
|
let priceString = ''; |
|
|
quantity: '售空', |
|
|
if (product.price) { |
|
|
display: spec.includes('毛重') ? spec : `毛重${spec}` |
|
|
priceString = String(product.price); |
|
|
})); |
|
|
} |
|
|
|
|
|
// 处理价格数组
|
|
|
|
|
|
let priceArray = []; |
|
|
|
|
|
if (priceString && typeof priceString === 'string') { |
|
|
|
|
|
priceArray = priceString.split(/[,,、]/).map(item => item.trim()).filter(item => item); |
|
|
|
|
|
} else if (priceString) { |
|
|
|
|
|
priceArray = [String(priceString)]; |
|
|
|
|
|
} |
|
|
|
|
|
weightQuantityData = weightSpecArray.map((spec, index) => { |
|
|
|
|
|
const price = priceArray[index] || ''; |
|
|
|
|
|
return { |
|
|
|
|
|
weightSpec: spec.includes('毛重') ? spec : `毛重${spec}`, |
|
|
|
|
|
quantity: '售空', |
|
|
|
|
|
price: price, |
|
|
|
|
|
display: price ? |
|
|
|
|
|
`${spec.includes('毛重') ? spec : `毛重${spec}`}【售空】¥${price}元` : |
|
|
|
|
|
`${spec.includes('毛重') ? spec : `毛重${spec}`}【售空】` |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
// 如果没有规格信息,则显示默认的售空信息
|
|
|
// 如果没有规格信息,则显示默认的售空信息
|
|
|
weightQuantityData = [{ |
|
|
weightQuantityData = [{ |
|
|
weightSpec: '规格信息', |
|
|
weightSpec: '规格信息', |
|
|
quantity: '售空', |
|
|
quantity: '售空', |
|
|
display: '规格信息' |
|
|
display: '规格信息【售空】' |
|
|
}]; |
|
|
}]; |
|
|
} |
|
|
} |
|
|
console.log('✓ 售空分支执行: 只显示规格信息'); |
|
|
console.log('✓ 售空分支执行: 显示规格信息和价格'); |
|
|
console.log('weightQuantityData设置为:', weightQuantityData); |
|
|
console.log('weightQuantityData设置为:', weightQuantityData); |
|
|
} else { |
|
|
} else { |
|
|
// 非售空状态,使用processWeightAndQuantityData函数正确处理规格和件数信息
|
|
|
// 非售空状态,使用processWeightAndQuantityData函数正确处理规格和件数信息
|
|
|
@ -1970,7 +1988,7 @@ Page({ |
|
|
priceString = String(product.price); |
|
|
priceString = String(product.price); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log('输入参数: weightSpecString="', weightSpecString, '", quantityString="', quantityString, '"'); |
|
|
console.log('输入参数: weightSpecString="', weightSpecString, '"'); |
|
|
|
|
|
|
|
|
// 获取规格状态信息
|
|
|
// 获取规格状态信息
|
|
|
let specStatusString = ''; |
|
|
let specStatusString = ''; |
|
|
|