diff --git a/pages-activity/activity/yifanshang/index.vue b/pages-activity/activity/yifanshang/index.vue index a51c610..5dd047c 100644 --- a/pages-activity/activity/yifanshang/index.vue +++ b/pages-activity/activity/yifanshang/index.vue @@ -387,9 +387,9 @@ async function onPaymentConfirm(paymentData) { channel: 'miniapp', count: selectedChoices.value.length, slot_index: selectedChoices.value.map(c => Number(c.id || c.number)), - coupon_id: paymentData.coupon_id || 0, - item_card_id: paymentData.item_card_id || 0, - use_game_pass: paymentData.use_game_pass || false + coupon_id: paymentData.coupon?.id ? Number(paymentData.coupon.id) : 0, + item_card_id: paymentData.card?.id ? Number(paymentData.card.id) : 0, + use_game_pass: paymentData.useGamePass || false } console.log('[Yifanshang] Calling join with:', joinData) diff --git a/pages-user/tasks/index.vue b/pages-user/tasks/index.vue index bc2330c..270a7db 100644 --- a/pages-user/tasks/index.vue +++ b/pages-user/tasks/index.vue @@ -136,7 +136,7 @@ const isRefreshing = ref(false) const expandedTasks = reactive({}) const claiming = reactive({}) -// 用户进度 (汇总) +// 用户进度 (汇总 - 用于顶部统计卡片显示) const userProgress = reactive({ orderCount: 0, orderAmount: 0, @@ -145,6 +145,9 @@ const userProgress = reactive({ claimedTiers: {} // { taskId: [tierId1, tierId2] } }) +// BUG修复:每个任务独立存储进度数据 +const taskProgress = reactive({}) // { taskId: { orderCount, orderAmount, inviteCount, firstOrder } } + // 获取用户ID function getUserId() { return uni.getStorageSync('user_id') @@ -294,21 +297,24 @@ function isTierClaimed(taskId, tierId) { return claimed.includes(tierId) } -// 是否可领取 +// 是否可领取 - BUG修复:使用任务独立的进度数据 function isTierClaimable(task, tier) { const metric = tier.metric || '' const threshold = tier.threshold || 0 const operator = tier.operator || '>=' + // 获取该任务独立的进度数据 + const progress = taskProgress[task.id] || {} + let current = 0 if (metric === 'first_order') { - return userProgress.firstOrder + return progress.firstOrder || false } else if (metric === 'order_count') { - current = userProgress.orderCount || 0 + current = progress.orderCount || 0 } else if (metric === 'order_amount') { - current = userProgress.orderAmount || 0 + current = progress.orderAmount || 0 } else if (metric === 'invite_count') { - current = userProgress.inviteCount || 0 + current = progress.inviteCount || 0 } if (operator === '>=') return current >= threshold @@ -317,21 +323,24 @@ function isTierClaimable(task, tier) { return current >= threshold } -// 获取进度文字 +// 获取进度文字 - BUG修复:使用任务独立的进度数据 function getTierProgressText(task, tier) { const metric = tier.metric || '' const threshold = tier.threshold || 0 + // 获取该任务独立的进度数据 + const progress = taskProgress[task.id] || {} + let current = 0 if (metric === 'first_order') { - return userProgress.firstOrder ? '已完成' : '未完成' + return progress.firstOrder ? '已完成' : '未完成' } else if (metric === 'order_count') { - current = userProgress.orderCount || 0 + current = progress.orderCount || 0 } else if (metric === 'order_amount') { - current = userProgress.orderAmount || 0 + current = progress.orderAmount || 0 return `¥${current / 100}/¥${threshold / 100}` } else if (metric === 'invite_count') { - current = userProgress.inviteCount || 0 + current = progress.inviteCount || 0 } return `${current}/${threshold}` @@ -412,7 +421,15 @@ async function fetchData() { const p = result.value const taskId = list[index].id - // 聚合进度指标 (取各任务返回的最大值) + // BUG修复:每个任务独立存储进度数据 + taskProgress[taskId] = { + orderCount: p.order_count || 0, + orderAmount: p.order_amount || 0, + inviteCount: p.invite_count || 0, + firstOrder: p.first_order || false + } + + // 聚合进度指标 (取各任务返回的最大值 - 仅用于顶部统计卡片显示) userProgress.orderCount = Math.max(userProgress.orderCount, p.order_count || 0) userProgress.orderAmount = Math.max(userProgress.orderAmount, p.order_amount || 0) userProgress.inviteCount = Math.max(userProgress.inviteCount, p.invite_count || 0)