Commit ee7ee08c authored by xishifeng's avatar xishifeng

分佣

parent 7ef0fd05
...@@ -599,11 +599,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -599,11 +599,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
}, },
maidTest: function(type){ maidTest: function(type){
var _stopFlag = false; var _stopFlag = false;
var _num = 0; var _data = [];
var _data = {
'bargain_id': bargain.bargain_id,//成交报告id
'is_account_commission': type//0是保存,1是确认分佣
};
var _parObj = $('#maid_new_table_list>tr'); var _parObj = $('#maid_new_table_list>tr');
if(_parObj.length > 0){ if(_parObj.length > 0){
$.each(_parObj, function(i, v) { $.each(_parObj, function(i, v) {
...@@ -613,6 +609,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -613,6 +609,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
var _role = _$v.attr('data-role');//盘方等类型 var _role = _$v.attr('data-role');//盘方等类型
var _scaleVal = $.trim(_$v.find('.detail-modal-maid-span-scale').html());//分佣比例 var _scaleVal = $.trim(_$v.find('.detail-modal-maid-span-scale').html());//分佣比例
var _shouldCommissionVal = $.trim(_$v.find('.detail-modal-maid-td-should-commission').html());//应分佣金 var _shouldCommissionVal = $.trim(_$v.find('.detail-modal-maid-td-should-commission').html());//应分佣金
var _dataTemp = {
'bargain_id': _$v.attr('data-id'),//成交报告id
'last_commission_id': _$v.attr('lastid')?_$v.attr('lastid'):0,//最后一个提交的记录id
'is_account_commission': type//0是保存,1是确认分佣
};
if(_scaleVal == '' || _shouldCommissionVal == ''){ if(_scaleVal == '' || _shouldCommissionVal == ''){
_stopFlag = true; _stopFlag = true;
}else{ }else{
...@@ -622,7 +623,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -622,7 +623,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
console.count('$v2'); console.count('$v2');
var _$v2 = $(v2); var _$v2 = $(v2);
var _cid = _$v2.attr('data-id'); var _cid = _$v2.attr('data-id');
_cid=_cid?_cid:0; _cid=_cid?_cid:0;//如果没有这个id,则为新增,传0
var _sfyj = $.trim(_$v2.find('.detail-modal-maid-span-real-fee').html()); 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 _sxf = $.trim(_$v2.find('.detail-modal-maid-span-service-charge').html());
var _csjj = $.trim(_$v2.find('.detail-modal-maid-span-charity-fund').html()); var _csjj = $.trim(_$v2.find('.detail-modal-maid-span-charity-fund').html());
...@@ -631,7 +632,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -631,7 +632,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
if(_sfyj == ''||_sxf == ''||_csjj == ''||_xjj == ''||_ssyj == ''){ if(_sfyj == ''||_sxf == ''||_csjj == ''||_xjj == ''||_ssyj == ''){
_stopFlag = true; _stopFlag = true;
}else{ }else{
_data['commission_date['+_num+']'] = { _dataTemp['commission_date['+i2+']'] = {
'agent_id': _agendId,//业务员id 'agent_id': _agendId,//业务员id
'role': _role,//盘方等角色类型 'role': _role,//盘方等角色类型
'scale': Number(_scaleVal),//分佣比例 'scale': Number(_scaleVal),//分佣比例
...@@ -643,36 +644,42 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -643,36 +644,42 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
'cash': _xjj,//现金奖 'cash': _xjj,//现金奖
'practical_fee': _ssyj//实收佣金 'practical_fee': _ssyj//实收佣金
}; };
_num++;
} }
}); });
}else{ }else{
} }
} };
_data.push(_dataTemp);
}); });
}; };
return { return {
'flag': _stopFlag, 'flag': _stopFlag,
'data': _data 'list': _data
} }
}, },
maidConfirmOk: function(type){ maidConfirmOk: function(type){
var _back = bargain.maidTest(type); var _back = bargain.maidTest(type);
console.log(_back);
if(!_back.flag){ if(!_back.flag){
var _len = _back.list.length;
! function funTemp(count) {
if(count >= _len) {
alert(type===0?'保存成功':'确认成功');
bargain.maidShow();
} else {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/index/addRealIncome', url: '/index/addRealIncome',
data: _back.data, data: _back.list[count],
timeout: 30000, timeout: 30000,
dataType: 'json', dataType: 'json',
beforeSend: function() {}, beforeSend: function() {},
success: function(_data) { success: function(_data) {
if(typeof _data === 'object') { if(typeof _data === 'object') {
if(_data['code'] == '200') { if(_data['code'] == '200') {
alert(type===0?'保存成功':'确认成功'); funTemp(++count);
bargain.maidShow();
} else { } else {
layerTipsX(_data['msg']); layerTipsX(_data['msg']);
} }
...@@ -690,13 +697,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s ...@@ -690,13 +697,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
}; };
} }
}); });
}
}(0);
}else{ }else{
alert('请填写完整'); alert('请填写完整');
} }
},
maidSave: function(){
}, },
newAddTax: function(obj) { newAddTax: function(obj) {
var _tempTableObj = $('.addtax-modal-tax-table'); var _tempTableObj = $('.addtax-modal-tax-table');
......
<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) { %]
[% var dealT=function(g){if(g&&(g!="null")){return g}else{return""}}; %]
[% for(var i in it['data']){ %] [% 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'] %]"> <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]['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>
...@@ -16,7 +17,7 @@ ...@@ -16,7 +17,7 @@
<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-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-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 contenteditable class="detail-modal-maid-span-practical-fee">[%= it['data'][i]['partial_commission'][j]['practical_fee'] %]</span>
<span class="detail-modal-maid-span-time">[%= it['data'][i]['partial_commission'][j]['confirm_date'] %]</span> <span class="detail-modal-maid-span-time">[%= dealT(it['data'][i]['partial_commission'][j]['confirm_date']) %]</span>
</div> </div>
[% } %] [% } %]
[% }else{ %] [% }else{ %]
......
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