feat: v1.0 AI炫图工作台上线+业务做实+按需裁剪+主题精致化

- AI炫图: 自研程序化场景合成引擎(风格×时间×场景, 家具剪影/光束/暗角,
  seed构图微差), 阶段化生成动画+四方案画廊+PNG下载, 引擎抽为共享模块
- 业务做实: 报价接入产品价格本(use_price_book), 注册邀请码+返利真实计数,
  报价单转订单携带图纸
- 按需裁剪: 下线短信验证码登录/支付收银, 商城改为功能总览
- 主题精致化: 品牌色设计变量+Element Plus主题覆盖+视觉升级
- 全接口回归通过, 移除项405确认
This commit is contained in:
HHY
2026-09-20 13:15:31 -07:00
parent 453decf2e4
commit a20f3df854
15 changed files with 566 additions and 214 deletions
+26 -1
View File
@@ -15,6 +15,7 @@ class QuoteRequest(BaseModel):
template_id: int | None = Field(default=None, description="或直接指定样板")
order_id: int | None = Field(default=None, description="或对已有订单报价")
prices: dict | None = Field(default=None, description="价格本覆盖 {frame,mullion,sash,glass,hardware}")
use_price_book: bool = Field(default=False, description="从产品管理价格本取价(按材料类别均价)")
async def _resolve_drawing(db, body: QuoteRequest) -> str | dict | None:
@@ -32,14 +33,38 @@ async def _resolve_drawing(db, body: QuoteRequest) -> str | dict | None:
return None
async def _price_book(db, company_id: int) -> dict | None:
"""从产品价格本推导报价参数:各类材料均价。"""
from sqlalchemy import func, select
from huamenchuang.models.business import Product
rows = (await db.execute(
select(Product.material, func.avg(Product.price))
.where(Product.company_id == company_id, Product.enabled == 1)
.group_by(Product.material))).all()
if not rows:
return None
avg = {m: float(p or 0) for m, p in rows}
prices: dict = {}
if avg.get("profile"):
prices["frame"] = prices["mullion"] = prices["sash"] = round(avg["profile"], 2)
if avg.get("glass"):
prices["glass"] = round(avg["glass"], 2)
if avg.get("hardware"):
prices["hardware"] = round(avg["hardware"], 2)
return prices or None
@router.post("")
async def offer_price(body: QuoteRequest, user: CurrentUser, db: DbSession):
"""算料报价:型材清单 + 玻璃面积 + 五金 + 总价。"""
drawing = await _resolve_drawing(db, body)
if drawing is None:
return fail("未找到图纸数据")
prices = body.prices
if prices is None and body.use_price_book:
prices = await _price_book(db, user.company_id)
try:
result = calc_quote(drawing, body.prices)
result = calc_quote(drawing, prices)
except Exception:
return fail("图纸数据解析失败")
return ok(data=result, message="报价成功")