From 73af15f2dbc1a4e70b34281a60a552e22b93f76e Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Tue, 6 Oct 2026 17:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=9B=BA=E6=AF=8F=E6=97=A5=E8=B4=A6?= =?UTF-8?q?=E5=8D=95=E5=AF=BC=E5=87=BA=EF=BC=9A=E8=AE=BE=E7=BD=AE=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E5=89=8D=E5=85=88=E5=85=B3=E6=8E=88=E6=9D=83=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=B9=B6=E9=80=90=E6=AC=A1=E6=A0=A1=E9=AA=8C=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/erp-daily-bills/export-daily.mjs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/erp-daily-bills/export-daily.mjs b/scripts/erp-daily-bills/export-daily.mjs index ca3e816b..74b49387 100644 --- a/scripts/erp-daily-bills/export-daily.mjs +++ b/scripts/erp-daily-bills/export-daily.mjs @@ -118,13 +118,20 @@ cdp.on((msg) => { // 1) 设置结算时间 = 月初 → 昨日(日历面板) log('设置结算时间'); -for (let attempt = 1; attempt <= 3; attempt++) { +// 「店铺授权过期提醒」会反复弹出遮挡,先关弹窗再点日期框,并逐次校验面板是否真的打开 +let calendarOpen = false; +for (let attempt = 1; attempt <= 8 && !calendarOpen; attempt++) { + await closeAuthModal(cdp, sid, 2); const sBox = await evaluate(cdp, sid, `(() => { const i = [...document.querySelectorAll('input')].find(x => x.placeholder === '开始日期' && (x.offsetWidth||x.offsetHeight)); const r = i.getBoundingClientRect(); return { x: r.left + 6, y: r.top + r.height/2 }; })()`); await clickPoint(cdp, sid, sBox.x, sBox.y); - await sleep(1800); + await sleep(1900); const cells = await evaluate(cdp, sid, `document.querySelectorAll('.ant-picker-dropdown td[title]').length`); - if (cells > 0) break; - await closeAuthModal(cdp, sid, 1); + calendarOpen = cells > 0; + if (!calendarOpen) log(` 日历未打开,第 ${attempt} 次重试`); +} +if (!calendarOpen) { + await shot(cdp, sid, OUT_DIR + '\\date-panel-failed.png'); + throw new Error('日历面板未能打开,已截图:' + OUT_DIR + '\\date-panel-failed.png'); } async function pickDate(title) { for (let i = 0; i < 30; i++) {