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