fix(wallet): 充值登记显示层——msg带回余额/累计充值前后值(登记即见随之改变)+弹窗改VScrollPanel填充防按钮溢出不可点+弹窗放大

This commit is contained in:
yumoqing 2026-09-15 17:23:12 +08:00
parent 123e4aaa74
commit 0335083b71
3 changed files with 18 additions and 7 deletions

View File

@ -61,8 +61,8 @@
"target": "PopupWindow",
"popup_options": {
"title": "充值登记",
"width": "46%",
"height": "52%",
"width": "52%",
"height": "62%",
"resizable": true
},
"options": {

View File

@ -734,7 +734,12 @@ async def govern_settle(ctx: dict, ok_call: bool, note: str = '', usages: dict =
# ────────────────────────── 充值 ──────────────────────────
async def recharge_account(account_id: str, amount, note: str = '', operator: str = ''):
"""供应商账号充值(成本侧钱包)。返回 (ok, msg)。"""
"""供应商账号充值登记(成本侧钱包)。返回 (ok, msg)。
真实充值动作在供应商侧完成本平台只做登记balance += 金额
total_recharge += 金额 recharge 流水msg 带回变动前后值
余额/累计充值 前端无需再查即可展示随之改变
"""
try:
amount = float(amount)
except (TypeError, ValueError):
@ -743,17 +748,22 @@ async def recharge_account(account_id: str, amount, note: str = '', operator: st
return False, '充值金额必须大于 0'
db, dbname = _get_db()
async with db.sqlorContext(dbname) as sor:
recs = await sor.sqlExe("SELECT id FROM llm_account WHERE id=${i}$", {"i": account_id})
recs = await sor.sqlExe(
"SELECT id, balance, total_recharge FROM llm_account WHERE id=${i}$",
{"i": account_id})
await sor.sqlExe("COMMIT", {})
if not recs:
return False, '账号不存在'
old_bal = float(recs[0]['balance'] or 0)
old_tot = float(recs[0]['total_recharge'] or 0)
await sor.sqlExe(
"UPDATE llm_account SET balance=balance+${a}$, total_recharge=total_recharge+${a}$ "
"WHERE id=${i}$", {"a": amount, "i": account_id})
await sor.sqlExe("COMMIT", {})
await _write_recharge_usage(sor, '', '', account_id, amount, note, operator)
_govern_cache.clear()
return True, '账号充值 %.4f 成功' % amount
return True, ('账号充值 %.4f 成功(余额 %.4f%.4f,累计充值 %.4f%.4f'
% (amount, old_bal, old_bal + amount, old_tot, old_tot + amount))
async def recharge_org(org_id: str, amount, note: str = '', operator: str = ''):

View File

@ -78,9 +78,10 @@ do_js = (_read_input_js('llm_acc_amt')
+ "else{new bricks.Message({title:'充值失败',message:(d&&(d.message||d.error))||('请求失败 HTTP '+r.status)}).open();}")
return {
"widgettype": "VBox",
"widgettype": "VScrollPanel",
"id": "llm_acc_recharge_box",
"options": {"width": "100%", "height": "100%", "padding": "16px", "gap": "12px"},
"options": {"css": "filler", "width": "100%", "height": "100%",
"padding": "14px", "gap": "12px"},
"subwidgets": [
{"widgettype": "MdWidget", "options": {"mdtext": '\n'.join(head_md), "width": "100%"}},
{"widgettype": "HBox",