目前已经把代码放到网站上了
在线版三级分销提成计算器:http://www.yifei100.com/services/fenxiao-calc.html
代码:
<?php
/*
* @author Lmy
* QQ:6232967
* Create at 2016-3-16 15:27:20
*/
error_reporting(E_ALL);
if(isset($_GET['act']) && $_GET['act']){
$level1Money = $_POST['level1Money'];
$level2Money = $_POST['level2Money'];
$level3Money = $_POST['level3Money'];
if($_GET['act'] == 'normal'){
$level1People = $_POST['level-people'];
$level2People = $level1People * $level1People;
$level3People = $level1People * $level1People * $level1People;
$level1_total = $level1Money * $level1People;
$level2_total = $level2Money * $level2People;
$level3_total = $level3Money * $level3People;
$total_people = $level1People + $level2People + $level3People;
$total = $level1_total + $level2_total + $level3_total;
}else if ($_GET['act'] == 'custom') {
$level1People = $_POST['level1'];
$level2People = $_POST['level2'];
$level3People = $_POST['level3'];
$level1_total = $level1Money * $level1People;
$level2_total = $level2Money * $level2People;
$level3_total = $level3Money * $level3People;
$total_people = $level1People + $level2People + $level3People;
$total = $level1_total + $level2_total + $level3_total;
}else{
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8"/>
<title>三级分销提成计算器</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css" rel="stylesheet">
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<ul class="nav nav-tabs">
<li id="li-normal" class="active"><a href="javascript:void(0);">简单计算</a></li>
<li id="li-custom"><a href="javascript:void(0);">定制计算</a></li>
</ul>
<div id="normal" class="panel panel-success">
<div class="panel-heading">简单计算</div>
<div class="panel-body">
<form class="form-inline" action="?act=normal" method="post">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label for="level1Money">一级提成:</label>
<input name="level1Money" type="text" class="form-control" id="level1Money" value="200" placeholder="请输入金额">
</div>
<div class="form-group">
<label for="level2Money">二级提成:</label>
<input name="level2Money" type="text" class="form-control" id="level2Money" value="60" placeholder="请输入金额">
</div>
<div class="form-group">
<label for="level3Money">三级提成:</label>
<input name="level3Money" type="text" class="form-control" id="level3Money" value="30" placeholder="请输入金额">
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label for="level-people">每级裂变人数:</label>
<input name="level-people" type="text" class="form-control" id="level-people" placeholder="每级裂变人数">
</div>
</div>
<div class="col-xs-12">
<button type="submit" class="btn btn-lg btn-primary">查询</button>
</div>
</div>
</form>
</div>
</div>
<div id="custom" class="panel panel-success" style="display: none;">
<div class="panel-heading">定制计算</div>
<div class="panel-body">
<form class="form-inline" action="?act=custom" method="post">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label for="exampleInputName2">一级提成:</label>
<input name="level1Money" type="text" class="form-control" id="exampleInputName2" value="200" placeholder="请输入金额">
</div>
<div class="form-group">
<label for="exampleInputEmail2">二级提成:</label>
<input name="level2Money" type="text" class="form-control" id="exampleInputEmail2" value="60" placeholder="请输入金额">
</div>
<div class="form-group">
<label for="exampleInputEmail3">三级提成:</label>
<input name="level3Money" type="text" class="form-control" id="exampleInputEmail3" value="30" placeholder="请输入金额">
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label for="exampleInputName4">一级人数:</label>
<input name="level1" type="text" class="form-control" id="exampleInputName4" placeholder="请输入人数">
</div>
<div class="form-group">
<label for="exampleInputEmail5">二级人数:</label>
<input name="level2" type="text" class="form-control" id="exampleInputEmail5" placeholder="请输入人数">
</div>
<div class="form-group">
<label for="exampleInputEmail6">三级人数:</label>
<input name="level3" type="text" class="form-control" id="exampleInputEmail6" placeholder="请输入人数">
</div>
</div>
<div class="col-xs-12">
<button type="submit" class="btn btn-lg btn-primary">查询</button>
</div>
</div>
</form>
</div>
</div>
<?php if(isset($_GET['act']) && $_GET['act']){ ?>
<div class="panel panel-info">
<div class="panel panel-heading">计算结果</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-6">
一级人数:<?= $level1People; ?>
</div>
<div class="col-xs-6">
提成:<?= $level1_total; ?>
</div>
<div class="col-xs-6">
二级人数:<?= $level2People; ?>
</div>
<div class="col-xs-6">
提成:<?= $level2_total; ?>
</div>
<div class="col-xs-6">
三级人数:<?= $level3People; ?>
</div>
<div class="col-xs-6">
提成:<?= $level3_total; ?>
</div>
<div class="col-xs-12">
总人数:<?= $total_people; ?>
</div>
<div class="col-xs-12">
总提成:<?= $total; ?>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<script>
$("#li-normal").on('click',function(){
$("#custom").hide();
$("#normal").fadeIn();
});
$("#li-custom").on('click',function(){
$("#normal").hide();
$("#custom").fadeIn();
});
</script>
</body>
</html>