f
This commit is contained in:
@@ -352,7 +352,8 @@ async function loadReportOptions() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const list = data.value?.data?.AgentProductConfig || data.value?.data?.agent_product_config || []
|
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 => ({
|
.map(item => ({
|
||||||
label: item.product_name || `报告${item.product_id}`,
|
label: item.product_name || `报告${item.product_id}`,
|
||||||
value: item.product_id,
|
value: item.product_id,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const currentPromoteData = computed(() => {
|
|||||||
const currentTeamData = computed(() => {
|
const currentTeamData = computed(() => {
|
||||||
const range = dateRangeMap[selectedTeamDate.value]
|
const range = dateRangeMap[selectedTeamDate.value]
|
||||||
return data.value?.active_reward?.[range] || {
|
return data.value?.active_reward?.[range] || {
|
||||||
|
active_reward: 0,
|
||||||
sub_promote_reward: 0,
|
sub_promote_reward: 0,
|
||||||
sub_upgrade_reward: 0,
|
sub_upgrade_reward: 0,
|
||||||
sub_withdraw_reward: 0,
|
sub_withdraw_reward: 0,
|
||||||
@@ -178,10 +179,17 @@ function toSubordinateList() {
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="rounded-xl from-green-50/40 to-cyan-50/30 bg-gradient-to-r p-6 shadow-lg">
|
<view class="rounded-xl from-green-50/40 to-cyan-50/30 bg-gradient-to-r p-6 shadow-lg">
|
||||||
<view class="mb-4">
|
<view class="mb-4 flex items-center justify-between">
|
||||||
<text class="text-lg text-gray-800 font-bold">
|
<view>
|
||||||
活跃下级奖励
|
<text class="text-lg text-gray-800 font-bold">
|
||||||
</text>
|
活跃下级奖励
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="text-right">
|
||||||
|
<text class="text-2xl text-green-600 font-bold">
|
||||||
|
¥ {{ (data?.active_reward?.total_reward || 0).toFixed(2) }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="grid grid-cols-3 mb-6 gap-2">
|
<view class="grid grid-cols-3 mb-6 gap-2">
|
||||||
@@ -197,6 +205,14 @@ function toSubordinateList() {
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="grid grid-cols-2 mb-6 gap-2">
|
<view class="grid grid-cols-2 mb-6 gap-2">
|
||||||
|
<view class="rounded-lg bg-green-50/60 p-3 backdrop-blur-sm">
|
||||||
|
<view class="text-sm text-gray-500">
|
||||||
|
{{ teamTimeText }}奖励
|
||||||
|
</view>
|
||||||
|
<text class="mt-1 text-xl text-green-600 font-bold">
|
||||||
|
¥ {{ (currentTeamData.active_reward || 0).toFixed(2) }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
<view class="rounded-lg bg-green-50/60 p-3 backdrop-blur-sm">
|
<view class="rounded-lg bg-green-50/60 p-3 backdrop-blur-sm">
|
||||||
<view class="text-sm text-gray-500">
|
<view class="text-sm text-gray-500">
|
||||||
{{ teamTimeText }}下级推广奖励
|
{{ teamTimeText }}下级推广奖励
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ const formData = ref({
|
|||||||
const availableReportTypes = computed(() => {
|
const availableReportTypes = computed(() => {
|
||||||
if (!productConfig.value?.length)
|
if (!productConfig.value?.length)
|
||||||
return []
|
return []
|
||||||
return productConfig.value
|
return [...productConfig.value]
|
||||||
|
.sort((a, b) => Number(a.product_id) - Number(b.product_id))
|
||||||
.map(item => ({
|
.map(item => ({
|
||||||
id: item.product_id,
|
id: item.product_id,
|
||||||
label: item.product_name || `产品${item.product_id}`,
|
label: item.product_name || `产品${item.product_id}`,
|
||||||
|
|||||||
@@ -7,6 +7,16 @@ export function safeTruncate(num, decimals = 2) {
|
|||||||
return (scaled / factor).toFixed(decimals)
|
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) {
|
function calculatePlatformOverpricingCost(price, config) {
|
||||||
if (price <= config.p_pricing_standard)
|
if (price <= config.p_pricing_standard)
|
||||||
return 0
|
return 0
|
||||||
@@ -37,10 +47,12 @@ export function calculatePromotionPricing(priceInput, config) {
|
|||||||
const platformOverpricingCost = calculatePlatformOverpricingCost(price, config)
|
const platformOverpricingCost = calculatePlatformOverpricingCost(price, config)
|
||||||
const superiorOverpricingCost = calculateSuperiorOverpricingCost(price, config)
|
const superiorOverpricingCost = calculateSuperiorOverpricingCost(price, config)
|
||||||
const totalCost = baseCost + platformOverpricingCost + superiorOverpricingCost
|
const totalCost = baseCost + platformOverpricingCost + superiorOverpricingCost
|
||||||
const revenue = price - totalCost
|
const priceCents = toTruncatedCents(price)
|
||||||
|
const costCents = toTruncatedCents(totalCost)
|
||||||
|
const revenueCents = priceCents - costCents
|
||||||
|
|
||||||
return {
|
return {
|
||||||
costPrice: safeTruncate(totalCost),
|
costPrice: centsToFixed(costCents),
|
||||||
promotionRevenue: safeTruncate(revenue),
|
promotionRevenue: centsToFixed(revenueCents),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user