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):
|
async def sor_get_star_discount(sor, resellerid, biz_date):
|
||||||
"""Get default discount for a reseller (no specific customer)."""
|
"""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}$
|
where d.resellerid = ${resellerid}$
|
||||||
and d.customerid is NULL
|
and d.customerid is NULL
|
||||||
and d.enabled_date <= ${biz_date}$
|
and d.enabled_date <= ${biz_date}$
|
||||||
|
|||||||
@ -1,40 +1,39 @@
|
|||||||
{
|
{
|
||||||
"tblname": "discount",
|
"tblname": "discount",
|
||||||
"alias": "discount_list",
|
"title": "折扣管理",
|
||||||
"title": "折扣管理",
|
"params": {
|
||||||
"params": {
|
"sortby": [
|
||||||
"sortby": [
|
"enabled_date desc"
|
||||||
"enabled_date desc"
|
],
|
||||||
],
|
"browserfields": {
|
||||||
"browserfields": {
|
"exclouded": [
|
||||||
"exclouded": [
|
"id",
|
||||||
"id",
|
"resellerid"
|
||||||
"resellerid"
|
],
|
||||||
],
|
"alters": {
|
||||||
"alters": {
|
"customerid": {
|
||||||
"customerid": {
|
"uitype": "code",
|
||||||
"uitype": "code",
|
"dataurl": "{{entire_url('../api/get_customer_list.dspy')}}",
|
||||||
"dataurl": "{{entire_url('../api/get_customer_list.dspy')}}",
|
"datamethod": "GET"
|
||||||
"datamethod": "GET"
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"editexclouded": [
|
||||||
"editexclouded": [
|
"id",
|
||||||
"id",
|
"resellerid"
|
||||||
"resellerid"
|
],
|
||||||
],
|
"editable": {
|
||||||
"editable": {
|
"new_data_url": "{{entire_url('../api/discount_create.dspy')}}",
|
||||||
"new_data_url": "{{entire_url('../api/discount_create.dspy')}}",
|
"update_data_url": "{{entire_url('../api/discount_update.dspy')}}",
|
||||||
"update_data_url": "{{entire_url('../api/discount_update.dspy')}}",
|
"delete_data_url": "{{entire_url('../api/discount_delete.dspy')}}"
|
||||||
"delete_data_url": "{{entire_url('../api/discount_delete.dspy')}}"
|
},
|
||||||
},
|
"logined_userorgid": "resellerid",
|
||||||
"logined_userorgid": "resellerid",
|
"subtables": [
|
||||||
"subtables": [
|
{
|
||||||
{
|
"field": "discountid",
|
||||||
"field": "discountid",
|
"title": "设置产品折扣",
|
||||||
"title": "设置产品折扣",
|
"subtable": "discount_setting"
|
||||||
"subtable": "discount_setting"
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,97 +1,96 @@
|
|||||||
{
|
{
|
||||||
"tblname": "discount_marketing",
|
"tblname": "discount_marketing",
|
||||||
"alias": "discount_marketing_list",
|
"title": "营销方案",
|
||||||
"title": "营销方案",
|
"params": {
|
||||||
"params": {
|
"browserfields": {
|
||||||
"browserfields": {
|
"name": {
|
||||||
"name": {
|
"title": "方案名称"
|
||||||
"title": "方案名称"
|
},
|
||||||
},
|
"enabled_date": {
|
||||||
"enabled_date": {
|
"title": "启用日期",
|
||||||
"title": "启用日期",
|
"width": 120
|
||||||
"width": 120
|
},
|
||||||
},
|
"expired_date": {
|
||||||
"expired_date": {
|
"title": "失效日期",
|
||||||
"title": "失效日期",
|
"width": 120
|
||||||
"width": 120
|
},
|
||||||
},
|
"status": {
|
||||||
"status": {
|
"title": "状态",
|
||||||
"title": "状态",
|
"width": 80
|
||||||
"width": 80
|
},
|
||||||
},
|
"created_by": {
|
||||||
"created_by": {
|
"title": "创建人",
|
||||||
"title": "创建人",
|
"width": 120,
|
||||||
"width": 120,
|
"uitype": "code",
|
||||||
"uitype": "code",
|
"valueField": "created_by",
|
||||||
"valueField": "created_by",
|
"textField": "created_by_text",
|
||||||
"textField": "created_by_text",
|
"params": {
|
||||||
"params": {
|
"dbname": "{{get_module_dbname('discount')}}",
|
||||||
"dbname": "{{get_module_dbname('discount')}}",
|
"table": "users",
|
||||||
"table": "users",
|
"tblvalue": "id",
|
||||||
"tblvalue": "id",
|
"tbltext": "username",
|
||||||
"tbltext": "username",
|
"valueField": "created_by",
|
||||||
"valueField": "created_by",
|
"textField": "created_by_text"
|
||||||
"textField": "created_by_text"
|
},
|
||||||
},
|
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
}
|
||||||
}
|
},
|
||||||
},
|
"editexclouded": [
|
||||||
"editexclouded": [
|
"id",
|
||||||
"id",
|
"resellerid",
|
||||||
"resellerid",
|
"created_by",
|
||||||
"created_by",
|
"created_at",
|
||||||
"created_at",
|
"updated_at"
|
||||||
"updated_at"
|
],
|
||||||
],
|
"toolbar": {
|
||||||
"toolbar": {
|
"tools": [
|
||||||
"tools": [
|
{
|
||||||
{
|
"name": "detail",
|
||||||
"name": "detail",
|
"selected_row": true,
|
||||||
"selected_row": true,
|
"label": "产品明细",
|
||||||
"label": "产品明细",
|
"icon": "{{entire_url('/bricks/imgs/list.svg')}}"
|
||||||
"icon": "{{entire_url('/bricks/imgs/list.svg')}}"
|
},
|
||||||
},
|
{
|
||||||
{
|
"name": "gen_promo",
|
||||||
"name": "gen_promo",
|
"selected_row": true,
|
||||||
"selected_row": true,
|
"label": "生成促销码"
|
||||||
"label": "生成促销码"
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
},
|
"binds": [
|
||||||
"binds": [
|
{
|
||||||
{
|
"wid": "self",
|
||||||
"wid": "self",
|
"event": "detail",
|
||||||
"event": "detail",
|
"actiontype": "urlwidget",
|
||||||
"actiontype": "urlwidget",
|
"target": "app.sage_main_content",
|
||||||
"target": "app.sage_main_content",
|
"params_mapping": {
|
||||||
"params_mapping": {
|
"mapping": {
|
||||||
"mapping": {
|
"id": "discountid"
|
||||||
"id": "discountid"
|
},
|
||||||
},
|
"need_other": false
|
||||||
"need_other": false
|
},
|
||||||
},
|
"options": {
|
||||||
"options": {
|
"url": "{{entire_url('../marketing_discount_setting')}}"
|
||||||
"url": "{{entire_url('../marketing_discount_setting')}}"
|
}
|
||||||
}
|
},
|
||||||
},
|
{
|
||||||
{
|
"wid": "self",
|
||||||
"wid": "self",
|
"event": "gen_promo",
|
||||||
"event": "gen_promo",
|
"actiontype": "urlwidget",
|
||||||
"actiontype": "urlwidget",
|
"target": "PopupWindow",
|
||||||
"target": "PopupWindow",
|
"popup_options": {
|
||||||
"popup_options": {
|
"title": "生成促销码",
|
||||||
"title": "生成促销码",
|
"cwidth": 16,
|
||||||
"cwidth": 16,
|
"cheight": 10
|
||||||
"cheight": 10
|
},
|
||||||
},
|
"options": {
|
||||||
"options": {
|
"url": "{{entire_url('../api/gen_promo_from_mkt.dspy')}}"
|
||||||
"url": "{{entire_url('../api/gen_promo_from_mkt.dspy')}}"
|
}
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
],
|
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
|
||||||
"new_data_url": "{{entire_url('/discount/api/marketing_create.dspy')}}",
|
"update_data_url": "{{entire_url('/discount/api/marketing_update.dspy')}}",
|
||||||
"update_data_url": "{{entire_url('/discount/api/marketing_update.dspy')}}",
|
"delete_data_url": "{{entire_url('/discount/api/marketing_delete.dspy')}}",
|
||||||
"delete_data_url": "{{entire_url('/discount/api/marketing_delete.dspy')}}",
|
"logined_userorgid": "resellerid"
|
||||||
"logined_userorgid": "resellerid"
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,80 +1,79 @@
|
|||||||
{
|
{
|
||||||
"tblname": "discount_promo_code",
|
"tblname": "discount_promo_code",
|
||||||
"alias": "discount_promo_code_list",
|
"title": "促销码",
|
||||||
"title": "促销码",
|
"params": {
|
||||||
"params": {
|
"browserfields": {
|
||||||
"browserfields": {
|
"exclouded": [
|
||||||
"exclouded": [
|
"id"
|
||||||
"id"
|
],
|
||||||
],
|
"marketing_id": {
|
||||||
"marketing_id": {
|
"title": "营销方案",
|
||||||
"title": "营销方案",
|
"width": 150
|
||||||
"width": 150
|
},
|
||||||
},
|
"code_type": {
|
||||||
"code_type": {
|
"title": "类型",
|
||||||
"title": "类型",
|
"width": 80
|
||||||
"width": 80
|
},
|
||||||
},
|
"status": {
|
||||||
"status": {
|
"title": "状态",
|
||||||
"title": "状态",
|
"width": 80
|
||||||
"width": 80
|
},
|
||||||
},
|
"sale_id": {
|
||||||
"sale_id": {
|
"title": "生成销售",
|
||||||
"title": "生成销售",
|
"width": 120,
|
||||||
"width": 120,
|
"uitype": "code",
|
||||||
"uitype": "code",
|
"valueField": "sale_id",
|
||||||
"valueField": "sale_id",
|
"textField": "sale_id_text",
|
||||||
"textField": "sale_id_text",
|
"params": {
|
||||||
"params": {
|
"dbname": "{{get_module_dbname('discount')}}",
|
||||||
"dbname": "{{get_module_dbname('discount')}}",
|
"table": "users",
|
||||||
"table": "users",
|
"tblvalue": "id",
|
||||||
"tblvalue": "id",
|
"tbltext": "username",
|
||||||
"tbltext": "username",
|
"valueField": "sale_id",
|
||||||
"valueField": "sale_id",
|
"textField": "sale_id_text"
|
||||||
"textField": "sale_id_text"
|
},
|
||||||
},
|
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
},
|
||||||
},
|
"created_at": {
|
||||||
"created_at": {
|
"title": "生成时间",
|
||||||
"title": "生成时间",
|
"width": 160
|
||||||
"width": 160
|
}
|
||||||
}
|
},
|
||||||
},
|
"editexclouded": [
|
||||||
"editexclouded": [
|
"id",
|
||||||
"id",
|
"resellerid",
|
||||||
"resellerid",
|
"sale_id",
|
||||||
"sale_id",
|
"created_at"
|
||||||
"created_at"
|
],
|
||||||
],
|
"toolbar": {
|
||||||
"toolbar": {
|
"tools": [
|
||||||
"tools": [
|
{
|
||||||
{
|
"name": "generate_qr",
|
||||||
"name": "generate_qr",
|
"label": "生成二维码",
|
||||||
"label": "生成二维码",
|
"selected_row": true
|
||||||
"selected_row": true
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
},
|
"binds": [
|
||||||
"binds": [
|
{
|
||||||
{
|
"wid": "self",
|
||||||
"wid": "self",
|
"event": "generate_qr",
|
||||||
"event": "generate_qr",
|
"actiontype": "urlwidget",
|
||||||
"actiontype": "urlwidget",
|
"target": "PopupWindow",
|
||||||
"target": "PopupWindow",
|
"popup_options": {
|
||||||
"popup_options": {
|
"title": "促销码二维码",
|
||||||
"title": "促销码二维码",
|
"cwidth": 18,
|
||||||
"cwidth": 18,
|
"cheight": 22
|
||||||
"cheight": 22
|
},
|
||||||
},
|
"options": {
|
||||||
"options": {
|
"url": "{{entire_url('../api/promo_code_qr.dspy')}}?id=${id}$"
|
||||||
"url": "{{entire_url('../api/promo_code_qr.dspy')}}?id=${id}$"
|
}
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
],
|
"new_data_url": "{{entire_url('/discount/api/promo_code_create.dspy')}}",
|
||||||
"new_data_url": "{{entire_url('/discount/api/promo_code_create.dspy')}}",
|
"update_data_url": "{{entire_url('/discount/api/promo_code_update.dspy')}}",
|
||||||
"update_data_url": "{{entire_url('/discount/api/promo_code_update.dspy')}}",
|
"delete_data_url": "{{entire_url('/discount/api/promo_code_delete.dspy')}}",
|
||||||
"delete_data_url": "{{entire_url('/discount/api/promo_code_delete.dspy')}}",
|
"logined_userid": "sale_id",
|
||||||
"logined_userid": "sale_id",
|
"logined_userorgid": "resellerid"
|
||||||
"logined_userorgid": "resellerid"
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -6,19 +6,19 @@
|
|||||||
"cwidth":10,
|
"cwidth":10,
|
||||||
"items":[
|
"items":[
|
||||||
{
|
{
|
||||||
"name":"discount_list",
|
"name":"discount",
|
||||||
"label": "折扣管理",
|
"label": "折扣管理",
|
||||||
"url": "{{entire_url('discount_list/index.ui')}}"
|
"url": "{{entire_url('discount/index.ui')}}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"discount_marketing_list",
|
"name":"discount_marketing",
|
||||||
"label": "营销方案",
|
"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": "促销码",
|
"label": "促销码",
|
||||||
"url": "{{entire_url('discount_promo_code_list/index.ui')}}"
|
"url": "{{entire_url('discount_promo_code/index.ui')}}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"discount_customer_bind_list",
|
"name":"discount_customer_bind_list",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user