每日对账默认收起麦麦垫付明细
This commit is contained in:
1 parent
518513e630
commit
0e146739bc
3 files changed
+5
-5
No files matched your search
+1
-1
@@ -65,7 +65,7 @@ input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-
|
||||
|
||||
.report-pool-material{margin-top:13px;padding:12px 14px;background:var(--soft);border:1px solid var(--border);border-radius:7px;font-size:12px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.report-pool-material-heading{display:flex;align-items:baseline;gap:7px 16px;flex-wrap:wrap}.report-pool-material-heading>strong{font-size:18px;font-weight:600;color:var(--green)}.report-pool-material ul{list-style:none;padding:0;margin:9px 0;display:grid;gap:6px}.report-pool-material li{display:flex;align-items:baseline;flex-wrap:wrap;gap:3px 14px;line-height:1.8}.report-pool-material li>span{color:var(--muted)}.report-pool-material li>strong{font-weight:500}.report-pool-material p{margin:7px 0 0;line-height:1.7}.report-pool-material p b{font-size:14px;font-weight:550;margin-left:7px}.report-pool-material .small{font-size:11px}.report-pool-material .report-owner-advance{font-weight:550;line-height:1.9}@media(max-width:650px){.report-pool-material{padding:10px 11px}.report-pool-material li{display:block}.report-pool-material li>strong{display:block}}
|
||||
|
||||
.report-owner-advances{margin-top:17px;padding-top:15px;border-top:1px solid var(--border);min-width:0}.report-owner-advances>h3{font-size:13px;font-weight:550;margin:0}.report-owner-advances>p.small{font-size:11px;line-height:1.7;margin:7px 0 0}.report-owner-advance-day{margin-top:12px;padding-top:11px;border-top:1px solid var(--border)}.report-owner-advance-day>header{display:flex;align-items:baseline;flex-wrap:wrap;gap:7px 22px;font-size:12px}.report-owner-advance-day h4{font-size:13px;font-weight:550;margin:0}.report-owner-advance-day header strong{font-size:18px;color:var(--green);margin-left:9px;font-variant-numeric:tabular-nums}.report-owner-advance-day>.report-owner-advance{font-size:12px;line-height:1.8;margin:8px 0}.report-owner-advance-day>.table-wrap{margin-top:10px}.report-owner-advance-table{font-size:12px;min-width:510px}.report-owner-advance-table th,.report-owner-advance-table td{padding:10px 9px;white-space:normal;overflow-wrap:anywhere}.report-owner-advance-table th:first-child{width:100px}.report-owner-advance-table th:nth-child(2){width:25%}.report-owner-advance-table th:last-child{width:155px;text-align:right}.report-owner-advance-table small{display:block;font-size:10px;line-height:1.7;margin-top:4px}.report-owner-advance-table .link-button{font-size:12px}.report-business-history>summary{font-size:12px;color:var(--muted);font-weight:500}.report-business-history>p.small{font-size:11px;line-height:1.7}@media(max-width:650px){.report-owner-advance-table{min-width:430px;font-size:11px}.report-owner-advance-table th,.report-owner-advance-table td{padding:8px 6px}.report-owner-advance-table th:first-child{width:86px}.report-owner-advance-table th:last-child{width:120px}}
|
||||
.report-owner-advances{margin:17px 0 0;padding-top:15px;border-top:1px solid var(--border);min-width:0}.report-owner-advances>summary{font-size:13px;font-weight:550;margin:0}.report-owner-advances>p.small{font-size:11px;line-height:1.7;margin:7px 0 0}.report-owner-advance-day{margin-top:12px;padding-top:11px;border-top:1px solid var(--border)}.report-owner-advance-day>header{display:flex;align-items:baseline;flex-wrap:wrap;gap:7px 22px;font-size:12px}.report-owner-advance-day h4{font-size:13px;font-weight:550;margin:0}.report-owner-advance-day header strong{font-size:18px;color:var(--green);margin-left:9px;font-variant-numeric:tabular-nums}.report-owner-advance-day>.report-owner-advance{font-size:12px;line-height:1.8;margin:8px 0}.report-owner-advance-day>.table-wrap{margin-top:10px}.report-owner-advance-table{font-size:12px;min-width:510px}.report-owner-advance-table th,.report-owner-advance-table td{padding:10px 9px;white-space:normal;overflow-wrap:anywhere}.report-owner-advance-table th:first-child{width:100px}.report-owner-advance-table th:nth-child(2){width:25%}.report-owner-advance-table th:last-child{width:155px;text-align:right}.report-owner-advance-table small{display:block;font-size:10px;line-height:1.7;margin-top:4px}.report-owner-advance-table .link-button{font-size:12px}.report-business-history>summary{font-size:12px;color:var(--muted);font-weight:500}.report-business-history>p.small{font-size:11px;line-height:1.7}@media(max-width:650px){.report-owner-advance-table{min-width:430px;font-size:11px}.report-owner-advance-table th,.report-owner-advance-table td{padding:8px 6px}.report-owner-advance-table th:first-child{width:86px}.report-owner-advance-table th:last-child{width:120px}}
|
||||
|
||||
.report-daily-profits{min-width:0;margin-bottom:20px}.report-daily-profits h2{font-size:16px;margin:0 0 8px}.report-daily-profits>p{font-size:11px;line-height:1.7}.report-daily-profits .table-wrap{margin-top:14px}.report-daily-profits table{font-size:13px;min-width:550px;font-variant-numeric:tabular-nums}.report-daily-profits th,.report-daily-profits td{padding:12px 10px;white-space:normal;overflow-wrap:anywhere}.report-daily-profits th.number{text-align:right}.report-daily-profits td:first-child{width:120px;white-space:nowrap}.report-daily-profits small{display:block;font-size:10px;line-height:1.6;margin-top:4px}.report-daily-profits tfoot td{font-weight:600;background:var(--soft);border-top:1px solid var(--border)}.report-daily-profits .report-daily-profit-note{margin:12px 0 0}@media(max-width:650px){.report-daily-profits{padding:17px 14px}.report-daily-profits table{min-width:500px;font-size:12px}.report-daily-profits th,.report-daily-profits td{padding:10px 7px}}
|
||||
|
||||
|
||||
+1
-1
@@ -1441,7 +1441,7 @@ function reportOwnerAdvanceIdentity(item){
|
||||
function reportOwnerAdvancesHTML(business){
|
||||
const advances=business.ownerAdvances,single=advances.from===advances.date,label=business.member==='owner'?'麦麦付款明细':'麦麦垫付明细';
|
||||
const days=advances.days.length?advances.days:single?[{date:advances.date,amount:0,knownAmount:0,missingCount:0,pendingCount:0,items:[]}]:[];
|
||||
return `<section class="report-owner-advances" aria-label="${e(business.name+label)}"><h3>${single?'当日':'按日核对'}${label}</h3><p class="small muted">按所属订单开单日、售后记录日归集;仅列所选日期,不累计历史垫付。垫付与扣除代收、转账后的净往来分别核对。</p>${days.map(day=>`<div class="report-owner-advance-day"><header><h4>${e(day.date)}</h4><span>${day.missingCount?'已知':''}${business.member==='owner'?'付款':'垫付'}小计 <strong>${e(reportOwnerAdvanceAmount(day.amount,day.knownAmount))}</strong></span></header>${day.items.some(item=>item.poolMaterial)?`<p class="report-owner-advance">${e(reportOwnerAdvanceFormula(business,day))}</p>`:''}${day.items.length?`<div class="table-wrap"><table class="report-owner-advance-table" aria-label="${e(day.date+' '+label)}"><thead><tr><th>日期</th><th>客户/单号</th><th>成本项目</th><th class="number">麦麦承担金额</th></tr></thead><tbody>${day.items.map(item=>`<tr${item.status==='recorded'?'':' class="report-pending-cost"'}><td>${e(item.date)}</td><td>${reportOwnerAdvanceIdentity(item)}</td><td>${e(item.name)}${item.source?`<small class="muted">${e(item.source)}</small>`:''}</td><td class="number">${e(reportOwnerAdvanceItemAmount(item))}</td></tr>`).join('')}</tbody></table></div>`:'<p class="small muted">当天没有已登记的'+(business.member==='owner'?'麦麦付款':'麦麦垫付')+'明细。</p>'}${day.pendingCount?'<p class="small muted">待核对项目尚未入账,预估金额不计垫付小计。</p>':''}</div>`).join('')||'<p class="small muted">所选月份暂无已登记的'+label+'。</p>'}</section>`;
|
||||
return `<details class="report-owner-advances" aria-label="${e(business.name+label)}"><summary>${single?'当日':'按日核对'}${label}</summary><p class="small muted">按所属订单开单日、售后记录日归集;仅列所选日期,不累计历史垫付。垫付与扣除代收、转账后的净往来分别核对。</p>${days.map(day=>`<div class="report-owner-advance-day"><header><h4>${e(day.date)}</h4><span>${day.missingCount?'已知':''}${business.member==='owner'?'付款':'垫付'}小计 <strong>${e(reportOwnerAdvanceAmount(day.amount,day.knownAmount))}</strong></span></header>${day.items.some(item=>item.poolMaterial)?`<p class="report-owner-advance">${e(reportOwnerAdvanceFormula(business,day))}</p>`:''}${day.items.length?`<div class="table-wrap"><table class="report-owner-advance-table" aria-label="${e(day.date+' '+label)}"><thead><tr><th>日期</th><th>客户/单号</th><th>成本项目</th><th class="number">麦麦承担金额</th></tr></thead><tbody>${day.items.map(item=>`<tr${item.status==='recorded'?'':' class="report-pending-cost"'}><td>${e(item.date)}</td><td>${reportOwnerAdvanceIdentity(item)}</td><td>${e(item.name)}${item.source?`<small class="muted">${e(item.source)}</small>`:''}</td><td class="number">${e(reportOwnerAdvanceItemAmount(item))}</td></tr>`).join('')}</tbody></table></div>`:'<p class="small muted">当天没有已登记的'+(business.member==='owner'?'麦麦付款':'麦麦垫付')+'明细。</p>'}${day.pendingCount?'<p class="small muted">待核对项目尚未入账,预估金额不计垫付小计。</p>':''}</div>`).join('')||'<p class="small muted">所选月份暂无已登记的'+label+'。</p>'}</details>`;
|
||||
}
|
||||
function reportOwnerAdvancesText(business){
|
||||
const advances=business.ownerAdvances,label=business.member==='owner'?'麦麦付款明细':'麦麦垫付明细';
|
||||
|
||||
@@ -237,10 +237,10 @@ test('料费分项、克重、付款归属和其他成本必须守恒,缺失
|
||||
for(const change of changes){const response=poolBusinessReport();change(response);const h=businessHarness(response);await h.run('renderReport()');assert.equal(h.run('currentReport'),null);assert.match(h.content.innerHTML,/所属订单成本、利润或待转资料未完整返回/);assert.doesNotMatch(h.content.innerHTML,/料池已用料费<\/span>/);}
|
||||
});
|
||||
|
||||
test('麦麦逐笔垫付默认展开且客户可打开原单,多人池料子行只显示分摊金额,所有文字转义',async()=>{
|
||||
test('麦麦逐笔垫付默认收起且客户可打开原单,多人池料子行只显示分摊金额,所有文字转义',async()=>{
|
||||
const response=poolBusinessReport(),day=response.ownershipBusiness.assistant.ownerAdvances.days[0];day.items[0].customer='<img src=x>';day.items[1].name='<script>实际运费</script>';day.items[1].source='<b>付款备注</b>';
|
||||
const h=businessHarness(response);await h.run('renderReport()');const card=memberCard(h.content.innerHTML,'assistant'),html=table(card,D+' 麦麦垫付明细');
|
||||
assert.match(card,/<section class="report-owner-advances"[^>]*><h3>当日麦麦垫付明细<\/h3>/);assert.match(card,/垫付小计 <strong>¥1,069\.33/);assert.match(html,/<th>日期<\/th><th>客户/单号<\/th><th>成本项目<\/th><th class="number">麦麦承担金额/);assert.match(html,/料池料费 · 麦麦垫付部分/);assert.match(html,/¥1,033\.33/);assert.doesNotMatch(html,/2\.000g|×/);assert.match(html,/<img src=x>/);assert.match(html,/<script>实际运费<\/script>/);assert.match(html,/<b>付款备注<\/b>/);assert.doesNotMatch(html,/<img|<script|<b>/);
|
||||
assert.match(card,/<details class="report-owner-advances"[^>]*><summary>当日麦麦垫付明细<\/summary>/);assert.doesNotMatch(card,/<details[^>]*report-owner-advances[^>]*\sopen(?:\s|=|>)/);assert.match(card,/垫付小计 <strong>¥1,069\.33/);assert.match(html,/<th>日期<\/th><th>客户/单号<\/th><th>成本项目<\/th><th class="number">麦麦承担金额/);assert.match(html,/料池料费 · 麦麦垫付部分/);assert.match(html,/¥1,033\.33/);assert.doesNotMatch(html,/2\.000g|×/);assert.match(html,/<img src=x>/);assert.match(html,/<script>实际运费<\/script>/);assert.match(html,/<b>付款备注<\/b>/);assert.doesNotMatch(html,/<img|<script|<b>/);
|
||||
assert.ok(card.indexOf('report-owner-advances')<card.indexOf('report-business-history'));assert.match(card,/<details class="report-business-settlement report-business-history"><summary>累计往来(含历史/);assert.doesNotMatch(card,/<details[^>]*report-business-history[^>]* open/);
|
||||
const button={dataset:{action:'open-order',id:'pool'},closest(){return null;}};for(const handler of h.handlers.click)await handler({target:{closest:()=>button}});assert.deepEqual(JSON.parse(JSON.stringify(h.calls.slice(1))),[{openOrder:'pool'}]);
|
||||
const text=h.run('reportOwnershipReceiptsText(currentReport).join(String.fromCharCode(10))');assert.match(text,/2026-10-22 垫付小计:¥1,069\.33/);assert.match(text,/累计往来(含历史,截至 2026-10-22)/);
|
||||
@@ -250,7 +250,7 @@ test('月份垫付明细只列实际记录日期及各日小计,不把月合
|
||||
const response=poolBusinessReport(),from='2026-10-01',prior='2026-10-21',old=response.ownershipBusiness.assistant;
|
||||
response.from=from;response.dailyProfits.from=from;for(const b of Object.values(response.ownershipBusiness)){b.from=from;b.ownerAdvances.from=from;b.settlement.from=from;}
|
||||
response.ownershipBusiness.assistant=businessPerson(response.ownershipReceipts.assistant,D,from,{costByPayer:{owner:{totalCost:116933,knownTotalCost:116933},assistant:{totalCost:90300,knownTotalCost:90300}},poolMaterial:{...old.poolMaterial,otherCosts:{amount:13900,knownAmount:13900}},ownerAdvances:advances([advanceDay(prior,[advanceItem('yesterday','昨日实际配件',10000)]),...old.ownerAdvances.days],from,D),settlement:settlement([counterpart('owner',50000,96933)],D,from)});
|
||||
const h=businessHarness(response);h.range(D,true);await h.run('renderReport()');const card=memberCard(h.content.innerHTML,'assistant');assert.match(card,/<h3>按日核对麦麦垫付明细<\/h3>/);assert.match(card,/<h4>2026-10-21<\/h4><span>垫付小计 <strong>¥100\.00/);assert.match(card,/<h4>2026-10-22<\/h4><span>垫付小计 <strong>¥1,069\.33/);assert.doesNotMatch(card,/垫付小计 <strong>¥1,169\.33|<h4>2026-10-01/);assert.equal((card.match(/class="report-owner-advance-day"/g)||[]).length,2);
|
||||
const h=businessHarness(response);h.range(D,true);await h.run('renderReport()');const card=memberCard(h.content.innerHTML,'assistant');assert.match(card,/<details class="report-owner-advances"[^>]*><summary>按日核对麦麦垫付明细<\/summary>/);assert.doesNotMatch(card,/<details[^>]*report-owner-advances[^>]*\sopen(?:\s|=|>)/);assert.match(card,/<h4>2026-10-21<\/h4><span>垫付小计 <strong>¥100\.00/);assert.match(card,/<h4>2026-10-22<\/h4><span>垫付小计 <strong>¥1,069\.33/);assert.doesNotMatch(card,/垫付小计 <strong>¥1,169\.33|<h4>2026-10-01/);assert.equal((card.match(/class="report-owner-advance-day"/g)||[]).length,2);
|
||||
const text=h.run('reportOwnershipReceiptsText(currentReport).join(String.fromCharCode(10))');assert.match(text,/2026-10-21 垫付小计:¥100\.00/);assert.match(text,/2026-10-22 垫付小计:¥1,069\.33/);assert.doesNotMatch(text,/垫付小计:¥1,169\.33/);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user