first commit
This commit is contained in:
commit
9399a88d39
347 files changed
+167716
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import fs from 'node:fs';
|
||||
const v = JSON.parse(fs.readFileSync('.cdp/out/orders-probe.json', 'utf8'));
|
||||
const L = [];
|
||||
L.push('状态 | 订单号 | 下单时间 | 时限 | 金额 | 商品');
|
||||
for (const o of v.orders) {
|
||||
L.push([o.status, o.orderNo, o.orderTime, o.deadline || o.countdown || '-', '¥' + o.amount,
|
||||
String(o.title || '').slice(0, 30), '|', String(o.spec || '').slice(0, 26)].join(' | '));
|
||||
}
|
||||
// 按下单日期统计
|
||||
const byDay = {};
|
||||
for (const o of v.orders) {
|
||||
const d = (o.orderTime || '').slice(0, 10) || '?';
|
||||
byDay[d] = byDay[d] || { n: 0, amt: 0, closed: 0, pending: 0 };
|
||||
byDay[d].n++;
|
||||
byDay[d].amt += Number(o.amount) || 0;
|
||||
if (o.status === '交易关闭') byDay[d].closed++;
|
||||
if (o.status === '待发货' || o.status === '待付款') byDay[d].pending++;
|
||||
}
|
||||
L.push('');
|
||||
L.push('下单日 | 单数 | 金额 | 其中已关闭 | 其中待处理');
|
||||
for (const [d, s] of Object.entries(byDay).sort()) L.push(`${d} | ${s.n} | ¥${s.amt.toFixed(2)} | ${s.closed} | ${s.pending}`);
|
||||
fs.writeFileSync('.cdp/out/orders-list.txt', L.join('\n'), 'utf8');
|
||||
Reference in new issue
Block a user