电商投产比计算器
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 20px;
color: #333;
}
.container {
max-width: 800px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
text-align: center;
color: #2c3e50;
margin-bottom: 30px;
}
.calculator {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.input-section, .result-section {
flex: 1;
min-width: 300px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
button {
background-color: #3498db;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
}
button:hover {
background-color: #2980b9;
}
.result-box {
background-color: #f9f9f9;
padding: 15px;
border-radius: 4px;
margin-bottom: 15px;
}
.result-value {
font-size: 18px;
font-weight: bold;
color: #2c3e50;
}
.profit-section {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.formula-section {
margin-top: 20px;
font-size: 14px;
color: #7f8c8d;
}
</style>
电商投产比计算器
0) ? ($net_profit_per_unit / $price) * 100 : 0;
// 计算保本投产比
$break_even_ratio = ($net_profit_per_unit > 0) ? $price / $net_profit_per_unit : 0;
// 计算最佳投产比 (通常为保本投产比的70%-80%)
$optimal_ratio = $break_even_ratio * 0.75;
// 盈亏计算部分
if (isset($_POST['calculate_profit'])) {
$ad_cost = isset($_POST['ad_cost']) ? floatval($_POST['ad_cost']) : 0;
$actual_ratio = isset($_POST['actual_ratio']) ? floatval($_POST['actual_ratio']) : 0;
// 计算预估营业金额
$estimated_amount = ($actual_ratio > 0) ? $ad_cost * $actual_ratio : 0;
// 计算盈亏金额
$profit_loss = $estimated_amount * ($net_profit_rate / 100) - $ad_cost;
}
}
?>