支持多商品锁价及待交付修改作废审批
This commit is contained in:
1 parent
1cbcdc728c
commit
337b2a709f
28 files changed
+1187
-344
No files matched your search
+11
-3
@@ -147,6 +147,9 @@ function createApp(options={}){
|
||||
const materialPoolMatch=route.match(/^\/api\/material-pools\/(\d{4}-\d{2}-\d{2})(?:\/(settlement))?$/);
|
||||
if(materialPoolMatch&&!isPost){if(materialPoolMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.materialPoolDetail(materialPoolMatch[1],Object.fromEntries(url.searchParams),actor));}
|
||||
if(route==='/api/price-locks'&&!isPost)return send(res,200,actorLedger.priceLocks(Object.fromEntries(url.searchParams)));
|
||||
if(route==='/api/price-lock-changes'&&!isPost)return send(res,200,actorLedger.priceLockChanges(Object.fromEntries(url.searchParams),actor));
|
||||
const lockChangeMatch=route.match(/^\/api\/price-lock-changes\/([a-f0-9-]{36})(?:\/(approve|reject))?$/);
|
||||
if(lockChangeMatch&&!isPost){if(lockChangeMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.priceLockChange(lockChangeMatch[1],actor));}
|
||||
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))?$/);
|
||||
@@ -156,8 +159,8 @@ function createApp(options={}){
|
||||
if(route==='/api/order-cancellations'&&!isPost)return send(res,200,actorLedger.orderCancellations(Object.fromEntries(url.searchParams),actor));
|
||||
const cancellationMatch=route.match(/^\/api\/order-cancellations\/([a-f0-9-]{36})(?:\/(approve|reject))?$/);
|
||||
if(cancellationMatch&&!isPost){if(cancellationMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.orderCancellationRequest(cancellationMatch[1],actor));}
|
||||
const lockMatch=route.match(/^\/api\/price-locks\/([a-f0-9-]+)(?:\/(deliver))?$/);
|
||||
if(lockMatch&&!isPost){if(lockMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.priceLockDetail(lockMatch[1]));}
|
||||
const lockMatch=route.match(/^\/api\/price-locks\/([a-f0-9-]+)(?:\/(deliver|edit-context|edit|cancel|change-requests))?$/);
|
||||
if(lockMatch&&!isPost){if(lockMatch[2]==='edit-context')return send(res,200,actorLedger.priceLockEdit(lockMatch[1],actor));if(lockMatch[2])fail('地址不存在',404);return send(res,200,actorLedger.priceLockDetail(lockMatch[1]));}
|
||||
if(route==='/api/inventory'&&!isPost)return send(res,200,{...actorLedger.inventoryStatus(actor),automaticSnapshot:automaticSnapshots.status()});
|
||||
if(route==='/api/inventory/movements/export.xlsx'&&!isPost){
|
||||
const file=inventoryMovementsFile(actorLedger.inventoryMovementsExport(Object.fromEntries(url.searchParams)),today());
|
||||
@@ -225,6 +228,11 @@ function createApp(options={}){
|
||||
if(materialPoolMatch&&materialPoolMatch[2]==='settlement')return actorLedger.settleMaterialPool(materialPoolMatch[1],b,actor);
|
||||
if(route==='/api/price-locks')return actorLedger.createPriceLock(b,actor);
|
||||
if(lockMatch&&lockMatch[2]==='deliver')return actorLedger.deliverPriceLock(lockMatch[1],b,actor);
|
||||
if(lockMatch&&lockMatch[2]==='edit')return actorLedger.editPriceLock(lockMatch[1],b,actor);
|
||||
if(lockMatch&&lockMatch[2]==='cancel')return actorLedger.cancelPriceLock(lockMatch[1],b,actor);
|
||||
if(lockMatch&&lockMatch[2]==='change-requests')return actorLedger.requestPriceLockChange(lockMatch[1],b,actor);
|
||||
if(lockChangeMatch&&lockChangeMatch[2]==='approve')return actorLedger.approvePriceLockChange(lockChangeMatch[1],b,actor);
|
||||
if(lockChangeMatch&&lockChangeMatch[2]==='reject')return actorLedger.rejectPriceLockChange(lockChangeMatch[1],b,actor);
|
||||
if(route==='/api/after-sales')return actorLedger.saveAfterSale(b,actor);
|
||||
if(afterSaleMatch&&afterSaleMatch[2]==='update')return actorLedger.updateAfterSale(afterSaleMatch[1],b,actor);
|
||||
if(afterSaleChangeMatch&&afterSaleChangeMatch[2]==='approve')return actorLedger.approveAfterSaleChange(afterSaleChangeMatch[1],b,actor);
|
||||
@@ -254,7 +262,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','/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','/recovery-changes-ui.js':'recovery-changes-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','/price-lock-changes-ui.js':'price-lock-changes-ui.js','/material-pools-ui.js':'material-pools-ui.js','/recoveries-ui.js':'recoveries-ui.js','/recovery-changes-ui.js':'recovery-changes-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||'操作失败'),...(e.code==='ACCOUNT_CHANGED'?{code:e.code}:{}),...(e.code==='RECOVERY_MATERIAL_IN_USE'?{code:e.code,blockedUsages:e.blockedUsages}:{})});else res.end();}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user