+42
-7
@@ -2245,7 +2245,27 @@
|
||||
});
|
||||
}
|
||||
document.getElementById('btnSearchDedupeTotalData').onclick = function () { loadDedupeTotalData(1); };
|
||||
document.getElementById('btnExportDedupeTotalData').onclick = function () {
|
||||
var dedupeTotalDataExportButton = document.getElementById('btnExportDedupeTotalData');
|
||||
var dedupeTotalDataExportWait = document.getElementById('dedupeTotalDataExportWait');
|
||||
var dedupeTotalDataExportWaitSeconds = document.getElementById('dedupeTotalDataExportWaitSeconds');
|
||||
var dedupeTotalDataExportWaitTimer = null;
|
||||
function showDedupeTotalDataExportWait() {
|
||||
var startedAt = Date.now();
|
||||
dedupeTotalDataExportWaitSeconds.textContent = '0';
|
||||
dedupeTotalDataExportWait.classList.add('show');
|
||||
dedupeTotalDataExportWait.setAttribute('aria-hidden', 'false');
|
||||
dedupeTotalDataExportWaitTimer = setInterval(function () {
|
||||
dedupeTotalDataExportWaitSeconds.textContent = String(Math.floor((Date.now() - startedAt) / 1000));
|
||||
}, 1000);
|
||||
}
|
||||
function hideDedupeTotalDataExportWait() {
|
||||
clearInterval(dedupeTotalDataExportWaitTimer);
|
||||
dedupeTotalDataExportWaitTimer = null;
|
||||
dedupeTotalDataExportWait.classList.remove('show');
|
||||
dedupeTotalDataExportWait.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
dedupeTotalDataExportButton.onclick = function () {
|
||||
if (dedupeTotalDataExportButton.disabled) return;
|
||||
var username = (document.getElementById('searchDedupeTotalDataUsername').value || '').trim();
|
||||
var groupId = (document.getElementById('dedupeTotalDataGroupFilterId').value || '').trim();
|
||||
var dateRange = getDedupeTotalDataDateRange();
|
||||
@@ -2255,6 +2275,11 @@
|
||||
if (groupId) params.push('group_id=' + encodeURIComponent(groupId));
|
||||
if (dateRange.startDate) params.push('start_date=' + encodeURIComponent(dateRange.startDate));
|
||||
if (dateRange.endDate) params.push('end_date=' + encodeURIComponent(dateRange.endDate));
|
||||
var originalButtonText = dedupeTotalDataExportButton.textContent;
|
||||
dedupeTotalDataExportButton.disabled = true;
|
||||
dedupeTotalDataExportButton.setAttribute('aria-busy', 'true');
|
||||
dedupeTotalDataExportButton.textContent = '导出中...';
|
||||
showDedupeTotalDataExportWait();
|
||||
fetch('/api/admin/dedupe-total-data/export' + (params.length ? ('?' + params.join('&')) : ''))
|
||||
.then(function (response) {
|
||||
var contentType = response.headers.get('content-type') || '';
|
||||
@@ -2278,6 +2303,12 @@
|
||||
})
|
||||
.catch(function (err) {
|
||||
alert((err && err.message) || '导出失败');
|
||||
})
|
||||
.finally(function () {
|
||||
dedupeTotalDataExportButton.disabled = false;
|
||||
dedupeTotalDataExportButton.removeAttribute('aria-busy');
|
||||
dedupeTotalDataExportButton.textContent = originalButtonText;
|
||||
hideDedupeTotalDataExportWait();
|
||||
});
|
||||
};
|
||||
var dedupeImportPollTimer = null;
|
||||
@@ -2907,16 +2938,16 @@
|
||||
.then(function (res) {
|
||||
var tbody = document.getElementById('shopManageListBody');
|
||||
if (!res.success) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="empty-tip">加载失败: ' + (res.error || '') + '</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="10" class="empty-tip">加载失败: ' + (res.error || '') + '</td></tr>';
|
||||
return;
|
||||
}
|
||||
var items = res.items || [];
|
||||
if (items.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="empty-tip">暂无店铺</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="10" class="empty-tip">暂无店铺</td></tr>';
|
||||
} else {
|
||||
tbody.innerHTML = items.map(function (item, index) {
|
||||
var rowNo = (shopManagePage - 1) * shopManagePageSize + index + 1;
|
||||
return '<tr><td>' + rowNo + '</td><td>' + (item.group_name || '') + '</td><td>' + (item.shop_name || '') + '</td><td>' + (item.mall_name || '') + '</td><td>' + (item.account || '') + '</td><td>' + renderShopPasswordCell(item) + '</td><td>' + (item.created_at || '') + '</td><td>' + (item.updated_at || '') + '</td><td>' +
|
||||
return '<tr><td>' + rowNo + '</td><td>' + (item.group_name || '') + '</td><td>' + (item.shop_name || '') + '</td><td>' + (item.mall_name || '') + '</td><td>' + (item.zn_username || '') + '</td><td>' + (item.account || '') + '</td><td>' + renderShopPasswordCell(item) + '</td><td>' + (item.created_at || '') + '</td><td>' + (item.updated_at || '') + '</td><td>' +
|
||||
'<button class="btn btn-sm" data-shop-manage-edit="' + item.id + '" data-shop-manage="' + (JSON.stringify(item).replace(/"/g, '"')) + '">编辑</button> ' +
|
||||
'<button class="btn btn-sm btn-danger" data-shop-manage-delete="' + item.id + '" data-shop-manage-name="' + (item.shop_name || '').replace(/"/g, '"') + '">删除</button>' +
|
||||
'</td></tr>';
|
||||
@@ -2926,7 +2957,7 @@
|
||||
bindShopManageActions();
|
||||
})
|
||||
.catch(function () {
|
||||
document.getElementById('shopManageListBody').innerHTML = '<tr><td colspan="9" class="empty-tip">请求失败</td></tr>';
|
||||
document.getElementById('shopManageListBody').innerHTML = '<tr><td colspan="10" class="empty-tip">请求失败</td></tr>';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2974,6 +3005,7 @@
|
||||
document.getElementById('editShopManageId').value = item.id || '';
|
||||
document.getElementById('editShopManageShopName').value = item.shop_name || '';
|
||||
document.getElementById('editShopManageMallName').value = item.mall_name || '';
|
||||
document.getElementById('editShopManageZnUsername').value = item.zn_username || '';
|
||||
document.getElementById('editShopManageAccount').value = item.account || '';
|
||||
document.getElementById('editShopManagePassword').value = item.password || '';
|
||||
document.getElementById('msgEditShopManage').textContent = '';
|
||||
@@ -3367,6 +3399,7 @@
|
||||
var groupId = (document.getElementById('shopManageGroupSelect').value || '').trim();
|
||||
var shopName = (document.getElementById('shopManageShopName').value || '').trim();
|
||||
var mallName = (document.getElementById('shopManageMallName').value || '').trim();
|
||||
var znUsername = (document.getElementById('shopManageZnUsername').value || '').trim();
|
||||
var account = (document.getElementById('shopManageAccount').value || '').trim();
|
||||
var password = (document.getElementById('shopManagePassword').value || '').trim();
|
||||
var msgEl = document.getElementById('msgShopManage');
|
||||
@@ -3380,7 +3413,7 @@
|
||||
fetch('/api/admin/shop-manage', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, mall_name: mallName, account: account, password: password })
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, mall_name: mallName, zn_username: znUsername, account: account, password: password })
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (res) {
|
||||
@@ -3388,6 +3421,7 @@
|
||||
document.getElementById('shopManageGroupSelect').value = '';
|
||||
document.getElementById('shopManageShopName').value = '';
|
||||
document.getElementById('shopManageMallName').value = '';
|
||||
document.getElementById('shopManageZnUsername').value = '';
|
||||
document.getElementById('shopManageAccount').value = '';
|
||||
document.getElementById('shopManagePassword').value = '';
|
||||
msgEl.textContent = res.msg || '创建成功';
|
||||
@@ -3409,6 +3443,7 @@
|
||||
var groupId = (document.getElementById('editShopManageGroupSelect').value || '').trim();
|
||||
var shopName = (document.getElementById('editShopManageShopName').value || '').trim();
|
||||
var mallName = (document.getElementById('editShopManageMallName').value || '').trim();
|
||||
var znUsername = (document.getElementById('editShopManageZnUsername').value || '').trim();
|
||||
var account = (document.getElementById('editShopManageAccount').value || '').trim();
|
||||
var password = (document.getElementById('editShopManagePassword').value || '').trim();
|
||||
var msgEl = document.getElementById('msgEditShopManage');
|
||||
@@ -3422,7 +3457,7 @@
|
||||
fetch('/api/admin/shop-manage/' + itemId, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, mall_name: mallName, account: account, password: password })
|
||||
body: JSON.stringify({ group_id: Number(groupId), shop_name: shopName, mall_name: mallName, zn_username: znUsername, account: account, password: password })
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (res) {
|
||||
|
||||
Reference in New Issue
Block a user