修复库存=0误转为-1的bug + 盲盒显示??及随机消费语录

This commit is contained in:
ypsdf1
2026-07-16 16:48:31 +08:00
parent a8303ba772
commit e2808276c0
2 changed files with 23 additions and 3 deletions
+3 -1
View File
@@ -3616,7 +3616,9 @@ async function editShopConfig(id) {
async function saveShopConfig() {
const id = document.getElementById('scfId').value;
const name = document.getElementById('scfName').value.trim();
const stock = parseInt(document.getElementById('scfStock').value) || -1;
// ★ 修复:库存=0不能写成-1。空值才默认-1(无限),0是合法售罄值
const stockRaw = document.getElementById('scfStock').value;
const stock = stockRaw === '' ? -1 : parseInt(stockRaw, 10);
const offer = document.getElementById('scfOffer').value.trim();
const expire = document.getElementById('scfExpire').value.trim();
const price = parseFloat(document.getElementById('scfPrice').value) || 0;