feat: 支持批量导入 PDD 商品链接 (#104)
This commit is contained in:
@@ -175,6 +175,41 @@ tr.empty small { color: #aaa; }
|
||||
margin: 12px 2px;
|
||||
}
|
||||
|
||||
/* PDD 批量导入结果:统计、下一步和失败明细放在同一区域,
|
||||
采购员不需要从底部状态条猜本批数据发生了什么。 */
|
||||
.import-result {
|
||||
margin-bottom: 12px;
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid #c9d8ee;
|
||||
border-left: 4px solid #1f6feb;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.import-result-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.import-result h2 { margin: 0 0 6px; font-size: 16px; }
|
||||
.import-result p { margin: 0; }
|
||||
.import-result .hint { margin-top: 8px; }
|
||||
.import-success { color: #176b36; font-weight: 600; }
|
||||
.import-failure-table {
|
||||
max-height: 280px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.import-failure-table .import-raw,
|
||||
.import-failure-table .import-reason {
|
||||
min-width: 260px;
|
||||
max-width: 520px;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.import-result-head { align-items: flex-start; flex-direction: column; }
|
||||
}
|
||||
|
||||
/* ── 第三段:底部状态条 ───────────────── */
|
||||
.statusbar {
|
||||
position: fixed;
|
||||
|
||||
+34
-14
@@ -189,21 +189,40 @@
|
||||
|
||||
/* PDD 批量采集弹窗只同步已选数量并提供提交反馈。
|
||||
客户端权限和任务初始状态始终由服务端决定。 */
|
||||
function setupCollectModal() {
|
||||
var openButton = document.querySelector("[data-collect-open]");
|
||||
var count = document.querySelector("[data-collect-count]");
|
||||
var form = document.getElementById("pdd-form");
|
||||
var submitButton = document.querySelector("[data-collect-submit]");
|
||||
if (!openButton || !count || !form || !submitButton) return;
|
||||
function setupCollectModals() {
|
||||
document.querySelectorAll("[data-collect-open]").forEach(function (openButton) {
|
||||
var formID = openButton.getAttribute("data-collect-form") || "pdd-form";
|
||||
var form = document.getElementById(formID);
|
||||
var modal = document.getElementById(openButton.getAttribute("data-modal-open"));
|
||||
if (!form || !modal) return;
|
||||
var count = modal.querySelector("[data-collect-count]");
|
||||
var submitButton = modal.querySelector("[data-collect-submit]");
|
||||
if (!count || !submitButton) return;
|
||||
|
||||
openButton.addEventListener("click", function () {
|
||||
count.textContent = checkedCount();
|
||||
openButton.addEventListener("click", function () {
|
||||
var fixedCount = openButton.getAttribute("data-collect-count-value");
|
||||
count.textContent = fixedCount === null ? checkedCount() : fixedCount;
|
||||
});
|
||||
form.addEventListener("submit", function (event) {
|
||||
if (event.submitter !== submitButton) return;
|
||||
submitButton.disabled = true;
|
||||
submitButton.setAttribute("aria-busy", "true");
|
||||
submitButton.textContent = "创建中…";
|
||||
});
|
||||
});
|
||||
form.addEventListener("submit", function (event) {
|
||||
if (event.submitter !== submitButton) return;
|
||||
submitButton.disabled = true;
|
||||
submitButton.setAttribute("aria-busy", "true");
|
||||
submitButton.textContent = "创建中…";
|
||||
}
|
||||
|
||||
/* Excel 解析可能需要几秒。浏览器校验通过并开始上传后立即锁住提交按钮,
|
||||
防止采购员因为没有反馈而重复提交同一批文件。 */
|
||||
function setupUploadFeedback() {
|
||||
document.querySelectorAll("[data-upload-form]").forEach(function (form) {
|
||||
var button = form.querySelector("[data-upload-submit]");
|
||||
if (!button) return;
|
||||
form.addEventListener("submit", function () {
|
||||
button.disabled = true;
|
||||
button.setAttribute("aria-busy", "true");
|
||||
button.textContent = "导入中…";
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -423,7 +442,8 @@
|
||||
setupUserResetModal();
|
||||
setupClientAssignmentModal();
|
||||
setupPurchaseModal();
|
||||
setupCollectModal();
|
||||
setupCollectModals();
|
||||
setupUploadFeedback();
|
||||
setupModals();
|
||||
setupRowDetail();
|
||||
setupCaptchaRefresh();
|
||||
|
||||
Reference in New Issue
Block a user