增加货盘新增改名与启停管理,保留历史库存关联

This commit is contained in:
summer committed 2026-11-08 03:30:58 +08:00
1 parent 337b2a709f
commit ba15795f0a
29 files changed
+748 -218

No files matched your search

+3 -3
View File
@@ -70,7 +70,7 @@ function orderChangeLineValue(line,kind){
if(kind==='quantity')return line.unit==='g'?grams(line.quantity)+'g':String(line.quantity)+'件';
if(kind==='sale')return money(line.sale);
if(kind==='pricing')return line.goldPrice!=null?`销售金价 ${money(line.goldPrice)}/克\n${line.laborMode==='gram'?'销售克工费':'销售件工费'} ${money(line.laborRate)}${line.laborMode==='gram'?'/克':'/件'}\n件数 ${line.pieces??'未填写'}`:`手填基础金额 ${money(line.baseSale??line.sale)}`;
if(kind==='pocket')return line.pocket||'外配/不扣黄金';
if(kind==='pocket')return pocketLabel(line.pocket)||'外配/不扣黄金';
if(kind==='charges')return line.charges?.length?line.charges.map(item=>`${item.name}:${money(item.amount)}`).join('\n'):'无附加收费';
if(kind==='cost')return money(line.cost);
if(kind==='material'){
@@ -99,13 +99,13 @@ function orderChangeActionSummaryHTML(request){
if(input.payer)facts.push(['实际付款人',orderChangePayer(input.payer)]);
if(input.note)facts.push(['费用项目/说明',input.note]);
if(input.reference)facts.push(['退款凭据备注',input.reference]);
if(Array.isArray(input.returnPockets))facts.push(['退货实物去向',input.returnPockets.map((pocket,index)=>`${request.before.lines[index]?.name||'商品 '+(index+1)}:${pocket||'退供应商/不留黄金货盘'}`).join('\n')]);
if(Array.isArray(input.returnPockets))facts.push(['退货实物去向',input.returnPockets.map((pocket,index)=>`${request.before.lines[index]?.name||'商品 '+(index+1)}:${pocketLabel(pocket)||'退供应商/不留黄金货盘'}`).join('\n')]);
if(Array.isArray(input.fee_items))facts.push(['本次旧费用',input.fee_items.map(item=>`${item.note||'费用'}:${orderChangeInputMoney(item.amount)} · ${orderChangePayer(item.payer)}支付`).join('\n')]);
return `<section class="order-change-action-summary"><h3>本次申请动作</h3><dl class="order-change-action-facts">${facts.map(([title,value])=>`<div><dt>${e(title)}</dt><dd>${orderChangeCell(value)}</dd></div>`).join('')}</dl><p class="small muted">下方对照为服务器试算;批准后才登记这笔变更,不会由系统发起真实收款、退款或转账。</p></section>`;
}
function orderChangeInventoryHTML(inventory){
if(!inventory)return '';
const table=(title,rows,changes=false)=>`<h3>${title}</h3>${rows.length?`<div class="table-wrap"><table class="order-change-inventory"><thead><tr><th>日期</th><th>货盘</th>${changes?'':'<th>库存业务</th>'}<th class="number">${changes?'本次增减':'已记克重'}</th></tr></thead><tbody>${rows.map(row=>`<tr><td>${e(row.date)}</td><td>${e(row.pocket)}</td>${changes?'':`<td>${e(row.kind||'未提供')}</td>`}<td class="number">${row.mg>0?'+':''}${grams(row.mg)}g</td></tr>`).join('')}</tbody></table></div>`:`<p class="small muted">${changes?'本次没有黄金货盘净变动。':'没有本单库存流水。'}</p>`}`;
const table=(title,rows,changes=false)=>`<h3>${title}</h3>${rows.length?`<div class="table-wrap"><table class="order-change-inventory"><thead><tr><th>日期</th><th>货盘</th>${changes?'':'<th>库存业务</th>'}<th class="number">${changes?'本次增减':'已记克重'}</th></tr></thead><tbody>${rows.map(row=>`<tr><td>${e(row.date)}</td><td>${e(pocketLabel(row.pocket))}</td>${changes?'':`<td>${e(row.kind||'未提供')}</td>`}<td class="number">${row.mg>0?'+':''}${grams(row.mg)}g</td></tr>`).join('')}</tbody></table></div>`:`<p class="small muted">${changes?'本次没有黄金货盘净变动。':'没有本单库存流水。'}</p>`}`;
return `<section class="order-change-inventory-summary"><h3>库存原值与批准后变化</h3><p class="small muted">以下为本单各日期、货盘的库存流水;正数为增加,负数为减少。按件商品或退回供应商不计黄金货盘。</p>${table('原库存记录',inventory.before)}${table('同意后的库存记录',inventory.after)}${table('本次库存净变化',inventory.changes,true)}</section>`;
}
function orderChangePriceLockCostsHTML(before,after){