fix: add id to status widgets + return item_id from save dspys
This commit is contained in:
parent
5a00a42f05
commit
e2811156b0
@ -26,6 +26,7 @@
|
||||
{% for p in items %}
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"id": "da_row_{{p.productid}}",
|
||||
"options": {"padding": "6px 0", "border": "0 0 1px 0", "borderColor": "#334155", "alignItems": "center", "width": "100%"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps(p.category_name or '')}}, "width": "22%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||
@ -45,7 +46,7 @@
|
||||
]
|
||||
},
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps(p.sale_price or '')}}, "width": "14%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||
{"widgettype": "Text", "options": {"text": {% if p.item_id %}"✓已设置"{% else %}"-未设置"{% endif %}, "width": "20%", "padding": "0 8px", "fontSize": "11px", "color": {% if p.item_id %}"#34D399"{% else %}"#64748B"{% endif %}}}
|
||||
{"widgettype": "Text", "id": "da_status_{{p.productid}}", "options": {"text": {% if p.item_id %}"✓已设置"{% else %}"-未设置"{% endif %}, "width": "20%", "padding": "0 8px", "fontSize": "11px", "color": {% if p.item_id %}"#34D399"{% else %}"#64748B"{% endif %}}}
|
||||
]
|
||||
}{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@ -27,10 +27,10 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
})
|
||||
elif float(new_discount) > 0 and new_discount != old_discount:
|
||||
# New item — create
|
||||
new_id = getID()
|
||||
item_id = getID()
|
||||
now = timestampstr()
|
||||
await sor.C('distribution_agreement_items', {
|
||||
'id': new_id, 'agreement_id': agreement_id, 'resellerid': userorgid,
|
||||
'id': item_id, 'agreement_id': agreement_id, 'resellerid': userorgid,
|
||||
'productid': productid, 'prodtypeid': prodtypeid,
|
||||
'discount': new_discount, 'created_at': now,
|
||||
})
|
||||
@ -50,7 +50,7 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
await s3.C('product_org_auth', {
|
||||
'id': getID(), 'product_id': productid,
|
||||
'org_id': ag[0].sub_reseller_id,
|
||||
'auth_source': 'distribution_agreement', 'auth_source_id': new_id,
|
||||
'auth_source': 'distribution_agreement', 'auth_source_id': item_id,
|
||||
})
|
||||
|
||||
return {'status': 'ok'}
|
||||
return {'status': 'ok', 'item_id': item_id or '', 'discount': new_discount, 'productid': productid}
|
||||
|
||||
@ -27,4 +27,4 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
'discount': new_discount, 'created_at': now,
|
||||
})
|
||||
|
||||
return {'status': 'ok'}
|
||||
return {'status': 'ok', 'item_id': item_id or '', 'discount': new_discount, 'productid': productid}
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
{% for p in items %}
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
"id": "sc_row_{{p.productid}}",
|
||||
"options": {"padding": "6px 0", "border": "0 0 1px 0", "borderColor": "#334155", "alignItems": "center", "width": "100%"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps(p.category_name or '')}}, "width": "22%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||
@ -45,7 +46,7 @@
|
||||
]
|
||||
},
|
||||
{"widgettype": "Text", "options": {"text": {{json.dumps(p.sale_price or '')}}, "width": "14%", "padding": "0 8px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||
{"widgettype": "Text", "options": {"text": {% if p.item_id %}"✓已设置"{% else %}"-未设置"{% endif %}, "width": "20%", "padding": "0 8px", "fontSize": "11px", "color": {% if p.item_id %}"#34D399"{% else %}"#64748B"{% endif %}}}
|
||||
{"widgettype": "Text", "id": "sc_status_{{p.productid}}", "options": {"text": {% if p.item_id %}"✓已设置"{% else %}"-未设置"{% endif %}, "width": "20%", "padding": "0 8px", "fontSize": "11px", "color": {% if p.item_id %}"#34D399"{% else %}"#64748B"{% endif %}}}
|
||||
]
|
||||
}{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user