餐饮部长周报管理
:root {
--primary-color: #165DFF;
--primary-hover: #0E42D2;
--bg-color: #f9f9f9;
--border-color: #e0e0e0;
--text-color: #333;
--hover-bg: #f0f0f0;
--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: 1000px; 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: 10px;
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;
}
.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: center;
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;
}
[hidden* department id:cf7-department]
[hidden* report-date id:cf7-report-date]
[hidden* reporter id:cf7-reporter]
[hidden* income-target id:cf7-income-target]
[hidden* weekly-income id:cf7-weekly-income]
[hidden* profit-target id:cf7-profit-target]
[hidden* total-profit id:cf7-total-profit]
[hidden* total-expense id:cf7-total-expense]
[hidden* customer-flow id:cf7-customer-flow]
[hidden* customer-unit-price id:cf7-customer-unit-price]
[hidden* analysis id:cf7-analysis]
[hidden* health id:cf7-health]
[hidden* unhealthy id:cf7-unhealthy]
[hidden* promotion-week id:cf7-promotion-week]
[hidden* popular-dishes id:cf7-popular-dishes]
[hidden* menu-suggestion id:cf7-menu-suggestion]
[hidden* manager-report id:cf7-manager-report]
[hidden* last-week-summary id:cf7-last-week-summary]
[hidden* improvement-plan id:cf7-improvement-plan]
[hidden* other-notes id:cf7-other-notes]
填写说明
数据提交要求:
- 所有经营数据需在本周营业结束后2小时内填写提交
- 人员管理和标准化体系部分需由部门主管审核
- 备注栏可用于记录特殊情况或需要说明的事项
数据准确性:请确保所有数据真实准确,财务数据精确到小数点后两位。
提交时效:周报需在每周日23:00前完成提交。
document.addEventListener('DOMContentLoaded', function() {
const today = new Date();
const formattedDate = today.toISOString().split('T')[0];
document.getElementById('report-date').value = formattedDate;
updateCards();
const businessInputs = [
'income-target', 'weekly-income', 'profit-target', 'total-profit',
'total-expense', 'customer-flow', 'customer-unit-price'
];
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('report-date').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 = [
'department', 'report-date', 'reporter', 'income-target', 'weekly-income',
'profit-target', 'total-profit', 'total-expense', 'customer-flow',
'customer-unit-price', 'analysis', 'unhealthy', 'promotion-week',
'popular-dishes', 'menu-suggestion', 'manager-report', 'last-week-summary',
'improvement-plan', 'other-notes'
];
fieldsToSync.forEach(id => {
const source = document.getElementById(id);
const target = document.getElementById('cf7-' + id);
if (source && target) target.value = source.value;
});
// 同步单选按钮
const checkedRadio = document.querySelector('input[name="health"]:checked');
const healthTarget = document.getElementById('cf7-health');
if (healthTarget) healthTarget.value = checkedRadio ? checkedRadio.value : '';
}
function updateCards() {
const incomeTarget = parseFloat(document.getElementById('income-target').value) || 0;
const weeklyIncome = parseFloat(document.getElementById('weekly-income').value) || 0;
const profitTarget = parseFloat(document.getElementById('profit-target').value) || 0;
const totalProfit = parseFloat(document.getElementById('total-profit').value) || 0;
const totalExpense = parseFloat(document.getElementById('total-expense').value) || 0;
const customerFlow = parseInt(document.getElementById('customer-flow').value) || 0;
const customerUnitPrice = parseFloat(document.getElementById('customer-unit-price').value) || 0;
const incomeCompletion = incomeTarget > 0 ? (weeklyIncome / incomeTarget) * 100 : 0;
const profitCompletion = profitTarget > 0 ? (totalProfit / profitTarget) * 100 : 0;
const grossProfit = weeklyIncome - totalExpense;
const grossMargin = weeklyIncome > 0 ? (grossProfit / weeklyIncome) * 100 : 0;
document.getElementById('income-value').textContent = `¥${weeklyIncome.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('income-target-value').textContent = `¥${incomeTarget.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('income-completion-value').textContent = `${incomeCompletion.toFixed(2)}%`;
document.getElementById('income-progress').style.width = `${Math.min(100, incomeCompletion)}%`;
document.getElementById('profit-value').textContent = `¥${totalProfit.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('profit-target-value').textContent = `¥${profitTarget.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('profit-completion-value').textContent = `${profitCompletion.toFixed(2)}%`;
document.getElementById('profit-progress').style.width = `${Math.min(100, profitCompletion)}%`;
document.getElementById('gross-profit-value').textContent = `¥${grossProfit.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('expense-value').textContent = `¥${totalExpense.toLocaleString('zh-CN', {maximumFractionDigits: 2})}`;
document.getElementById('gross-margin-value').textContent = `${grossMargin.toFixed(2)}%`;
document.getElementById('customer-traffic-value').textContent = customerFlow.toLocaleString('zh-CN');
document.getElementById('customer-unit-price-value').textContent = `¥${customerUnitPrice.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 = [
'department', 'report-date', 'reporter',
'income-target', 'weekly-income', 'profit-target',
'total-profit', 'total-expense', 'customer-flow',
'customer-unit-price', 'analysis', 'unhealthy',
'promotion-week', 'popular-dishes', 'menu-suggestion',
'manager-report', 'last-week-summary', 'improvement-plan',
'other-notes'
];
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 radioGroups = ['health'];
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;
}
}
});
// 如果有错误,滚动到第一个错误元素
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'));
}