feat(admin): add bulk actions and pending-record deletion to creator income
- Always render the checkbox column and bulk bar; disable with a reason instead of hiding when settlement is off or the page has no pending rows - Replace the batch-settle button with a bulk action select (settle / delete) plus apply, matching the charge cards and invite codes pages - Add per-row delete for pending records and Revenue::delete_pending(), guarded by status = 'pending' so settled ledger-backed rows are never removed - Report done / failed counts for bulk settle and delete Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b25ebc5fff
commit
1d6bc8f7cc
5 files changed
+146
-48
No files matched your search
@@ -12,11 +12,12 @@
|
||||
.aksrt-income-page .aksrt-income-filters__id { width: 96px; }
|
||||
.aksrt-income-filters__submit { display: inline-flex; gap: 8px; }
|
||||
|
||||
/* ---------- 批量结算 ---------- */
|
||||
.aksrt-income-batch { margin: 0; }
|
||||
.aksrt-income-batch__count { color: var(--an-muted); font-size: 12px; }
|
||||
.aksrt-income-batch__count.is-active { color: var(--an-text); font-weight: 500; }
|
||||
.aksrt-income-page .aksrt-income-batch .button:disabled { opacity: .6; cursor: not-allowed; }
|
||||
/* ---------- 批量操作 ---------- */
|
||||
.aksrt-income-bulk { margin: 0; }
|
||||
.aksrt-income-bulk__count { color: var(--an-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
||||
.aksrt-income-bulk__count.is-active { color: var(--an-text); font-weight: 500; }
|
||||
.aksrt-income-page .aksrt-income-bulk .button:disabled { opacity: .6; cursor: not-allowed; }
|
||||
.aksrt-income-table .check-column input:disabled { cursor: not-allowed; opacity: .45; }
|
||||
|
||||
/* ---------- 分成表 ---------- */
|
||||
.aksrt-income-table { min-width: 1040px; table-layout: fixed; }
|
||||
@@ -25,8 +26,8 @@
|
||||
.aksrt-income-table .column-source { width: 24%; }
|
||||
.aksrt-income-table .column-base { width: 14%; }
|
||||
.aksrt-income-table .column-amount { width: 12%; }
|
||||
.aksrt-income-table .column-status { width: 13%; }
|
||||
.aksrt-income-table .column-actions { width: 9%; }
|
||||
.aksrt-income-table .column-status { width: 12%; }
|
||||
.aksrt-income-table .column-actions { width: 13%; }
|
||||
.aksrt-income-table td,
|
||||
.aksrt-income-table tbody th { vertical-align: top; }
|
||||
.aksrt-income-id { color: var(--an-text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600; }
|
||||
@@ -40,7 +41,8 @@ a.aksrt-income-post:focus { color: var(--an-primary); }
|
||||
.aksrt-income-table .column-base,
|
||||
.aksrt-income-table .column-amount { font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* 行内结算:单按钮 POST 表单 */
|
||||
/* 行内操作:每个按钮是一个独立 POST 表单 */
|
||||
.aksrt-income-actions { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.aksrt-income-action { display: inline-flex; margin: 0; }
|
||||
.aksrt-income-action .button[disabled] { opacity: .6; cursor: progress; }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** 创作分成:批量勾选计数、全选、结算二次确认 + 防重复提交。仅本页入队。 */
|
||||
/** 创作分成:勾选计数、全选、批量操作(结算 / 删除)、二次确认 + 防重复提交。仅本页入队。 */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
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 bulkAction = root.querySelector('[data-aksrt-income-bulk-action]');
|
||||
var bulkSubmit = root.querySelector('[data-aksrt-income-bulk-submit]');
|
||||
var selected = root.querySelector('[data-aksrt-income-selected]');
|
||||
var emptyText = selected ? selected.textContent : '';
|
||||
|
||||
@@ -17,12 +18,12 @@
|
||||
|
||||
function sync() {
|
||||
var count = checkedCount();
|
||||
if (batchSubmit) batchSubmit.disabled = count === 0;
|
||||
if (bulkSubmit) bulkSubmit.disabled = count === 0 || !bulkAction || bulkAction.value === '';
|
||||
if (selected) {
|
||||
selected.textContent = count > 0 ? '已选 ' + count + ' 条' : emptyText;
|
||||
selected.classList.toggle('is-active', count > 0);
|
||||
}
|
||||
if (checkAll) {
|
||||
if (checkAll && !checkAll.disabled) {
|
||||
checkAll.checked = count > 0 && count === checks.length;
|
||||
checkAll.indeterminate = count > 0 && count < checks.length;
|
||||
}
|
||||
@@ -35,8 +36,18 @@
|
||||
});
|
||||
}
|
||||
checks.forEach(function (box) { box.addEventListener('change', sync); });
|
||||
if (bulkAction) bulkAction.addEventListener('change', sync);
|
||||
sync();
|
||||
|
||||
/** 单行表单的确认文案在 form 上;批量表单按所选操作取 option 上的文案。 */
|
||||
function confirmMessage(form) {
|
||||
if (bulkAction && form.contains(bulkAction)) {
|
||||
var option = bulkAction.selectedOptions[0];
|
||||
return option ? option.getAttribute('data-confirm') : '';
|
||||
}
|
||||
return form.getAttribute('data-aksrt-confirm');
|
||||
}
|
||||
|
||||
root.addEventListener('submit', function (event) {
|
||||
var form = event.target.closest('form');
|
||||
if (!form) return;
|
||||
@@ -44,7 +55,7 @@
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
var message = form.getAttribute('data-aksrt-confirm');
|
||||
var message = confirmMessage(form);
|
||||
if (message && !window.confirm(message.replace('{count}', String(checkedCount())))) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user