From bae0ba9a6d96dd4c66ed5566c9077f41a4ec70da Mon Sep 17 00:00:00 2001 From: coder Date: Tue, 14 Apr 2026 18:18:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A5=97=E9=A4=90=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=94=A8=E6=88=B7=E4=BC=9A=E5=91=98=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 当前套餐:绿色disabled按钮 - 已升级:灰色disabled按钮 - 未登录/低等级:显示购买按钮 - pricing路由传递user对象 --- app.py | 3 ++- templates/pricing.html | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index a1f841d..aea6239 100644 --- a/app.py +++ b/app.py @@ -206,7 +206,8 @@ def history(): @app.route('/pricing') def pricing(): """会员定价页""" - return render_template('pricing.html', plans=MEMBERSHIP_PLANS) + user = get_current_user() + return render_template('pricing.html', plans=MEMBERSHIP_PLANS, user=user) # ==================== 路由: API ==================== diff --git a/templates/pricing.html b/templates/pricing.html index 920e6ea..847a1e5 100644 --- a/templates/pricing.html +++ b/templates/pricing.html @@ -40,7 +40,13 @@
  • ❌ 批量翻译
  • + {% if user and user.user_type in ['free', 'vip_basic', 'vip_pro', 'vip_enterprise', 'admin'] %} + + {% if user.user_type == 'free' %}当前套餐{% else %}已升级{% endif %} + + {% else %} 免费注册 + {% endif %} @@ -62,7 +68,13 @@
  • ✅ 优先处理队列
  • + {% if user and user.user_type == 'vip_basic' %} + 当前套餐 + {% elif user and user.user_type in ['vip_pro', 'vip_enterprise', 'admin'] %} + 已升级 + {% else %} + {% endif %} @@ -86,7 +98,13 @@
  • ✅ 自定义术语库
  • + {% if user and user.user_type == 'vip_pro' %} + 当前套餐 + {% elif user and user.user_type in ['vip_enterprise', 'admin'] %} + 已升级 + {% else %} + {% endif %} @@ -106,7 +124,11 @@
  • ✅ API接口调用
  • + {% if user and user.user_type in ['vip_enterprise', 'admin'] %} + 当前套餐 + {% else %} + {% endif %}