瀏覽代碼

[财务管理/账单发往] 更新: [财务管理/账单发往] v2 状态机对齐生产: 补AP申请发送态(send=CF→AP+写apply,AP→SD无推进接口待确认)、作废仅CG、去掉状态筛选(生产无state条件)、加多选批量确认/批量申请发送、明细弹窗对齐接口(仅应收+账期)、单元列标注接口暂不返回、修正明细接口参数名

lio 2 月之前
父節點
當前提交
f575461b5b
共有 3 個文件被更改,包括 40 次插入 和 26 次删除
  1. 2 2
      _meta.js
  2. 2 2
      _meta.json
  3. 36 22
      财务管理/账单发往.html

+ 2 - 2
_meta.js

@@ -49,7 +49,7 @@ window.PROTO_META = {
       "domain": "财务管理",
       "name": "账单发往",
       "file": "财务管理/账单发往.html",
-      "status": "v1",
+      "status": "v2 状态机对齐生产(AP申请发送/批量/仅CG作废)",
       "updated": "2026-08-26",
       "initialSource": {
         "type": "墨刀",
@@ -57,7 +57,7 @@ window.PROTO_META = {
         "desc": "账单相关画板·账单发送子页"
       },
       "liveUrl": "",
-      "related": "任务11214二期;代码:service-bill BillSendRecordServiceImpl.generateBillSendRecord"
+      "related": "任务11214二期;代码:service-bill BillSendRecordServiceImpl.generateBillSendRecord;墨刀原型无此页(菜单为账单处理),本页按生产代码重构"
     }
   ]
 };

+ 2 - 2
_meta.json

@@ -48,7 +48,7 @@
       "domain": "财务管理",
       "name": "账单发往",
       "file": "财务管理/账单发往.html",
-      "status": "v1",
+      "status": "v2 状态机对齐生产(AP申请发送/批量/仅CG作废)",
       "updated": "2026-08-26",
       "initialSource": {
         "type": "墨刀",
@@ -56,7 +56,7 @@
         "desc": "账单相关画板·账单发送子页"
       },
       "liveUrl": "",
-      "related": "任务11214二期;代码:service-bill BillSendRecordServiceImpl.generateBillSendRecord"
+      "related": "任务11214二期;代码:service-bill BillSendRecordServiceImpl.generateBillSendRecord;墨刀原型无此页(菜单为账单处理),本页按生产代码重构"
     }
   ]
 }

+ 36 - 22
财务管理/账单发往.html

@@ -10,11 +10,15 @@
   二期变化(本原型核心):
   1.[生成账单]动作内部插入包额结算:圈定前先算超额、生成公共事业管理费(GG)收费项
   2.发往明细出现GG补收行(系统性费项,账期=生成日单日,强制挂包额费项所在发往组)
-  3.示例数据与包额管理原型跨页对齐(小米2026-09超额300的GG行在已发送记录可见)
+  3.示例数据与包额管理原型跨页对齐(小米2026-09超额300的GG行在申请发送记录可见)
   口径红线:
   1.圈定=付款截止日≤本月末(无下界)且未结清的历史滚动账单;C=本期,O=往期欠费
   2.重新生成=删除本月未确认记录重建;GG同合同+同生成月幂等不重复
-  3.状态机:CG待确认→CF已确认→SD已发送;旁路ZF作废;操作按钮按状态显隐
+  3.状态机:CG待确认→CF已确认→AP申请发送→SD已发送;作废仅CG态(ZF)
+    【生产现状】send接口 CF→AP 并写 bill_send_record_apply 记录;AP→SD 当前无推进接口(apply表无消费方,待业务确认闭环)
+    【批量】_confirm/_send 均支持 ids 逗号分隔批量;作废 _cancel 仅单条
+    【查询】_search 无 state 条件,状态筛选生产暂不支持
+    【单元列】列表 VO unitName 生产传 null,接口暂不返回
 ============================================================ -->
 <style>
   * { margin:0; padding:0; box-sizing:border-box; }
