23 Commits

Author SHA1 Message Date
ad65d7a8a9 fix: OilReference最后2处@click.self改为@mousedown.self,拖选不误关
Some checks are pending
Test / e2e-test (push) Blocked by required conditions
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 14s
全局已无@click.self弹窗关闭,统一使用@mousedown.self。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 18:19:36 +00:00
24e8aea39c fix: eoDrops变量提到volume分支外,修复编辑配方报错
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Successful in 53s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 18:17:43 +00:00
74a8d9aeb6 feat: 配方volume字段存储编辑器选择的容量
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 52s
- 后端: recipes表新增volume列,API返回/保存volume
- 前端: 保存时发送formVolume,编辑时优先用stored volume
- 容量显示优先级: stored volume > 椰子油计算 > 产品ml求和
- 修复编辑器容量选择保存后不生效的bug

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:31:04 +00:00
13b675e63d fix: 管理配方容量显示支持产品,混合g/ml统一显示ml
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 53s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:23:32 +00:00
5f1ead03ab fix: 配方卡片容量按单位分组求和,支持混合单位(30g+100ml)
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Successful in 52s
- 有椰子油: 单次 / Xml(不变)
- 无椰子油有产品: 同单位求和,不同单位用+连接
- 示例: 一个配方含30g面霜+100ml护手霜 → 显示"30g+100ml"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:19:34 +00:00
c19f6e8276 fix: add-oil-form强制flex column确保tab和表单分两行
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 53s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:14:42 +00:00
e28f5f9c0f fix: clean up tab style
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 50s
2026-04-13 17:12:48 +00:00
4df02edc53 fix: tab和表单改为上下布局,解决对齐问题
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 17s
Test / e2e-test (push) Successful in 50s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:10:35 +00:00
0451633bf5 fix: 新增tab样式对齐,改为inline-flex紧凑布局
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 49s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:35:19 +00:00
7af83b96ca fix: 新增tab文案精简为"精油"和"其他"
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:32:57 +00:00
30bb69f52c feat: 新增产品表单(ml/g/颗)+配方卡片显示产品容量
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 50s
- 精油价目新增分两个tab:新增精油(标准容量) / 新增其他产品(ml/g/颗)
- saveOil支持unit参数
- 配方卡片:含产品的配方直接显示产品用量+单位(如30g)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:30:46 +00:00
42993d47ee fix: 配方成分显示和导出使用动态单位,重复提示改为"修改用量"
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 52s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:25:14 +00:00
eeb9b0aa88 feat: 通用单位系统 — drop/ml/g/capsule,去掉硬编码
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 3m5s
unit字段支持4种值,所有显示自动适配:
- drop: 精油(滴/drop)
- ml: 液体产品(ml)
- g: 膏霜产品(g)
- capsule: 胶囊(颗/capsule)
新增产品选单位即可,无需改代码。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:10:36 +00:00
7bcb1d1a5b fix: 植物空胶囊全局显示"颗"(capsule),配方卡片/编辑器/价目统一
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 51s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:31:00 +00:00
371aa74c31 fix: 植物空胶囊详情显示每颗价格
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 49s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:29:41 +00:00
395e837de8 fix: 精油详情面板重排 — 总容量(5ml/93滴)+会员每滴+零售每滴
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 52s
精油: 总容量(Xml/X滴) → 会员价 → 每滴价格 → 零售价 → 零售每滴价格
ml产品: 总容量(Xml) → 会员价 → 每ml价格
配方列表单位跟随产品类型

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:19:32 +00:00
7abc219659 fix: 精油价目恢复原始显示(每滴/每ml/每颗),ml产品用新显示
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 52s
精油: 总滴数 + 每滴价格 + 每ml价格(和之前一样)
植物空胶囊: /颗(和之前一样)
ml产品: 总容量Xml + 每ml价格(新)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:13:37 +00:00
9beddc387a fix: 精油详情去掉每ml价格行,只保留每滴价格
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 52s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:10:38 +00:00
b28b1c7f62 fix: 导出isMlUnit函数,修复精油价目页点击报错
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:07:41 +00:00
9f072e48f8 feat: ml产品全局适配 — 编辑器/价目/详情统一显示ml单位
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 50s
- 编辑器: 表头改为"成分/用量/单价",每行显示对应单位(滴/ml)
- 精油价目: ml产品显示"总容量Xml"和"每ml价格",精油保持"每滴"
- 知识卡片/配方详情: 单位跟随产品类型
- 精油的"每ml价格"行对ml产品隐藏(已是ml单位)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:57:21 +00:00
a3bf13c58d feat: 护肤品用ml单位,精油用滴,通过unit字段区分
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 53s
- 后端: oils表新增unit列(drop/ml),API返回unit字段
- 前端: 根据unit='ml'显示ml单位,精油显示滴/drop
- 护肤品drop_count改为实际ml容量,成本按用量比例计算
  如玫瑰护手霜100ml ¥135,配方用30ml → 成本¥40.5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:48:11 +00:00
