整合公共店铺配置与动态员工管理,保留最新订单功能及历史账兼容

This commit is contained in:
summer committed 2026-12-04 00:53:53 +08:00
commit b87f774386
84 files changed
+1622 -715

No files matched your search

@@ -44,7 +44,7 @@ test('修改payload不丢多行和费用,使用专用update与原版本,0费
});
test('助理仅本人,原日与新日均今天为直改,其余显示申请,待审禁止重复处理',async()=>{
const h=harness('assistant');await h.open();const {fields,submit}=h.editForm();h.run('syncRecoveryEditMode()');assert.equal(submit.textContent,'保存修改');fields.date.value=OLD;h.run('syncRecoveryEditMode()');assert.equal(submit.textContent,'提交修改申请');assert.match(h.nodes.get('#recovery-edit-mode').textContent,/审批前.*不变/);const denied=harness('assistant2');await assert.rejects(denied.open(),/不属于当前成员/);const pending=harness();await assert.rejects(pending.open({pending:request(),permissions:{canEdit:false,canCancel:false,canDirect:false,requiresApproval:true,reason:'待麦麦复核'}}),/待麦麦复核/);assert.equal(pending.run('recoveryEditEntry'),null);
const h=harness('assistant');await h.open();const {fields,submit}=h.editForm();h.run('syncRecoveryEditMode()');assert.equal(submit.textContent,'保存修改');fields.date.value=OLD;h.run('syncRecoveryEditMode()');assert.equal(submit.textContent,'提交修改申请');assert.match(h.nodes.get('#recovery-edit-mode').textContent,/审批前.*不变/);const denied=harness('assistant2');await assert.rejects(denied.open(),/不属于当前成员/);const pending=harness();await assert.rejects(pending.open({pending:request(),permissions:{canEdit:false,canCancel:false,canDirect:false,requiresApproval:true,reason:'待店主复核'}}),/待店主复核/);assert.equal(pending.run('recoveryEditEntry'),null);
});
test('已有用料仍能取消,展示订单锁价与匿名用量,修改约束保留',async()=>{
@@ -72,7 +72,7 @@ test('审批显示完整前后旧料、费用付款人与实际净额,同意
});
test('过期申请只能驳回,助理不能审批;取消对照显示冲正且不把未提供利润当0',async()=>{
const h=harness();await h.review({stale:true,canApprove:false});assert.ok(!h.nodes.get('#recovery-change-dialog').innerHTML.includes('data-kind="approve"'));assert.throws(()=>h.run("showRecoveryDecision('approve')"),/已有变动/);const assistant=harness('assistant');await assistant.review({canApprove:false});assert.throws(()=>assistant.run("showRecoveryDecision('reject')"),/麦麦账号/);h.context.__request=request({action:'cancel',after:null,summary:{...request().summary,blockedUsages:[{orderId:'visible-order',number:'XS<已用>',mg:3000},{number:'不应展示',orderId:'private-order',anonymous:true,mg:500}]}});const html=h.run('recoveryChangeComparisonHTML(__request)');assert.match(html,/取消后/);assert.match(html,/冲正原库存及关联购料/);assert.match(html,/公共料不足仍可取消/);assert.match(html,/料费待补/);assert.match(html,/XS&lt;已用&gt; · 3\.000g/);assert.match(html,/其他成员用料 · 0\.500g/);assert.doesNotMatch(html,/不应展示|private-order|不能取消|undefined|NaN/);
const h=harness();await h.review({stale:true,canApprove:false});assert.ok(!h.nodes.get('#recovery-change-dialog').innerHTML.includes('data-kind="approve"'));assert.throws(()=>h.run("showRecoveryDecision('approve')"),/已有变动/);const assistant=harness('assistant');await assistant.review({canApprove:false});assert.throws(()=>assistant.run("showRecoveryDecision('reject')"),/店主账号/);h.context.__request=request({action:'cancel',after:null,summary:{...request().summary,blockedUsages:[{orderId:'visible-order',number:'XS<已用>',mg:3000},{number:'不应展示',orderId:'private-order',anonymous:true,mg:500}]}});const html=h.run('recoveryChangeComparisonHTML(__request)');assert.match(html,/取消后/);assert.match(html,/冲正原库存及关联购料/);assert.match(html,/公共料不足仍可取消/);assert.match(html,/料费待补/);assert.match(html,/XS&lt;已用&gt; · 3\.000g/);assert.match(html,/其他成员用料 · 0\.500g/);assert.doesNotMatch(html,/不应展示|private-order|不能取消|undefined|NaN/);
});
test('409保留修改草稿并禁旧版本,重新读取与核对前不允许重交',async()=>{