Files
wordpress-theme-aksrt/assets/js/admin-orders.js
T
kate522andClaude Fable 5 b32b56f8bc feat(admin): redesign order list and detail workspace
Replace the type/method tab rows with status views backed by one GROUP BY
count, move filters into a single toolbar card, show gateway names, keep
list context across detail and actions, and split the detail page into a
summary/timeline column and an actions/buyer/note sidebar. Confirmations
move to admin-orders.js; PayOrders splits into flat List/Detail traits.

Remove dead code: unused Order AJAX endpoints and init(), get_orders_count(),
shipping flash codes, and the legacy raw-note fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 14:03:57 +08:00

37 lines
1.3 KiB
JavaScript

/** 订单明细:危险操作二次确认 + 防重复提交。仅本页入队。 */
(function () {
'use strict';
var root = document.querySelector('.aksrt-orders-page');
if (!root) return;
root.addEventListener('submit', function (event) {
var form = event.target.closest('form');
if (!form) return;
if (form.dataset.submitting) {
event.preventDefault();
return;
}
var message = form.getAttribute('data-aksrt-confirm');
if (message && !window.confirm(message)) {
event.preventDefault();
return;
}
if (form.method.toLowerCase() !== 'post') return;
form.dataset.submitting = '1';
// 延后禁用:同步禁用 submit 按钮会让部分浏览器丢掉这次提交。
setTimeout(function () {
form.querySelectorAll('button[type="submit"]').forEach(function (button) { button.disabled = true; });
}, 0);
});
// bfcache 返回时恢复按钮,避免整页停在禁用态。
window.addEventListener('pageshow', function (event) {
if (!event.persisted) return;
root.querySelectorAll('form[data-submitting]').forEach(function (form) {
delete form.dataset.submitting;
form.querySelectorAll('button[type="submit"]').forEach(function (button) { button.disabled = false; });
});
});
})();