Merge branch 'main' of git.kaiyuancloud.cn:yumoqing/platformbiz

This commit is contained in:
yumoqing 2025-02-25 21:06:03 +08:00
commit ad49b667f8
10 changed files with 192 additions and 13 deletions

View File

@ -7,6 +7,17 @@
},
"editexclouded": [
"id", "agreeid"
]
],
"subtables":[
{
"field":"agreedetailid",
"title":"协议产品",
"params":{
"agreeid":"${agreeid}",
"prodtypeid":"${prodtypeid}"
},
"subtable":"agreeproduct"
}
]
}
}

View File

@ -1,12 +1,13 @@
{
"tblname":"agreeproduct",
"params":{
"logined_userorgid":"orgid",
"browserfields": {
"exclouded": ["id"],
"exclouded": ["id", "agreedetailid", "resellerpid"],
"alters": {}
},
"editexclouded": [
"id"
"id", "agreedetailid", "resellerpid"
]
}
}

22
json/choose_prodtype.json Normal file
View File

@ -0,0 +1,22 @@
{
"treetype":"singlestruct",
"tblname":"prodtype",
"uitype":"tree",
"alias":"choose_prodtype",
"params":{
"idField":"id",
"textField":"name",
"editable":true,
"browserfields":{
"alters":{}
},
"edit_exclouded_fields":["del_flg", "create_at"],
"checkField":"dd",
"parentField":"parentid",
"toolbar":{
},
"binds":[
]
}
}

20
json/prodpricing.json Normal file
View File

@ -0,0 +1,20 @@
{
"tblname":"prodpricing",
"params":{
"browserfields": {
"exclouded": ["id", "prodid" ],
"alters": {
}
},
"editexclouded": [
"id", "prodid"
],
"subtables":[
{
"field":"prodpricingid",
"subtable":"prodpricingtab",
"title":"产品定价表"
}
]
}
}

15
json/prodtypespec.json Normal file
View File

@ -0,0 +1,15 @@
{
"tblname":"prodtypespec",
"params":{
"browserfields": {
"exclouded": ["id", "prodtypeid"],
"alters": {}
},
"data_params":{
"prodtypeid":"${params_kw.id}"
},
"editexclouded": [
"id", "prodtypeid"
]
}
}

View File

@ -16,7 +16,7 @@
"params":{
"prodtypeid":"${prodtypeid}"
},
"subtable":"prodpricingtab",
"subtable":"prodpricing",
"title":"产品定价"
}
]

35
json/provide_agree.json Normal file
View File

@ -0,0 +1,35 @@
{
"tblname":"agreement",
"alias":"provide_agree",
"params":{
"title":"供应协议",
"logined_userorgid":"resellerid",
"browserfields": {
"exclouded": ["id", "resellerid" ],
"alters": {
"providerid":{
"uitype":"search",
"search_event":"row_selected",
"search_url":"{{entire_url('../select_org')}}",
"valueField":"id",
"textField":"orgname"
}
}
},
"subtables":[
{
"title":"协议明细",
"subtable":"agreedetail",
"field":"agreeid"
},
{
"title":"协议产品",
"subtable":"agreeproduct",
"field":"agreeid"
}
],
"editexclouded": [
"id", "resellerid"
]
}
}

20
json/providing_agree.json Normal file
View File

@ -0,0 +1,20 @@
{
"tblname":"agreement",
"params":{
"browserfields": {
"exclouded": ["id"],
"alters": {
"resellerid":{
"uitype":"search",
"search_event":"row_selected",
"search_url":"{{entire_url('../select_org')}}",
"valueField":"id",
"textField":"orgname"
}
}
},
"editexclouded": [
"id"
]
}
}

25
json/retail_agree.json Normal file
View File

@ -0,0 +1,25 @@
{
"tblname":"agreement",
"alias":"retail_agree",
"params":{
"title":"分销协议",
"sortby":"name",
"logined_userorgid":"providerid",
"logined_userid":"provideruid",
"browserfields": {
"exclouded": ["id", "providerid", "provideruid" ],
"alters": {
"resellerid":{
"uitype":"search",
"search_event":"row_selected",
"search_url":"{{entire_url('../select_org')}}",
"valueField":"id",
"textField":"orgname"
}
}
},
"editexclouded": [
"id", "providerid", "provideruid"
]
}
}

View File

@ -117,19 +117,49 @@ where a.agreeid = b.id
raise e
return rec
async def get_fact_price(sor, productid, fact_config):
sql = "select * from prodpricingtab where prodid=${productid}$"
recs = await sor.sqlExe(sql, {'productid':productid})
async def get_unit_value_price(sc, pricingtab):
for pt in pricingtab:
if sc.spec_name == pt.specname and pt.spec_value == pt.specvalue:
return pt.unit_value, pt.unit_amt
return None, None
async def get_fact_price(sor, productid, spec_config):
"""fact_config:
[
{
spec_name, spec_value, count
}
]
"""
biz_date = await get_business_date(sor)
sql = """select c.*,
e.name as specname
from product a, prodpricing b,
prodpricingtab c, prodtype d,
prodtypespec e
where a.id=${productid}$
and a.protypeid = d.id
and e.protypeid = d.id
and a.id = b.prodid
and b.enable_date <= ${biz_date}$
and b.expire_date > ${biz_date}$
and c.prodpricingid = b.id
and c.protypespecid = e.id
"""
recs = await sor.sqlExe(sql, {'productid':productid,
'biz_date':biz_date})
if len(recs) < 1:
e = Exception(f'{sql=}, {productid=} return not data')
e = Exception(f'{sql=}, {productid=} {biz_date=} return not data')
exception(f'{e=}')
raise e
price = 0.0
for r in recs:
if r.fact_value is None or r.fact_value == 0:
r.fact_value = 1
count = fact_config.get(r.fact_name, 0)
price += r.unit_amt * count / r.fact_value
for sc in spec_config:
uv, up = get_unit_value_price(sc, recs)
if uv is None:
continue
cnt = sc.count / uv
price = up * cnt
return price
async def get_sell_price(sor, sellerid, buyerid, productid, list_price):