| #10 | 24x34 | 10 | 0) {
products.forEach(function(item) {
var itemHtml = `
`;
$car.append(itemHtml);
});
$("[name='chickPid']").val(1);
} else {
$nullNote.addClass("inquiry-note").append(``);
$("[name='chickPid']").val("");
}
if(typeof $('#basic').popup === 'function') {
$('#basic').popup();
}
}
// 2. 數量更動與減到 0 詢問邏輯
function updateQty(id, newQty) {
var qty = parseInt(newQty);
if (isNaN(qty) || qty <= 0) {
if (confirm("是否將此商品自詢價車中移除?")) {
delProduct(id);
return;
} else {
qty = 1;
}
}
$.ajax({
url: _jsPath + "/index",
type: "GET",
data: { pid: id, qty: qty },
dataType: "json",
success: function(msg) {
renderInquiryCar(msg.data);
}
});
}
// 3. 新增商品
function addProduct(id) {
$.ajax({
url: _jsPath + "/index",
type: "GET",
data: { pid: id },
dataType: "json",
success: function(msg) {
renderInquiryCar(msg.data);
}
});
}
// 4. 刪除商品
function delProduct(id) {
$.ajax({
url: _jsPath + "/index",
type: "GET",
data: { delPid: id },
dataType: "json",
success: function(msg) {
renderInquiryCar(msg.data);
}
});
}
|