Commit a333d8b6 authored by xishifeng's avatar xishifeng Committed by hujun

分佣4

parent a857c204
...@@ -645,7 +645,7 @@ class Finance extends Basic ...@@ -645,7 +645,7 @@ class Finance extends Basic
*/ */
public function addRealIncome() public function addRealIncome()
{ {
if (empty($this->params['bargain_id']) || empty($this->params['is_account_commission'])) { if (empty($this->params['bargain_id']) || !isset($this->params['is_account_commission'])) {
return $this->response(101, '请求参数错误'); return $this->response(101, '请求参数错误');
} }
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消 <button type="button" class="btn btn-default" data-dismiss="modal">取消
</button> </button>
<button type="button" class="btn btn-info" data-dismiss="modal" class="pass-modal-btn-pass"> <button type="button" class="btn btn-info" data-dismiss="modal" class="pass-modal-btn-pass" id="pass_ok_btn">
确定 确定
</button> </button>
</div> </div>
......
...@@ -78,12 +78,12 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -78,12 +78,12 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
}); });
//点击通过,修改全局bargain_id,弹出框出来 //点击通过,修改全局bargain_id,弹出框出来
_doc.delegate("[href=\"#modal-pass\"]", "click", function() { _doc.on('click', '[href=\"#modal-pass\"]', function() {
bargain.bargain_id = $(this).closest('tr').attr("data-id"); bargain.bargain_id = $(this).closest('tr').attr("data-id");
}); });
//点击通过,确定按钮触发的事件 //点击通过,确定按钮触发的事件
_doc.delegate(".pass-modal-btn-pass", "click", function() { _doc.on('click', '#pass_ok_btn', function() {
bargain.pass(); bargain.pass();
}); });
...@@ -236,14 +236,19 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -236,14 +236,19 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
_doc.on('click', '#maid_ok_btn', function(e){ _doc.on('click', '#maid_ok_btn', function(e){
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
bargain.maidConfirmOk(); if(bargain.mainTabIndex === 2){
bargain.maidConfirmOk(1);
}else{
alert('财务第三级审核人员才能确认分佣!');
}
}); });
//详情弹出框,分佣提成里,点击保存触发的事件 //详情弹出框,分佣提成里,点击保存触发的事件
_doc.on('click', '#maid_save_btn', function(e){ _doc.on('click', '#maid_save_btn', function(e){
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
bargain.maidSave(); // bargain.maidSave();
bargain.maidConfirmOk(0);
}); });
//详情弹出框,分佣提成里,点击增加实收按钮 //详情弹出框,分佣提成里,点击增加实收按钮
...@@ -256,6 +261,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -256,6 +261,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
$.each(_temp, function(i, v) { $.each(_temp, function(i, v) {
if(v.innerHTML == ''){ if(v.innerHTML == ''){
_flag = true; _flag = true;
return false;
}; };
}); });
}; };
...@@ -591,45 +597,103 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -591,45 +597,103 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
} }
}); });
}, },
maidConfirmOk: function(){ maidTest: function(type){
$.ajax({ var _stopFlag = false;
type: 'POST', var _num = 0;
url: '/index/addRealIncome', var _data = {
data: { 'bargain_id': bargain.bargain_id,//成交报告id
'bargain_id': bargain.bargain_id, 'is_account_commission': type//0是保存,1是确认分佣
'practical_fee': bargain.bargain_id, };
'cash': bargain.bargain_id, var _parObj = $('#maid_new_table_list>tr');
'service_charge': bargain.bargain_id, if(_parObj.length > 0){
'charity_fund': bargain.bargain_id, $.each(_parObj, function(i, v) {
'real_fee': bargain.bargain_id, console.count('$v');
'confirm_date': bargain.bargain_id, var _$v = $(v);
'should_commission': bargain.bargain_id, var _agendId = _$v.attr('data-agentid');//经纪人id
'scale': bargain.bargain_id var _role = _$v.attr('data-role');//盘方等类型
}, var _scaleVal = $.trim(_$v.find('.detail-modal-maid-span-scale').html());//分佣比例
timeout: 30000, var _shouldCommissionVal = $.trim(_$v.find('.detail-modal-maid-td-should-commission').html());//应分佣金
dataType: 'json', if(_scaleVal == '' || _shouldCommissionVal == ''){
beforeSend: function() {}, _stopFlag = true;
success: function(_data) { }else{
if(typeof _data === 'object') { var _parObj2 = _$v.find('.detail-modal-maid-mix-td>div');
if(_data['code'] == '200') { if(_parObj2.length > 0){
$.each(_parObj2, function(i2, v2) {
} else { console.count('$v2');
layerTipsX(_data['msg']); var _$v2 = $(v2);
} var _cid = _$v2.attr('data-id');
} else { _cid=_cid?_cid:0;
layerTipsX('数据错误'); var _sfyj = $.trim(_$v2.find('.detail-modal-maid-span-real-fee').html());
}; var _sxf = $.trim(_$v2.find('.detail-modal-maid-span-service-charge').html());
}, var _csjj = $.trim(_$v2.find('.detail-modal-maid-span-charity-fund').html());
error: function() { var _xjj = $.trim(_$v2.find('.detail-modal-maid-span-cash').html());
layerTipsX('enter error'); var _ssyj = $.trim(_$v2.find('.detail-modal-maid-span-practical-fee').html());
}, if(_sfyj == ''||_sxf == ''||_csjj == ''||_xjj == ''||_ssyj == ''){
complete: function(xhr, textStatus){ _stopFlag = true;
if(textStatus === 'timeout') { }else{
//处理超时的逻辑 _data['commission_date['+_num+']'] = {
layerTipsX('请求超时,请重试'); 'agent_id': _agendId,//业务员id
}; 'role': _role,//盘方等角色类型
} 'scale': Number(_scaleVal),//分佣比例
}); 'should_commission': _shouldCommissionVal,//应分佣金
'commission_id': _cid,//子记录id
'real_fee': _sfyj,//实分佣金
'service_charge': _sxf,//手续费
'charity_fund': _csjj,//慈善基金
'cash': _xjj,//现金奖
'practical_fee': _ssyj//实收佣金
};
_num++;
}
});
}else{
}
}
});
};
return {
'flag': _stopFlag,
'data': _data
}
},
maidConfirmOk: function(type){
var _back = bargain.maidTest(type);
if(!_back.flag){
$.ajax({
type: 'POST',
url: '/index/addRealIncome',
data: _back.data,
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(_data['code'] == '200') {
alert(type===0?'保存成功':'确认成功');
bargain.maidShow();
} else {
layerTipsX(_data['msg']);
}
} else {
layerTipsX('数据错误');
};
},
error: function() {
layerTipsX('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
layerTipsX('请求超时,请重试');
};
}
});
}else{
alert('请填写完整');
}
}, },
maidSave: function(){ maidSave: function(){
......
<script id="reportList_maid_list_tpl" type="text/template"> <script id="reportList_maid_list_tpl" type="text/template">
[% if(it['data'] && it['data'].length && it['data'].length>0) { %] [% if(it['data'] && it['data'].length && it['data'].length>0) { %]
[% for(var i in it['data']){ %] [% for(var i in it['data']){ %]
<tr class="text-center" data-id="[%= it['data'][i]['id'] %]"> <tr class="text-center" data-id="[%= it['data'][i]['id'] %]" data-agentid="[%= it['data'][i]['agent_id'] %]" data-role="[%= it['data'][i]['role'] %]">
<td>[%= it['data'][i]['role_name'] %]</td> <td>[%= it['data'][i]['role_name'] %]</td>
<td>[%= it['data'][i]['agent'] %]</td> <td>[%= it['data'][i]['agent'] %]</td>
<td>[%= it['data'][i]['district_store'] %]</td> <td>[%= it['data'][i]['district_store'] %]</td>
<td contenteditable class="detail-modal-maid-span-scale">[%= it['data'][i]['scale'] %]%</td> <td><span contenteditable class="detail-modal-maid-span-scale">[%= it['data'][i]['scale'] %]</span><span>%</span></td>
<td contenteditable class="detail-modal-maid-span-should-commission">[%= it['data'][i]['scale_fee'] %]</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"> <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) { %] [% if(it['data'][i]['partial_commission'] && it['data'][i]['partial_commission'].length && it['data'][i]['partial_commission'].length>0) { %]
<div class="oh"> [% for(var j in it['data'][i]['partial_commission']){ %]
<span contenteditable class="detail-modal-maid-span-real-fee">2</span> <div class="oh" data-id="[%= it['data'][i]['partial_commission'][j]['id'] %]">
<span contenteditable class="detail-modal-maid-span-service-charge">2</span> <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-charity-fund">2</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-cash">2</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-practical-fee">2</span> <span contenteditable class="detail-modal-maid-span-cash">[%= it['data'][i]['partial_commission'][j]['cash'] %]</span>
<span class="detail-modal-maid-span-time">4</span> <span contenteditable class="detail-modal-maid-span-practical-fee">[%= it['data'][i]['partial_commission'][j]['practical_fee'] %]</span>
</div> <span class="detail-modal-maid-span-time">[%= it['data'][i]['partial_commission'][j]['confirm_date'] %]</span>
</div>
[% } %]
[% }else{ %] [% }else{ %]
<div class="oh"> <div class="oh">
<span contenteditable class="detail-modal-maid-span-real-fee"></span> <span contenteditable class="detail-modal-maid-span-real-fee"></span>
......
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