fba66b42c2 feat: 含护肤品的配方卡片显示容量(从备注提取ml/克,否则显示"调配")
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Successful in 50s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:42:42 +00:00
67d268bc92 feat: 非精油产品(drop_count=1)显示"份"而非"滴"
All checks were successful
Test / unit-test (push) Successful in 5s
PR Preview / teardown-preview (pull_request) Has been skipped
Test / build-check (push) Successful in 4s
Test / e2e-test (push) Successful in 54s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
oils store新增 unitLabel/unitLabelPlural,根据 dropCount 判断:
- 精油(dropCount>1): 滴/drop
- 护肤品等(dropCount=1): 份/portion
影响: 配方卡片、个人配方、库存匹配、去重提示

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:25:41 +00:00
9 changed files with 290 additions and 79 deletions

View File

@@ -227,6 +227,8 @@ def init_db():
c.execute("ALTER TABLE oils ADD COLUMN is_active INTEGER DEFAULT 1")
if "en_name" not in oil_cols:
c.execute("ALTER TABLE oils ADD COLUMN en_name TEXT DEFAULT ''")
if "unit" not in oil_cols:
c.execute("ALTER TABLE oils ADD COLUMN unit TEXT DEFAULT 'drop'")
# Migration: add new columns to category_modules if missing
cat_cols = [row[1] for row in c.execute("PRAGMA table_info(category_modules)").fetchall()]
@@ -246,6 +248,8 @@ def init_db():
c.execute("ALTER TABLE recipes ADD COLUMN updated_by INTEGER")
if "en_name" not in cols:
c.execute("ALTER TABLE recipes ADD COLUMN en_name TEXT DEFAULT ''")
if "volume" not in cols:
c.execute("ALTER TABLE recipes ADD COLUMN volume TEXT DEFAULT ''")
# Seed admin user if no users exist
count = c.execute("SELECT COUNT(*) FROM users").fetchone()[0]

View File

