后台管理跳过asin、后台相关数据做数据隔离
This commit is contained in:
@@ -1995,10 +1995,35 @@
|
||||
if (!value) return '<span style="color:#999;">-</span>';
|
||||
return '<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap;">' +
|
||||
'<span>' + value + '</span>' +
|
||||
'<button class="btn btn-sm" data-skip-price-asin-edit="' + item.id + '" data-country="' + country.code + '" data-asin="' + value.replace(/"/g, '"') + '" data-shop-name="' + (item.shop_name || '').replace(/"/g, '"') + '">编辑</button>' +
|
||||
'<button class="btn btn-sm btn-danger" data-skip-price-asin-delete="' + item.id + '" data-country="' + country.code + '" data-shop-name="' + (item.shop_name || '').replace(/"/g, '"') + '">删除</button>' +
|
||||
'</div>';
|
||||
}
|
||||
function bindSkipPriceAsinActions() {
|
||||
document.querySelectorAll('[data-skip-price-asin-edit]').forEach(function(btn) {
|
||||
btn.onclick = function() {
|
||||
var shopName = (btn.dataset.shopName || '').replace(/"/g, '"');
|
||||
var countryCode = btn.dataset.country || '';
|
||||
var currentAsin = (btn.dataset.asin || '').replace(/"/g, '"');
|
||||
var nextAsin = prompt('请输入店铺“' + shopName + '”在 ' + countryCode + ' 的 ASIN', currentAsin);
|
||||
if (nextAsin === null) return;
|
||||
nextAsin = (nextAsin || '').trim();
|
||||
if (!nextAsin) {
|
||||
alert('ASIN 不能为空');
|
||||
return;
|
||||
}
|
||||
fetch('/api/admin/skip-price-asin/' + btn.dataset.skipPriceAsinEdit + '/country/' + countryCode, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ asin: nextAsin })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(res) {
|
||||
if (res.success) loadSkipPriceAsin(skipPriceAsinPage);
|
||||
else alert(res.error || '保存失败');
|
||||
});
|
||||
};
|
||||
});
|
||||
document.querySelectorAll('[data-skip-price-asin-delete]').forEach(function(btn) {
|
||||
btn.onclick = function() {
|
||||
var shopName = (btn.dataset.shopName || '').replace(/"/g, '"');
|
||||
|
||||
Reference in New Issue
Block a user