feat(admin): redesign creator income page with status views and safer settlement
- Split PayIncome into shell + PayIncomeList flat sibling trait - Add policy callout, per-currency stats, status views, filter card - Show source post/order/buyer, base amount x ratio, expected settle time - Confirm single/batch settlement, selection count, double-submit guard - Redirect back preserving filters; report settled/failed counts - Revenue: add get_status_counts(), share admin_list_where(), drop dead settle() Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1273a0138e
commit
b25ebc5fff
6 files changed
+719
-247
No files matched your search
@@ -0,0 +1,69 @@
|
||||
/** 创作分成:批量勾选计数、全选、结算二次确认 + 防重复提交。仅本页入队。 */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var root = document.querySelector('.aksrt-income-page');
|
||||
if (!root) return;
|
||||
|
||||
var checkAll = root.querySelector('[data-aksrt-income-check-all]');
|
||||
var checks = Array.from(root.querySelectorAll('[data-aksrt-income-check]'));
|
||||
var batchSubmit = root.querySelector('[data-aksrt-income-batch-submit]');
|
||||
var selected = root.querySelector('[data-aksrt-income-selected]');
|
||||
var emptyText = selected ? selected.textContent : '';
|
||||
|
||||
function checkedCount() {
|
||||
return checks.filter(function (box) { return box.checked; }).length;
|
||||
}
|
||||
|
||||
function sync() {
|
||||
var count = checkedCount();
|
||||
if (batchSubmit) batchSubmit.disabled = count === 0;
|
||||
if (selected) {
|
||||
selected.textContent = count > 0 ? '已选 ' + count + ' 条' : emptyText;
|
||||
selected.classList.toggle('is-active', count > 0);
|
||||
}
|
||||
if (checkAll) {
|
||||
checkAll.checked = count > 0 && count === checks.length;
|
||||
checkAll.indeterminate = count > 0 && count < checks.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkAll) {
|
||||
checkAll.addEventListener('change', function () {
|
||||
checks.forEach(function (box) { box.checked = checkAll.checked; });
|
||||
sync();
|
||||
});
|
||||
}
|
||||
checks.forEach(function (box) { box.addEventListener('change', sync); });
|
||||
sync();
|
||||
|
||||
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.replace('{count}', String(checkedCount())))) {
|
||||
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; });
|
||||
});
|
||||
sync();
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user