fix(distribution): 分成改为分主站提价利润,分站自主提价溢价全额归卖方
- 文档:升级至 v0.7,固化号主保底、主站提价利润分账(35/40/25)与分站加价溢价独享逻辑 - 定价:修正货架兑换比例调价方向为调减比例提价(site_ratio = base_ratio - delta) - 分账:分成基数剔除号主成本与分站加价,提价利润按规则切分,分站自主加价溢价 100% 归卖出方 - 前端:更新分销后台提价说明文案,提示调减比例提高售价且溢价归本站
This commit is contained in:
@@ -701,7 +701,7 @@ func TestListPublicWithDistributionSiteCode(t *testing.T) {
|
||||
site := model.DistributionSite{SiteCode: "site_alpha", SiteName: "分销A", Domain: "a.com", Status: "active", DisplayAccountEnabled: true}
|
||||
db.Create(&site)
|
||||
|
||||
dsa := model.DistributionSiteAccount{SiteID: site.ID, AccountID: account1.ID, ListingID: l1.ID, DisplayStatus: "enabled", ShelfRatioDelta: 25}
|
||||
dsa := model.DistributionSiteAccount{SiteID: site.ID, AccountID: account1.ID, ListingID: l1.ID, DisplayStatus: "enabled", ShelfRatioDelta: 20}
|
||||
db.Create(&dsa)
|
||||
|
||||
res, err := repo.ListPublic(context.Background(), PublicListQuery{
|
||||
@@ -713,16 +713,17 @@ func TestListPublicWithDistributionSiteCode(t *testing.T) {
|
||||
if len(res.Items) != 1 || res.Items[0].ListingNo != "L101" {
|
||||
t.Fatalf("expected only L101, got %+v", res.Items)
|
||||
}
|
||||
if res.Items[0].PriceCent != 8000 {
|
||||
t.Fatalf("expected public price 8000 with ratio delta, got %d", res.Items[0].PriceCent)
|
||||
// 主站 100 元 (10000 分,100 比例);分站提价减 20 比例 (80 比例) → 售价 125 元 (12500 分)
|
||||
if res.Items[0].PriceCent != 12500 {
|
||||
t.Fatalf("expected public price 12500 with ratio delta, got %d", res.Items[0].PriceCent)
|
||||
}
|
||||
|
||||
detail, err := repo.FindPublic(context.Background(), l1.ID, "site_alpha")
|
||||
if err != nil {
|
||||
t.Fatalf("FindPublic err: %v", err)
|
||||
}
|
||||
if detail.PriceCent != 8000 {
|
||||
t.Fatalf("expected detail price 8000 with ratio delta, got %d", detail.PriceCent)
|
||||
if detail.PriceCent != 12500 {
|
||||
t.Fatalf("expected detail price 12500 with ratio delta, got %d", detail.PriceCent)
|
||||
}
|
||||
mainDetail, err := repo.FindPublic(context.Background(), l1.ID, "")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user