Files
2025-11-18 03:36:49 +08:00

74 lines
3.5 KiB
HTML

{% extends 'base.html' %}
{% block title %}运营面板 - 套餐管理{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
<h3>套餐管理</h3>
<div>
<a href="{% url 'admin_panel:plan_create' %}" class="btn btn-primary me-2">新建套餐</a>
<a class="btn btn-outline-secondary me-2" href="{% url 'admin_panel:dashboard' %}">返回概览</a>
<a class="btn btn-outline-secondary" href="/admin/">在 Django Admin 编辑</a>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>名称</th>
<th>月费</th>
<th>包含流量(GB)</th>
<th>超量单价</th>
<th>状态</th>
<th>公开</th>
<th>允许新购</th>
<th>允许续费</th>
<th>功能摘要</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for p in plans %}
<tr>
<td>{{ p.name }}</td>
<td>{{ p.base_price_per_domain }}</td>
<td>{{ p.included_traffic_gb_per_domain }}</td>
<td>{{ p.overage_price_per_gb }}</td>
<td>{% if p.is_active %}<span class="badge bg-success">Active</span>{% else %}<span class="badge bg-secondary">Disabled</span>{% endif %}</td>
<td>{% if p.is_public %}是{% else %}否{% endif %}</td>
<td>{% if p.allow_new_purchase %}是{% else %}否{% endif %}</td>
<td>{% if p.allow_renew %}是{% else %}否{% endif %}</td>
<td>
{% if p.features %}
<span class="badge bg-light text-dark me-1">WAF {% if p.features.waf_enabled %}✔{% else %}✖{% endif %}</span>
<span class="badge bg-light text-dark me-1">HTTP/3 {% if p.features.http3_enabled %}✔{% else %}✖{% endif %}</span>
<span class="badge bg-light text-dark me-1">WebSocket {% if p.features.websocket_enabled %}✔{% else %}✖{% endif %}</span>
<span class="badge bg-light text-dark me-1">日志 {% if p.features.realtime_logs_enabled or p.features.logs_enabled %}✔{% else %}✖{% endif %}</span>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td class="text-nowrap">
<a class="btn btn-sm btn-outline-primary me-2" href="{% url 'admin_panel:plan_edit' p.id %}">编辑</a>
<form action="{% url 'admin_panel:plan_toggle_active' p.id %}" method="post" class="d-inline" onsubmit="return confirm('确定切换启用状态吗?');">
{% csrf_token %}
<button class="btn btn-sm btn-outline-warning">切换启用</button>
</form>
<form action="{% url 'admin_panel:plan_toggle_public' p.id %}" method="post" class="d-inline" onsubmit="return confirm('确定切换公开状态吗?');">
{% csrf_token %}
<button class="btn btn-sm btn-outline-secondary">切换公开</button>
</form>
<form action="{% url 'admin_panel:plan_toggle_allow_new' p.id %}" method="post" class="d-inline" onsubmit="return confirm('确定切换允许新购吗?');">
{% csrf_token %}
<button class="btn btn-sm btn-outline-info">切换新购</button>
</form>
<form action="{% url 'admin_panel:plan_toggle_allow_renew' p.id %}" method="post" class="d-inline" onsubmit="return confirm('确定切换允许续费吗?');">
{% csrf_token %}
<button class="btn btn-sm btn-outline-success">切换续费</button>
</form>
</td>
</tr>
{% empty %}
<tr><td colspan="9" class="text-center">暂无套餐</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}