diff --git a/player.php b/player.php index d4adb1c..c5cb2e9 100644 --- a/player.php +++ b/player.php @@ -1211,7 +1211,18 @@ if ($currentVersion !== $BUILD_VERSION) { products.forEach((product, index) => { const isSelected = index === 0; // 默认选中第一个 const isBlindBox = product.bond_min !== product.bond_max; // 盲盒:范围格式 - const offerText = product.temporary_offer ? `
🎁 ${product.temporary_offer}${product.expire_display ? ' (有效期: ' + product.expire_display + ')' : ''}
` : ''; + // 活动信息显示(根据是否过期显示不同样式) + let offerText = ''; + if (product.temporary_offer) { + const isExpired = product.expire_valid === false || product.expire_valid === 'false'; + if (isExpired) { + // 活动已过期:显示灰色+删除线 + offerText = `
🎁 ${product.temporary_offer} (已过期)
`; + } else { + // 活动有效:显示黄色 + offerText = `
🎁 ${product.temporary_offer}${product.expire_display ? ' (有效期: ' + product.expire_display + ')' : ''}
`; + } + } const stockText = product.stock === -1 ? '无限库存' : (product.stock > 0 ? `库存: ${product.stock}` : '售罄'); const stockColor = product.stock === -1 ? 'var(--green)' : (product.stock > 0 ? 'var(--dim)' : 'var(--red)'); const isSoldOut = product.stock === 0; // 售罄:仍展示,但禁止购买 @@ -1220,9 +1231,10 @@ if ($currentVersion !== $BUILD_VERSION) { // ★ 盲盒随机语录 const quoteText = isBlindBox ? `
${blindBoxQuotes[Math.floor(Math.random() * blindBoxQuotes.length)]}
` : ''; - // 计算显示价格(折扣价格优先) - const displayPrice = product.discount_price > 0 ? product.discount_price : product.price; - const hasDiscount = product.discount_price > 0 && product.discount_price < product.price; + // 计算显示价格(折扣价格优先,但必须折扣有效且未过期) + const discountValid = product.discount_active === true || product.discount_active === 'true'; + const displayPrice = (discountValid && product.discount_price > 0) ? product.discount_price : product.price; + const hasDiscount = discountValid && product.discount_price > 0 && product.discount_price < product.price; html += `