套餐系列:梯度佣金,代理授权
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m47s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m47s
This commit is contained in:
@@ -15,6 +15,7 @@ export interface OneTimeCommissionTier {
|
||||
dimension: 'sales_count' | 'sales_amount' // 统计维度:销量或销售额
|
||||
amount: number // 佣金金额(分)
|
||||
stat_scope?: 'self' | 'self_and_sub' // 统计范围:仅自己或自己+下级
|
||||
operator?: '>=' | '>' | '<=' | '<' // 阈值比较运算符,空值时计算引擎默认 >=
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,9 +207,11 @@ export interface SeriesSelectOption {
|
||||
* 佣金梯度配置
|
||||
*/
|
||||
export interface CommissionTier {
|
||||
operator: '>=' // 运算符
|
||||
operator?: '>=' | '>' | '<=' | '<' // 阈值比较运算符,空值时计算引擎默认 >=
|
||||
threshold: number // 阈值
|
||||
amount: number // 佣金金额(分)
|
||||
dimension?: 'sales_count' | 'sales_amount' // 统计维度 (sales_count:销量, sales_amount:销售额)
|
||||
stat_scope?: 'self' | 'self_and_sub' // 统计范围 (self:仅自己, self_and_sub:自己+下级)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,12 +131,13 @@
|
||||
: tier.threshold
|
||||
const amountText = `¥${(tier.amount / 100).toFixed(2)}`
|
||||
const scopeText = tier.stat_scope === 'self' ? '仅自己' : '自己+下级'
|
||||
const operatorText = tier.operator || '>='
|
||||
|
||||
return h(
|
||||
ElTag,
|
||||
{ type: 'info', size: 'default' },
|
||||
() =>
|
||||
`档位${index + 1}: ${dimensionText} ≥ ${thresholdText}, 佣金 ${amountText}, ${scopeText}`
|
||||
`档位${index + 1}: ${dimensionText} ${operatorText} ${thresholdText}, 佣金 ${amountText}, ${scopeText}`
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
@@ -165,8 +165,28 @@
|
||||
<ElCard shadow="hover">
|
||||
<div style="display: flex; gap: 12px; align-items: flex-start">
|
||||
<div style="flex: 1; display: flex; flex-direction: column; gap: 12px">
|
||||
<!-- 第一行:阈值和维度 -->
|
||||
<!-- 第一行:比较运算符和阈值 -->
|
||||
<div style="display: flex; gap: 12px">
|
||||
<div style="flex: 1">
|
||||
<div
|
||||
style="
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
"
|
||||
>比较运算符</div
|
||||
>
|
||||
<ElSelect
|
||||
v-model="tier.operator"
|
||||
placeholder="比较运算符"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption label=">=" value=">=" />
|
||||
<ElOption label=">" value=">" />
|
||||
<ElOption label="<=" value="<=" />
|
||||
<ElOption label="<" value="<" />
|
||||
</ElSelect>
|
||||
</div>
|
||||
<div style="flex: 1">
|
||||
<div
|
||||
style="
|
||||
@@ -189,6 +209,9 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 第二行:统计维度和统计范围 -->
|
||||
<div style="display: flex; gap: 12px">
|
||||
<div style="flex: 1">
|
||||
<div
|
||||
style="
|
||||
@@ -207,26 +230,6 @@
|
||||
<ElOption label="销售额" value="sales_amount" />
|
||||
</ElSelect>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 第二行:佣金金额和统计范围 -->
|
||||
<div style="display: flex; gap: 12px">
|
||||
<div style="flex: 1">
|
||||
<div
|
||||
style="
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
"
|
||||
>佣金金额(元)</div
|
||||
>
|
||||
<ElInputNumber
|
||||
v-model="tier.amount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="佣金金额"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<div style="flex: 1">
|
||||
<div
|
||||
style="
|
||||
@@ -246,6 +249,26 @@
|
||||
</ElSelect>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 第三行:佣金金额 -->
|
||||
<div style="display: flex; gap: 12px">
|
||||
<div style="flex: 1">
|
||||
<div
|
||||
style="
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
"
|
||||
>佣金金额(元)</div
|
||||
>
|
||||
<ElInputNumber
|
||||
v-model="tier.amount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="佣金金额"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ElButton
|
||||
type="danger"
|
||||
@@ -1065,6 +1088,7 @@
|
||||
// 添加梯度
|
||||
const addTier = () => {
|
||||
form.one_time_commission_config.tiers.push({
|
||||
operator: '>=',
|
||||
threshold: undefined,
|
||||
dimension: 'sales_count',
|
||||
amount: undefined,
|
||||
|
||||
@@ -170,6 +170,11 @@
|
||||
<template v-if="form.commission_type === 'tiered'">
|
||||
<ElFormItem label="梯度配置" prop="commission_tiers">
|
||||
<ElTable :data="form.commission_tiers" border style="width: 100%">
|
||||
<ElTableColumn label="比较运算符" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElTag size="small" type="success">{{ row.operator || '>=' }}</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="达标阈值" width="120">
|
||||
<template #default="{ row }">
|
||||
<span class="readonly-value">{{ row.threshold }}</span>
|
||||
@@ -504,6 +509,7 @@
|
||||
one_time_commission_amount: 0, // 固定佣金金额(元)
|
||||
series_max_commission_amount: 0, // 系列最大佣金金额(元)
|
||||
commission_tiers: [] as Array<{
|
||||
operator?: '>=' | '>' | '<=' | '<' // 比较运算符
|
||||
threshold: number // 达标阈值
|
||||
dimension: 'sales_count' | 'sales_amount' // 统计维度
|
||||
stat_scope?: 'self' | 'self_and_sub' // 统计范围
|
||||
@@ -848,6 +854,7 @@
|
||||
// 梯度配置从系列继承,包含完整字段,佣金金额也默认继承
|
||||
if (commissionConfig.tiers && commissionConfig.tiers.length > 0) {
|
||||
form.commission_tiers = commissionConfig.tiers.map((tier) => ({
|
||||
operator: tier.operator || '>=', // 比较运算符(只读)
|
||||
threshold: tier.threshold, // 达标阈值(只读)
|
||||
dimension: tier.dimension, // 统计维度(只读)
|
||||
stat_scope: tier.stat_scope, // 统计范围(只读)
|
||||
@@ -1153,6 +1160,7 @@
|
||||
form.commission_tiers = detail.commission_tiers.map((tier, index) => {
|
||||
const seriesTier = seriesTiers[index]
|
||||
return {
|
||||
operator: tier.operator || seriesTier?.operator || '>=', // 比较运算符(只读,优先使用授权的,否则从系列获取)
|
||||
threshold: tier.threshold, // 达标阈值(只读)
|
||||
dimension: seriesTier?.dimension || 'sales_count', // 统计维度(只读,从系列获取)
|
||||
stat_scope: seriesTier?.stat_scope, // 统计范围(只读,从系列获取)
|
||||
|
||||
Reference in New Issue
Block a user