diff --git a/other-module/canteen-device/ratio-scale/02-weighing-packing.html b/other-module/canteen-device/ratio-scale/02-weighing-packing.html index bc9189e..6f25d2a 100644 --- a/other-module/canteen-device/ratio-scale/02-weighing-packing.html +++ b/other-module/canteen-device/ratio-scale/02-weighing-packing.html @@ -436,7 +436,7 @@
- +
@@ -745,52 +745,8 @@ event.target.value = ''; } - /* ---- 日期选择器 ---- */ - function initDatePicker() { - var yearSel = document.getElementById('formExpiryYear'); - var monthSel = document.getElementById('formExpiryMonth'); - var daySel = document.getElementById('formExpiryDay'); - var now = new Date(); - var thisYear = now.getFullYear(); - /* 年:今年起往后 3 年 */ - for (var y = thisYear; y <= thisYear + 3; y++) { - var opt = document.createElement('option'); - opt.value = y; opt.textContent = y + ' 年'; - yearSel.appendChild(opt); - } - /* 月:1-12 */ - for (var m = 1; m <= 12; m++) { - var opt = document.createElement('option'); - opt.value = m; opt.textContent = m + ' 月'; - monthSel.appendChild(opt); - } - /* 日:根据年月动态更新 */ - monthSel.onchange = function() { updateDays(); }; - yearSel.onchange = function() { updateDays(); }; - } - function updateDays() { - var year = parseInt(document.getElementById('formExpiryYear').value); - var month = parseInt(document.getElementById('formExpiryMonth').value); - var daySel = document.getElementById('formExpiryDay'); - var curVal = daySel.value; - daySel.innerHTML = ''; - if (!year || !month) return; - var daysInMonth = new Date(year, month, 0).getDate(); - for (var d = 1; d <= daysInMonth; d++) { - var opt = document.createElement('option'); - opt.value = d; opt.textContent = d + ' 日'; - daySel.appendChild(opt); - } - if (parseInt(curVal) <= daysInMonth) daySel.value = curVal; - } - function resetDatePicker() { - document.getElementById('formExpiryYear').value = ''; - document.getElementById('formExpiryMonth').value = ''; - document.getElementById('formExpiryDay').innerHTML = ''; - } - - /* ---- 下一步:打开包装弹窗 ---- */ - function handleNext() { + /* ---- 配比完成 ---- */ + function handlePackDone() { var allDone = currentPack.ingredients.every(function(ing) { var need = ing.weightPerPack * currentPack.packSize; return ing.weighed >= need; @@ -799,35 +755,10 @@ showToast('还有食材未完成称重', 2500, 'error'); return; } - /* 重置弹窗字段 */ - document.getElementById('formPackMethod').value = ''; - resetDatePicker(); - document.getElementById('formTemp').value = ''; - document.getElementById('formDevice').value = ''; - document.getElementById('modalOverlay').classList.add('show'); - } - - /* ---- 关闭弹窗 ---- */ - function closeModal() { - document.getElementById('modalOverlay').classList.remove('show'); - } - - /* ---- 确认包装 ---- */ - function confirmPack() { - var packMethod = document.getElementById('formPackMethod').value; - var expYear = document.getElementById('formExpiryYear').value; - var expMonth = document.getElementById('formExpiryMonth').value; - var expDay = document.getElementById('formExpiryDay').value; - - /* 必填校验 */ - if (!packMethod) { showToast('请选择包装方式', 2000, 'error'); return; } - if (!expYear || !expMonth || !expDay) { showToast('请选择保质期至', 2000, 'error'); return; } - - closeModal(); - showToast('包装信息已确认,返回任务列表', 2500, 'success'); + showToast('配比完成', 1500, 'success'); setTimeout(function() { window.location.href = '01-packing-tasks.html' + (userName ? '?user=' + encodeURIComponent(userName) : ''); - }, 1500); + }, 1000); } /* ---- 清空重量 ---- */ @@ -883,7 +814,6 @@ })(); /* ---- 启动 ---- */ - initDatePicker(); init();