feat: 客户归属支持多分销商 + 阶梯折扣表

discount_customer_bind:
- UNIQUE(customerid) → UNIQUE(customerid, resellerid)
  一个客户可绑定多个分销商
- bind_type: 加 3=域名注册
- 索引重命名: idx_dcb_customer → idx_dcb_customer_reseller

reseller_discount_tier (新增):
- 分销商阶梯折扣: name, min_amount, max_amount, discount_pct
- 按累计消费自动匹配档位
This commit is contained in:
yumoqing 2026-06-30 15:45:15 +08:00
parent 9d4c83a25f
commit 53eaa966ae
3 changed files with 144 additions and 5 deletions

View File

@ -0,0 +1,26 @@
{
"tblname": "reseller_discount_tier",
"title": "阶梯折扣管理",
"params": {
"sortby": "sort_order asc",
"logined_userorgid": "resellerid",
"browserfields": {
"exclouded": ["id"],
"alters": {
"status": {
"uitype": "code",
"data": [
{"value": "active", "text": "启用"},
{"value": "inactive", "text": "停用"}
]
}
}
},
"editexclouded": ["id", "created_at", "updated_at"],
"editable": {
"new_data_url": "{{entire_url('../api/reseller_discount_tier_create.dspy')}}",
"update_data_url": "{{entire_url('../api/reseller_discount_tier_update.dspy')}}",
"delete_data_url": "{{entire_url('../api/reseller_discount_tier_delete.dspy')}}"
}
}
}

View File

@ -24,7 +24,7 @@
},
{
"name": "resellerid",
"title": "归属机构id",
"title": "归属分销商机构id",
"type": "str",
"length": 32,
"nullable": "no"
@ -38,13 +38,13 @@
},
{
"name": "promo_code_id",
"title": "促销码id(可空=手动分配)",
"title": "促销码id(空=非促销码方式)",
"type": "str",
"length": 32
},
{
"name": "bind_type",
"title": "绑定方式(1=促销码 2=手动分配)",
"title": "绑定方式(1=促销码 2=手动 3=域名注册)",
"type": "char",
"length": 1,
"default": "1",
@ -59,9 +59,9 @@
],
"indexes": [
{
"name": "idx_dcb_customer",
"name": "idx_dcb_customer_reseller",
"idxtype": "unique",
"idxfields": ["customerid"]
"idxfields": ["customerid", "resellerid"]
},
{
"name": "idx_dcb_reseller",

View File

@ -0,0 +1,113 @@
{
"summary": [
{
"name": "reseller_discount_tier",
"title": "分销商阶梯折扣",
"primary": ["id"],
"catelog": "entity"
}
],
"fields": [
{
"name": "id",
"title": "主键ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "resellerid",
"title": "分销商机构ID",
"type": "str",
"length": 32,
"nullable": "no"
},
{
"name": "name",
"title": "档位名称",
"type": "str",
"length": 50,
"nullable": "no"
},
{
"name": "min_amount",
"title": "最低消费金额",
"type": "float",
"length": 18,
"dec": 2,
"nullable": "no",
"default": "0.00"
},
{
"name": "max_amount",
"title": "最高消费金额(NULL=无上限)",
"type": "float",
"length": 18,
"dec": 2,
"nullable": "yes"
},
{
"name": "discount_pct",
"title": "折扣百分比",
"type": "float",
"length": 5,
"dec": 2,
"nullable": "no"
},
{
"name": "sort_order",
"title": "排序",
"type": "int",
"length": 4,
"nullable": "no",
"default": "0"
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 10,
"nullable": "no",
"default": "active"
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp",
"nullable": "no"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp",
"nullable": "no"
}
],
"indexes": [
{
"name": "idx_rdt_reseller_order",
"idxtype": "index",
"idxfields": ["resellerid", "sort_order"]
},
{
"name": "idx_rdt_amount",
"idxtype": "index",
"idxfields": ["resellerid", "min_amount"]
}
],
"codes": [
{
"field": "resellerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "status",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='discount_tier_status'"
}
]
}