餐饮部月清表 - 经营数据优化版
:root {
--primary-color: #165DFF;
--primary-hover: #0E42D2;
--bg-color: #f0f0f0;
--border-color: #e0e0e0;
--text-color: #333;
--hover-bg: #c3c3c3;
--error-color: #e74c3c;
--info-bg: #f5f7fa;
--success-color: #28a745;
--warning-color: #ffc107;
--card-highlight: #f0f9ff;
}
* {
margin: 0; padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
body {
background-color: var(--bg-color); color: var(--text-color);
line-height: 1.6;
padding: 20px;
background-image: linear-gradient(135deg, #f5f7fa 0%, #e4ecff 100%);
min-height: 100vh;
}
.cf7-ultra-container {
max-width: 1200px; margin: 0 auto;
padding: 20px;
}
.cf7-header {
text-align: center; margin-bottom: 30px;
padding: 25px;
background: white;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.cf7-header h1 {
font-size: 2.2rem; color: var(--primary-color);
margin-bottom: 20px;
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
}
.cf7-header p {
font-size: 1.1rem; color: #666;
max-width: 700px;
margin: 0 auto;
}
.info-header {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
margin-top: 20px;
}
.info-item {
display: flex;
align-items: center;
gap: 10px;
background: var(--info-bg);
padding: 12px 20px;
border-radius: 8px;
}
.cf7-section-card {
background-color: #ffffff; border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
margin-bottom: 25px;
padding: 25px;
transition: all 0.3s ease; border-left: 4px solid var(--primary-color);
}
.cf7-section-card:hover {
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.cf7-info-card {
background-color: var(--info-bg); border-radius: 8px;
margin-bottom: 25px;
padding: 25px;
border-left: 4px solid #8c9eff;
}
.cf7-info-title {
color: #555; font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
}
.cf7-info-title i {
color: var(--primary-color);
}
.cf7-info-content {
color: #666; line-height: 1.6;
}
.cf7-info-content ul {
margin: 15px 0 15px 20px;
}
.cf7-info-content li {
margin-bottom: 8px;
}
.cf7-section-title {
color: var(--text-color); font-size: 20px;
font-weight: 600;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
display: flex;
align-items: center;
}
.cf7-section-title::before {
content: ''; display: inline-block;
width: 6px;
height: 20px;
background-color: var(--primary-color);
margin-right: 10px;
border-radius: 3px;
}
.cf7-form-row {
display: flex; flex-wrap: wrap;
margin: 0 -15px;
}
.cf7-form-col {
flex: 1; padding: 0 15px;
margin-bottom: 20px;
min-width: 280px;
}
.cf7-form-col-sm {
flex: 1; padding: 0 10px;
margin-bottom: 15px;
min-width: 120px;
}
@media (max-width: 768px) {
.cf7-form-col, .cf7-form-col-sm {
flex-basis: 100%;
}
}
.cf7-input-wrapper {
position: relative; margin-bottom: 20px;
}
.cf7-label {
display: block; margin-bottom: 8px;
font-weight: 500;
color: #555;
display: flex;
align-items: flex-start;
gap: 8px;
}
.cf7-label i {
color: var(--primary-color); font-size: 16px;
}
.required {
color: var(--error-color); margin-left: 3px;
font-size: 14px;
}
.cf7-input, .cf7-select, .cf7-textarea {
width: 100%; padding: 12px 15px;
border: 1px solid var(--border-color);
border-radius: 5px;
background-color: #fff;
transition: all 0.3s ease;
font-size: 15px;
color: var(--text-color); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.cf7-input:focus, .cf7-select:focus, .cf7-textarea:focus {
outline: none; border-color: var(--primary-color);
background-color: #fff;
box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.15);
}
.cf7-input::placeholder, .cf7-textarea::placeholder {
color: #999;
}
.cf7-radio-group {
margin-bottom: 20px;
}
.cf7-radio {
display: flex; flex-wrap: wrap;
gap: 10px;
}
.cf7-radio-item {
display: flex; align-items: center;
margin-right: 15px;
margin-bottom: 10px;
}
.cf7-radio-item input[type="radio"] {
position: absolute; opacity: 0;
width: 0;
height: 0;
}
.cf7-radio-item label {
display: inline-block; padding: 10px 20px;
border-radius: 6px;
background-color: var(--bg-color);
color: #666;
cursor: pointer;
transition: all 0.2s ease;
font-size: 15px;
min-width: 100px; text-align: center;
}
.cf7-radio-item input[type="radio"]:checked + label {
background-color: var(--primary-color); color: #fff;
box-shadow: 0 2px 5px rgba(22, 93, 255, 0.3);
}
.cf7-radio-item label:hover {
background-color: var(--hover-bg);
}
.cf7-checkbox-group {
margin-bottom: 20px;
}
.cf7-checkbox {
display: flex; flex-wrap: wrap;
gap: 10px;
}
.cf7-checkbox-item {
display: flex; align-items: center;
margin-bottom: 15px;
width: 100%;
}
.cf7-checkbox-item input[type="checkbox"] {
position: absolute; opacity: 0;
width: 0;
height: 0;
}
.cf7-checkbox-item label {
position: relative; padding-left: 35px;
cursor: pointer;
line-height: 22px;
color: #666;
font-size: 15px;
display: inline-block;
}
.cf7-checkbox-item label:before {
content: ''; position: absolute;
left: 0;
top: 0;
width: 22px;
height: 22px;
border: 2px solid var(--border-color);
border-radius: 4px;
background-color: #fff; transition: all 0.2s ease;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.cf7-checkbox-item input[type="checkbox"]:checked + label:before {
background-color: var(--primary-color); border-color: var(--primary-color);
}
.cf7-checkbox-item input[type="checkbox"]:checked + label:after {
content: ''; position: absolute;
left: 7px;
top: 3px;
width: 6px;
height: 12px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
.cf7-checkbox-item label:hover:before {
border-color: var(--primary-color);
}
.cf7-submit-wrapper {
text-align: center; margin-top: 30px;
margin-bottom: 20px;
}
.cf7-submit {
background-color: var(--primary-color); color: #fff;
border: none;
border-radius: 8px;
padding: 16px 50px;
font-size: 17px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease; box-shadow: 0 4px 12px rgba(22, 93, 255, 0.25);
position: relative;
overflow: hidden;
display: inline-flex;
align-items: center;
gap: 10px;
}
.cf7-submit:hover {
background-color: var(--primary-hover); transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(22, 93, 255, 0.3);
}
.cf7-submit:active {
transform: translateY(0);
}
.cf7-submit::before {
content: ''; position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); animation: shine 2s infinite;
}
@keyframes shine {
100% {
left: 100%;
}
}
.cf7-footer {
text-align: center; margin-top: 30px;
color: #777;
font-size: 14px;
}
.stats-summary {
display: flex; justify-content: space-around;
margin: 25px 0;
flex-wrap: wrap;
gap: 15px;
}
.stat-card {
background: white; border-radius: 10px;
padding: 20px;
box-shadow: 0 3px 10px rgba(0,0,0,0.05);
text-align: center;
min-width: 180px;
flex: 1;
transition: all 0.3s ease;
}
.stat-card.highlight {
background: var(--card-highlight); border: 2px solid var(--primary-color);
box-shadow: 0 6px 15px rgba(22, 93, 255, 0.15);
}
.stat-card:hover {
transform: translateY(-3px); box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}
.stat-card .value {
font-size: 1.8rem; font-weight: bold;
color: var(--primary-color);
margin: 10px 0;
}
.stat-card .sub-value {
font-size: 1rem; margin: 5px 0;
color: #666;
}
.stat-card .label {
color: #666; font-size: 0.9rem;
}
.progress-container {
margin-top: 10px;
}
.progress-bar {
height: 8px; background: #e0e0e0;
border-radius: 4px;
overflow: hidden;
}
.progress-fill {
height: 100%; background: var(--primary-color);
border-radius: 4px;
transition: width 0.5s ease;
}
.calculation-result {
font-size: 1.1rem; font-weight: 600;
color: var(--primary-color);
margin-top: 10px;
padding: 8px 0;
border-top: 1px dashed #ddd;
}
.calculation-value {
color: #ff6b35; font-weight: 700;
}
/* 添加自定义提醒样式 - 与日清表一致 */
.custom-alert {
position: fixed; top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20px 40px;
border-radius: 8px;
font-size: 18px;
font-weight: 500;
text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
z-index: 10000;
animation: fadeIn 0.3s ease-out, fadeOut 0.5s ease-in 2.5s forwards;
display: flex;
align-items: center; gap: 15px;
min-width: 400px;
}
@keyframes fadeIn {
from { opacity: 0; transform: translate(-50%, -60%); }
to { opacity: 1; transform: translate(-50%, -50%); }
}
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; visibility: hidden; }
}
.custom-alert.success {
background-color: #d4edda; color: #155724;
border: 1px solid #c3e6cb;
}
.custom-alert.error {
background-color: #f8d7da; color: #721c24;
border: 1px solid #f5c6cb;
}
/* 必填字段错误样式 */
.field-error .cf7-input-wrapper {
position: relative; }
.field-error .cf7-input-wrapper::after {
content: "此字段为必填项"; position: absolute;
top: 100%;
left: 15px;
color: #e74c3c;
font-size: 12px;
margin-top: 4px; }
.field-error .cf7-input-wrapper .cf7-input,
.field-error .cf7-input-wrapper .cf7-select,
.field-error .cf7-input-wrapper .cf7-textarea {
border-color: #e74c3c !important; box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15) !important; }
/* 单选框错误样式 */
.field-error.cf7-radio-group .cf7-radio-item label {
background-color: rgba(231, 76, 60, 0.1); border: 1px solid #e74c3c;
}
/* 复选框组错误样式 */
.field-error.cf7-checkbox-group .cf7-label {
color: var(--error-color);
}
.alert-icon {
font-size: 24px; }
.cf7-validation-error {
color: #e74c3c; font-size: 14px;
margin-top: 5px;
display: block;
}
/* 表单提交时的遮罩层 */
.form-overlay {
position: fixed; top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: none;
z-index: 9999;
transition: opacity 0.3s ease;
}
/* 加载动画 */
.loader {
position: fixed; top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 5px solid #f3f3f3;
border-top: 5px solid var(--primary-color);
border-radius: 50%;
width: 50px; height: 50px;
animation: spin 1s linear infinite;
z-index: 10001;
display: none; }
@keyframes spin {
0% { transform: translate(-50%, -50%) rotate(0deg); }
100% { transform: translate(-50%, -50%) rotate(360deg); }
}
/* 隐藏CF7生成的包裹元素,以避免样式冲突 */
.wpcf7-form-control-wrap {
display: none; }
/* 隐藏隐藏字段的容器 */
.cf7-hidden-fields {
display: none;
}
.target-status {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 20px;
}
.target-item {
display: flex;
align-items: center;
gap: 10px;
background: var(--info-bg);
padding: 12px 15px;
border-radius: 8px;
}
.checkbox-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 15px;
margin-top: 15px;
}
document.addEventListener('DOMContentLoaded', function() {
const today = new Date();
const formattedDate = today.toISOString().split('T')[0];
document.getElementById('填报日期').value = formattedDate;
updateCards();
const businessInputs = [
'本月收入目标', '本月总收入', '本月利润目标', '本月总利润',
'本月总支出', '本月客流量', '本月客单价'
];
businessInputs.forEach(id => {
const element = document.getElementById(id);
if(element) element.addEventListener('input', updateCards);
});
document.addEventListener('wpcf7mailsent', function(event) {
hideOverlay();
showAlert('提交成功!您的月报已成功发送。', 'success');
setTimeout(() => {
resetForm();
const today = new Date();
const formattedDate = today.toISOString().split('T')[0];
document.getElementById('填报日期').value = formattedDate;
updateCards();
}, 3000);
}, false);
document.addEventListener('wpcf7invalid', function(event) {
hideOverlay();
}, false);
document.addEventListener('wpcf7mailfailed', function(event) {
hideOverlay();
showAlert('提交过程中发生错误,请稍后再试。', 'error');
}, false);
const submitBtn = document.getElementById('cf7-submit-btn');
if(submitBtn) {
submitBtn.addEventListener('click', function(e) {
if (!validateForm()) {
e.preventDefault();
showAlert('表单验证失败:请检查所有必填字段并修正错误。', 'error');
return;
}
syncFormDataToCF7();
showOverlay();
});
}
let submitTimeout;
function showOverlay() {
document.getElementById('formOverlay').style.display = 'block';
document.getElementById('formLoader').style.display = 'block';
submitTimeout = setTimeout(function() {
hideOverlay();
showAlert('提交超时,请检查网络连接后重试。', 'error');
}, 30000);
}
function hideOverlay() {
clearTimeout(submitTimeout);
document.getElementById('formOverlay').style.display = 'none';
document.getElementById('formLoader').style.display = 'none';
}
});
function syncFormDataToCF7() {
const fieldsToSync = [
'填报人', '填报日期', '本月收入目标', '本月总收入',
'本月利润目标', '本月总利润', '本月总支出', '本月客流量',
'本月客单价', '分析', '员工满意度-主要情况',
'部门人数', '本月离职', '本月新增', '人员变动原因',
'当月顾客满意度调查条数', '当月顾客投诉条数', '投诉主要情况',
'迎检主要情况', '供应商情况说明', '月度总结'
];
fieldsToSync.forEach(id => {
const source = document.getElementById(id);
const target = document.getElementById('cf7-' + id);
if (source && target) target.value = source.value;
});
const radioGroups = [
'当月收入目标', '当月利润目标', '当月原材料占比',
'本月培训已完成并记录', '员工考核', '员工满意度',
'当月发票报销情况', '当月成本核算情况',
'当月顾客满意度', '当月顾客投诉', '当月迎检情况'
];
radioGroups.forEach(name => {
const checkedRadio = document.querySelector(`input[name="${name}"]:checked`);
const target = document.getElementById('cf7-' + name);
if (target) target.value = checkedRadio ? checkedRadio.value : '';
});
const records = Array.from(document.querySelectorAll('input[name="当月食堂记录本填写完成情况"]:checked'))
.map(cb => cb.value).join(', ');
const cf7Records = document.getElementById('cf7-当月食堂记录本填写完成情况');
if (cf7Records) cf7Records.value = records;
const suppliers = Array.from(document.querySelectorAll('input[name="供应商评估"]:checked'))
.map(cb => cb.value).join(', ');
const cf7Suppliers = document.getElementById('cf7-供应商评估');
if (cf7Suppliers) cf7Suppliers.value = suppliers;
}
function updateCards() {
const 本月收入目标 = parseFloat(document.getElementById('本月收入目标').value) || 0;
const 本月总收入 = parseFloat(document.getElementById('本月总收入').value) || 0;
const 本月利润目标 = parseFloat(document.getElementById('本月利润目标').value) || 0;
const 本月总利润 = parseFloat(document.getElementById('本月总利润').value) || 0;
const 本月总支出 = parseFloat(document.getElementById('本月总支出').value) || 0;
const 本月客流量 = parseInt(document.getElementById('本月客流量').value) || 0;
const 本月客单价 = parseFloat(document.getElementById('本月客单价').value) || 0;
const 收入完成率 = 本月收入目标 > 0 ? (本月总收入 / 本月收入目标) * 100 : 0;
const 利润完成率 = 本月利润目标 > 0 ? (本月总利润 / 本月利润目标) * 100 : 0;
const 毛利 = 本月总收入 - 本月总支出;
const 毛利率 = 本月总收入 > 0 ? (毛利 / 本月总收入) * 100 : 0;
document.getElementById('本月总收入-value').textContent = `¥${本月总收入.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('本月收入目标-value').textContent = `¥${本月收入目标.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('收入完成率-value').textContent = `${收入完成率.toFixed(2)}%`;
document.getElementById('收入进度').style.width = `${Math.min(100, 收入完成率)}%`;
document.getElementById('本月总利润-value').textContent = `¥${本月总利润.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('本月利润目标-value').textContent = `¥${本月利润目标.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('利润完成率-value').textContent = `${利润完成率.toFixed(2)}%`;
document.getElementById('利润进度').style.width = `${Math.min(100, 利润完成率)}%`;
document.getElementById('毛利-value').textContent = `¥${毛利.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('本月总支出-value').textContent = `¥${本月总支出.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('毛利率-value').textContent = `${毛利率.toFixed(2)}%`;
document.getElementById('本月客流量-value').textContent = 本月客流量.toLocaleString('zh-CN');
document.getElementById('本月客单价-value').textContent = `¥${本月客单价.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
}
function showAlert(message, type) {
const existingAlert = document.querySelector('.custom-alert');
if (existingAlert) existingAlert.remove();
const alertDiv = document.createElement('div');
alertDiv.className = `custom-alert ${type}`;
const icon = document.createElement('i');
icon.className = `fas ${type === 'success' ? 'fa-check-circle alert-icon' : 'fa-exclamation-circle alert-icon'}`;
alertDiv.appendChild(icon);
const text = document.createTextNode(message);
alertDiv.appendChild(text);
document.body.appendChild(alertDiv);
setTimeout(() => {
if (alertDiv.parentNode) alertDiv.parentNode.removeChild(alertDiv);
}, 3000);
}
function validateForm() {
let isValid = true;
let firstErrorElement = null;
document.querySelectorAll('.cf7-validation-error').forEach(el => el.textContent = '');
document.querySelectorAll('.field-error').forEach(el => el.classList.remove('field-error'));
const requiredFields = [
'填报人', '填报日期', '本月收入目标', '本月总收入',
'本月利润目标', '本月总利润', '本月总支出', '本月客流量',
'本月客单价', '分析', '员工满意度-主要情况',
'部门人数', '本月离职', '本月新增', '人员变动原因',
'当月顾客满意度调查条数', '当月顾客投诉条数', '投诉主要情况',
'迎检主要情况', '供应商情况说明', '月度总结'
];
requiredFields.forEach(fieldId => {
const element = document.getElementById(fieldId);
if (element) {
const wrapper = element.closest('.cf7-input-wrapper');
if (!element.value.trim()) {
document.getElementById(`${fieldId}-error`).textContent = '此字段为必填项';
if (wrapper) wrapper.classList.add('field-error');
isValid = false;
if (!firstErrorElement) firstErrorElement = element;
}
}
});
const 部门人数 = document.getElementById('部门人数');
const 本月离职 = document.getElementById('本月离职');
const 本月新增 = document.getElementById('本月新增');
const 部门人员情况Error = document.getElementById('部门人员情况-error');
const 部门人员情况Wrapper = 部门人数.closest('.cf7-input-wrapper');
if (!部门人数.value.trim() || !本月离职.value.trim() || !本月新增.value.trim()) {
部门人员情况Error.textContent = '部门人员情况均为必填项';
if (部门人员情况Wrapper) 部门人员情况Wrapper.classList.add('field-error');
isValid = false;
if (!firstErrorElement) firstErrorElement = 部门人数;
}
const radioGroups = [
'当月收入目标', '当月利润目标', '当月原材料占比',
'本月培训已完成并记录', '员工考核', '员工满意度',
'当月发票报销情况', '当月成本核算情况',
'当月顾客满意度', '当月顾客投诉', '当月迎检情况'
];
radioGroups.forEach(groupName => {
const selected = document.querySelector(`input[name="${groupName}"]:checked`);
if (!selected) {
const groupElement = document.querySelector(`input[name="${groupName}"]`);
if (groupElement) {
const groupWrapper = groupElement.closest('.cf7-radio-group');
document.getElementById(`${groupName}-error`).textContent = '请选择一个选项';
if (groupWrapper) groupWrapper.classList.add('field-error');
isValid = false;
if (!firstErrorElement) firstErrorElement = groupWrapper;
}
}
});
const checkboxGroups = [
{ name: '当月食堂记录本填写完成情况', errorId: '当月食堂记录本填写完成情况-error' },
{ name: '供应商评估', errorId: '供应商评估-error' }
];
checkboxGroups.forEach(group => {
const selected = document.querySelector(`input[name="${group.name}"]:checked`);
if (!selected) {
const groupElement = document.querySelector(`input[name="${group.name}"]`);
if (groupElement) {
const groupWrapper = groupElement.closest('.cf7-checkbox-group');
document.getElementById(group.errorId).textContent = '请至少选择一个选项';
if (groupWrapper) groupWrapper.classList.add('field-error');
isValid = false;
if (!firstErrorElement) firstErrorElement = groupWrapper;
}
}
});
if (firstErrorElement) {
firstErrorElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
return isValid;
}
function resetForm() {
const formContainer = document.querySelector('.cf7-ultra-container');
if (!formContainer) return;
formContainer.querySelectorAll('input[type="text"], input[type="number"], input[type="date"], textarea, select').forEach(el => {
el.value = '';
});
formContainer.querySelectorAll('input[type="checkbox"], input[type="radio"]').forEach(el => {
el.checked = false;
});
document.querySelectorAll('.cf7-validation-error').forEach(el => el.textContent = '');
document.querySelectorAll('.field-error').forEach(el => el.classList.remove('field-error'));
}
[kaya_qrcode title_align=”alignnone” dynamic_content=”0″ ecclevel=”L” border=”4″ color=”#000000″ bgcolor=”#FFFFFF” align=”alignnone” css_shadow=”0″ no_css=”0″ new_window=”0″ content_url=”0″ download_button=”0″ download_align=”alignnone”]