diff --git a/discount/init.py b/discount/init.py index bd9eeb0..bee6f5b 100644 --- a/discount/init.py +++ b/discount/init.py @@ -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}$ diff --git a/json/discount_list.json b/json/discount_list.json index 21012d4..734b303 100644 --- a/json/discount_list.json +++ b/json/discount_list.json @@ -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" - } - ] - } -} \ No newline at end of file + "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" + } + ] + } +} diff --git a/json/discount_marketing_list.json b/json/discount_marketing_list.json index f0db5cc..2f21a41 100644 --- a/json/discount_marketing_list.json +++ b/json/discount_marketing_list.json @@ -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" + } } diff --git a/json/discount_promo_code_list.json b/json/discount_promo_code_list.json index 365d9cd..79fb83d 100644 --- a/json/discount_promo_code_list.json +++ b/json/discount_promo_code_list.json @@ -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" - } -} \ No newline at end of file + "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" + } +} diff --git a/wwwroot/menu.ui b/wwwroot/menu.ui index d12ee0f..19516bd 100644 --- a/wwwroot/menu.ui +++ b/wwwroot/menu.ui @@ -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",