调整当天订单审批规则并完善订单复核状态展示

This commit is contained in:
summer committed 2026-10-23 11:58:19 +08:00
1 parent a506fb1228
commit 8a4d1df248
19 files changed
+545 -105

No files matched your search

+3 -3
View File
@@ -112,7 +112,7 @@ function projection(ledger,id){
function eligibility(ledger,order,action){
const blocked=pendingReason(ledger,order.id);if(blocked)return blocked;
if(action==='edit')return '';
if(order.cancellationApproved)return '本单已审批作废,不能新增费用、收退款、退货或成本';
if(order.cancellationApproved)return '本单已作废,不能新增费用、收退款、退货或成本';
if(action==='expense'&&order.status==='draft')return '请先确认订单,再申请补记实际费用';
if(action==='fees'&&(order.status!=='confirmed'||!order.pendingFees.length))return '本单没有待核实的附加成本';
if(action==='cost'&&order.status!=='confirmed')return '只有待交付订单可以申请补录成本';
@@ -121,8 +121,8 @@ function eligibility(ledger,order,action){
return '';
}
function detail(ledger,id,actor,env){
activeActor(actor,env);const order=ledger.detail(id),reason=pendingReason(ledger,id),actions=Object.fromEntries(Object.keys(ACTION_LABELS).map(action=>{const why=eligibility(ledger,order,action);return [action,{eligible:!why,reason:why}];})),requests=ledger.rows('SELECT * FROM order_changes WHERE order_id=? ORDER BY created DESC,rowid DESC',id).map(row=>rowDetail(ledger,row,actor));
return {eligible:!reason,reason,actions,revision:order.revision,pending:requests.find(row=>row.status==='pending')||null,requests,canApprove:actor.role==='owner'};
activeActor(actor,env);const order=ledger.detail(id),reason=pendingReason(ledger,id),directActionDate=env.today(),actions=Object.fromEntries(Object.keys(ACTION_LABELS).map(action=>{const why=eligibility(ledger,order,action);return [action,{eligible:!why,reason:why,directToday:!why&&['expense','fees','refund','return'].includes(action)&&order.date===directActionDate}];})),requests=ledger.rows('SELECT * FROM order_changes WHERE order_id=? ORDER BY created DESC,rowid DESC',id).map(row=>rowDetail(ledger,row,actor));
return {eligible:!reason,reason,actions,directActionDate,revision:order.revision,pending:requests.find(row=>row.status==='pending')||null,requests,canApprove:actor.role==='owner'};
}
function list(ledger,query,actor,env){
activeActor(actor,env);const status=env.pick(query.status??'pending',['pending','approved','rejected','all'],'修改审批状态');