支持订单归属修改与麦麦复核

This commit is contained in:
summer committed 2026-10-26 20:25:31 +08:00
1 parent ab9d3009ea
commit b3b67c8003
17 files changed
+829 -32

No files matched your search

+8 -2
View File
@@ -124,6 +124,9 @@ function createApp(options={}){
if(materialPoolMatch&&!isPost){if(materialPoolMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.materialPoolDetail(materialPoolMatch[1]));}
if(route==='/api/price-locks'&&!isPost)return send(res,200,actorLedger.priceLocks(Object.fromEntries(url.searchParams)));
if(route==='/api/order-changes'&&!isPost)return send(res,200,actorLedger.orderChanges(Object.fromEntries(url.searchParams),actor));
if(route==='/api/order-ownership-changes'&&!isPost)return send(res,200,actorLedger.orderOwnershipChanges(Object.fromEntries(url.searchParams),actor));
const ownershipMatch=route.match(/^\/api\/order-ownership-changes\/([a-f0-9-]{36})(?:\/(approve|reject))?$/);
if(ownershipMatch&&!isPost){if(ownershipMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.orderOwnershipChange(ownershipMatch[1],actor));}
const changeMatch=route.match(/^\/api\/order-changes\/([a-f0-9-]{36})(?:\/(approve|reject))?$/);
if(changeMatch&&!isPost){if(changeMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.orderChangeRequest(changeMatch[1],actor));}
if(route==='/api/order-cancellations'&&!isPost)return send(res,200,actorLedger.orderCancellations(Object.fromEntries(url.searchParams),actor));
@@ -151,7 +154,7 @@ function createApp(options={}){
const reimbursementMatch=route.match(/^\/api\/reimbursements\/([a-f0-9-]{36})\/(update|approve|reject)$/);
if(route==='/api/paper-number'&&!isPost)return send(res,200,{number:actorLedger.paperNumber(url.searchParams.get('date')||today())});
const match=route.match(/^\/api\/orders\/([a-f0-9-]+)(?:\/([a-z]+))?$/);
if(match&&!isPost){if(match[2]==='public')return send(res,200,actorLedger.publicOrder(match[1]));if(match[2]==='edit')return send(res,200,actorLedger.orderEdit(match[1],actor));if(match[2]==='change')return send(res,200,actorLedger.orderChange(match[1],actor));if(match[2]==='cancellation')return send(res,200,actorLedger.orderCancellation(match[1],actor));if(!match[2])return send(res,200,actorLedger.detail(match[1]));fail('地址不存在',404);}
if(match&&!isPost){if(match[2]==='public')return send(res,200,actorLedger.publicOrder(match[1]));if(match[2]==='edit')return send(res,200,actorLedger.orderEdit(match[1],actor));if(match[2]==='change')return send(res,200,actorLedger.orderChange(match[1],actor));if(match[2]==='ownership')return send(res,200,actorLedger.orderOwnership(match[1],actor));if(match[2]==='cancellation')return send(res,200,actorLedger.orderCancellation(match[1],actor));if(!match[2])return send(res,200,actorLedger.detail(match[1]));fail('地址不存在',404);}
const recoveryPrintMatch=route.match(/^\/print\/recoveries\/([a-f0-9-]{36})$/);
if(recoveryPrintMatch&&!isPost){const dto=actorLedger.publicRecovery(recoveryPrintMatch[1],actor),print=dto.mode==='exchange'?exchangeCustomerPrintDocument:recoveryCustomerPrintDocument;return send(res,200,print(dto,actorLedger.meta('printing',defaults)),'text/html; charset=utf-8');}
if(route.startsWith('/print/')&&!isPost){const id=route.slice(7),order=actorLedger.detail(id);if(order.recovery_id){const dto=actorLedger.publicRecovery(order.recovery_id,actor);return send(res,200,exchangeCustomerPrintDocument(dto,actorLedger.meta('printing',defaults)),'text/html; charset=utf-8');}return send(res,200,receipt(actorLedger.publicOrder(id),actorLedger.meta('printing',defaults),url.searchParams.get('mode')),'text/html; charset=utf-8');}
@@ -190,6 +193,9 @@ function createApp(options={}){
if(route==='/api/after-sales')return actorLedger.saveAfterSale(b,actor);
if(changeMatch&&changeMatch[2]==='approve')return actorLedger.approveOrderChange(changeMatch[1],b,actor);
if(changeMatch&&changeMatch[2]==='reject')return actorLedger.rejectOrderChange(changeMatch[1],b,actor);
if(ownershipMatch&&ownershipMatch[2]==='approve')return actorLedger.approveOrderOwnership(ownershipMatch[1],b,actor);
if(ownershipMatch&&ownershipMatch[2]==='reject')return actorLedger.rejectOrderOwnership(ownershipMatch[1],b,actor);
if(match&&match[2]==='ownership')return actorLedger.changeOrderOwnership(match[1],b,actor);
if(match&&match[2]==='change')return actorLedger.requestOrderChange(match[1],b,actor);
if(cancellationMatch&&cancellationMatch[2]==='approve')return actorLedger.approveOrderCancellation(cancellationMatch[1],b,actor);
if(cancellationMatch&&cancellationMatch[2]==='reject')return actorLedger.rejectOrderCancellation(cancellationMatch[1],b,actor);
@@ -210,7 +216,7 @@ function createApp(options={}){
fail('地址不存在',404);
});return send(res,200,route==='/api/people-count'?peopleCountResponse(actorLedger,result,actor):result);
}
const assets={'/':'index.html','/app.js':'app.js','/order-copy.js':'order-copy.js','/order-templates.js':'order-templates.js','/order-templates-ui.js':'order-templates-ui.js','/order-edit-ui.js':'order-edit-ui.js','/order-cancellations-ui.js':'order-cancellations-ui.js','/order-changes-ui.js':'order-changes-ui.js','/daily-funds-ui.js':'daily-funds-ui.js','/team-funds-ui.js':'team-funds-ui.js','/cost-funding-ui.js':'cost-funding-ui.js','/price-locks-ui.js':'price-locks-ui.js','/material-pools-ui.js':'material-pools-ui.js','/recoveries-ui.js':'recoveries-ui.js','/inventory-changes-ui.js':'inventory-changes-ui.js','/credit-card-fees.js':'credit-card-fees.js','/calculations.js':'calculations.js','/fee-estimates.js':'fee-estimates.js','/app.css':'app.css','/print.js':'print.js'};const file=assets[route];if(!file||isPost)fail('地址不存在',404);
const assets={'/':'index.html','/app.js':'app.js','/order-copy.js':'order-copy.js','/order-templates.js':'order-templates.js','/order-templates-ui.js':'order-templates-ui.js','/order-edit-ui.js':'order-edit-ui.js','/order-cancellations-ui.js':'order-cancellations-ui.js','/order-changes-ui.js':'order-changes-ui.js','/order-ownership-ui.js':'order-ownership-ui.js','/daily-funds-ui.js':'daily-funds-ui.js','/team-funds-ui.js':'team-funds-ui.js','/cost-funding-ui.js':'cost-funding-ui.js','/price-locks-ui.js':'price-locks-ui.js','/material-pools-ui.js':'material-pools-ui.js','/recoveries-ui.js':'recoveries-ui.js','/inventory-changes-ui.js':'inventory-changes-ui.js','/credit-card-fees.js':'credit-card-fees.js','/calculations.js':'calculations.js','/fee-estimates.js':'fee-estimates.js','/app.css':'app.css','/print.js':'print.js'};const file=assets[route];if(!file||isPost)fail('地址不存在',404);
send(res,200,fs.readFileSync(path.join(__dirname,'public',file)),file.endsWith('.js')?'application/javascript; charset=utf-8':file.endsWith('.css')?'text/css; charset=utf-8':'text/html; charset=utf-8');
}catch(e){if(!res.headersSent)send(res,e.status||400,{error:e.status||e.message?.startsWith('打印')?e.message:(e.code?.startsWith('SQLITE')?'保存失败,请保留操作内容并联系维护者':e.message||'操作失败')});else res.end();}
});