feat: 套餐按钮根据用户会员状态显示

- 当前套餐:绿色disabled按钮
- 已升级:灰色disabled按钮
- 未登录/低等级:显示购买按钮
- pricing路由传递user对象
This commit is contained in:
2026-04-14 18:18:42 +08:00
parent c1e929fc8a
commit bae0ba9a6d
2 changed files with 24 additions and 1 deletions

View File

@@ -40,7 +40,13 @@
<li class="text-muted">❌ 批量翻译</li>
</ul>
{% if user and user.user_type in ['free', 'vip_basic', 'vip_pro', 'vip_enterprise', 'admin'] %}
<span class="btn btn-secondary w-100 mt-3 disabled">
{% if user.user_type == 'free' %}当前套餐{% else %}已升级{% endif %}
</span>
{% else %}
<a href="/register" class="btn btn-outline-secondary w-100 mt-3">免费注册</a>
{% endif %}
</div>
</div>
</div>
@@ -62,7 +68,13 @@
<li>✅ 优先处理队列</li>
</ul>
{% if user and user.user_type == 'vip_basic' %}
<span class="btn btn-success w-100 mt-3 disabled">当前套餐</span>
{% elif user and user.user_type in ['vip_pro', 'vip_enterprise', 'admin'] %}
<span class="btn btn-secondary w-100 mt-3 disabled">已升级</span>
{% else %}
<button class="btn btn-outline-primary w-100 mt-3">立即购买</button>
{% endif %}
</div>
</div>
</div>
@@ -86,7 +98,13 @@
<li>✅ 自定义术语库</li>
</ul>
{% if user and user.user_type == 'vip_pro' %}
<span class="btn btn-success w-100 mt-3 disabled">当前套餐</span>
{% elif user and user.user_type in ['vip_enterprise', 'admin'] %}
<span class="btn btn-secondary w-100 mt-3 disabled">已升级</span>
{% else %}
<button class="btn btn-primary w-100 mt-3">立即购买</button>
{% endif %}
</div>
</div>
</div>
@@ -106,7 +124,11 @@
<li>✅ API接口调用</li>
</ul>
{% if user and user.user_type in ['vip_enterprise', 'admin'] %}
<span class="btn btn-success w-100 mt-3 disabled">当前套餐</span>
{% else %}
<button class="btn btn-outline-primary w-100 mt-3">联系购买</button>
{% endif %}
</div>
</div>
</div>