🍷 葡月ERP管理系统
{% if current_user %}
👤 欢迎, {{ current_user.name }} ({{ current_user.role }})
退出登录
{% endif %}
📊 首页
{% if current_user and current_user.role in ['admin','manager'] %}
📥 采购
{% endif %}
📦 库存
{% if current_user and current_user.role in ['admin','manager'] %}
🍷 商品
{% endif %}
{% if current_user and current_user.role in ['admin','manager'] %}
📋 销售
{% if current_user and current_user.role in ['admin','manager'] %}
➕ 录单
{% endif %}
👥 客户
{% if current_user and current_user.role in ['admin','manager'] %}
💰 财务
📝 费用
💾 备份
{% endif %}
{% if current_user and current_user.role == 'admin' %}
👨💼 用户管理
{% endif %}
{% if page == 'home' %}
{{ stats.total_sales }}
销售总额(元)
{{ stats.total_profit }}
销售利润(元)
{{ stats.total_orders }}
订单数量
{{ stats.total_quantity }}
销售箱数
{{ stats.total_customers }}
客户数
🏆 销售排行 TOP5 商品 销量 利润 {% for p in top_products %}{{ p.name[:20] }}... {{ p.quantity }}箱 ¥{{ p.profit }} {% endfor %}
👥 客户排行 客户 销量 利润 {% for c in top_customers %}{{ c.name[:15] }} {{ c.quantity }}箱 ¥{{ c.profit }} {% endfor %}
{% if warnings %}
⚠️ 库存预警 商品 当前库存 安全库存 状态 {% for w in warnings %}{{ w.name[:30] }} {{ w.quantity }}箱 {{ w.min_stock }}箱 库存不足 {% endfor %}
{% else %}
{% endif %}
{% endif %}
{% if page == 'purchase' %}
📥 采购订单 订单号 日期 商品 数量 单价 金额 付款状态 收货状态 操作 {% for p in purchase_orders %}#{{ p.id }} {{ p.date }} {{ p.product[:25] }} {{ p.quantity }}箱 ¥{{ p.unit_price }} ¥{{ p.total_amount }} {{ p.payment_status }} {{ p.delivery_status }} {% if p.payment_status!='已付款' %}付款 {% else %}取消付款 {% endif %} {% if p.delivery_status!='已收货' %}确认收货 {% else %}取消收货 {% endif %}{% if p.payment_status=='未付款' and p.delivery_status=='未收货' %} 删除 {% endif %} {% endfor %}
¥{{ purchase_stats.total }}
采购总金额
{{ purchase_stats.orders }}
采购订单数
{{ purchase_stats.quantity }}
采购箱数
{% endif %}
{% if page == 'inventory' %}
{# 库存预警 #}
{% if warnings %}
{% for w in warnings %}
{{ w.name[:30] }} 库存不足!当前: {{ w.quantity }}箱,安全: {{ w.min_stock }}箱,建议补货: {{ w.suggest }}箱
{% endfor %}
{% else %}
{% endif %}
{# 库存周转分析 #}
📊 库存周转分析
商品 当前库存 日均销量 可销售天数 状态 {% for t in turnover %}{{ t.name[:25] }} {{ t.quantity }}箱 {{ t.daily_sales }}箱 {{ t.days }}天 {{ t.status }} {% endfor %}
📦 当前库存 商品名称 规格 库存(箱) 库存(瓶) 成本(瓶) 库存总值 安全库存 {% for p in products %}{{ p.name }} {{ p.spec }} {{ p.quantity }} {{ p.quantity * (6 if '6瓶' in p.spec else 4) }} ¥{{ p.cost }} ¥{{ p.quantity * p.cost * (6 if '6瓶' in p.spec else 4) }} {{ p.get('min_stock', 0) }}箱 {% endfor %}📦 合计 {{ total_quantity }}箱 {{ total_bottles }}瓶 ¥{{ total_value }}
{# 库存盘点 #}
{% if current_user and current_user.role in ['admin','manager'] %}
🔍 库存盘点(批量)
{% if stock_check_records %}
📋 盘点记录
ID 商品 原库存 新库存 差异 时间 {% for r in stock_check_records[:10] %}#{{ r.id }} {{ r.product[:20] }} {{ r.old_quantity }}箱 {{ r.new_quantity }}箱 {{ '+' if r.new_quantity >= r.old_quantity }}{{ r.new_quantity - r.old_quantity }}箱 {{ r.date }} {% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% if page == 'products' %}
{{ product_stats.total_products }}
商品种类
{{ product_stats.total_quantity }}
总库存(箱)
{{ product_stats.total_bottles }}
总库存(瓶)
{{ product_stats.total_value }}
库存总值(元)
¥{{ "{:,.0f}".format(product_stats.total_sales|default(0)) }}
累计销售额
¥{{ "{:,.0f}".format(product_stats.total_profit|default(0)) }}
累计利润
{{ product_stats.low_stock_count }}
库存预警
🍷 商品库存明细
➕ 新增商品
ID 商品名称 类型 葡萄品种 产地 年份 酒精度 规格 库存 成本 股东价 状态 操作 {% for p in products %}{{ p.id }} {{ p.name }} {{ p.wine_type|default('-') }} {{ p.grape_variety|default('-') }} {{ p.region|default('-') }} {{ p.vintage|default('-') }} {% if p.alcohol %}{{ p.alcohol }}%{% else %}-{% endif %} {{ p.spec }} {{ p.quantity }}箱 ¥{{ p.cost }} ¥{{ p.shareholder_price|default(0) }} {% if p.low_stock %}库存不足 {% else %}正常 {% endif %} 编辑 删除 {% endfor %}
{% endif %}
{% if page in ['sales','analysis','product_analysis'] %}
{% if page == 'sales' %}
📋 销售订单 订单号 日期 客户 商品 数量 金额 收款状态 发货状态 操作 {% for order in orders %}#{{ order.id }} {{ order.date }} {{ order.customer }} {{ order.product[:20] }} {{ order.quantity }}箱 ¥{{ order.total_amount }} {{ order.payment_status }} {{ order.delivery_status }} {% if order.payment_status!='已收款' %}收款 {% else %}取消收款 {% endif %} {% if order.delivery_status!='已发货' %}确认发货 {% else %}取消发货 {% endif %}{% if order.payment_status=='未收款' and order.delivery_status=='未发货' %} 删除 {% endif %} {% endfor %}
{% endif %}
{% if page == 'analysis' %}
📈 销售趋势分析 时间 订单数 销量(箱) 销售额 利润 环比 {% for d in trend_data %}{{ d.period }} {{ d.orders }} {{ d.quantity }} ¥{{ d.sales }} ¥{{ d.profit }} {{ d.growth }}% {% endfor %}
按客户 客户 销量 销售额 利润 {% for c in customer_stats %}{{ c.name }} {{ c.quantity }}箱 ¥{{ c.sales }} ¥{{ c.profit }} {% endfor %}
按商品 商品 销量 销售额 利润 {% for p in product_stats %}{{ p.name[:15] }} {{ p.quantity }}箱 ¥{{ p.sales }} ¥{{ p.profit }} {% endfor %}
{% endif %}
{% if page == 'product_analysis' %}
{{ product_stats_summary.total_products }}
商品种类
{{ product_stats_summary.total_sales }}
销售总额
{{ product_stats_summary.total_profit }}
利润总额
{{ product_stats_summary.avg_order }}
平均客单价
{{ product_stats_summary.best_product }}
畅销商品
{{ product_stats_summary.best_sales }}
销售额
🏆 销售额Top5 商品 销量 销售额 利润 占比 {% for p in top_by_sales %}{{ p.name[:20] }} {{ p.quantity }}箱 ¥{{ p.sales }} ¥{{ p.profit }} {{ p.percent }}% {% endfor %}
💰 利润Top5 商品 销量 销售额 利润 单位利润 {% for p in top_by_profit %}{{ p.name[:20] }} {{ p.quantity }}箱 ¥{{ p.sales }} ¥{{ p.profit }} ¥{{ p.unit_profit }} {% endfor %}
📊 商品销售占比 {% for p in product_stats %}
{{ p.name[:20] }} ¥{{ p.sales }} ({{ p.percent }}%)
{% endfor %}
🍷 商品销售明细 排名 商品 销量 销售额 利润 单位利润 占比 {% for p in product_stats %}{{ loop.index }} {{ p.name[:20] }} {{ p.quantity }}箱 ¥{{ p.sales }} ¥{{ p.profit }} ¥{{ p.unit_profit }} {{ p.percent }}% {% endfor %}
{% endif %}
{% endif %}
{% if page == 'add_sale' %}
{% endif %}
{% if page in ['customers','customer_analysis'] %}
{{ customer_stats.total }}
总客户数
{{ customer_stats.active }}
活跃客户
{{ customer_stats.inactive }}
沉默客户
{{ customer_stats.repeat_rate }}%
复购率
{% if page == 'customers' %}
{% endif %}
{% if page == 'customer_analysis' %}
{{ customer_stats.total }}
总客户数
{{ customer_stats.active }}
活跃客户
{{ customer_stats.inactive }}
沉默客户
{{ customer_stats.repeat_rate }}%
复购率
{{ customer_stats.avg_order }}
平均订单金额
{{ customer_stats.total_sales }}
客户累计销售额
🏆 销售额Top5 客户 销售额 利润 订单数 {% for c in top_customers %}{{ c.name }} ¥{{ c.sales }} ¥{{ c.profit }} {{ c.orders }} {% endfor %}
💰 利润Top5 客户 销售额 利润 订单数 {% for c in top_profit_customers %}{{ c.name }} ¥{{ c.sales }} ¥{{ c.profit }} {{ c.orders }} {% endfor %}
📊 客户等级分布 {% for k,v in level_distribution.items() %}
{% endfor %}
👤 客户价值排名 排名 客户 类型 等级 销量 销售额 利润 订单数 平均订单 最后下单 状态 {% for c in customer_detail %}{{ loop.index }} {{ c.name }} {{ c.type }} {{ c.level }} {{ c.quantity }}箱 ¥{{ c.sales }} ¥{{ c.profit }} {{ c.order_count }} ¥{{ c.avg_order }} {{ c.last_order }} {{ c.status }} {% endfor %}
{% endif %}
{% endif %}
{% if page == 'customer_orders' %}
📋 {{ customer_name }} 的订单记录 订单号 日期 商品 数量 金额 利润 收款状态 发货状态 {% for o in customer_orders %}#{{ o.id }} {{ o.date }} {{ o.product[:20] }} {{ o.quantity }}箱 ¥{{ o.total_amount }} ¥{{ o.profit }} {{ o.payment_status }} {{ o.delivery_status }} {% endfor %}
{% endif %}
{% if page == 'analysis' %}
📈 销售趋势分析 时间 订单数 销量(箱) 销售额 利润 环比 {% for d in trend_data %}{{ d.period }} {{ d.orders }} {{ d.quantity }} ¥{{ d.sales }} ¥{{ d.profit }} {{ d.growth }}% {% endfor %}
按客户 客户 销量 销售额 利润 {% for c in customer_stats %}{{ c.name }} {{ c.quantity }}箱 ¥{{ c.sales }} ¥{{ c.profit }} {% endfor %}
按商品 商品 销量 销售额 利润 {% for p in product_stats %}{{ p.name[:15] }} {{ p.quantity }}箱 ¥{{ p.sales }} ¥{{ p.profit }} {% endfor %}
{% endif %}
{% if page == 'financial' %}
¥{{ financial.sales }}
销售总额(已收款)
¥{{ financial.cost }}
销售成本
¥{{ financial.profit }}
毛利润
{{ financial.margin }}%
毛利率
¥{{ financial.purchase }}
采购支出(已付款)
¥{{ financial.stock_value }}
库存资产
¥{{ financial.corporate }}
对公账户余额
¥{{ financial.cash }}
现金账户余额
¥{{ financial.capital }}
注册资本
¥{{ financial.receivable }}
应收账款
¥{{ financial.payable }}
应付账款
📊 资产负债表 资产 金额 负债及权益 金额 付款状态 收货状态 操作 库存商品 ¥{{ financial.stock_value }} 注册资本 ¥{{ financial.capital }} 应收账款 ¥{{ financial.receivable }} 未分配利润 ¥{{ financial.retained }} 资产合计 ¥{{ financial.total_assets }} 权益合计 ¥{{ financial.total_equity }}
💵 成本结构 商品 单位成本 销量 总成本 {% for c in cost_structure %}{{ c.name[:20] }} ¥{{ c.unit_cost }} {{ c.quantity }}箱 ¥{{ c.total_cost }} {% endfor %}
💳 账户交易流水 日期 类型 账户 金额 关联单号 备注 {% for t in transactions %}{{ t.date }} {{ t.type }} {{ t.account }} {{ '+' if t.amount > 0 else '' }}¥{{ t.amount|int }} {{ t.ref }} {{ t.customer[:15] }} {% endfor %}
{% endif %}
{% if page == 'expenses' %}
{# 预算监控 #}
{% if budget_info.budget > 0 %}
📊 {{ budget_info.month }} 预算监控
预算: ¥{{ "{:,.0f}".format(budget_info.budget) }} |
实际: ¥{{ "{:,.0f}".format(budget_info.actual) }} |
剩余: ¥{{ "{:,.0f}".format(budget_info.remaining) }}
{{ "%.1f"|format(budget_info.percent) }}% 已使用
{% endif %}
¥{{ "{:,.0f}".format(expense_stats.total) }}
费用总额
¥{{ "{:,.0f}".format(expense_stats.pending) }}
待报销
¥{{ "{:,.0f}".format(expense_stats.approved) }}
已报销
¥{{ "{:,.0f}".format(expense_stats.rejected) }}
已拒绝
{{ expense_stats.count }}
费用笔数
{{ expense_stats.status_counts.pending }}
待处理
{{ expense_stats.status_counts.approved }}
已通过
📊 费用类型分布
{% if top_expense_types %}
类型 金额 {% for t in top_expense_types %}{{ t.type }} ¥{{ "{:,.0f}".format(t.amount) }} {% endfor %}
{% else %}
暂无数据
{% endif %}
📈 月度趋势
{% if monthly_trend %}
月份 金额 笔数 {% for m in monthly_trend %}{{ m.month }} ¥{{ "{:,.0f}".format(m.total) }} {{ m.count }} {% endfor %}
{% else %}
暂无数据
{% endif %}
🔄 周期性费用
{% if recurring_expenses %}
已设置周期费用:
类型 金额 频率 下次 操作
{% for r in recurring_expenses %}{{ r.type }} ¥{{ "{:,.0f}".format(r.amount) }} {{ r.frequency }} {{ r.next_date }} ✕ {% endfor %}
{% endif %}
📋 费用明细 ID 日期 类型 金额 说明 支付账户 状态 操作 {% for e in expenses %}#{{ e.id }} {{ e.date }} {{ e.type }} ¥{{ "{:,.0f}".format(e.amount) }} {{ e.description[:20] if e.description else '' }} {% if e.pay_account %}{{ e.pay_account }}{% else %}-{% endif %} {% if e.status == '待报销' %}{{ e.status }} {% elif e.status == '已报销' %}{{ e.status }} {% else %}{{ e.status }} {% endif %} {% if e.status == '待报销' %}支付 拒绝 {% endif %} 删除 {% endfor %}
{% endif %}
{% if page == 'users' %}
👨💼 用户管理
ID 用户名 姓名 角色 创建时间 操作
{% for u in users %}
#{{ u.id }}
{{ u.username }}
{{ u.name }}
{% if u.role == 'admin' %}管理员 {% elif u.role == 'manager' %}经理 {% else %}员工 {% endif %}
{{ u.created_at }}
{% if u.role != 'admin' %}编辑 删除 {% endif %}
{% endfor %}
{% endif %}
{% if page == 'edit_user' %}
{% endif %}
📊 库存周转分析 商品 当前库存 日均销量 可销售天数 状态 {% for t in turnover %}{{ t.name[:20] }} {{ t.quantity }}箱 {{ t.daily_sales }}箱 {{ t.days }}天 {{ t.status }} {% endfor %}
{% endif %}
{% if page == 'receive_payment' %}
{% endif %}
{% if page == 'pay_purchase' %}
{% endif %}
{% if page == 'pay_expense' %}
{% endif %}
{% if page == 'backup' %}
📂 备份历史
{% if backups %}
文件名 大小 创建时间 操作
{% for b in backups %}{{ b.name }} {{ b.size }} {{ b.time }} 下载 {% endfor %}
{% else %}
暂无备份记录
{% endif %}
{% endif %}