增加订单退货退款售后、原成本回料及跨日损益核算
This commit is contained in:
1 parent
b6a0213a0c
commit
dab735423e
24 files changed
+1048
-82
No files matched your search
@@ -4,7 +4,7 @@ let orderChangeDetail=null,orderChangeFormEntry=null,orderActionChangeEntry=null
|
||||
let orderChangeCountRequest=0,orderChangeListRequest=0,orderChangeListStatus='pending';
|
||||
const orderChangeStatus={pending:'待麦麦复核',approved:'已同意变更',rejected:'已驳回'};
|
||||
const orderChangeActionLabels={edit:'修改订单',expense:'费用补记',fees:'旧费用核实',refund:'退款',return:'退货',cost:'成本补录'};
|
||||
function orderChangeActionLabel(request){return request.action_label||orderChangeActionLabels[request.action||'edit']||'订单变更';}
|
||||
function orderChangeActionLabel(request){if((request.action_input||request.action_details)?.afterSale)return '处理订单售后';return request.action_label||orderChangeActionLabels[request.action||'edit']||'订单变更';}
|
||||
function orderActionUsesChangeForm(kind){return state.user.role==='assistant'&&['expense','fees','refund','return','cost'].includes(kind);}
|
||||
function orderActionCanDirect(kind,date=state.today,order=currentOrder){
|
||||
const data=currentOrderChange(order)?.data,entry=orderActionChangeEntry;
|
||||
@@ -94,6 +94,7 @@ function orderChangeInputMoney(value){try{return orderChangeMoney(LedgerCalc.cen
|
||||
function orderChangeActionSummaryHTML(request){
|
||||
const action=request.action||'edit',input=request.action_input||request.action_details||{};
|
||||
if(action==='edit')return '';
|
||||
if(input.afterSale&&typeof orderAfterSaleSummaryHTML==='function'){const record=orderAfterSaleRecord(request.after);return `<section class="order-change-action-summary"><h3>本次售后申请</h3><p>售后日期:${e(input.date)} · 申请原因:${e(request.reason)}</p>${orderAfterSaleSummaryHTML(record,{preview:true})}</section>`;}
|
||||
const facts=[['申请动作',orderChangeActionLabel(request)],['业务日期',input.date||request.after.returned_date||request.after.date]];
|
||||
if(input.amount!==undefined)facts.push(['本次金额',orderChangeInputMoney(input.amount)]);
|
||||
if(input.account)facts.push(['退款账户',accountDisplayName(input.account)]);
|
||||
@@ -213,13 +214,14 @@ function orderChangeOperation(url){
|
||||
return application?{kind:'request',orderId:decodeURIComponent(application[1])}:decision?{kind:decision[2],requestId:decodeURIComponent(decision[1])}:null;
|
||||
}
|
||||
function applyOrderChangeRestrictions(){
|
||||
applyOrderActionChangeRestrictions();const form=$('#order-change-form');if(!form)return;
|
||||
applyOrderActionChangeRestrictions();if(typeof applyOrderAfterSaleRestrictions==='function')applyOrderAfterSaleRestrictions();const form=$('#order-change-form');if(!form)return;
|
||||
const blocked=busy||!!pending()||!orderChangeFormEntry;
|
||||
form.querySelectorAll('input,textarea,button').forEach(control=>{const action=control.dataset.action;control.disabled=action==='close-order-change-form'?false:['reload-order-change','retry'].includes(action)?busy:blocked;});
|
||||
}
|
||||
function orderChangeError(err,operation=null){
|
||||
err.message=err.message.replace('不要重新开单','不要重复提交修改申请或复核');
|
||||
operation=operation||orderChangeOperation(pending()?.url||'');const id=orderChangeFormEntry?.id||currentOrder?.id||operation?.orderId;
|
||||
if(operation?.kind==='request'&&$('#order-after-sale-form')&&typeof orderAfterSaleError==='function')return orderAfterSaleError(err);
|
||||
if(operation?.kind==='request'&&$('#action-form[data-order-change="true"]'))return orderActionChangeError(err,operation);
|
||||
if(operation?.kind==='request'&&typeof orderEditError==='function'&&typeof orderEditEntry!=='undefined'&&orderEditEntry?.id===operation.orderId)return orderEditError(err,operation.orderId);
|
||||
if([409,403,404].includes(err.status)){
|
||||
@@ -253,6 +255,7 @@ async function finishOrderChangeSave(url,input,result,detailContext=captureOrder
|
||||
localStorage.removeItem(orderEditDraftKey(id));if(localStorage.getItem(orderEditActiveKey())===id)localStorage.removeItem(orderEditActiveKey());
|
||||
++orderEditRequest;orderEditEntry=null;
|
||||
}
|
||||
if(typeof invalidateOrderAfterSaleForm==='function')invalidateOrderAfterSaleForm();
|
||||
orderChangeFormEntry=null;orderActionChangeEntry=null;orderChangeDetail=null;currentOrder=null;
|
||||
invalidateMaterialPools();invalidateReport();invalidatePriceLockViews();if(typeof invalidateOrderCancellationViews==='function')invalidateOrderCancellationViews();inventoryPage=null;++orderBookRequest;
|
||||
if(detailContext)detailContext={...detailContext,bookRequest:orderBookRequest};
|
||||
|
||||
Reference in new issue
Block a user