From 3e6c9b4c99df59457362bd09609251e04edad9c8 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Tue, 27 Oct 2026 11:14:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=90=A5=E9=94=80=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E8=B4=A6=E5=8D=95=E5=90=AF=E7=94=A8=E6=97=A5=E6=9C=9F=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/business/marketing-account-bills.js | 47 ++++++++++ .../partials/embedded-table.blade.php | 16 ++-- .../partials/embedded-table.blade.php | 16 ++-- .../partials/embedded-table.blade.php | 19 ++-- .../partials/embedded-table.blade.php | 19 ++-- .../partials/date-range-picker.blade.php | 2 + .../marketing-bill-date-range.blade.php | 91 +++++++++++++++++++ resources/views/business/pages/show.blade.php | 3 + .../MarketingAccountBillsTabsTest.php | 41 ++++++++- 9 files changed, 211 insertions(+), 43 deletions(-) create mode 100644 resources/views/business/pages/partials/marketing-bill-date-range.blade.php diff --git a/resources/assets/js/views/business/marketing-account-bills.js b/resources/assets/js/views/business/marketing-account-bills.js index 8a301b5f..344aefc1 100644 --- a/resources/assets/js/views/business/marketing-account-bills.js +++ b/resources/assets/js/views/business/marketing-account-bills.js @@ -65,10 +65,30 @@ } } + function setupBillDatePickers(scope) { + if (!scope || !window.CaiWuDatePicker) { + return; + } + + scope.querySelectorAll('[data-marketing-bill-date-filter]').forEach((form) => { + window.CaiWuDatePicker.setup(form); + + const from = form.elements.namedItem('from'); + const to = form.elements.namedItem('to'); + if (from && to) { + [from, to].forEach((input) => { + input.addEventListener('change', () => to.setCustomValidity('')); + }); + } + }); + } + function initialiseInsertedContent(workspace) { if (window.Alpine && typeof window.Alpine.initTree === 'function') { window.Alpine.initTree(workspace); } + + setupBillDatePickers(workspace); } async function navigate(url, options) { @@ -176,6 +196,27 @@ }, true); document.addEventListener('submit', (event) => { + const workspace = currentWorkspace(); + const dateFilter = workspace + ? event.target.closest(`${workspaceSelector} [data-marketing-bill-date-filter]`) + : null; + + if (dateFilter) { + const from = dateFilter.elements.namedItem('from'); + const to = dateFilter.elements.namedItem('to'); + if (from && to) { + to.setCustomValidity(''); + if (String(from.value || '') !== '' + && String(to.value || '') !== '' + && String(from.value) > String(to.value)) { + event.preventDefault(); + to.setCustomValidity('结束日期不能早于开始日期'); + to.reportValidity(); + return; + } + } + } + const form = event.target.closest(`${workspaceSelector} [data-jd-wallet-filter]`); if (!form) { @@ -198,6 +239,12 @@ navigate(target.href, { focus: '#jd-filter-store' }); }, true); + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', () => setupBillDatePickers(document)); + } else { + setupBillDatePickers(document); + } + window.addEventListener('popstate', () => { if (currentWorkspace() && isSupportedUrl(window.location.href)) { navigate(window.location.href, { pushState: false }); diff --git a/resources/views/banking/marketing_alibaba_bills/partials/embedded-table.blade.php b/resources/views/banking/marketing_alibaba_bills/partials/embedded-table.blade.php index 2134e202..cf36a499 100644 --- a/resources/views/banking/marketing_alibaba_bills/partials/embedded-table.blade.php +++ b/resources/views/banking/marketing_alibaba_bills/partials/embedded-table.blade.php @@ -69,7 +69,7 @@ @endforeach -