@@ -87,6 +87,7 @@ class OilIn(BaseModel):
retail_price: Optional[float] = None
en_name: Optional[str] = None
is_active: Optional[int] = None
unit: Optional[str] = None
class IngredientIn(BaseModel):
@@ -109,6 +110,7 @@ class RecipeUpdate(BaseModel):
ingredients: Optional[list[IngredientIn]] = None
tags: Optional[list[str]] = None
version: Optional[int] = None
volume: Optional[str] = None
class UserIn(BaseModel):
@@ -318,7 +320,7 @@ def symptom_search(body: dict, user=Depends(get_current_user)):
conn = get_db()
# Search in recipe names
rows = conn.execute(
"SELECT id, name, note, owner_id, version, en_name FROM recipes ORDER BY id"
"SELECT id, name, note, owner_id, version, en_name, volume FROM recipes ORDER BY id"
).fetchall()
exact = []
related = []
@@ -715,7 +717,7 @@ def impersonate(body: dict, user=Depends(require_role("admin"))):
@app.get("/api/oils")
def list_oils():
conn = get_db()
rows = conn.execute("SELECT name, bottle_price, drop_count, retail_price, is_active, en_name FROM oils ORDER BY name").fetchall()
rows = conn.execute("SELECT name, bottle_price, drop_count, retail_price, is_active, en_name, unit FROM oils ORDER BY name").fetchall()
conn.close()
return [dict(r) for r in rows]
@@ -724,11 +726,11 @@ def list_oils():
def upsert_oil(oil: OilIn, user=Depends(require_role("admin", "senior_editor"))):
conn = get_db()
conn.execute(
"INSERT INTO oils (name, bottle_price, drop_count, retail_price, en_name, is_active) VALUES (?, ?, ?, ?, ?, ?) "
"INSERT INTO oils (name, bottle_price, drop_count, retail_price, en_name, is_active, unit) VALUES (?, ?, ?, ?, ?, ?, ?) "
"ON CONFLICT(name) DO UPDATE SET bottle_price=excluded.bottle_price, drop_count=excluded.drop_count, "
"retail_price=excluded.retail_price, en_name=COALESCE(excluded.en_name, oils.en_name), "
"is_active=COALESCE(excluded.is_active, oils.is_active)",
(oil.name, oil.bottle_price, oil.drop_count, oil.retail_price, title_case(oil.en_name) if oil.en_name else oil.en_name, oil.is_active),
"is_active=COALESCE(excluded.is_active, oils.is_active), unit=COALESCE(excluded.unit, oils.unit)",
(oil.name, oil.bottle_price, oil.drop_count, oil.retail_price, title_case(oil.en_name) if oil.en_name else oil.en_name, oil.is_active, oil.unit),
)
log_audit(conn, user["id"], "upsert_oil", "oil", oil.name, oil.name,
json.dumps({"bottle_price": oil.bottle_price, "drop_count": oil.drop_count}))
@@ -772,6 +774,7 @@ def _recipe_to_dict(conn, row):
"version": row["version"] if "version" in row.keys() else 1,
"ingredients": [{"oil_name": i["oil_name"], "drops": i["drops"]} for i in ings],
"tags": [t["tag_name"] for t in tags],
"volume": row["volume"] if "volume" in row.keys() else "",
}
@@ -780,19 +783,19 @@ def list_recipes(user=Depends(get_current_user)):
conn = get_db()
# Admin sees all; others see admin-owned (adopted) + their own
if user["role"] == "admin":
rows = conn.execute("SELECT id, name, note, owner_id, version, en_name FROM recipes ORDER BY id").fetchall()
rows = conn.execute("SELECT id, name, note, owner_id, version, en_name, volume FROM recipes ORDER BY id").fetchall()
else:
admin = conn.execute("SELECT id FROM users WHERE role = 'admin' LIMIT 1").fetchone()
admin_id = admin["id"] if admin else 1
user_id = user.get("id")
if user_id:
rows = conn.execute(
"SELECT id, name, note, owner_id, version, en_name FROM recipes WHERE owner_id = ? OR owner_id = ? ORDER BY id",
"SELECT id, name, note, owner_id, version, en_name, volume FROM recipes WHERE owner_id = ? OR owner_id = ? ORDER BY id",
(admin_id, user_id)
).fetchall()
else:
rows = conn.execute(
"SELECT id, name, note, owner_id, version, en_name FROM recipes WHERE owner_id = ? ORDER BY id",
"SELECT id, name, note, owner_id, version, en_name, volume FROM recipes WHERE owner_id = ? ORDER BY id",
(admin_id,)
).fetchall()
result = [_recipe_to_dict(conn, r) for r in rows]
@@ -803,7 +806,7 @@ def list_recipes(user=Depends(get_current_user)):
@app.get("/api/recipes/{recipe_id}")
def get_recipe(recipe_id: int):
conn = get_db()
row = conn.execute("SELECT id, name, note, owner_id, version, en_name FROM recipes WHERE id = ?", (recipe_id,)).fetchone()
row = conn.execute("SELECT id, name, note, owner_id, version, en_name, volume FROM recipes WHERE id = ?", (recipe_id,)).fetchone()
if not row:
conn.close()
raise HTTPException(404, "Recipe not found")
@@ -893,6 +896,8 @@ def update_recipe(recipe_id: int, update: RecipeUpdate, user=Depends(get_current
c.execute("UPDATE recipes SET note = ? WHERE id = ?", (update.note, recipe_id))
if update.en_name is not None:
c.execute("UPDATE recipes SET en_name = ? WHERE id = ?", (title_case(update.en_name), recipe_id))
if update.volume is not None:
c.execute("UPDATE recipes SET volume = ? WHERE id = ?", (update.volume, recipe_id))
if update.ingredients is not None:
c.execute("DELETE FROM recipe_ingredients WHERE recipe_id = ?", (recipe_id,))
for ing in update.ingredients:
@@ -932,7 +937,7 @@ def delete_recipe(recipe_id: int, user=Depends(get_current_user)):
conn = get_db()
row = _check_recipe_permission(conn, recipe_id, user)
# Save full snapshot for undo
full = conn.execute("SELECT id, name, note, owner_id, version, en_name FROM recipes WHERE id = ?", (recipe_id,)).fetchone()
full = conn.execute("SELECT id, name, note, owner_id, version, en_name, volume FROM recipes WHERE id = ?", (recipe_id,)).fetchone()
snapshot = _recipe_to_dict(conn, full)
log_audit(conn, user["id"], "delete_recipe", "recipe", recipe_id, row["name"],
json.dumps(snapshot, ensure_ascii=False))
@@ -1595,7 +1600,7 @@ def recipes_by_inventory(user=Depends(get_current_user)):
if not inv:
conn.close()
return []
rows = conn.execute("SELECT id, name, note, owner_id, version, en_name FROM recipes ORDER BY id").fetchall()
rows = conn.execute("SELECT id, name, note, owner_id, version, en_name, volume FROM recipes ORDER BY id").fetchall()
result = []
for r in rows:
recipe = _recipe_to_dict(conn, r)

View File

@@ -48,13 +48,33 @@ const priceInfo = computed(() => oilsStore.fmtCostWithRetail(props.recipe.ingred
const isFav = computed(() => recipesStore.isFavorite(props.recipe))
const volumeLabel = computed(() => {
// Priority 1: stored volume from editor selection
const vol = props.recipe.volume
if (vol) {
if (vol === 'single') return '单次'
if (vol === 'custom') return ''
if (/^\d+$/.test(vol)) return `${vol}ml`
return vol
}
// Priority 2: calculate from ingredients
const ings = props.recipe.ingredients || []
const coco = ings.find(i => i.oil === '椰子油')
if (!coco || !coco.drops) return ''
if (coco && coco.drops) {
const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0)
const ml = totalDrops / 18.6
if (ml <= 2) return '单次'
return `${Math.round(ml)}ml`
}
// Priority 3: sum portion products as ml
let totalMl = 0
let hasProduct = false
for (const ing of ings) {
if (!oilsStore.isPortionUnit(ing.oil)) continue
hasProduct = true
totalMl += ing.drops || 0
}
if (hasProduct && totalMl > 0) return `${Math.round(totalMl)}ml`
return ''
})
</script>

View File

@@ -64,7 +64,7 @@
<ul style="list-style:none;margin-bottom:20px;padding:0">
<li v-for="(ing, i) in cardIngredients" :key="i" class="ec-ing">
<span class="ec-oil-name">{{ getCardOilName(ing.oil) }}</span>
<span class="ec-drops">{{ ing.drops }} {{ cardLang === 'en' ? (ing.drops === 1 ? 'drop' : 'drops') : '滴' }}</span>
<span class="ec-drops">{{ ing.drops }} {{ oilsStore.unitLabelPlural(ing.oil, ing.drops, cardLang) }}</span>
<span class="ec-cost">{{ oilsStore.fmtPrice(oilsStore.pricePerDrop(ing.oil) * ing.drops) }}</span>
<span v-if="hasRetailForOil(ing.oil) && retailPerDrop(ing.oil) > oilsStore.pricePerDrop(ing.oil)" class="ec-retail">{{ oilsStore.fmtPrice(retailPerDrop(ing.oil) * ing.drops) }}</span>
</li>
@@ -170,7 +170,7 @@
<div class="editor-section">
<table class="editor-table">
<thead>
<tr><th>精油</th><th>滴数</th><th>单价/</th><th>小计</th><th></th></tr>
<tr><th>成分</th><th>用量</th><th>单价</th><th>小计</th><th></th></tr>
</thead>
<tbody>
<tr v-for="(ing, i) in editEoIngredients" :key="'eo-'+i">
@@ -180,8 +180,13 @@
<option v-for="name in oilsStore.oilNames" :key="name" :value="name">{{ name }}</option>
</select>
</td>
<td><input v-model.number="ing.drops" type="number" min="0.5" step="0.5" class="editor-drops" /></td>
<td class="ing-ppd">{{ ing.oil ? oilsStore.fmtPrice(oilsStore.pricePerDrop(ing.oil)) : '-' }}</td>
<td>
<div class="drops-with-unit">
<input v-model.number="ing.drops" type="number" min="0.5" step="0.5" class="editor-drops" />
<span class="unit-hint">{{ oilsStore.unitLabel(ing.oil) }}</span>
</div>
</td>
<td class="ing-ppd">{{ ing.oil ? oilsStore.fmtPrice(oilsStore.pricePerDrop(ing.oil)) : '-' }}/{{ oilsStore.unitLabel(ing.oil) }}</td>
<td class="ing-cost">{{ ing.oil ? oilsStore.fmtPrice(oilsStore.pricePerDrop(ing.oil) * (ing.drops || 0)) : '-' }}</td>
<td><button class="remove-row-btn" @click="editIngredients.splice(editIngredients.indexOf(ing), 1)"></button></td>
</tr>
@@ -1703,6 +1708,8 @@ async function saveRecipe() {
.editor-drops:focus {
border-color: var(--sage, #7a9e7e);
}
.drops-with-unit { display: flex; align-items: center; gap: 2px; }
.unit-hint { font-size: 11px; color: #b0aab5; white-space: nowrap; }
.ing-ppd {
font-size: 12px;

View File

@@ -70,20 +70,23 @@ export const useOilsStore = defineStore('oils', () => {
retailPrice: oil.retail_price ?? null,
isActive: oil.is_active !== 0,
enName: oil.en_name ?? null,
unit: oil.unit || 'drop',
}
}
oils.value = newOils
oilsMeta.value = newMeta
}
async function saveOil(name, bottlePrice, dropCount, retailPrice, enName = null) {
await api.post('/api/oils', {
async function saveOil(name, bottlePrice, dropCount, retailPrice, enName = null, unit = null) {
const payload = {
name,
bottle_price: bottlePrice,
drop_count: dropCount,
retail_price: retailPrice,
en_name: enName,
})
}
if (unit) payload.unit = unit
await api.post('/api/oils', payload)
await loadOils()
}
@@ -93,6 +96,41 @@ export const useOilsStore = defineStore('oils', () => {
delete oilsMeta.value[name]
}
const UNIT_LABELS = {
drop: { zh: '滴', en: 'drop', enPlural: 'drops' },
ml: { zh: 'ml', en: 'ml', enPlural: 'ml' },
g: { zh: 'g', en: 'g', enPlural: 'g' },
capsule: { zh: '颗', en: 'capsule', enPlural: 'capsules' },
}
function getUnit(name) {
const meta = oilsMeta.value[name]
return (meta && meta.unit) || 'drop'
}
function isDropUnit(name) {
return getUnit(name) === 'drop'
}
function isMlUnit(name) {
return getUnit(name) === 'ml'
}
function isPortionUnit(name) {
return !isDropUnit(name)
}
function unitLabel(name, lang = 'zh') {
const u = UNIT_LABELS[getUnit(name)] || UNIT_LABELS.drop
return lang === 'en' ? u.en : u.zh
}
function unitLabelPlural(name, count, lang = 'zh') {
const u = UNIT_LABELS[getUnit(name)] || UNIT_LABELS.drop
if (lang === 'en') return count === 1 ? u.en : u.enPlural
return u.zh
}
return {
oils,
oilsMeta,
@@ -105,5 +143,11 @@ export const useOilsStore = defineStore('oils', () => {
loadOils,
saveOil,
deleteOil,
getUnit,
isDropUnit,
isMlUnit,
isPortionUnit,
unitLabel,
unitLabelPlural,
}
})

View File

@@ -76,7 +76,7 @@
class="match-ing"
:class="{ missing: !ownedSet.has(ing.oil) }"
>
{{ ing.oil }} {{ ing.drops }}
{{ ing.oil }} {{ ing.drops }}{{ oils.unitLabel(ing.oil) }}
</span>
</div>
<div class="match-meta">

View File

@@ -31,7 +31,7 @@
<div class="diary-name">{{ d.name || '未命名' }}</div>
<div class="diary-ings">
<span v-for="ing in (d.ingredients || []).slice(0, 3)" :key="ing.oil" class="diary-ing">
{{ ing.oil }} {{ ing.drops }}
{{ ing.oil }} {{ ing.drops }}{{ oils.unitLabel(ing.oil) }}
</span>
<span v-if="(d.ingredients || []).length > 3" class="diary-more">+{{ (d.ingredients || []).length - 3 }}</span>
</div>

View File

@@ -107,7 +107,12 @@
<!-- Add Oil Form (toggleable) -->
<div v-if="showAddForm && auth.canManage" class="add-oil-form">
<div class="form-row">
<div class="add-type-tabs">
<button class="add-type-tab" :class="{ active: addType === 'oil' }" @click="addType = 'oil'">精油</button>
<button class="add-type-tab" :class="{ active: addType === 'product' }" @click="addType = 'product'">其他</button>
</div>
<!-- 新增精油 -->
<div v-if="addType === 'oil'" class="form-row">
<input v-model="newOilName" style="flex:1;min-width:120px" placeholder="精油名称" class="form-input-sm" />
<input v-model="newOilEnName" style="flex:1;min-width:100px" placeholder="英文名" class="form-input-sm" />
<input v-model.number="newBottlePrice" style="width:100px" type="number" step="0.01" min="0" placeholder="会员价 ¥" class="form-input-sm" />
@@ -124,6 +129,20 @@
<input v-model.number="newRetailPrice" style="width:100px" type="number" step="0.01" min="0" placeholder="零售价 ¥" class="form-input-sm" />
<button class="btn btn-primary btn-sm" @click="addOil" :disabled="!newOilName.trim()"> 添加</button>
</div>
<!-- 新增其他产品 -->
<div v-else class="form-row">
<input v-model="newOilName" style="flex:1;min-width:120px" placeholder="产品名称" class="form-input-sm" />
<input v-model="newOilEnName" style="flex:1;min-width:100px" placeholder="英文名" class="form-input-sm" />
<input v-model.number="newBottlePrice" style="width:100px" type="number" step="0.01" min="0" placeholder="会员价 ¥" class="form-input-sm" />
<input v-model.number="newProductAmount" style="width:70px" type="number" step="1" min="1" placeholder="容量" class="form-input-sm" />
<select v-model="newProductUnit" class="form-input-sm" style="width:60px">
<option value="ml">ml</option>
<option value="g">g</option>
<option value="capsule"></option>
</select>
<input v-model.number="newRetailPrice" style="width:100px" type="number" step="0.01" min="0" placeholder="零售价 ¥" class="form-input-sm" />
<button class="btn btn-primary btn-sm" @click="addProduct" :disabled="!newOilName.trim() || !newProductAmount"> 添加</button>
</div>
</div>
<!-- Oil Grid -->
@@ -146,9 +165,9 @@
<div v-if="getMeta(name)?.retailPrice" class="oil-retail-line">¥{{ getMeta(name).retailPrice }}/</div>
</template>
<template v-else>
<div class="oil-price-line">¥{{ oils.pricePerDrop(name).toFixed(2) }}<span class="oil-price-unit">{{ name === '植物空胶囊' ? '/颗' : '/滴' }}</span></div>
<div class="oil-price-line">¥{{ oils.pricePerDrop(name).toFixed(2) }}<span class="oil-price-unit">/{{ oilPriceUnit(name) }}</span></div>
<div v-if="getMeta(name)?.retailPrice && getMeta(name)?.dropCount" class="oil-retail-line">
¥{{ (getMeta(name).retailPrice / getMeta(name).dropCount).toFixed(2) }}{{ name === '植物空胶囊' ? '/' : '/' }}
¥{{ (getMeta(name).retailPrice / getMeta(name).dropCount).toFixed(2) }}/{{ oilPriceUnit(name) }}
</div>
</template>
</div>
@@ -172,7 +191,7 @@
<div class="oil-card-price-info" v-if="getMeta(activeCardName)">
¥ {{ (getMeta(activeCardName).bottlePrice || 0).toFixed(2) }}
<span v-if="oils.pricePerDrop(activeCardName)">
&middot; ¥ {{ oils.pricePerDrop(activeCardName).toFixed(4) }}/
&middot; ¥ {{ oils.pricePerDrop(activeCardName).toFixed(4) }}/{{ oilPriceUnit(activeCardName) }}
</span>
</div>
</div>
@@ -216,7 +235,7 @@
</div>
<!-- Simple Oil Detail Panel (for oils without a knowledge card) -->
<div v-if="selectedOilName && !activeCard" class="modal-overlay" @click.self="selectedOilName = null">
<div v-if="selectedOilName && !activeCard" class="modal-overlay" @mousedown.self="selectedOilName = null">
<div class="oil-detail-panel">
<div class="detail-header">
<div>
@@ -226,32 +245,58 @@
<button class="btn-close" @click="selectedOilName = null"></button>
</div>
<div class="detail-body">
<!-- 精油非ml产品 -->
<template v-if="oils.isDropUnit(selectedOilName)">
<div class="detail-row">
<span class="detail-label">总容量</span>
<span class="detail-value">{{ volumeWithDrops(selectedOilName) }}</span>
</div>
<div class="detail-row">
<span class="detail-label">会员价</span>
<span class="detail-value">{{ getMeta(selectedOilName)?.bottlePrice != null ? ('¥ ' + getMeta(selectedOilName).bottlePrice.toFixed(2)) : '--' }}</span>
</div>
<div class="detail-row">
<span class="detail-label">总滴数</span>
<span class="detail-value">{{ getMeta(selectedOilName)?.dropCount || '--' }}</span>
</div>
<div class="detail-row">
<span class="detail-label">每滴价格</span>
<span class="detail-label">{{ oilPriceUnit(selectedOilName) }}价格</span>
<span class="detail-value">{{ oils.pricePerDrop(selectedOilName) ? ('¥ ' + oils.pricePerDrop(selectedOilName).toFixed(4)) : '--' }}</span>
</div>
<div class="detail-row" v-if="getMeta(selectedOilName)?.retailPrice">
<span class="detail-label">零售价</span>
<span class="detail-value">¥ {{ getMeta(selectedOilName).retailPrice.toFixed(2) }}</span>
</div>
<div class="detail-row">
<span class="detail-label">ml价格</span>
<span class="detail-value">{{ oils.pricePerDrop(selectedOilName) ? ('¥ ' + (oils.pricePerDrop(selectedOilName) * DROPS_PER_ML).toFixed(2)) : '--' }}</span>
<div class="detail-row" v-if="getMeta(selectedOilName)?.retailPrice && getMeta(selectedOilName)?.dropCount">
<span class="detail-label">{{ oilPriceUnit(selectedOilName) }}价格</span>
<span class="detail-value">¥ {{ (getMeta(selectedOilName).retailPrice / getMeta(selectedOilName).dropCount).toFixed(4) }}</span>
</div>
</template>
<!-- ml产品 -->
<template v-else>
<div class="detail-row">
<span class="detail-label">总容量</span>
<span class="detail-value">{{ getMeta(selectedOilName)?.dropCount || '--' }}{{ oils.unitLabel(selectedOilName) }}</span>
</div>
<div class="detail-row">
<span class="detail-label">会员价</span>
<span class="detail-value">{{ getMeta(selectedOilName)?.bottlePrice != null ? ('¥ ' + getMeta(selectedOilName).bottlePrice.toFixed(2)) : '--' }}</span>
</div>
<div class="detail-row">
<span class="detail-label">{{ oils.unitLabel(selectedOilName) }}价格</span>
<span class="detail-value">{{ oils.pricePerDrop(selectedOilName) ? ('¥ ' + oils.pricePerDrop(selectedOilName).toFixed(2)) : '--' }}</span>
</div>
<div class="detail-row" v-if="getMeta(selectedOilName)?.retailPrice">
<span class="detail-label">零售价</span>
<span class="detail-value">¥ {{ getMeta(selectedOilName).retailPrice.toFixed(2) }}</span>
</div>
<div class="detail-row" v-if="getMeta(selectedOilName)?.retailPrice && getMeta(selectedOilName)?.dropCount">
<span class="detail-label">{{ oils.unitLabel(selectedOilName) }}价格</span>
<span class="detail-value">¥ {{ (getMeta(selectedOilName).retailPrice / getMeta(selectedOilName).dropCount).toFixed(2) }}</span>
</div>
</template>
<h4 style="margin:16px 0 8px">含此精油的配方</h4>
<h4 style="margin:16px 0 8px">含此{{ oils.isDropUnit(selectedOilName) ? '精油' : '产品' }}的配方</h4>
<div v-if="recipesWithOil.length" class="detail-recipes">
<div v-for="r in recipesWithOil" :key="r._id" class="detail-recipe-item">
<span class="dr-name">{{ r.name }}</span>
<span class="dr-drops">{{ getDropsForOil(r, selectedOilName) }}</span>
<span class="dr-drops">{{ getDropsForOil(r, selectedOilName) }}{{ oils.unitLabel(selectedOilName) }}</span>
</div>
</div>
<div v-else class="empty-hint">暂无使用此精油的配方</div>
@@ -260,7 +305,7 @@
</div>
<!-- Edit Oil Overlay -->
<div v-if="editingOilName" class="modal-overlay" @click.self="editingOilName = null" @keydown.enter="$event.isComposing || saveEditOil()">
<div v-if="editingOilName" class="modal-overlay" @mousedown.self="editingOilName = null" @keydown.enter="$event.isComposing || saveEditOil()">
<div class="modal-panel">
<div class="modal-header">
<h3>{{ editingOilName }}</h3>
@@ -387,12 +432,15 @@ const activeCardName = ref(null)
const activeCard = ref(null)
// Add oil form
const addType = ref('oil')
const newOilName = ref('')
const newOilEnName = ref('')
const newBottlePrice = ref(null)
const newVolume = ref('5')
const newCustomDrops = ref(null)
const newRetailPrice = ref(null)
const newProductAmount = ref(null)
const newProductUnit = ref('ml')
// Edit oil
const editingOilName = ref(null)
@@ -472,11 +520,24 @@ for (const [ml, drops] of Object.entries(VOLUME_OPTIONS)) {
DROPS_TO_VOLUME[drops] = ml + 'ml'
}
function oilPriceUnit(name) {
return oils.unitLabel(name)
}
function volumeLabel(dropCount, name) {
if (dropCount === 160) return '160颗'
if (!oils.isDropUnit(name)) return dropCount + oils.unitLabel(name)
return DROPS_TO_VOLUME[dropCount] || (dropCount + '滴')
}
function volumeWithDrops(name) {
const meta = getMeta(name)
if (!meta || !meta.dropCount) return '--'
if (!oils.isDropUnit(name)) return meta.dropCount + oils.unitLabel(name)
const ml = DROPS_TO_VOLUME[meta.dropCount]
if (ml) return `${ml}/${meta.dropCount}`
return meta.dropCount + '滴'
}
function chipStyle(name) {
const hasCard = !!getOilCard(name)
if (hasCard) return 'cursor:pointer;border-left:3px solid var(--sage);background:linear-gradient(90deg,var(--sage-mist),white)'
@@ -618,6 +679,29 @@ async function addOil() {
}
}
async function addProduct() {
if (!newOilName.value.trim() || !newProductAmount.value) return
try {
await oils.saveOil(
newOilName.value.trim(),
newBottlePrice.value || 0,
newProductAmount.value,
newRetailPrice.value || null,
newOilEnName.value.trim() || null,
newProductUnit.value
)
ui.showToast(`已添加: ${newOilName.value}`)
newOilName.value = ''
newOilEnName.value = ''
newBottlePrice.value = null
newProductAmount.value = null
newProductUnit.value = 'ml'
newRetailPrice.value = null
} catch (e) {
ui.showToast('添加失败: ' + (e.message || ''))
}
}
function editOil(name) {
editingOilName.value = name
editOilDisplayName.value = name
@@ -1026,12 +1110,24 @@ async function saveCardImage(name) {
}
/* ===== Add Oil Form ===== */
.add-type-tabs { display: flex; gap: 0; margin-bottom: 10px; }
.add-type-tab {
padding: 6px 20px; text-align: center; font-size: 13px; cursor: pointer;
border: 1.5px solid var(--border, #d4cfc7); background: #fff; color: var(--text-mid, #6b6375);
font-family: inherit;
}
.add-type-tab:first-child { border-radius: 8px 0 0 8px; }
.add-type-tab:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.add-type-tab.active { background: var(--sage, #7a9e7e); color: #fff; border-color: var(--sage, #7a9e7e); }
.add-oil-form {
margin-bottom: 16px;
padding: 14px;
background: var(--sage-mist, #eef4ee);
border-radius: 12px;
border: 1.5px solid var(--border, #e0d4c0);
display: flex;
flex-direction: column;
}
/* Hide number input spinners in add form */
.add-oil-form input[type="number"]::-webkit-inner-spin-button,

View File

@@ -171,7 +171,7 @@
/>
<div class="row-info" @click="editRecipe(r)">
<span class="row-name">{{ r.name }}</span>
<span v-if="getVolumeLabel(r.ingredients)" class="row-volume">{{ getVolumeLabel(r.ingredients) }}</span>
<span v-if="getVolumeLabel(r.ingredients, r.volume)" class="row-volume">{{ getVolumeLabel(r.ingredients, r.volume) }}</span>
<span class="row-tags">
<span v-for="t in [...(r.tags || [])].sort((a,b)=>a.localeCompare(b,'zh'))" :key="t" class="mini-tag">{{ t }}</span>
</span>
@@ -271,7 +271,7 @@
<div class="editor-section">
<table class="editor-table">
<thead>
<tr><th>精油</th><th>滴数</th><th>单价/</th><th>小计</th><th></th></tr>
<tr><th>成分</th><th>用量</th><th>单价</th><th>小计</th><th></th></tr>
</thead>
<tbody>
<tr v-for="(ing, i) in formEoIngredients" :key="'eo-'+i">
@@ -296,8 +296,13 @@
</div>
</div>
</td>
<td><input v-model.number="ing.drops" type="number" min="0.5" step="0.5" class="editor-drops" /></td>
<td class="ing-ppd">{{ ing.oil ? oils.fmtPrice(oils.pricePerDrop(ing.oil)) : '-' }}</td>
<td>
<div class="drops-with-unit">
<input v-model.number="ing.drops" type="number" min="0.5" step="0.5" class="editor-drops" />
<span class="unit-hint">{{ oils.unitLabel(ing.oil) }}</span>
</div>
</td>
<td class="ing-ppd">{{ ing.oil ? oils.fmtPrice(oils.pricePerDrop(ing.oil)) : '-' }}/{{ oils.unitLabel(ing.oil) }}</td>
<td class="ing-cost">{{ ing.oil && ing.drops ? oils.fmtPrice(oils.pricePerDrop(ing.oil) * ing.drops) : '-' }}</td>
<td><button class="remove-row-btn" @click="removeEoRow(i)"></button></td>
</tr>
@@ -772,8 +777,15 @@ function editRecipe(recipe) {
const coco = ings.find(i => i.oil === '椰子油')
if (coco) {
formCocoRow.value = { ...coco, _search: '椰子油', _open: false }
// Guess volume from total drops
const eoDrops = ings.filter(i => i.oil && i.oil !== '椰子油').reduce((s, i) => s + (i.drops || 0), 0)
// Use stored volume if available, otherwise guess from drops
if (recipe.volume) {
formVolume.value = recipe.volume
if (recipe.volume === 'custom') {
const totalDrops = eoDrops + coco.drops
formCustomVolume.value = Math.round(totalDrops / DROPS_PER_ML)
}
} else {
const totalDrops = eoDrops + coco.drops
const ml = totalDrops / DROPS_PER_ML
if (ml <= 2) formVolume.value = 'single'
@@ -783,6 +795,7 @@ function editRecipe(recipe) {
else if (Math.abs(ml - 20) < 3) formVolume.value = '20'
else if (Math.abs(ml - 30) < 6) formVolume.value = '30'
else { formVolume.value = 'custom'; formCustomVolume.value = Math.round(ml) }
}
// Guess dilution
if (eoDrops > 0 && coco.drops > 0) {
const ratio = Math.round(coco.drops / eoDrops)
@@ -867,7 +880,7 @@ function selectOil(ing, name) {
// Check for duplicate oil in current recipe
const existing = formIngredients.value.find(i => i !== ing && i.oil === name)
if (existing) {
ui.showToast(`已有「${name}」,请直接修改滴数`)
ui.showToast(`已有「${name}」,请直接修改用量`)
ing._open = false
return
}
@@ -1019,8 +1032,8 @@ async function checkDupName(name, ings, target = 'diary') {
return false
}
const existIngs = dupIngs.map(i => `${i.oil}${i.drops}`).join('、')
const newIngs = myIngs.map(i => `${i.oil}${i.drops}`).join('、')
const existIngs = dupIngs.map(i => `${i.oil}${i.drops}${oils.unitLabel(i.oil)}`).join('、')
const newIngs = myIngs.map(i => `${i.oil}${i.drops}${oils.unitLabel(i.oil)}`).join('、')
const ok = await showConfirm(
`${where}中已有同名配方「${currentName}」,内容不同:\n\n已有${existIngs}\n新的${newIngs}\n\n请改名后保存`,
{ okText: '改名', cancelText: '取消' }
@@ -1086,6 +1099,7 @@ async function saveCurrentRecipe() {
ingredients: mappedIngs,
note: formNote.value,
tags: formTags.value,
volume: formVolume.value || '',
}
try {
await recipeStore.saveRecipe(payload)
@@ -1450,15 +1464,34 @@ function openRecipeDetail(recipe) {
if (idx >= 0) previewRecipeIndex.value = idx
}
function getVolumeLabel(ingredients) {
function getVolumeLabel(ingredients, volume) {
// Priority 1: stored volume
if (volume) {
if (volume === 'single') return '单次'
if (volume === 'custom') return ''
if (/^\d+$/.test(volume)) return `${volume}ml`
return volume
}
// Priority 2: calculate from ingredients
const ings = ingredients || []
const coco = ings.find(i => i.oil === '椰子油')
if (!coco || !coco.drops) return ''
if (coco && coco.drops) {
const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0)
const ml = totalDrops / 18.6
if (ml <= 2) return '单次'
return `${Math.round(ml)}ml`
}
// Priority 3: sum portion products as ml
let totalMl = 0
let hasProduct = false
for (const ing of ings) {
if (!oils.isPortionUnit(ing.oil)) continue
hasProduct = true
totalMl += ing.drops || 0
}
if (hasProduct && totalMl > 0) return `${Math.round(totalMl)}ml`
return ''
}
function diaryMatchesPublic(d) {
const pub = recipeStore.recipes.find(r => r.name === d.name)
@@ -1563,7 +1596,7 @@ function recipesIdentical(a, b) {
}
function formatIngsCompare(ings) {
return (ings || []).map(i => `${i.oil} ${i.drops}`).join('、')
return (ings || []).map(i => `${i.oil} ${i.drops}${oils.unitLabel(i.oil)}`).join('、')
}
async function approveRecipe(recipe) {
@@ -1645,7 +1678,7 @@ async function exportExcel() {
return list.map(r => ({
'配方名称': r.name,
'标签': (r.tags || []).join('/'),
'精油成分': r.ingredients.map(i => `${i.oil}${i.drops}`).join('、'),
'精油成分': r.ingredients.map(i => `${i.oil}${i.drops}${oils.unitLabel(i.oil)}`).join('、'),
'成本': oils.fmtPrice(oils.calcCost(r.ingredients)),
'备注': r.note || '',
}))
@@ -2081,6 +2114,8 @@ watch(() => recipeStore.recipes, () => {
.editor-table td { padding: 6px 4px; border-bottom: 1px solid #f5f5f5; }
.editor-drops { width: 65px; padding: 6px 8px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; text-align: center; outline: none; font-family: inherit; }
.editor-drops:focus { border-color: #7ec6a4; }
.drops-with-unit { display: flex; align-items: center; gap: 2px; }
.unit-hint { font-size: 11px; color: #b0aab5; white-space: nowrap; }
.editor-input { padding: 8px 10px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; outline: none; font-family: inherit; width: 100%; box-sizing: border-box; }
.editor-input:focus { border-color: #7ec6a4; }
.editor-textarea { width: 100%; padding: 8px 10px; border: 1.5px solid #d4cfc7; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; resize: vertical; box-sizing: border-box; }