|
|
|
@ -917,6 +917,10 @@ Page({ |
|
|
|
const formattedGoods = { |
|
|
|
// 优先设置售空状态标记,放在最前面确保不被覆盖
|
|
|
|
_isSoldOut: isSoldOut, |
|
|
|
// 复制原始产品对象中的所有字段,确保不丢失任何数据
|
|
|
|
...product, |
|
|
|
// 合并预加载数据中的字段
|
|
|
|
...(preloadedData || {}), |
|
|
|
// 其他字段
|
|
|
|
id: productIdStr, |
|
|
|
productId: productIdStr, |
|
|
|
@ -935,17 +939,13 @@ Page({ |
|
|
|
supplyStatus: supplyStatusValue, |
|
|
|
sourceType: product.sourceType || '', |
|
|
|
sourceTypeColor: getSourceTypeColor(product.sourceType), |
|
|
|
// 复制原始产品对象中的所有字段,确保不丢失任何数据
|
|
|
|
...product, |
|
|
|
// 合并预加载数据中的字段
|
|
|
|
...(preloadedData || {}), |
|
|
|
// 添加产品包装字段(放在product之后,确保不被覆盖)
|
|
|
|
// 添加产品包装字段
|
|
|
|
// 修复:使用正确的数据库字段名producting
|
|
|
|
producting: product.producting || '', |
|
|
|
// 直接使用数据库字段名,确保与表结构完全一致,放在后面覆盖前面的值
|
|
|
|
// 直接使用数据库字段名,确保与表结构完全一致
|
|
|
|
product_contact: contactName, |
|
|
|
contact_phone: contactPhone, |
|
|
|
// 确保reservedCount字段使用我们计算得到的值,放在最后以覆盖其他来源的值
|
|
|
|
// 确保reservedCount字段使用我们计算得到的值
|
|
|
|
reservedCount: finalReservationCount, |
|
|
|
// 添加净重和件数的一一对应数据
|
|
|
|
weightQuantityData: weightQuantityData, |
|
|
|
@ -2170,6 +2170,7 @@ Page({ |
|
|
|
|
|
|
|
return { |
|
|
|
...goods, |
|
|
|
price: priceString, // 确保price字段是字符串类型
|
|
|
|
mediaItems: processMediaUrls(goods.imageUrls), |
|
|
|
weightQuantityData: weightQuantityData, |
|
|
|
province: province // 添加省份字段
|
|
|
|
@ -2351,10 +2352,41 @@ Page({ |
|
|
|
// 提取省份信息
|
|
|
|
const province = extractProvince(product.region || ''); |
|
|
|
|
|
|
|
// 处理重量、数量和价格数据
|
|
|
|
let weightSpecString = ''; |
|
|
|
let quantityString = ''; |
|
|
|
let priceString = ''; |
|
|
|
|
|
|
|
// 提取重量规格
|
|
|
|
if (product.spec && typeof product.spec === 'string' && (product.spec.includes('净重') || product.spec.includes('毛重'))) { |
|
|
|
weightSpecString = product.spec; |
|
|
|
} else if (product.specification && typeof product.specification === 'string' && (product.specification.includes('净重') || product.specification.includes('毛重'))) { |
|
|
|
weightSpecString = product.specification; |
|
|
|
} else if (product.grossWeight) { |
|
|
|
weightSpecString = String(product.grossWeight); |
|
|
|
} |
|
|
|
|
|
|
|
// 提取数量
|
|
|
|
if (product.minOrder) { |
|
|
|
quantityString = String(product.minOrder); |
|
|
|
} else if (product.quantity) { |
|
|
|
quantityString = String(product.quantity); |
|
|
|
} |
|
|
|
|
|
|
|
// 提取价格
|
|
|
|
if (product.price) { |
|
|
|
priceString = String(product.price); |
|
|
|
} |
|
|
|
|
|
|
|
// 处理数据
|
|
|
|
const weightQuantityData = processWeightAndQuantityData(weightSpecString, quantityString, '', priceString); |
|
|
|
|
|
|
|
return { |
|
|
|
...product, |
|
|
|
price: priceString, // 确保price字段是字符串类型
|
|
|
|
mediaItems: processMediaUrls(product.imageUrls), |
|
|
|
province: province // 添加省份字段
|
|
|
|
province: province, // 添加省份字段
|
|
|
|
weightQuantityData: weightQuantityData // 添加价格处理数据
|
|
|
|
}; |
|
|
|
}); |
|
|
|
console.log('所有商品详情获取完成,有效商品数量:', validProducts.length); |
|
|
|
@ -2377,10 +2409,41 @@ Page({ |
|
|
|
// 提取省份信息
|
|
|
|
const province = extractProvince(product.region || ''); |
|
|
|
|
|
|
|
// 处理重量、数量和价格数据
|
|
|
|
let weightSpecString = ''; |
|
|
|
let quantityString = ''; |
|
|
|
let priceString = ''; |
|
|
|
|
|
|
|
// 提取重量规格
|
|
|
|
if (product.spec && typeof product.spec === 'string' && (product.spec.includes('净重') || product.spec.includes('毛重'))) { |
|
|
|
weightSpecString = product.spec; |
|
|
|
} else if (product.specification && typeof product.specification === 'string' && (product.specification.includes('净重') || product.specification.includes('毛重'))) { |
|
|
|
weightSpecString = product.specification; |
|
|
|
} else if (product.grossWeight) { |
|
|
|
weightSpecString = String(product.grossWeight); |
|
|
|
} |
|
|
|
|
|
|
|
// 提取数量
|
|
|
|
if (product.minOrder) { |
|
|
|
quantityString = String(product.minOrder); |
|
|
|
} else if (product.quantity) { |
|
|
|
quantityString = String(product.quantity); |
|
|
|
} |
|
|
|
|
|
|
|
// 提取价格
|
|
|
|
if (product.price) { |
|
|
|
priceString = String(product.price); |
|
|
|
} |
|
|
|
|
|
|
|
// 处理数据
|
|
|
|
const weightQuantityData = processWeightAndQuantityData(weightSpecString, quantityString, '', priceString); |
|
|
|
|
|
|
|
return { |
|
|
|
...product, |
|
|
|
price: priceString, // 确保price字段是字符串类型
|
|
|
|
mediaItems: processMediaUrls(product.imageUrls), |
|
|
|
province: province // 添加省份字段
|
|
|
|
province: province, // 添加省份字段
|
|
|
|
weightQuantityData: weightQuantityData // 添加价格处理数据
|
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
|