Commit 69d9487a authored by xishifeng's avatar xishifeng

分佣提成计算修改

parent ae8d6ca9
......@@ -157,7 +157,9 @@
<div class="detail-modal-maid-top-btn-area oh">
<a class="btn btn-success" href="#modal_new_maid" data-toggle="modal">新增</a>
<a id="maid_new_btn" class="btn btn-primary" data-toggle="modal">增加实收</a>
<a id="maid_count_btn" class="btn btn-primary" title="可自动计算实收佣金和合计">计算</a>
</div>
<p class="text-right" id="maid_count_tips_p"><span>提示:</span>点击<span>计算</span>按钮可自动计算<span>实收佣金</span><span>合计</span>的内容</p>
<table class="table table-striped table-bordered table-hover table-condensed" id="maid_table_main">
<thead>
<tr>
......@@ -211,9 +213,26 @@
</td>
</tr>-->
</tbody>
<tfoot>
<tr>
<td class="text-center">合计</td>
<td class="text-center"></td>
<td class="text-center"></td>
<td class="text-center" id="maid_count_total_rate"></td>
<td class="text-center" id="maid_count_total_yingfen"></td>
<td class="text-center" id="maid_count_total_yufen"></td>
<td class="text-center" id="maid_count_total_shouxu"></td>
<td class="text-center" id="maid_count_total_cishan"></td>
<td class="text-center" id="maid_count_total_xianjin"></td>
<td class="text-center" id="maid_count_total_shishou"></td>
<td class="text-center"></td>
<td class="text-center"></td>
</tr>
</tfoot>
</table>
<div class="detail-modal-maid-bottom-btn-area text-right">
<a id="maid_ok_btn" class="btn btn-primary" data-toggle="modal">确认分佣</a>
<a id="maid_save_btn" class="btn btn-primary" data-toggle="modal">保存</a>
</div>
......
......@@ -139,9 +139,13 @@ addtax_
float: left;
display: none;
}
#maid_new_btn{
#maid_new_btn,
#maid_count_btn{
float: right;
}
#maid_count_btn{
margin-right: 10px;
}
#maid_table_main>thead th:nth-last-of-type(-n+7){
width: 91px;
}
......@@ -153,6 +157,14 @@ addtax_
width: 40px;
}
#maid_count_tips_p>span{
color: red;
opacity: .6;
}
#maid_count_tips_p>span:nth-of-type(1){
opacity: 1;
}
.detail-modal-maid-mix-td{
padding: 0!important;
}
......@@ -306,7 +318,6 @@ addtax_
#modal_detail>div {
/*width: 1030px;*/
width: 1280px;
}
......
......@@ -154,7 +154,7 @@ function is_mobile(text) {
return /^1[1234567890]\d{9}$/.test(text)?true:false;
}
//处理金额的数字,最多位小数
//处理金额的数字,最多位小数
function dealJineNum(num){
if(isFinite(num)){
if(parseInt(num)==num || num.toString().split(".")[1].length < 3){
......
define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_shuiFee_template_tpl.html', 'text!temp/reportList_maid_template_tpl.html', 'text!temp/reportList_maid_sub1_template_tpl.html', 'css!style/home.css', 'css!style/report_list.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template, template_tax, template_maid, template_maid_sub1) {
define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', 'css!style/report_list.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template, template_tax, template_maid, template_maid_sub1) {
bargain = {
pageNo: 1,
/*第几页*/
......@@ -12,7 +12,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
maidTotalCommission: 0,//应收总佣金
init: function() {
//初始化dot
$(document.body).append(template + template_tax + template_maid + template_maid_sub1);
$(document.body).append(template);
bargain.getList(1);
bargain.event();
},
......@@ -290,6 +290,68 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
};
});
//详情弹出框,分佣提成里,点击计算执行的方法
_doc.on('click', '#maid_count_btn', function(e){
e.preventDefault();
e.stopPropagation();
//计算每个实收佣金
var _rateTotal = 0;//分佣比例
var _yingfenTotal = 0;//应分佣金
var _yufenTotal = 0;//预分佣金
var _shouxuTotal = 0;//手续费
var _cishanTotal = 0;//慈善基金
var _xianjinTotal = 0;//现金奖
var _shishouTotal = 0;//实收佣金
$.each($('.detail-modal-maid-span-practical-fee'), function(i, v) {
var _vObj = $(v);
var a = Number(_vObj.parent().find('.detail-modal-maid-span-real-fee').html());//预分佣金
var b = Number(_vObj.parent().find('.detail-modal-maid-span-service-charge').html());//手续费
var c = Number(_vObj.parent().find('.detail-modal-maid-span-charity-fund').html());//慈善基金
var d = Number(_vObj.parent().find('.detail-modal-maid-span-cash').html());//现金奖
var _smallTotal = dealJineNum(a-b-c-d);
_shishouTotal += _smallTotal;
_vObj.html(_smallTotal);
});
$('#maid_count_total_shishou').html(dealJineNum(_shishouTotal));
//计算分佣比例
$.each($('.detail-modal-maid-span-scale'), function(i, v) {
_rateTotal += Number($(v).html());
});
$('#maid_count_total_rate').html(_rateTotal+'%');
//计算应分佣金
$.each($('.detail-modal-maid-td-should-commission'), function(i, v) {
_yingfenTotal += Number($(v).html());
});
$('#maid_count_total_yingfen').html(dealJineNum(_yingfenTotal));
//计算预分佣金
$.each($('.detail-modal-maid-span-real-fee'), function(i, v) {
_yufenTotal += Number($(v).html());
});
$('#maid_count_total_yufen').html(dealJineNum(_yufenTotal));
//计算手续费
$.each($('.detail-modal-maid-span-service-charge'), function(i, v) {
_shouxuTotal += Number($(v).html());
});
$('#maid_count_total_shouxu').html(dealJineNum(_shouxuTotal));
//计算慈善基金
$.each($('.detail-modal-maid-span-charity-fund'), function(i, v) {
_cishanTotal += Number($(v).html());
});
$('#maid_count_total_cishan').html(dealJineNum(_cishanTotal));
//计算现金奖
$.each($('.detail-modal-maid-span-cash'), function(i, v) {
_xianjinTotal += Number($(v).html());
});
$('#maid_count_total_xianjin').html(dealJineNum(_xianjinTotal));
});
//新增分佣提成,业务员input输入搜索,点击之后赋值
_doc.on('click', '#addmaid_input_ywy+ul>li', function() {
var _this = $(this);
......
<script id="reportList_maid_sub1_list_tpl" type="text/template">
<div class="oh">
<span contenteditable class="detail-modal-maid-span-real-fee"></span>
<span contenteditable class="detail-modal-maid-span-service-charge">0</span>
<span contenteditable class="detail-modal-maid-span-charity-fund">0</span>
<span contenteditable class="detail-modal-maid-span-cash">0</span>
<span contenteditable class="detail-modal-maid-span-practical-fee"></span>
<span class="detail-modal-maid-span-time"></span>
</div>
</script>
\ No newline at end of file
<script id="reportList_maid_list_tpl" type="text/template">
[% if(it['data'] && it['data'].length && it['data'].length>0) { %]
[% var dealT=function(g){if(g&&(g!="null")){return g}else{return""}}; %]
[% for(var i in it['data']){ %]
<tr class="text-center" data-id="[%= it['data'][i]['id'] %]" data-agentid="[%= it['data'][i]['agent_id'] %]" data-role="[%= it['data'][i]['role'] %]" data-lastid="[%= it['data'][i]['last_commission_id'] %]">
<td>[%= it['data'][i]['role_name'] %]</td>
<td>[%= it['data'][i]['agent'] %]</td>
<td>[%= it['data'][i]['district_store'] %]</td>
<td><span contenteditable class="detail-modal-maid-span-scale">[%= it['data'][i]['scale'] %]</span><span>%</span></td>
<td contenteditable class="detail-modal-maid-td-should-commission">[%= it['data'][i]['scale_fee'] %]</td>
<td colspan="6" class="detail-modal-maid-mix-td oh">
[% if(it['data'][i]['partial_commission'] && it['data'][i]['partial_commission'].length && it['data'][i]['partial_commission'].length>0) { %]
[% for(var j in it['data'][i]['partial_commission']){ %]
<div class="oh" data-id="[%= it['data'][i]['partial_commission'][j]['id'] %]">
<span contenteditable class="detail-modal-maid-span-real-fee">[%= it['data'][i]['partial_commission'][j]['real_fee'] %]</span>
<span contenteditable class="detail-modal-maid-span-service-charge">[%= it['data'][i]['partial_commission'][j]['service_charge'] %]</span>
<span contenteditable class="detail-modal-maid-span-charity-fund">[%= it['data'][i]['partial_commission'][j]['charity_fund'] %]</span>
<span contenteditable class="detail-modal-maid-span-cash">[%= it['data'][i]['partial_commission'][j]['cash'] %]</span>
<span contenteditable class="detail-modal-maid-span-practical-fee">[%= it['data'][i]['partial_commission'][j]['practical_fee'] %]</span>
<span class="detail-modal-maid-span-time">[%= dealT(it['data'][i]['partial_commission'][j]['confirm_date']) %]</span>
</div>
[% } %]
[% }else{ %]
<div class="oh">
<span contenteditable class="detail-modal-maid-span-real-fee"></span>
<span contenteditable class="detail-modal-maid-span-service-charge">0</span>
<span contenteditable class="detail-modal-maid-span-charity-fund">0</span>
<span contenteditable class="detail-modal-maid-span-cash">0</span>
<span contenteditable class="detail-modal-maid-span-practical-fee"></span>
<span class="detail-modal-maid-span-time"></span>
</div>
[% } %]
</td>
<td>
[% if(check_auth('index/delPartialCommission') && (it['data'][i]['father_id'] != 0)) { %]
<a href="javascript:;" class="detail-modal-maid-a-del">删除</a>
[% } %]
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="11" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
<script id="reportList_shuiFee_list_tpl" type="text/template">
[% if(it && it.length && it.length>0) { %]
[% for(var item in it){ %]
[% var getInfoType=function(r){switch(Number(r)){case 1:return"盘方";case 2:return"客方";case 3:return"反签";case 4:return"独家";case 5:return"合作方";default:return"未定义"}}; %]
<section>
<div>
<table class="detail-modal-tax-table table-haveborder">
<tr>
<td>开票金额</td>
<td>[%= it[item]['total_fee'] %]</td>
<td>开票日期</td>
<td>[%= it[item]['operation_date'] %]</td>
</tr>
<tr>
<td>分佣方</td>
<td>业务员</td>
<td>分佣比例</td>
<td>税费</td>
</tr>
[% if(it[item]['fee_list'] && it[item]['fee_list'].length && it[item]['fee_list'].length>0) { %]
[% for(var item2 in it[item]['fee_list']){ %]
<tr data-feeid="[%= it[item]['fee_list'][item2]['fee_id'] %]">
<td>[%= getInfoType(it[item]['fee_list'][item2]['role']) %]</td>
<td>[%= it[item]['fee_list'][item2]['name']+'-'+it[item]['fee_list'][item2]['phone'] %]</td>
<td>[%= it[item]['fee_list'][item2]['scale'] %]</td>
<td>[%= it[item]['fee_list'][item2]['fee'] %]</td>
</tr>
[% } %]
[% }else{ %]
<tr>暂无</tr>
[% } %]
</table>
</div>
<div>
<a class="btn btn-default" href="#modal_new_tax" data-recordid="[%= it[item]['id'] %]" data-toggle="modal">编辑</a>
</div>
</section>
[% } %]
[% }else{ %]
<section>暂无数据</section>
[% } %]
</script>
......@@ -38,6 +38,103 @@
[% } %]
</script>
<script id="reportList_shuiFee_list_tpl" type="text/template">
[% if(it && it.length && it.length>0) { %]
[% for(var item in it){ %]
[% var getInfoType=function(r){switch(Number(r)){case 1:return"盘方";case 2:return"客方";case 3:return"反签";case 4:return"独家";case 5:return"合作方";default:return"未定义"}}; %]
<section>
<div>
<table class="detail-modal-tax-table table-haveborder">
<tr>
<td>开票金额</td>
<td>[%= it[item]['total_fee'] %]</td>
<td>开票日期</td>
<td>[%= it[item]['operation_date'] %]</td>
</tr>
<tr>
<td>分佣方</td>
<td>业务员</td>
<td>分佣比例</td>
<td>税费</td>
</tr>
[% if(it[item]['fee_list'] && it[item]['fee_list'].length && it[item]['fee_list'].length>0) { %]
[% for(var item2 in it[item]['fee_list']){ %]
<tr data-feeid="[%= it[item]['fee_list'][item2]['fee_id'] %]">
<td>[%= getInfoType(it[item]['fee_list'][item2]['role']) %]</td>
<td>[%= it[item]['fee_list'][item2]['name']+'-'+it[item]['fee_list'][item2]['phone'] %]</td>
<td>[%= it[item]['fee_list'][item2]['scale'] %]</td>
<td>[%= it[item]['fee_list'][item2]['fee'] %]</td>
</tr>
[% } %]
[% }else{ %]
<tr>暂无</tr>
[% } %]
</table>
</div>
<div>
<a class="btn btn-default" href="#modal_new_tax" data-recordid="[%= it[item]['id'] %]" data-toggle="modal">编辑</a>
</div>
</section>
[% } %]
[% }else{ %]
<section>暂无数据</section>
[% } %]
</script>
<script id="reportList_maid_list_tpl" type="text/template">
[% if(it['data'] && it['data'].length && it['data'].length>0) { %]
[% var dealT=function(g){if(g&&(g!="null")){return g}else{return""}}; %]
[% for(var i in it['data']){ %]
<tr class="text-center" data-id="[%= it['data'][i]['id'] %]" data-agentid="[%= it['data'][i]['agent_id'] %]" data-role="[%= it['data'][i]['role'] %]" data-lastid="[%= it['data'][i]['last_commission_id'] %]">
<td>[%= it['data'][i]['role_name'] %]</td>
<td>[%= it['data'][i]['agent'] %]</td>
<td>[%= it['data'][i]['district_store'] %]</td>
<td><span contenteditable class="detail-modal-maid-span-scale">[%= it['data'][i]['scale'] %]</span><span>%</span></td>
<td contenteditable class="detail-modal-maid-td-should-commission">[%= it['data'][i]['scale_fee'] %]</td>
<td colspan="6" class="detail-modal-maid-mix-td oh">
[% if(it['data'][i]['partial_commission'] && it['data'][i]['partial_commission'].length && it['data'][i]['partial_commission'].length>0) { %]
[% for(var j in it['data'][i]['partial_commission']){ %]
<div class="oh" data-id="[%= it['data'][i]['partial_commission'][j]['id'] %]">
<span contenteditable class="detail-modal-maid-span-real-fee">[%= it['data'][i]['partial_commission'][j]['real_fee'] %]</span>
<span contenteditable class="detail-modal-maid-span-service-charge">[%= it['data'][i]['partial_commission'][j]['service_charge'] %]</span>
<span contenteditable class="detail-modal-maid-span-charity-fund">[%= it['data'][i]['partial_commission'][j]['charity_fund'] %]</span>
<span contenteditable class="detail-modal-maid-span-cash">[%= it['data'][i]['partial_commission'][j]['cash'] %]</span>
<span contenteditable class="detail-modal-maid-span-practical-fee">[%= it['data'][i]['partial_commission'][j]['practical_fee'] %]</span>
<span class="detail-modal-maid-span-time">[%= dealT(it['data'][i]['partial_commission'][j]['confirm_date']) %]</span>
</div>
[% } %]
[% }else{ %]
<div class="oh">
<span contenteditable class="detail-modal-maid-span-real-fee"></span>
<span contenteditable class="detail-modal-maid-span-service-charge">0</span>
<span contenteditable class="detail-modal-maid-span-charity-fund">0</span>
<span contenteditable class="detail-modal-maid-span-cash">0</span>
<span contenteditable class="detail-modal-maid-span-practical-fee"></span>
<span class="detail-modal-maid-span-time"></span>
</div>
[% } %]
</td>
<td>
[% if(check_auth('index/delPartialCommission') && (it['data'][i]['father_id'] != 0)) { %]
<a href="javascript:;" class="detail-modal-maid-a-del">删除</a>
[% } %]
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="11" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
<script id="reportList_maid_sub1_list_tpl" type="text/template">
<div class="oh">
<span contenteditable class="detail-modal-maid-span-real-fee"></span>
<span contenteditable class="detail-modal-maid-span-service-charge">0</span>
<span contenteditable class="detail-modal-maid-span-charity-fund">0</span>
<span contenteditable class="detail-modal-maid-span-cash">0</span>
<span contenteditable class="detail-modal-maid-span-practical-fee"></span>
<span class="detail-modal-maid-span-time"></span>
</div>
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment