完善订单审批、每日对账与信用卡手续费
加入助理订单变更复核、收款人汇总、每日报销和应转金额;优化库存筛选、订单明细与连续浏览。开单身份必填,信用卡手续费按实收4‰自动计算并默认由麦麦承担,打印优惠显示在人民币大写旁。 验证:484项测试通过;独立HTTP与浏览器覆盖普通订单、锁价、修改审批、断线恢复和打印隔离。旧报表兼容,本机升级原29表295行数据保持一致。
This commit is contained in:
1 parent
27a11e9b35
commit
a506fb1228
68 files changed
+3591
-259
No files matched your search
@@ -6,7 +6,8 @@
|
||||
})(typeof globalThis==='object'?globalThis:this,function(Fees){
|
||||
const products=['足金999','足银999','纯银925'],charges=['编绳','证书','包装','快递','附加费'];
|
||||
const pockets=['','现货','金料','找金','回收旧料','君宝汇'];
|
||||
const accounts=['助理微信','助理支付宝','助理现金','麦麦微信','麦麦支付宝','麦麦现金'];
|
||||
const accounts=['助理微信','助理支付宝','助理现金','助理信用卡','麦麦微信','麦麦支付宝','麦麦现金','麦麦信用卡'];
|
||||
const cardFee=item=>item?.system==='credit_card'||String(item?.key||'').startsWith('card_fee:');
|
||||
const uuid=/^[a-f0-9-]{36}$/;
|
||||
function object(value,name){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error(name+'格式无效');return value;}
|
||||
function string(value,name,max=100){
|
||||
@@ -65,14 +66,16 @@
|
||||
return result;
|
||||
});
|
||||
const fees=draft.fee_items??[];if(!Array.isArray(fees)||fees.length>6100)throw new Error('模板费用项目过多');
|
||||
const cardExpenseIds=new Set(fees.filter(cardFee).map(fee=>fee.expense_id).filter(Boolean));
|
||||
const keys=new Set(),items=fees.map(raw=>{
|
||||
const fee=object(raw,'模板费用'),old=string(fee.key,'费用标识',80);
|
||||
const fee=object(raw,'模板费用');if(cardFee(fee)||fee.expense_id&&cardExpenseIds.has(fee.expense_id))return null;
|
||||
const old=string(fee.key,'费用标识',80);
|
||||
if(!['shipping','box','certificate','braiding','sticker','other'].includes(old)&&! /^(charge|manual):[a-f0-9-]{36}$/.test(old))throw new Error('模板费用项目无效');
|
||||
if(keys.has(old))throw new Error('模板费用项目不能重复');keys.add(old);
|
||||
const linked=old.startsWith('charge:')?ids.get(old.slice(7)):null;if(old.startsWith('charge:')&&!linked)return null;
|
||||
return {key:linked?'charge:'+linked:old==='shipping'?'shipping':'manual:'+newId(),note:string(fee.note,'费用名称',150),amount:numeric(fee.amount,'实际费用'),payer:pick(fee.payer,['owner','assistant'],'费用付款人','assistant'),status:'estimated',edited:fee.edited!==false,...(linked?{sourceName:string(fee.sourceName||fee.note,'附加项目名称',40)}:{})};
|
||||
}).filter(Boolean);
|
||||
const preset={salesperson:string(draft.salesperson,'开单人',30),payment_account:pick(draft.payment_account,accounts,'收款账户','助理微信'),discount:numeric(draft.discount??'0','整单优惠'),note:string(draft.note,'客户单备注',240),fee_auto_initialized:true,lines,fee_items:Fees.sync(items,lines)};
|
||||
const preset={salesperson:string(draft.salesperson,'开单人',30),payment_account:pick(draft.payment_account,accounts,'收款账户','助理微信'),credit_card_fee_payer:pick(draft.credit_card_fee_payer,['owner','assistant'],'信用卡手续费付款人','owner'),discount:numeric(draft.discount??'0','整单优惠'),note:string(draft.note,'客户单备注',240),fee_auto_initialized:true,lines,fee_items:Fees.sync(items,lines)};
|
||||
if(JSON.stringify(preset).length>240000)throw new Error('模板内容过大,请减少商品或附加项目');return preset;
|
||||
}
|
||||
function apply(preset,{today,salesperson='',newId}={}){
|
||||
|
||||
Reference in new issue
Block a user