274 lines
12 KiB
XML
274 lines
12 KiB
XML
{% set cats_r = get_category_tree(org_id='0') %}
|
|
{% set cats = (cats_r or {}).get('tree', []) if (cats_r or {}).get('success') else [] %}
|
|
{% set userid = get_user() %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"padding": "0",
|
|
"bgcolor": "#f1f5f9"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "TabPanel",
|
|
"options": {
|
|
"css": "filler",
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"tab_pos": "top",
|
|
"items": [
|
|
{% for cat in cats %}
|
|
{% set pr = get_products_by_category(cat.id, org_id='0') %}
|
|
{% set prods = (pr or {}).get('products', []) %}
|
|
{
|
|
"name": "cat_{{cat.id}}",
|
|
"label": {{json.dumps(cat.name or '', ensure_ascii=False)}},
|
|
"content": {
|
|
"widgettype": "VScrollPanel",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"padding": "20px 24px",
|
|
"gap": "16px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"flexWrap": "wrap",
|
|
"gap": "16px"
|
|
},
|
|
"subwidgets": [
|
|
{% set ns = namespace(first=true) %}
|
|
{% for p in prods %}
|
|
{% if p.get('is_active', true) %}
|
|
{% set disp = get_product_display_info(p.get('id')) %}
|
|
{% set pricing_text = (disp or {}).get('pricing_text', '定价暂不可用') if (disp or {}).get('success') else '定价暂不可用' %}
|
|
{% set is_pipeline = (p.get('product_type') == 'pipeline') %}
|
|
{% set extra = {} %}
|
|
{% if is_pipeline %}
|
|
{% set extra = {'tab_name': 'pipeline_card_' + str(p.get('product_code','')), 'tab_label': p.get('product_name') or '', 'url': '', 'planned': False, 'message': ''} %}
|
|
{% if (p.get('product_code') or '') == 'PIPE-OPP' %}
|
|
{% set _ = extra.update({'url': '/pipeline-opportunity/agent'}) %}
|
|
{% elif (p.get('product_code') or '') == 'PIPE-BID' %}
|
|
{% set _ = extra.update({'url': '/pipeline-bidding/agent'}) %}
|
|
{% elif (p.get('product_code') or '') == 'PIPE-DEV' %}
|
|
{% set _ = extra.update({'url': '/pipeline_core/agent'}) %}
|
|
{% else %}
|
|
{% set _ = extra.update({'planned': True, 'message': (p.get('product_name') or '') + '规划中,尚未开发'}) %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if not ns.first %},{% endif %}
|
|
{% set ns.first = false %}
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"css": "card",
|
|
"cwidth": 24,
|
|
"cheight": 15,
|
|
"padding": "20px",
|
|
"bgcolor": "#fff",
|
|
"cursor": "pointer",
|
|
"gap": "8px"
|
|
},
|
|
{% if is_pipeline %}
|
|
"binds": [
|
|
{% if extra.planned %}
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "script",
|
|
"target": "self",
|
|
"script": {{json.dumps("bricks.show_message({title:" + json.dumps(extra.tab_label, ensure_ascii=False) + ",message:" + json.dumps(extra.message, ensure_ascii=False) + "});", ensure_ascii=False)}}
|
|
}
|
|
{% else %}
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "script",
|
|
"target": "self",
|
|
"script": {{json.dumps("var _tp=bricks.getWidgetById('main_content',bricks.app);if(_tp&&_tp.open_tab){_tp.open_tab({name:" + json.dumps(extra.tab_name, ensure_ascii=False) + ",label:" + json.dumps(extra.tab_label, ensure_ascii=False) + ",url:" + json.dumps(extra.url, ensure_ascii=False) + ",removable:true});}", ensure_ascii=False)}}
|
|
}
|
|
{% endif %}
|
|
],
|
|
{% else %}
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "PopupWindow",
|
|
"popup_options": {
|
|
"title": {{json.dumps('购买 - ' + (p.get('product_name') or ''), ensure_ascii=False)}},
|
|
"cwidth": 40,
|
|
"cheight": 26
|
|
},
|
|
"options": {
|
|
"method": "POST",
|
|
"url": "{{entire_url('/product_management/storefront/api/purchase_confirm.dspy')}}",
|
|
"params": {
|
|
"product_id": {{json.dumps(p.get('id') or '', ensure_ascii=False)}}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
{% endif %}
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Title4",
|
|
"options": {
|
|
"text": {{json.dumps(p.get('product_name') or '', ensure_ascii=False)}},
|
|
"color": "#1e293b"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "VScrollPanel",
|
|
"options": {
|
|
"flex": "1",
|
|
"width": "100%"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": {{json.dumps(p.get('brief_intro') or '暂无介绍', ensure_ascii=False)}},
|
|
"fontSize": "13px",
|
|
"color": "#64748b",
|
|
"wrap": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{% if is_pipeline %}
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
{% if extra.planned %}
|
|
"text": "规划中",
|
|
"fontSize": "14px",
|
|
"color": "#94a3b8",
|
|
"fontWeight": "600"
|
|
{% else %}
|
|
"text": "订阅制",
|
|
"fontSize": "14px",
|
|
"color": "#e74c3c"
|
|
{% endif %}
|
|
}
|
|
},
|
|
{% else %}
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": {{json.dumps(pricing_text, ensure_ascii=False)}},
|
|
"fontSize": "14px",
|
|
"color": "#e74c3c"
|
|
}
|
|
},
|
|
{% endif %}
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"justifyContent": "flex-end"
|
|
},
|
|
"subwidgets": [
|
|
{% if is_pipeline %}
|
|
{% if extra.planned %}
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "敬请期待",
|
|
"fontSize": "13px",
|
|
"color": "#94a3b8"
|
|
}
|
|
}
|
|
{% else %}
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "进入产线",
|
|
"bgcolor": "#2563eb",
|
|
"color": "#fff",
|
|
"padding": "8px 24px",
|
|
"borderRadius": "6px"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "script",
|
|
"target": "self",
|
|
"script": {{json.dumps("var _tp=bricks.getWidgetById('main_content',bricks.app);if(_tp&&_tp.open_tab){_tp.open_tab({name:" + json.dumps(extra.tab_name, ensure_ascii=False) + ",label:" + json.dumps(extra.tab_label, ensure_ascii=False) + ",url:" + json.dumps(extra.url, ensure_ascii=False) + ",removable:true});}", ensure_ascii=False)}}
|
|
}
|
|
]
|
|
}
|
|
{% endif %}
|
|
{% elif userid %}
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "立即购买",
|
|
"bgcolor": "#e74c3c",
|
|
"color": "#fff",
|
|
"padding": "8px 24px",
|
|
"borderRadius": "6px"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "PopupWindow",
|
|
"popup_options": {
|
|
"title": {{json.dumps('购买 - ' + (p.get('product_name') or ''), ensure_ascii=False)}},
|
|
"cwidth": 40,
|
|
"cheight": 26
|
|
},
|
|
"options": {
|
|
"method": "POST",
|
|
"url": "{{entire_url('/product_management/storefront/api/purchase_confirm.dspy')}}",
|
|
"params": {
|
|
"product_id": {{json.dumps(p.get('id') or '', ensure_ascii=False)}}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
{% else %}
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "登录后购买",
|
|
"fontSize": "13px",
|
|
"color": "#94a3b8"
|
|
}
|
|
}
|
|
{% endif %}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
{% endif %}
|
|
{% endfor %}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}{% if not loop.last %},{% endif %}
|
|
{% endfor %}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|