fix(star_discount): SQL 去掉不存在的 d.discount 列
discount 表无 discount 字段(值在 discount_detail 表)。原 select d.id, d.discount 导致 reseller 级通用折扣(customerid=NULL)查询永远报 Unknown column 错误, 被上层 try/except 兜住后 fallback 到 1.0,通用折扣形同虚设。
This commit is contained in:
parent
f9408e12e2
commit
a3d7077acc
@ -135,7 +135,7 @@ async def _discount_detail_exists(sor):
|
||||
|
||||
async def sor_get_star_discount(sor, resellerid, biz_date):
|
||||
"""Get default discount for a reseller (no specific customer)."""
|
||||
sql = """select d.id, d.discount from discount d
|
||||
sql = """select d.id from discount d
|
||||
where d.resellerid = ${resellerid}$
|
||||
and d.customerid is NULL
|
||||
and d.enabled_date <= ${biz_date}$
|
||||
|
||||
@ -1,40 +1,39 @@
|
||||
{
|
||||
"tblname": "discount",
|
||||
"alias": "discount_list",
|
||||
"title": "折扣管理",
|
||||
"params": {
|
||||
"sortby": [
|
||||
"enabled_date desc"
|
||||
],
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id",
|
||||
"resellerid"
|
||||
],
|
||||
"alters": {
|
||||
"customerid": {
|
||||
"uitype": "code",
|
||||
"dataurl": "{{entire_url('../api/get_customer_list.dspy')}}",
|
||||
"datamethod": "GET"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id",
|
||||
"resellerid"
|
||||
],
|
||||
"editable": {
|
||||
"new_data_url": "{{entire_url('../api/discount_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('../api/discount_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('../api/discount_delete.dspy')}}"
|
||||
},
|
||||
"logined_userorgid": "resellerid",
|
||||
"subtables": [
|
||||
{
|
||||
"field": "discountid",
|
||||
"title": "设置产品折扣",
|
||||
"subtable": "discount_setting"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"tblname": "discount",
|
||||
"title": "折扣管理",
|
||||
"params": {
|
||||
"sortby": [
|
||||
"enabled_date desc"
|
||||
],
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id",
|
||||
"resellerid"
|
||||
],
|
||||
"alters": {
|
||||
"customerid": {
|
||||
"uitype": "code",
|
||||
"dataurl": "{{entire_url('../api/get_customer_list.dspy')}}",
|
||||
"datamethod": "GET"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id",
|
||||
"resellerid"
|
||||
],
|
||||
"editable": {
|
||||
"new_data_url": "{{entire_url('../api/discount_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('../api/discount_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('../api/discount_delete.dspy')}}"
|
||||
},
|
||||
"logined_userorgid": "resellerid",
|
||||
"subtables": [
|
||||
{
|
||||
"field": "discountid",
|
||||
"title": "设置产品折扣",
|
||||
"subtable": "discount_setting"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,97 +1,96 @@
|
||||
{
|
||||
"tblname": "discount_marketing",
|
||||
"alias": "discount_marketing_list",
|
||||
"title": "营销方案",
|
||||
"params": {
|
||||
"browserfields": {
|
||||
"name": {
|
||||
"title": "方案名称"
|
||||
},
|
||||
"enabled_date": {
|
||||
"title": "启用日期",
|
||||
"width": 120
|
||||
},
|
||||
"expired_date": {
|
||||
"title": "失效日期",
|
||||
"width": 120
|
||||
},
|
||||
"status": {
|
||||
"title": "状态",
|
||||
"width": 80
|
||||
},
|
||||
"created_by": {
|
||||
"title": "创建人",
|
||||
"width": 120,
|
||||
"uitype": "code",
|
||||
"valueField": "created_by",
|
||||
"textField": "created_by_text",
|
||||
"params": {
|
||||
"dbname": "{{get_module_dbname('discount')}}",
|
||||
"table": "users",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "username",
|
||||
"valueField": "created_by",
|
||||
"textField": "created_by_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id",
|
||||
"resellerid",
|
||||
"created_by",
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"toolbar": {
|
||||
"tools": [
|
||||
{
|
||||
"name": "detail",
|
||||
"selected_row": true,
|
||||
"label": "产品明细",
|
||||
"icon": "{{entire_url('/bricks/imgs/list.svg')}}"
|
||||
},
|
||||
{
|
||||
"name": "gen_promo",
|
||||
"selected_row": true,
|
||||
"label": "生成促销码"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "detail",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "app.sage_main_content",
|
||||
"params_mapping": {
|
||||
"mapping": {
|
||||
"id": "discountid"
|
||||
},
|
||||
"need_other": false
|
||||
},
|
||||
"options": {
|
||||
"url": "{{entire_url('../marketing_discount_setting')}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "gen_promo",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "PopupWindow",
|
||||
"popup_options": {
|
||||
"title": "生成促销码",
|
||||
"cwidth": 16,
|
||||
"cheight": 10
|
||||
},
|
||||
"options": {
|
||||
"url": "{{entire_url('../api/gen_promo_from_mkt.dspy')}}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('/discount/api/marketing_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('/discount/api/marketing_delete.dspy')}}",
|
||||
"logined_userorgid": "resellerid"
|
||||
}
|
||||
"tblname": "discount_marketing",
|
||||
"title": "营销方案",
|
||||
"params": {
|
||||
"browserfields": {
|
||||
"name": {
|
||||
"title": "方案名称"
|
||||
},
|
||||
"enabled_date": {
|
||||
"title": "启用日期",
|
||||
"width": 120
|
||||
},
|
||||
"expired_date": {
|
||||
"title": "失效日期",
|
||||
"width": 120
|
||||
},
|
||||
"status": {
|
||||
"title": "状态",
|
||||
"width": 80
|
||||
},
|
||||
"created_by": {
|
||||
"title": "创建人",
|
||||
"width": 120,
|
||||
"uitype": "code",
|
||||
"valueField": "created_by",
|
||||
"textField": "created_by_text",
|
||||
"params": {
|
||||
"dbname": "{{get_module_dbname('discount')}}",
|
||||
"table": "users",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "username",
|
||||
"valueField": "created_by",
|
||||
"textField": "created_by_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id",
|
||||
"resellerid",
|
||||
"created_by",
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"toolbar": {
|
||||
"tools": [
|
||||
{
|
||||
"name": "detail",
|
||||
"selected_row": true,
|
||||
"label": "产品明细",
|
||||
"icon": "{{entire_url('/bricks/imgs/list.svg')}}"
|
||||
},
|
||||
{
|
||||
"name": "gen_promo",
|
||||
"selected_row": true,
|
||||
"label": "生成促销码"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "detail",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "app.sage_main_content",
|
||||
"params_mapping": {
|
||||
"mapping": {
|
||||
"id": "discountid"
|
||||
},
|
||||
"need_other": false
|
||||
},
|
||||
"options": {
|
||||
"url": "{{entire_url('../marketing_discount_setting')}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "gen_promo",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "PopupWindow",
|
||||
"popup_options": {
|
||||
"title": "生成促销码",
|
||||
"cwidth": 16,
|
||||
"cheight": 10
|
||||
},
|
||||
"options": {
|
||||
"url": "{{entire_url('../api/gen_promo_from_mkt.dspy')}}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('/discount/api/marketing_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('/discount/api/marketing_delete.dspy')}}",
|
||||
"logined_userorgid": "resellerid"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,80 +1,79 @@
|
||||
{
|
||||
"tblname": "discount_promo_code",
|
||||
"alias": "discount_promo_code_list",
|
||||
"title": "促销码",
|
||||
"params": {
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id"
|
||||
],
|
||||
"marketing_id": {
|
||||
"title": "营销方案",
|
||||
"width": 150
|
||||
},
|
||||
"code_type": {
|
||||
"title": "类型",
|
||||
"width": 80
|
||||
},
|
||||
"status": {
|
||||
"title": "状态",
|
||||
"width": 80
|
||||
},
|
||||
"sale_id": {
|
||||
"title": "生成销售",
|
||||
"width": 120,
|
||||
"uitype": "code",
|
||||
"valueField": "sale_id",
|
||||
"textField": "sale_id_text",
|
||||
"params": {
|
||||
"dbname": "{{get_module_dbname('discount')}}",
|
||||
"table": "users",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "username",
|
||||
"valueField": "sale_id",
|
||||
"textField": "sale_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
"created_at": {
|
||||
"title": "生成时间",
|
||||
"width": 160
|
||||
}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id",
|
||||
"resellerid",
|
||||
"sale_id",
|
||||
"created_at"
|
||||
],
|
||||
"toolbar": {
|
||||
"tools": [
|
||||
{
|
||||
"name": "generate_qr",
|
||||
"label": "生成二维码",
|
||||
"selected_row": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "generate_qr",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "PopupWindow",
|
||||
"popup_options": {
|
||||
"title": "促销码二维码",
|
||||
"cwidth": 18,
|
||||
"cheight": 22
|
||||
},
|
||||
"options": {
|
||||
"url": "{{entire_url('../api/promo_code_qr.dspy')}}?id=${id}$"
|
||||
}
|
||||
}
|
||||
],
|
||||
"new_data_url": "{{entire_url('/discount/api/promo_code_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('/discount/api/promo_code_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('/discount/api/promo_code_delete.dspy')}}",
|
||||
"logined_userid": "sale_id",
|
||||
"logined_userorgid": "resellerid"
|
||||
}
|
||||
}
|
||||
"tblname": "discount_promo_code",
|
||||
"title": "促销码",
|
||||
"params": {
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id"
|
||||
],
|
||||
"marketing_id": {
|
||||
"title": "营销方案",
|
||||
"width": 150
|
||||
},
|
||||
"code_type": {
|
||||
"title": "类型",
|
||||
"width": 80
|
||||
},
|
||||
"status": {
|
||||
"title": "状态",
|
||||
"width": 80
|
||||
},
|
||||
"sale_id": {
|
||||
"title": "生成销售",
|
||||
"width": 120,
|
||||
"uitype": "code",
|
||||
"valueField": "sale_id",
|
||||
"textField": "sale_id_text",
|
||||
"params": {
|
||||
"dbname": "{{get_module_dbname('discount')}}",
|
||||
"table": "users",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "username",
|
||||
"valueField": "sale_id",
|
||||
"textField": "sale_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
"created_at": {
|
||||
"title": "生成时间",
|
||||
"width": 160
|
||||
}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id",
|
||||
"resellerid",
|
||||
"sale_id",
|
||||
"created_at"
|
||||
],
|
||||
"toolbar": {
|
||||
"tools": [
|
||||
{
|
||||
"name": "generate_qr",
|
||||
"label": "生成二维码",
|
||||
"selected_row": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"binds": [
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "generate_qr",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "PopupWindow",
|
||||
"popup_options": {
|
||||
"title": "促销码二维码",
|
||||
"cwidth": 18,
|
||||
"cheight": 22
|
||||
},
|
||||
"options": {
|
||||
"url": "{{entire_url('../api/promo_code_qr.dspy')}}?id=${id}$"
|
||||
}
|
||||
}
|
||||
],
|
||||
"new_data_url": "{{entire_url('/discount/api/promo_code_create.dspy')}}",
|
||||
"update_data_url": "{{entire_url('/discount/api/promo_code_update.dspy')}}",
|
||||
"delete_data_url": "{{entire_url('/discount/api/promo_code_delete.dspy')}}",
|
||||
"logined_userid": "sale_id",
|
||||
"logined_userorgid": "resellerid"
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,19 +6,19 @@
|
||||
"cwidth":10,
|
||||
"items":[
|
||||
{
|
||||
"name":"discount_list",
|
||||
"name":"discount",
|
||||
"label": "折扣管理",
|
||||
"url": "{{entire_url('discount_list/index.ui')}}"
|
||||
"url": "{{entire_url('discount/index.ui')}}"
|
||||
},
|
||||
{
|
||||
"name":"discount_marketing_list",
|
||||
"name":"discount_marketing",
|
||||
"label": "营销方案",
|
||||
"url": "{{entire_url('discount_marketing_list/index.ui')}}"
|
||||
"url": "{{entire_url('discount_marketing/index.ui')}}"
|
||||
},
|
||||
{
|
||||
"name":"discount_promo_code_list",
|
||||
"name":"discount_promo_code",
|
||||
"label": "促销码",
|
||||
"url": "{{entire_url('discount_promo_code_list/index.ui')}}"
|
||||
"url": "{{entire_url('discount_promo_code/index.ui')}}"
|
||||
},
|
||||
{
|
||||
"name":"discount_customer_bind_list",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user