From 9e643b6319464dc5e6fd609d6788ce8b829596f2 Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Thu, 1 Jan 2026 11:48:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=87=91=E5=B8=81=E6=B6=88=E8=80=97):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=87=91=E5=B8=81=E6=B6=88=E8=80=97=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=EF=BC=8C=E4=BC=98=E5=85=88=E6=B6=88=E8=80=97=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=87=91=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改金币消耗逻辑,将任务金币的消耗优先级提高到免费金币之前,以符合业务需求 --- src/views/consume/gold/addCoinConsume.vue | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/views/consume/gold/addCoinConsume.vue b/src/views/consume/gold/addCoinConsume.vue index 09f897f..7e184bd 100644 --- a/src/views/consume/gold/addCoinConsume.vue +++ b/src/views/consume/gold/addCoinConsume.vue @@ -234,23 +234,25 @@ function calculateCoins(sumGold) { let remaining = parsedSumGold; let freeUsed = 0, permanentUsed = 0, taskUsed = 0; - // 优先消耗免费金币 - if (nowFreeGold > 0) { + // 先消耗任务金币 + if (remaining > 0 && nowTaskGold > 0) { + const availableTaskGold = parseFloat(nowTaskGold.toFixed(4)); + taskUsed = Math.min(availableTaskGold, remaining); + remaining = parseFloat((remaining - taskUsed).toFixed(4)); + } + + // 再消耗免费金币 + if (remaining > 0 && nowFreeGold > 0) { freeUsed = Math.min(parseFloat(nowFreeGold.toFixed(4)), remaining); remaining = parseFloat((remaining - freeUsed).toFixed(4)); } - // 其次消耗永久金币 + // 最后消耗永久金币 if (remaining > 0 && nowPermanentGold > 0) { permanentUsed = Math.min(parseFloat(nowPermanentGold.toFixed(4)), remaining); remaining = parseFloat((remaining - permanentUsed).toFixed(4)); } - // 最后消耗任务金币 - if (remaining > 0 && nowTaskGold > 0) { - taskUsed = parseFloat(remaining.toFixed(4)); - } - // 更新金币值 addConsume.value.freeGold = freeUsed; addConsume.value.permanentGold = permanentUsed; @@ -1087,4 +1089,4 @@ p { } } } - \ No newline at end of file +