@@ -70,6 +74,7 @@
   .tag-green { background:#f0fdf4; color:#16a34a; }
   .tag-red { background:#fef2f2; color:#dc2626; }
   .tag-gray { background:#f4f4f5; color:#909399; }
+  .tag-cyan { background:#ecfeff; color:#0891b2; }
   .op-link { color:#2563eb; cursor:pointer; margin-right:10px; }
   .op-link:hover { text-decoration:underline; }
   .op-link.danger { color:#dc2626; }
@@ -174,8 +179,7 @@
       <div class="card">
         <div class="query-row">
           <div class="field"><label>信息检索<i class="note" data-tip="信息检索\n接口:keyword(模糊匹配)\n范围:客户名称/合同编号/发往单号"></i></label><input type="text" id="kw" placeholder="客户名称 / 合同编号 / 发往单号"></div>
-          <div class="field"><label>月份<i class="note" data-tip="月份条件\n接口:month_period,格式 yyyy-MM\n语义:记录的生成月(生成动作发生的自然月),非账期月"></i></label><select id="qMonth"><option value="">年月</option><option>2026-10</option><option>2026-09</option></select></div>
-          <div class="field"><label>状态<i class="note" data-tip="状态条件\n接口:state\n枚举:CG待确认 / CF已确认 / SD已发送 / ZF作废"></i></label><select id="qState"><option value="">全部</option><option value="CG">待确认</option><option value="CF">已确认</option><option value="SD">已发送</option><option value="ZF">作废</option></select></div>
+          <div class="field"><label>月份<i class="note" data-tip="月份条件\n接口:month_period,格式 yyyy-MM\n语义:记录的生成月(生成动作发生的自然月),非账期月\n【查询现状】_search 仅支持 keyword/月份/合同/项目/楼栋等,无状态条件(状态筛选生产暂不支持)"></i></label><select id="qMonth"><option value="">年月</option><option>2026-10</option><option>2026-09</option></select></div>
           <button class="btn btn-primary" onclick="render()">查询</button>
           <button class="btn btn-plain" onclick="resetQuery()">重置</button>
         </div>
@@ -183,16 +187,19 @@
 
       <!-- 列表 -->
       <div class="table-wrap">
-        <div class="table-title">账单发往记录<span class="tip">按月生成 · 按合同发往组打包 · 确认后发送</span>
+        <div class="table-title">账单发往记录<span class="tip">按月生成 · 按合同发往组打包 · 确认后申请发送</span>
           <span style="display:flex;gap:8px;align-items:center">
+            <button class="btn btn-plain" onclick="batchOp('confirm')">批量确认<i class="note" data-tip="批量确认\n接口:PUT /v1/hl/bill-send-records/_confirm?id=ids(逗号分隔)\n条件:选中行全部为 CG 待确认\n【注意】生产逐条校验,存在非CG会整体失败,故按钮仅全CG可用"></i></button>
+            <button class="btn btn-plain" onclick="batchOp('send')">批量申请发送<i class="note" data-tip="批量申请发送\n接口:PUT /v1/hl/bill-send-records/_send?id=ids(逗号分隔)\n条件:选中行全部为 CF 已确认\n结果:CF→AP(申请发送)+写bill_send_record_apply;AP→SD 待业务确认闭环"></i></button>
             <button class="btn btn-primary" onclick="alert('触发生成,见标注①时序')">生成账单发送记录<i class="note" data-tip="★生成动作 · 二期完整时序(自内向外)\n1.清理:删除本月(month_period)生成的未确认记录(重新生成语义,已确认/已发送的保留)\n2.【二期·包额结算】:逐合同圈定本期收费项(C型)∩包额费项清单→Σ应收−包额额度→超额>0生成一条公共事业管理费(GG)收费项账单(账期=生成日当天,三件套齐全,同合同+同生成月幂等)\n3.圈定账单:valid=Y 且 付款截止日≤本月末 且 支付状态∈{WP未付,PPE部分支付}\n【口径】截止日条件无下界=历史滚动欠费全部纳入;已结清(APE)不圈\n4.防重:排除本月已生成过发往明细的账单\n5.分组:按合同发送配置(sendConfig)的费项清单匹配入组;GG强制挂包额费项所在发往组(存量合同免配置兜底)\n6.落库:每组一条发往记录(状态CG)+明细行(C本期/O往期分型)\n触发:手动点击(租户级批处理,无单合同粒度)"></i></button>
             <button class="btn btn-note" id="noteBtn" onclick="toggleNotes()">ⓘ 逻辑标注</button>
           </span>
         </div>
         <table>
           <thead><tr>
-            <th>序号</th><th>发往单号<i class="note" data-tip="发往单号\n字段:no\n规则:日期流水号(生成时分配,重新生成会换号)"></i></th><th>月份<i class="note" data-tip="生成月\n字段:month_period = 生成动作发生的自然月(yyyy-MM)\n【注意】是生成月,不是账期月;同月可反复生成(删未确认重建)"></i></th><th>客户名称<i class="note" data-tip="客户名称\n字段:customer_name(取该组第一条账单的合同客户)"></i></th><th class="c-mcode">合同编号<i class="note" data-tip="合同编号\n字段:contract_mcode"></i></th><th class="c-contractname">合同名称</th><th>项目</th><th class="c-unit">单元</th><th>发往组<i class="note" data-tip="发往组\n字段:send_config_name\n来源:合同发送配置(组名+费项清单+邮箱/地址),一个合同可配多组\n分组:费项按费项配置id精确匹配进组(isContainExpense)\n【GG兜底】公共事业管理费强制挂包额费项所在组,不依赖配置"></i></th>
-            <th>包含收费项<i class="note" data-tip="包含收费项\n字段:expense_names\n内容:该组明细内费项 distinct 名称\n【GG】补收的公共事业管理费会出现在此(其账期为生成日单日)"></i></th><th class="num">应收金额(元)<i class="note note-r" data-tip="应收金额\n字段:amount_receive = 组内明细应收合计\n口径:C本期+O往期欠费全量(未结清的滚动累计)"></i></th><th class="num c-pay">已收金额(元)</th><th class="num">剩余金额(元)<i class="note note-r" data-tip="剩余金额\n公式:rest_amount = 应收 − 已收"></i></th><th>状态<i class="note" data-tip="状态机\nCG待确认(生成初态,蓝)→CF已确认(绿)→SD已发送(灰蓝)\n旁路:ZF作废(灰)\n流转接口:_confirm确认 / _send发送 / _cancel作废"></i></th><th class="c-ctime">创建时间<i class="note" data-tip="创建时间\n字段:create_time(生成时)\n另有:confirm_time确认时间 / send_time发送时间(状态推进时回填)"></i></th><th style="width:190px">操作<i class="note note-r" data-tip="操作按钮按状态显隐\nCG待确认:查看明细 / 确认 / 作废\nCF已确认:查看明细 / 发送 / 作废\nSD已发送:查看明细\nZF作废:查看明细\n【说明】发送走通知渠道(邮箱/地址取发往组配置)"></i></th>
+            <th style="width:32px"><input type="checkbox" onclick="toggleAll(this)" title="全选(仅CG/CF可勾选)"></th>
+            <th>序号</th><th>发往单号<i class="note" data-tip="发往单号\n字段:no(接口字段名 billNo)\n规则:日期流水号(生成时分配,重新生成会换号)"></i></th><th>月份<i class="note" data-tip="生成月\n字段:month_period = 生成动作发生的自然月(yyyy-MM)\n【注意】是生成月,不是账期月;同月可反复生成(删未确认重建)"></i></th><th>客户名称<i class="note" data-tip="客户名称\n字段:customer_name(取该组第一条账单的合同客户)"></i></th><th class="c-mcode">合同编号<i class="note" data-tip="合同编号\n字段:contract_mcode"></i></th><th class="c-contractname">合同名称</th><th>项目</th><th class="c-unit">单元<i class="note" data-tip="单元名称\n字段:unit_name\n【生产现状】列表 VO unitName 传 null,接口暂不返回,待后端补齐后展示"></i></th><th>发往组<i class="note" data-tip="发往组\n字段:send_config_name\n来源:合同发送配置(组名+费项清单+邮箱/地址),一个合同可配多组\n分组:费项按费项配置id精确匹配进组(isContainExpense)\n【GG兜底】公共事业管理费强制挂包额费项所在组,不依赖配置"></i></th>
+            <th>包含收费项<i class="note" data-tip="包含收费项\n字段:expense_names\n内容:该组明细内费项 distinct 名称\n【GG】补收的公共事业管理费会出现在此(其账期为生成日单日)"></i></th><th class="num">应收金额(元)<i class="note note-r" data-tip="应收金额\n字段:amount_receive = 组内明细应收合计\n口径:C本期+O往期欠费全量(未结清的滚动累计)"></i></th><th class="num c-pay">已收金额(元)</th><th class="num">剩余金额(元)<i class="note note-r" data-tip="剩余金额\n公式:rest_amount = 应收 − 已收"></i></th><th>状态<i class="note" data-tip="状态机\nCG待确认(生成初态,蓝)→CF已确认(绿)→AP申请发送(青)→SD已发送(灰蓝)\n旁路:ZF作废(灰,仅CG可作废)\n流转接口:_confirm确认 / _send申请发送 / _cancel作废\n【生产现状】send后为AP(申请发送)并写apply记录;AP→SD暂无推进接口(待业务确认)"></i></th><th class="c-ctime">创建时间<i class="note" data-tip="创建时间\n字段:create_time(生成时)\n另有:confirm_time确认时间 / send_time发送时间(状态推进时回填)"></i></th><th style="width:190px">操作<i class="note note-r" data-tip="操作按钮按状态显隐\nCG待确认:查看明细 / 确认 / 作废\nCF已确认:查看明细 / 申请发送\nAP申请发送:查看明细\nSD已发送:查看明细\nZF作废:查看明细\n【批量】确认/申请发送走批量按钮(接口支持ids逗号分隔);作废仅单条、仅CG"></i></th>
           </tr></thead>
           <tbody id="tbody"></tbody>
         </table>
@@ -208,19 +215,18 @@
 <!-- 明细弹窗 -->
 <div class="mask" id="dlg">
   <div class="dialog">
-    <div class="dialog-head"><b id="dlgTitle">发往明细</b><span style="display:flex;align-items:center;gap:10px"><i class="note" data-tip="弹窗数据来源\n接口:GET /v1/hl/bill-send-record-detail?record_id={行id}\n结构:记录头(状态/组/金额) + 明细行列表"></i><span class="close" onclick="closeDlg()">✕</span></span></div>
+    <div class="dialog-head"><b id="dlgTitle">发往明细</b><span style="display:flex;align-items:center;gap:10px"><i class="note" data-tip="弹窗数据来源\n接口:GET /v1/hl/bill-send-record-detail?id={记录id}(批量:GET /v1/hl/bill-send-record-details?ids=,逗号分隔)\n结构:记录头(状态/组/金额) + 明细行列表\n【明细金额】生产 ExpenseItemVO 仅返回应收金额,已收/剩余需后端补传"></i><span class="close" onclick="closeDlg()">✕</span></span></div>
     <div class="summary" id="dlgSummary"></div>
     <div class="dialog-body">
       <h4>收费项明细 <span style="font-weight:400;color:#909399;font-size:12px">(C=本期收费项 · O=往期欠费 · 补收=公共事业管理费超额补收)</span><i class="note" data-tip="明细行类型(C/O分型)\nC本期:费项付款截止日 ≥ 生成月1号(当月到期)\nO往期:费项付款截止日 < 生成月1号(历史到期未付,滚动催收直到付清)\n补收(GG):包额超额时系统在生成时点动态生成,账期=生成日单日,恒为C型\n【红线】只有C型参与包额超额计算,O型不重复计入"></i></h4>
       <table>
-        <thead><tr><th>收费项名称</th><th>类型<i class="note" data-tip="类型标签\nC(绿)/O(橙)/补收(红)\n补收行=公共事业管理费,底色浅红高亮"></i></th><th>账单编号<i class="note" data-tip="账单编号\n字段:bill_no\n动作:可跳原账单(新版术语'收费项')详情"></i></th><th class="num">应收(元)</th><th class="num">已收(元)</th><th class="num">剩余(元)</th><th>账期<i class="note" data-tip="费项账期\n字段:bill_begin_date ~ bill_end_date\n【GG特征】补收行账期=生成日当天(单日),一眼可辨"></i></th></tr></thead>
+        <thead><tr><th>收费项名称</th><th>类型<i class="note" data-tip="类型标签\nC(绿)/O(橙)/补收(红)\n补收行=公共事业管理费,底色浅红高亮"></i></th><th>账单编号<i class="note" data-tip="账单编号\n字段:bill_no\n动作:可跳原账单(新版术语'收费项')详情"></i></th><th class="num">应收(元)<i class="note note-r" data-tip="明细应收\n字段:amount_receive\n【生产现状】明细行仅返回应收;已收/剩余接口未传(ExpenseItemVO 无),如需展示需后端补"></i></th><th>账期<i class="note" data-tip="费项账期\n字段:bill_begin_date ~ bill_end_date\n【GG特征】补收行账期=生成日当天(单日),一眼可辨"></i></th></tr></thead>
         <tbody id="dlgBody"></tbody>
       </table>
     </div>
     <div class="dialog-foot">
       <div class="totals" id="dlgTotals"></div>
       <div class="dialog-btns">
-        <button class="btn btn-plain" onclick="alert('发送至发往组配置的邮箱/地址')">发送通知</button>
         <button class="btn btn-primary" onclick="closeDlg()">关 闭</button>
       </div>
     </div>
@@ -229,7 +235,7 @@
 
 <script>
 /* ===== 示例数据(自洽:应收=明细求和;剩余=应收−已收;与包额管理原型跨页对齐) =====
-   小米2026-09:包额超额300→GG 300行(对应包额页"已补收"态)
+   小米2026-09:包额超额300→GG 300行(对应包额页"已补收"态),该记录已"申请发送"(AP)
    卓悦2026-10:包额超额180但发往未生成→本列表不出现(点生成时才会出现并补GG) */
 const DATA = [
   { no:1, sendNo:"ZD20261020-001", month:"2026-10", customer:"德润实业发展有限公司", mcode:"HTBH00004", contractName:"德润实业租赁合同",
@@ -252,7 +258,7 @@ const DATA = [
       { name:"水费", type:"C", billNo:"ZD20261000021", amount:260, payed:0, period:"2026-10-01 至 2026-10-31" }
     ] },
   { no:4, sendNo:"ZD20260920-001", month:"2026-09", customer:"小米科技有限公司", mcode:"HTBH00001", contractName:"恒隆租赁合同",
-    project:"恒隆一期", unit:"恒隆一期-1-107", group:"租户联系组", expenseNames:"水费、电费、公共事业管理费", amountReceive:1100, amountPayed:800, state:"SD", ctime:"2026-09-20 10:00:00",
+    project:"恒隆一期", unit:"恒隆一期-1-107", group:"租户联系组", expenseNames:"水费、电费、公共事业管理费", amountReceive:1100, amountPayed:800, state:"AP", ctime:"2026-09-20 10:00:00",
     items:[
       { name:"水费",           type:"C",  billNo:"ZD20260900001", amount:530, payed:530, period:"2026-09-01 至 2026-09-30" },
       { name:"电费",           type:"C",  billNo:"ZD20260900002", amount:270, payed:270, period:"2026-08-15 至 2026-09-14" },
@@ -264,16 +270,15 @@ const DATA = [
       { name:"水费", type:"C", billNo:"ZD20260900021", amount:240, payed:0, period:"2026-09-01 至 2026-09-30" }
     ] }
 ];
-const STATE = { CG:["待确认","tag-blue"], CF:["已确认","tag-green"], SD:["已发送","tag-gray"], ZF:["作废","tag-gray"] };
+const STATE = { CG:["待确认","tag-blue"], CF:["已确认","tag-green"], AP:["申请发送","tag-cyan"], SD:["已发送","tag-gray"], ZF:["作废","tag-gray"] };
 const TYPE  = { C:["本期","tag-green"], O:["往期欠费","tag-orange"], GG:["补收","tag-red"] };
 const fmt = n => n == null ? "-" : n.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2});
 
 function rows(){
   const kw=(document.getElementById("kw").value||"").trim();
-  const m=document.getElementById("qMonth").value, s=document.getElementById("qState").value;
+  const m=document.getElementById("qMonth").value;
   return DATA.filter(r=>{
     if(m && r.month!==m) return false;
-    if(s && r.state!==s) return false;
     if(!kw) return true;
     return [r.customer,r.mcode,r.sendNo,r.contractName].some(x=>x&&x.includes(kw));
   });
@@ -283,11 +288,13 @@ function render(){
   tb.innerHTML=""; empty.style.display=list.length?"none":"block";
   list.forEach(r=>{
     const st=STATE[r.state], rest=r.amountReceive-r.amountPayed;
+    const opable = (r.state==="CG" || r.state==="CF");
     let ops = `<span class="op-link" onclick='openDlg(${JSON.stringify(r.no)})'>查看明细</span>`;
-    if(r.state==="CG") ops += `<span class="op-link" onclick="alert('确认:CG→CF')">确认</span><span class="op-link danger" onclick="alert('作废')">作废</span>`;
-    if(r.state==="CF") ops += `<span class="op-link" onclick="alert('发送:→SD,通知至发往组邮箱/地址')">发送</span><span class="op-link danger" onclick="alert('作废')">作废</span>`;
+    if(r.state==="CG") ops += `<span class="op-link" onclick="alert('确认:CG→CF(接口 _confirm 单条)')">确认</span><span class="op-link danger" onclick="alert('作废:CG→ZF(接口 _cancel,仅CG可作废)')">作废</span>`;
+    if(r.state==="CF") ops += `<span class="op-link" onclick="alert('申请发送:CF→AP(接口 _send,写apply记录)')">申请发送</span>`;
     const tr=document.createElement("tr");
     tr.innerHTML = `
+      <td><input type="checkbox" class="row-cb" value="${r.no}" ${opable?"":"disabled"}></td>
       <td>${r.no}</td>
       <td><a class="link" onclick='openDlg(${JSON.stringify(r.no)})'>${r.sendNo}</a></td>
       <td>${r.month}</td>
@@ -308,10 +315,19 @@ function render(){
   const pg=document.getElementById("pager");
   pg.innerHTML = `<span>共 ${list.length} 条</span><div class="pg">‹</div><div class="pg cur">1</div><div class="pg">›</div>`;
 }
-function resetQuery(){ ["kw","qMonth","qState"].forEach(i=>document.getElementById(i).value=""); render(); }
+function resetQuery(){ ["kw","qMonth"].forEach(i=>document.getElementById(i).value=""); render(); }
+function toggleAll(cb){ document.querySelectorAll(".row-cb").forEach(x=>{ if(!x.disabled) x.checked=cb.checked; }); }
+function batchOp(op){
+  const sel=[...document.querySelectorAll(".row-cb:checked")].map(x=>x.value);
+  if(!sel.length){ alert("请先勾选记录(仅CG/CF可勾选)"); return; }
+  const states=sel.map(v=>DATA.find(r=>r.no==v).state);
+  if(op==="confirm" && !states.every(s=>s==="CG")){ alert("批量确认仅支持全部为待确认(CG):生产逐条校验,存在非CG将整体失败"); return; }
+  if(op==="send" && !states.every(s=>s==="CF")){ alert("批量申请发送仅支持全部为已确认(CF)"); return; }
+  alert((op==="confirm"?"确认:CG→CF":"申请发送:CF→AP(写apply)")+"\n接口参数 id="+sel.join(",")+"(逗号分隔批量)");
+}
 function openDlg(no){
   const r=DATA.find(x=>x.no===no), st=STATE[r.state];
-  const receive=r.items.reduce((s,i)=>s+i.amount,0), payed=r.items.reduce((s,i)=>s+i.payed,0);
+  const receive=r.items.reduce((s,i)=>s+i.amount,0);
   document.getElementById("dlgTitle").textContent=`发往明细 - ${r.sendNo}`;
   document.getElementById("dlgSummary").innerHTML = `
     <div class="cell"><div class="k">客户名称</div><div class="v">${r.customer}</div></div>
@@ -324,13 +340,11 @@ function openDlg(no){
     return `<tr class="${i.type==='GG'?'gg-row':''}"><td>${i.name}</td>
       <td><span class="tag ${t[1]}">${t[0]}</span></td>
       <td><a class="link" onclick="alert('跳转:原账单详情 ${i.billNo}')">${i.billNo}</a></td>
-      <td class="num">${fmt(i.amount)}</td><td class="num">${fmt(i.payed)}</td><td class="num">${fmt(i.amount-i.payed)}</td>
+      <td class="num">${fmt(i.amount)}</td>
       <td>${i.period}</td></tr>`;
   }).join("");
   document.getElementById("dlgTotals").innerHTML = `
     <div class="t"><div class="k">应收合计<i class="note" data-tip="应收合计\n公式:amount_receive = Σ 明细行应收\n口径:C+O+GG 全量"></i></div><div class="v">${fmt(receive)}</div></div>
-    <div class="t"><div class="k">已收合计</div><div class="v">${fmt(payed)}</div></div>
-    <div class="t"><div class="k">剩余合计<i class="note" data-tip="剩余合计\n公式:rest_amount = 应收 − 已收"></i></div><div class="v">${fmt(receive-payed)}</div></div>
     <div class="t"><div class="k">其中补收(GG)<i class="note" data-tip="GG补收小计\n公式:Σ type=GG 明细行应收\n来源:包额超额自动生成,金额=超额值\n【幂等】同合同+同生成月只生成一次\n【例】本单300元=包额管理页2026-09超额金额(跨页对齐)"></i></div><div class="v" style="color:#dc2626">${fmt(r.items.filter(i=>i.type==='GG').reduce((s,i)=>s+i.amount,0))}</div></div>`;
   document.getElementById("dlg").classList.add("show");
 }