feat(fragment): 小程序适配碎片多数量产出展示

- normalizeRewards 传递 drop_quantity 字段
- 抽奖结果弹窗自动合并同类碎片显示 x{N}
- 购买记录仅 count>1 时显示数量角标(当前不展示)
- RewardsPreview/RewardsPopup 保留 drop_quantity 样式(当前不展示)
This commit is contained in:
Zuncle 2026-03-23 22:27:50 +08:00
parent eb3257f1bd
commit d55be3dbcf
5 changed files with 27 additions and 2 deletions

View File

@ -19,7 +19,7 @@
<view class="record-info">
<view class="record-title">{{ item.title }}</view>
<view class="record-meta">
<text class="record-count">x1</text>
<text class="record-count" v-if="item.count > 1">x{{ item.count }}</text>
</view>
</view>
</view>

View File

@ -205,6 +205,16 @@ defineEmits(['update:visible'])
flex-shrink: 0;
}
.rewards-qty-tag {
font-size: $font-xxs;
font-weight: 700;
color: #fff;
background: linear-gradient(135deg, #ff6b35, #ff4500);
padding: 2rpx 10rpx;
border-radius: $radius-sm;
flex-shrink: 0;
}
.rewards-percent {
font-size: $font-sm;
color: $text-sub;

View File

@ -242,6 +242,20 @@ const rewardGroups = computed(() => {
}
}
.drop-qty-badge {
position: absolute;
top: 10rpx;
right: 10rpx;
background: linear-gradient(135deg, #ff6b35, #ff4500);
color: #fff;
font-size: 20rpx;
padding: 2rpx 10rpx;
border-radius: 16rpx;
z-index: 10;
font-weight: 700;
box-shadow: 0 2rpx 6rpx rgba(255, 69, 0, 0.3);
}
/* 空状态 */
.empty-state {
display: flex;

View File

@ -31,7 +31,7 @@ export function useRecords() {
id: it.id,
title: it.reward_name || it.title || it.name || '-', // 奖品名称
image: it.reward_image || it.image || '', // 奖品图片
count: 1, // 单个记录数量为1
count: 1,
// 用户信息
user_id: it.user_id,

View File

@ -110,6 +110,7 @@ export function normalizeRewards(list, cleanUrl = (u) => u) {
weight: Number(i.weight) || 0,
boss: detectBoss(i),
min_score: i.min_score || 0,
drop_quantity: Number(i.drop_quantity) || 1,
level: levelToAlpha(i.prize_level ?? i.level ?? (detectBoss(i) ? 'BOSS' : '赏'))
}))
const total = items.reduce((acc, it) => acc + (it.weight > 0 ? it.weight : 0), 0)