订单列表与详情显示北京时间录入到分钟

This commit is contained in:
summer committed 2026-11-14 01:20:22 +08:00
1 parent ecb8d6dec0
commit 8d68111479
3 files changed
+46 -2

No files matched your search

@@ -28,6 +28,30 @@ function text(html){return html.replace(/<[^>]*>/g,'').replace(/\s+/g,' ').trim(
const withoutFees={expenses:[],fee_items:[],directCost:0};
const zeroLine=(extra={})=>line({cost:0,costParts:{material:0,labor:0,accessories:0,other:0},costMaterial:{mode:'total'},costLabor:{mode:'total'},...extra});
test('录入时间固定北京时间和24小时到分钟,跨日与缺失时间不依赖设备时区',()=>{
const {run}=render();
for(const [created,expected] of [
['2026-10-22T07:08:59.999Z','2026-10-22 15:08'],
['2026-10-22T16:07:59.999Z','2026-10-23 00:07'],
['2026-10-23T00:07:00+08:00','2026-10-23 00:07'],
['2026-12-31T23:59:59Z','2027-01-01 07:59'],
[undefined,'未记录'],[null,'未记录'],['','未记录'],['2026-10-22','未记录'],
['2026-10-22T07:08:00','未记录'],['invalid','未记录'],['2026-02-30T07:08:00Z','未记录'],['2026-10-22T24:00:00Z','未记录']
])assert.equal(run('orderEntryTime('+JSON.stringify(created)+')'),expected,String(created));
});
test('详情业务日期与首次录入时间分开,旧草稿、补齐旧单和锁价销售均不伪称开单时间',()=>{
const created='2026-10-23T01:06:59Z';
for(const extra of [{},{status:'draft'},{price_lock_id:'synthetic-lock'},
{audit:[{action:'生成已交付单据',actor:'合成开单人',created:'2026-10-24T02:30:00Z',detail:{}}]}]){
const {html}=render(order({created,...extra}));
assert.match(html,/业务日期 2026-10-22/);
assert.match(html,/<div class="small muted order-entry-time">录入时间(北京时间):2026-10-23 09:06<\/div>/);
assert.doesNotMatch(html,/开单时间/);
}
assert.match(render(order({created:D})).html,/录入时间(北京时间):未记录/);
});
test('打开单据即显示截图中的销售计算、附加收费、整单取整和实际利润,只有一份成本明细',()=>{
const {html}=render(),sales=text(panel(html,'销售计算')),costs=panel(html,'成本明细与付款人'),profit=text(panel(html,'实际订单利润'));
assert.match(sales,/0\.620g ×(金价 927\.00元\/克 + 工费 45\.00元\/克) = ¥602\.64/);