功能:浮窗商店同步加「💍 求婚戒指」分组
toolbar.blade.php renderShop 补充: - ring 类型分组(存入背包,求婚时消耗) - 图标持有数量红色徽章 - 卡片下方亲密度/魅力加成标注 - 购买按钮走现有 buyItem 流程(后端 buyRing 处理)
This commit is contained in:
@@ -782,6 +782,8 @@
|
||||
badge.style.display = 'inline-block';
|
||||
}
|
||||
|
||||
const ringCounts = data.ring_counts || {};
|
||||
|
||||
const groups = [{
|
||||
label: '⚡ 单次特效卡',
|
||||
desc: '立即播放一次,仅自己可见',
|
||||
@@ -797,6 +799,11 @@
|
||||
desc: '',
|
||||
type: 'one_time'
|
||||
},
|
||||
{
|
||||
label: '💍 求婚戒指',
|
||||
desc: '存入背包,求婚时消耗(被拒则遗失)',
|
||||
type: 'ring'
|
||||
},
|
||||
];
|
||||
|
||||
const list = document.getElementById('shop-items-list');
|
||||
@@ -815,17 +822,31 @@
|
||||
items.forEach(item => {
|
||||
const isRename = item.slug === 'rename_card';
|
||||
const canUse = isRename && data.has_rename_card;
|
||||
const isRing = item.type === 'ring';
|
||||
const ownedQty = isRing ? (ringCounts[item.id] || 0) : 0;
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.className = 'shop-card';
|
||||
|
||||
// 顶部:图标 + 名称
|
||||
// 顶部:图标 + 名称(戒指加持有数徽章)
|
||||
const iconHtml = isRing && ownedQty > 0 ?
|
||||
`<span style="position:relative;display:inline-block;">
|
||||
<span class="shop-card-icon">${item.icon}</span>
|
||||
<span style="position:absolute;top:-4px;right:-6px;background:#f43f5e;color:#fff;font-size:9px;font-weight:800;min-width:15px;height:15px;border-radius:8px;text-align:center;line-height:15px;padding:0 2px;">${ownedQty}</span>
|
||||
</span>` :
|
||||
`<span class="shop-card-icon">${item.icon}</span>`;
|
||||
|
||||
card.innerHTML = `
|
||||
<div class="shop-card-top">
|
||||
<span class="shop-card-icon">${item.icon}</span>
|
||||
${iconHtml}
|
||||
<span class="shop-card-name">${item.name}</span>
|
||||
</div>
|
||||
<div class="shop-card-desc">${item.description ?? ''}</div>
|
||||
${isRing && (item.intimacy_bonus > 0 || item.charm_bonus > 0) ? `
|
||||
<div style="font-size:9px;margin-top:3px;display:flex;gap:8px;">
|
||||
${item.intimacy_bonus > 0 ? `<span style="color:#f43f5e;">💞 亲密 +${item.intimacy_bonus}</span>` : ''}
|
||||
${item.charm_bonus > 0 ? `<span style="color:#a855f7;">✨ 魅力 +${item.charm_bonus}</span>` : ''}
|
||||
</div>` : ''}
|
||||
`;
|
||||
|
||||
// 按钮
|
||||
@@ -840,7 +861,7 @@
|
||||
btn.innerHTML = `🪙 ${Number(item.price).toLocaleString()}`;
|
||||
btn.onclick = () => openGiftDialog(item);
|
||||
} else {
|
||||
// 周卡等其他商品:直接确认购买
|
||||
// 周卡、道具、戒指:直接确认购买
|
||||
btn.className = 'shop-btn';
|
||||
btn.innerHTML = `🪙 ${Number(item.price).toLocaleString()}`;
|
||||
btn.onclick = () => buyItem(item.id, item.name, item.price, 'all', '');
|
||||
|
||||
Reference in New Issue
Block a user