fix(distribution): 分成改为分主站提价利润,分站自主提价溢价全额归卖方
- 文档:升级至 v0.7,固化号主保底、主站提价利润分账(35/40/25)与分站加价溢价独享逻辑 - 定价:修正货架兑换比例调价方向为调减比例提价(site_ratio = base_ratio - delta) - 分账:分成基数剔除号主成本与分站加价,提价利润按规则切分,分站自主加价溢价 100% 归卖出方 - 前端:更新分销后台提价说明文案,提示调减比例提高售价且溢价归本站
This commit is contained in:
@@ -75,7 +75,7 @@ func TestCalculateSettlementRejectsRefundOverPayment(t *testing.T) {
|
||||
|
||||
func TestSplitSettlementTwoPartyDistributorReceive(t *testing.T) {
|
||||
rule := Rule{Mode: ModeTwoPartyDistributorReceive, DistributorReceiveRatio: 35, PlatformSellRatio: 40}
|
||||
splits := SplitSettlement(rule, 3950)
|
||||
splits := SplitSettlement(rule, 3950, 0)
|
||||
if len(splits) != 2 {
|
||||
t.Fatalf("splits = %#v", splits)
|
||||
}
|
||||
@@ -85,26 +85,34 @@ func TestSplitSettlementTwoPartyDistributorReceive(t *testing.T) {
|
||||
if splits[1].PartyRole != "platform_sell" || splits[1].AmountCent != 1580 {
|
||||
t.Fatalf("platform split = %#v", splits[1])
|
||||
}
|
||||
if got := SplitRoundingCent(3950, 988, splits); got != -1 {
|
||||
if got := SplitRoundingCent(3950, 988, 0, splits); got != -1 {
|
||||
t.Fatalf("rounding = %d, want -1", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitSettlementDoesNotAddYuanMarkup(t *testing.T) {
|
||||
func TestSplitSettlementAddsShelfMarkupDirectlyToSeller(t *testing.T) {
|
||||
rule := Rule{Mode: ModeTwoPartyPlatformReceive, DistributorSellRatio: 40, PlatformReceiveRatio: 35}
|
||||
splits := SplitSettlement(rule, 10000)
|
||||
if splits[0].PartyRole != "distributor_sell" || splits[0].AmountCent != 4000 {
|
||||
t.Fatalf("distributor sell = %#v", splits[0])
|
||||
// 提价利润 10000 分,分站自主加价 2000 分
|
||||
splits := SplitSettlement(rule, 10000, 2000)
|
||||
// 卖方分站获得 40% (4000) + 2000 (加价) = 6000
|
||||
if splits[0].PartyRole != "distributor_sell" || splits[0].AmountCent != 6000 {
|
||||
t.Fatalf("distributor sell = %#v, want 6000", splits[0])
|
||||
}
|
||||
// 收号方获得 35% = 3500
|
||||
if splits[1].AmountCent != 3500 {
|
||||
t.Fatalf("platform receive = %#v", splits[1])
|
||||
t.Fatalf("platform receive = %#v, want 3500", splits[1])
|
||||
}
|
||||
// 尾差校验:平台服务费 2500,提价利润 10000 - (3500 + 4000) - 2500 = 0
|
||||
if got := SplitRoundingCent(10000, 2500, 2000, splits); got != 0 {
|
||||
t.Fatalf("rounding = %d, want 0", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitSettlementThreeParty(t *testing.T) {
|
||||
rule := Rule{Mode: ModeThreeParty, DistributorARatio: 35, DistributorBRatio: 40}
|
||||
splits := SplitSettlement(rule, 10000)
|
||||
if len(splits) != 2 || splits[0].AmountCent != 3500 || splits[1].AmountCent != 4000 {
|
||||
// 提价利润 10000,分站B自主加价 1500
|
||||
splits := SplitSettlement(rule, 10000, 1500)
|
||||
if len(splits) != 2 || splits[0].AmountCent != 3500 || splits[1].AmountCent != 5500 {
|
||||
t.Fatalf("splits = %#v", splits)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user