|
|
@ -11,6 +11,20 @@ function getSourceTypeColor(sourceType) { |
|
|
return colorMap[sourceType] || '#4d9dff'; |
|
|
return colorMap[sourceType] || '#4d9dff'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 计算显示价格 - 处理价格字符串,提取第一个价格
|
|
|
|
|
|
function calculateDisplayPrice(price) { |
|
|
|
|
|
if (!price) { |
|
|
|
|
|
return '暂无价格'; |
|
|
|
|
|
} |
|
|
|
|
|
if (typeof price === 'string') { |
|
|
|
|
|
// 支持多种逗号分隔符:英文逗号、中文逗号、全角逗号
|
|
|
|
|
|
const priceArray = price.split(/[,,、]/).map(item => item.trim()).filter(item => item); |
|
|
|
|
|
return priceArray[0] || '暂无价格'; |
|
|
|
|
|
} |
|
|
|
|
|
// 如果不是字符串,转换为字符串
|
|
|
|
|
|
return String(price); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 格式化分享标题 - 按优先级: 地区、规格、数量、蛋黄颜色、蛋壳颜色
|
|
|
// 格式化分享标题 - 按优先级: 地区、规格、数量、蛋黄颜色、蛋壳颜色
|
|
|
function formatShareTitle(goodsDetail) { |
|
|
function formatShareTitle(goodsDetail) { |
|
|
console.log('===== formatShareTitle 开始 ====='); |
|
|
console.log('===== formatShareTitle 开始 ====='); |
|
|
@ -357,7 +371,7 @@ function processWeightAndQuantityData(weightSpecString, quantityString, specStri |
|
|
display = `${weightSpecDisplay}————售空`; |
|
|
display = `${weightSpecDisplay}————售空`; |
|
|
} else { |
|
|
} else { |
|
|
if (price) { |
|
|
if (price) { |
|
|
display = `${weightSpecDisplay}【${quantity}件】${price}元`; |
|
|
display = `${weightSpecDisplay}【${quantity}件】¥${price}元`; |
|
|
} else { |
|
|
} else { |
|
|
display = `${weightSpecDisplay}【${quantity}件】`; |
|
|
display = `${weightSpecDisplay}【${quantity}件】`; |
|
|
} |
|
|
} |
|
|
@ -908,7 +922,8 @@ Page({ |
|
|
productId: productIdStr, |
|
|
productId: productIdStr, |
|
|
// 直接使用数据库字段名
|
|
|
// 直接使用数据库字段名
|
|
|
name: product.productName || product.name || '商品名称', |
|
|
name: product.productName || product.name || '商品名称', |
|
|
price: product.price, |
|
|
price: product.price ? String(product.price) : '', |
|
|
|
|
|
displayPrice: calculateDisplayPrice(product.price), |
|
|
minOrder: product.minOrder || product.quantity, |
|
|
minOrder: product.minOrder || product.quantity, |
|
|
yolk: product.yolk, |
|
|
yolk: product.yolk, |
|
|
spec: product.spec || product.specification || '暂无规格', |
|
|
spec: product.spec || product.specification || '暂无规格', |
|
|
|