diff --git a/src/components/PriceInputPopup.vue b/src/components/PriceInputPopup.vue index 116ee4f..9160573 100644 --- a/src/components/PriceInputPopup.vue +++ b/src/components/PriceInputPopup.vue @@ -10,7 +10,7 @@
-
diff --git a/src/pages/agent.vue b/src/pages/agent.vue index aa9cc8d..a6d9415 100644 --- a/src/pages/agent.vue +++ b/src/pages/agent.vue @@ -51,6 +51,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 @@ -72,7 +73,7 @@ const getData = async () => { if (res.code === 200) { data.value = res.data } - } catch {} + } catch { } } onBeforeMount(() => { @@ -195,6 +196,9 @@ function toWithdrawDetails() { 活跃下级奖励 + + ¥ {{ (data?.active_reward?.total_reward || 0).toFixed(2) }} + @@ -209,37 +213,44 @@ function toWithdrawDetails() { + + + {{ teamTimeText }}奖励 + + ¥ {{ (currentTeamData.active_reward || 0).toFixed(2) }} + {{ teamTimeText }}下级推广奖励 - ¥ {{ (currentTeamData.sub_promote_reward || 0).toFixed(2) }} + ¥ {{ (currentTeamData.sub_promote_reward || + 0).toFixed(2) }} {{ teamTimeText }}下级转化奖励 - ¥ {{ (currentTeamData.sub_upgrade_reward || 0).toFixed(2) }} + ¥ {{ (currentTeamData.sub_upgrade_reward || + 0).toFixed(2) }} {{ teamTimeText }}下级提现奖励 - ¥ {{ (currentTeamData.sub_withdraw_reward || 0).toFixed(2) }} + ¥ {{ (currentTeamData.sub_withdraw_reward || + 0).toFixed(2) }} + @click="goToRewardsDetail"> 查看奖励明细 + @tap="toSubordinateList"> 查看我的下级 @@ -247,11 +258,7 @@ function toWithdrawDetails() { - + diff --git a/src/pages/agentVipConfig.vue b/src/pages/agentVipConfig.vue index d356530..97970a5 100644 --- a/src/pages/agentVipConfig.vue +++ b/src/pages/agentVipConfig.vue @@ -44,9 +44,14 @@ - - + + + + + + + 提示:最大加价金额为{{ priceIncreaseAmountMax }}元 @@ -61,9 +66,14 @@ - - + + + + + + + 提示:定价区间最低金额不能低于(基础最低 {{ productConfigData?.price_range_min || 0 }}元 + 加价金额) @@ -71,9 +81,14 @@ - - + + + + + + + 提示:定价区间最高金额不能超过上限({{ productConfigData?.price_range_max || 0 }}元)和大于定价区间最低金额({{ @@ -83,8 +98,14 @@ - - + + + + + + % + 提示:最大收取比例为{{ priceRatioMax }}% @@ -357,7 +378,8 @@ const loadReportOptions = async () => { if (res.code !== 200 || !res.data) return const list = res.data.agent_product_config || res.data.AgentProductConfig || [] - reportOptions.value = list + reportOptions.value = [...list] + .sort((a, b) => Number(a.product_id) - Number(b.product_id)) .map(p => ({ label: p.product_name || `报告${p.product_id}`, value: p.product_id, @@ -367,7 +389,7 @@ const loadReportOptions = async () => { if (!reportOptions.value.find(o => o.value === selectedReportId.value)) selectedReportId.value = reportOptions.value[0].value } - } catch {} + } catch { } } onMounted(async () => { @@ -377,7 +399,7 @@ onMounted(async () => { }) - { "layout": "page", diff --git a/src/pages/promote.vue b/src/pages/promote.vue index 587aa0c..b6115f4 100644 --- a/src/pages/promote.vue +++ b/src/pages/promote.vue @@ -95,7 +95,8 @@ const formData = ref({ const reportTypes = 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), } }