From 0d0bf8f81e912f83aaae01fa10841353ab4a3172 Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Tue, 28 Apr 2026 16:37:10 +0800 Subject: [PATCH] f --- src/pages/agent-vip-config.vue | 3 ++- src/pages/agent.vue | 24 ++++++++++++++++++++---- src/pages/promote.vue | 3 ++- src/utils/promotionPricing.js | 18 +++++++++++++++--- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/pages/agent-vip-config.vue b/src/pages/agent-vip-config.vue index 046d0d9..4903db3 100644 --- a/src/pages/agent-vip-config.vue +++ b/src/pages/agent-vip-config.vue @@ -352,7 +352,8 @@ async function loadReportOptions() { return } const list = data.value?.data?.AgentProductConfig || data.value?.data?.agent_product_config || [] - reportOptions.value = list + reportOptions.value = [...list] + .sort((a, b) => Number(a.product_id) - Number(b.product_id)) .map(item => ({ label: item.product_name || `报告${item.product_id}`, value: item.product_id, diff --git a/src/pages/agent.vue b/src/pages/agent.vue index b8c224e..d691ce3 100644 --- a/src/pages/agent.vue +++ b/src/pages/agent.vue @@ -41,6 +41,7 @@ const currentPromoteData = computed(() => { const currentTeamData = computed(() => { const range = dateRangeMap[selectedTeamDate.value] return data.value?.active_reward?.[range] || { + active_reward: 0, sub_promote_reward: 0, sub_upgrade_reward: 0, sub_withdraw_reward: 0, @@ -178,10 +179,17 @@ function toSubordinateList() { - - - 活跃下级奖励 - + + + + 活跃下级奖励 + + + + + ¥ {{ (data?.active_reward?.total_reward || 0).toFixed(2) }} + + @@ -197,6 +205,14 @@ function toSubordinateList() { + + + {{ teamTimeText }}奖励 + + + ¥ {{ (currentTeamData.active_reward || 0).toFixed(2) }} + + {{ teamTimeText }}下级推广奖励 diff --git a/src/pages/promote.vue b/src/pages/promote.vue index cb69363..9511459 100644 --- a/src/pages/promote.vue +++ b/src/pages/promote.vue @@ -22,7 +22,8 @@ const formData = ref({ const availableReportTypes = computed(() => { if (!productConfig.value?.length) return [] - return productConfig.value + return [...productConfig.value] + .sort((a, b) => Number(a.product_id) - Number(b.product_id)) .map(item => ({ id: item.product_id, label: item.product_name || `产品${item.product_id}`, diff --git a/src/utils/promotionPricing.js b/src/utils/promotionPricing.js index 523ada8..979a8bd 100644 --- a/src/utils/promotionPricing.js +++ b/src/utils/promotionPricing.js @@ -7,6 +7,16 @@ export function safeTruncate(num, decimals = 2) { return (scaled / factor).toFixed(decimals) } +function toTruncatedCents(num) { + if (Number.isNaN(num) || !Number.isFinite(num)) + return 0 + return Math.trunc((num + Number.EPSILON) * 100) +} + +function centsToFixed(cents) { + return (cents / 100).toFixed(2) +} + function calculatePlatformOverpricingCost(price, config) { if (price <= config.p_pricing_standard) return 0 @@ -37,10 +47,12 @@ export function calculatePromotionPricing(priceInput, config) { const platformOverpricingCost = calculatePlatformOverpricingCost(price, config) const superiorOverpricingCost = calculateSuperiorOverpricingCost(price, config) const totalCost = baseCost + platformOverpricingCost + superiorOverpricingCost - const revenue = price - totalCost + const priceCents = toTruncatedCents(price) + const costCents = toTruncatedCents(totalCost) + const revenueCents = priceCents - costCents return { - costPrice: safeTruncate(totalCost), - promotionRevenue: safeTruncate(revenue), + costPrice: centsToFixed(costCents), + promotionRevenue: centsToFixed(revenueCents), } }