Revert "支持按账号自定义单据默认经办人"

This reverts commit 81584dc45a.
This commit is contained in:
summer committed 2026-10-22 15:31:10 +08:00
1 parent 81584dc45a
commit 3bf9e8d82d
9 files changed
+15 -152

No files matched your search

+2 -3
View File
@@ -15,12 +15,11 @@ function lockCharges(root){return [...root.querySelectorAll('.charge-row')].map(
function syncLockChargeFields(root){for(const row of root.querySelectorAll('.charge-row')){const custom=row.querySelector('[name="chargeType"]').value==='其他',input=row.querySelector('[name="chargeName"]');input.closest('label').hidden=!custom;input.disabled=!custom;input.required=custom;}}
function collectPriceLockCreate(){
const form=$('#price-lock-create-form'),get=name=>lockFormValue(form,name);
return {date:get('date'),customer:get('customer').trim(),salesperson:get('salesperson'),salesperson_set:true,salesperson_default:form.dataset.salespersonDefault,salesperson_manual:form.dataset.salespersonManual==='true',note:get('note'),discount:get('discount'),line:{name:get('name').trim(),unit:'g',pricingMode:'auto',quantity:get('quantity'),goldPrice:get('goldPrice'),laborRate:get('laborRate'),laborMode:get('laborMode'),pieces:get('pieces'),charges:lockCharges(form)},payment:{amount:get('received_amount'),account:get('payment_recipient')+get('payment_method'),verified:form.querySelector('[name="payment_verified"]').checked},material:{rate:get('material_rate'),payer:get('material_payer'),verified:form.querySelector('[name="material_verified"]').checked}};
return {date:get('date'),customer:get('customer').trim(),salesperson:get('salesperson'),note:get('note'),discount:get('discount'),line:{name:get('name').trim(),unit:'g',pricingMode:'auto',quantity:get('quantity'),goldPrice:get('goldPrice'),laborRate:get('laborRate'),laborMode:get('laborMode'),pieces:get('pieces'),charges:lockCharges(form)},payment:{amount:get('received_amount'),account:get('payment_recipient')+get('payment_method'),verified:form.querySelector('[name="payment_verified"]').checked},material:{rate:get('material_rate'),payer:get('material_payer'),verified:form.querySelector('[name="material_verified"]').checked}};
}
function renderPriceLockCreate(){
const d=priceLockReadDraft(priceLockDraftKey())||{},line=d.line||{},payment=d.payment||{},material=d.material||{};
const salesperson=draftSalesperson(d),salespersonManual=!!d.salesperson_manual||!!d.salesperson&&salesperson!==defaultSalesperson();
$('#main').innerHTML=heading('GOLD PRICE LOCK','黄金锁价','每张锁价记录一件按克黄金;多件请分别锁价。保存后进入待交付,暂不出入库、不计利润。',priceLockCreateControls())+`<form id="price-lock-create-form" data-salesperson-default="${e(defaultSalesperson())}" data-salesperson-manual="${salespersonManual}"><section class="panel"><h2>客户与锁价日期</h2><div class="grid four">${field('锁价日期','date',d.date||state.today,'date',`required max="${e(state.today)}"`)}${field('客户称呼/代号','customer',d.customer||'','text','required maxlength="60"')}${field('经办人','salesperson',salesperson,'text','required maxlength="30"')}${field('黄金商品','name',line.name||'足金999','text','required maxlength="60"')}</div></section><section class="panel line-item" data-price-lock-sale><h2>锁定售价与预计克重</h2><div class="grid four">${field('锁定克重(g)','quantity',line.quantity||'','number','required min="0.001" step="0.001"')}${moneyField('锁定销售金价(元/克)','goldPrice',line.goldPrice||'')}${choice('销售工费方式','laborMode',[['gram','克工费'],['piece','件工费']],line.laborMode||'gram')}${moneyField('销售工费','laborRate',line.laborRate??'')}${field('计工费件数','pieces',line.pieces||'1','number','required min="1" step="1"')}</div><div class="sale-charges"><div class="panel-title"><strong>客户附加项目(选填)</strong>${button('+ 添加附加项目','add-charge')}</div><p class="small muted">沿用直接开单的收费默认值,可按实际修改;交付时会保留这些项目。</p><div class="charge-list">${(line.charges||[]).map(chargeHTML).join('')}</div></div><div class="grid two" style="margin-top:16px">${moneyField('整单优惠(元)','discount',d.discount??'0')}<label>客户可见备注<textarea name="note" maxlength="170" rows="2">${e(d.note||'')}</textarea></label></div><p id="lock-sale-estimate" class="calculation small" aria-live="polite"></p></section><section class="panel"><h2>客户实际已付款</h2><p class="small muted">填写已经收到的金额,可与预计报价不同;尚未收款填0。</p><div class="grid three">${moneyField('实际收款(元)','received_amount',payment.amount??'')}${accountFields(payment.account)}</div><label class="check"><input type="checkbox" name="payment_verified" ${payment.verified?'checked':''} required>已核实实际收款金额与账户。</label></section><section class="panel internal"><h2>原锁金料实际成本</h2><div class="grid three">${moneyField('原锁进货料价(元/克)','material_rate',material.rate??'')}${choice('原锁料费付款人','material_payer',[['owner','麦麦'],['assistant','助理']],material.payer||'owner')}<div><span class="small muted">这批金料已付金额</span><div id="lock-material-estimate" class="summary-amount">待填写</div></div></div><label class="check"><input type="checkbox" name="material_verified" ${material.verified?'checked':''} required>已核实原锁金料的实际付款。</label><p class="small muted">此处只记原锁金料付款;工费、快递等在交付时填写实际成本。库存归属也在交付时确认。</p></section><section class="panel"><div class="form-actions"><div><span class="small muted">预计成交额 · 四舍五入到元</span><div id="lock-create-total" class="summary-amount">待填写</div><div class="small muted">待交付,不计利润</div></div><button class="primary" type="submit">保存锁价待交付</button></div><div id="price-lock-error" aria-live="polite"></div></section></form>`;
$('#main').innerHTML=heading('GOLD PRICE LOCK','黄金锁价','每张锁价记录一件按克黄金;多件请分别锁价。保存后进入待交付,暂不出入库、不计利润。',priceLockCreateControls())+`<form id="price-lock-create-form"><section class="panel"><h2>客户与锁价日期</h2><div class="grid four">${field('锁价日期','date',d.date||state.today,'date',`required max="${e(state.today)}"`)}${field('客户称呼/代号','customer',d.customer||'','text','required maxlength="60"')}${field('经办人','salesperson',d.salesperson||session.user.name,'text','required maxlength="30"')}${field('黄金商品','name',line.name||'足金999','text','required maxlength="60"')}</div></section><section class="panel line-item" data-price-lock-sale><h2>锁定售价与预计克重</h2><div class="grid four">${field('锁定克重(g)','quantity',line.quantity||'','number','required min="0.001" step="0.001"')}${moneyField('锁定销售金价(元/克)','goldPrice',line.goldPrice||'')}${choice('销售工费方式','laborMode',[['gram','克工费'],['piece','件工费']],line.laborMode||'gram')}${moneyField('销售工费','laborRate',line.laborRate??'')}${field('计工费件数','pieces',line.pieces||'1','number','required min="1" step="1"')}</div><div class="sale-charges"><div class="panel-title"><strong>客户附加项目(选填)</strong>${button('+ 添加附加项目','add-charge')}</div><p class="small muted">沿用直接开单的收费默认值,可按实际修改;交付时会保留这些项目。</p><div class="charge-list">${(line.charges||[]).map(chargeHTML).join('')}</div></div><div class="grid two" style="margin-top:16px">${moneyField('整单优惠(元)','discount',d.discount??'0')}<label>客户可见备注<textarea name="note" maxlength="170" rows="2">${e(d.note||'')}</textarea></label></div><p id="lock-sale-estimate" class="calculation small" aria-live="polite"></p></section><section class="panel"><h2>客户实际已付款</h2><p class="small muted">填写已经收到的金额,可与预计报价不同;尚未收款填0。</p><div class="grid three">${moneyField('实际收款(元)','received_amount',payment.amount??'')}${accountFields(payment.account)}</div><label class="check"><input type="checkbox" name="payment_verified" ${payment.verified?'checked':''} required>已核实实际收款金额与账户。</label></section><section class="panel internal"><h2>原锁金料实际成本</h2><div class="grid three">${moneyField('原锁进货料价(元/克)','material_rate',material.rate??'')}${choice('原锁料费付款人','material_payer',[['owner','麦麦'],['assistant','助理']],material.payer||'owner')}<div><span class="small muted">这批金料已付金额</span><div id="lock-material-estimate" class="summary-amount">待填写</div></div></div><label class="check"><input type="checkbox" name="material_verified" ${material.verified?'checked':''} required>已核实原锁金料的实际付款。</label><p class="small muted">此处只记原锁金料付款;工费、快递等在交付时填写实际成本。库存归属也在交付时确认。</p></section><section class="panel"><div class="form-actions"><div><span class="small muted">预计成交额 · 四舍五入到元</span><div id="lock-create-total" class="summary-amount">待填写</div><div class="small muted">待交付,不计利润</div></div><button class="primary" type="submit">保存锁价待交付</button></div><div id="price-lock-error" aria-live="polite"></div></section></form>`;
syncPriceLockForm();
}
function syncPriceLockCreate(){