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
},
maidTest: function(type){
var _stopFlag = false;
var _num = 0;
var _data = {
'bargain_id': bargain.bargain_id,//成交报告id
'is_account_commission': type//0是保存,1是确认分佣
};
var _data = [];
var _parObj = $('#maid_new_table_list>tr');
if(_parObj.length > 0){
$.each(_parObj, function(i, v) {
......@@ -613,6 +609,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
var _role = _$v.attr('data-role');//盘方等类型
var _scaleVal = $.trim(_$v.find('.detail-modal-maid-span-scale').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 == ''){
_stopFlag = true;
}else{
......@@ -622,7 +623,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
console.count('$v2');
var _$v2 = $(v2);
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 _sxf = $.trim(_$v2.find('.detail-modal-maid-span-service-charge').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
if(_sfyj == ''||_sxf == ''||_csjj == ''||_xjj == ''||_ssyj == ''){
_stopFlag = true;
}else{
_data['commission_date['+_num+']'] = {
_dataTemp['commission_date['+i2+']'] = {
'agent_id': _agendId,//业务员id
'role': _role,//盘方等角色类型
'scale': Number(_scaleVal),//分佣比例
......@@ -643,60 +644,64 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'text!temp/reportList_s
'cash': _xjj,//现金奖
'practical_fee': _ssyj//实收佣金
};
_num++;
}
});
}else{
}
}
};
_data.push(_dataTemp);
});
};
return {
'flag': _stopFlag,
'data': _data
'list': _data
}
},
maidConfirmOk: function(type){
var _back = bargain.maidTest(type);
console.log(_back);
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('请求超时,请重试');
};
}
});
var _len = _back.list.length;
! function funTemp(count) {
if(count >= _len) {
alert(type===0?'保存成功':'确认成功');
bargain.maidShow();
} else {
$.ajax({
type: 'POST',
url: '/index/addRealIncome',
data: _back.list[count],
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(_data['code'] == '200') {
funTemp(++count);
} else {
layerTipsX(_data['msg']);
}
} else {
layerTipsX('数据错误');
};
},
error: function() {
layerTipsX('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
layerTipsX('请求超时,请重试');
};
}
});
}
}(0);
}else{
alert('请填写完整');
}
},
maidSave: function(){
},
newAddTax: function(obj) {
var _tempTableObj = $('.addtax-modal-tax-table');
......
<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'] %]">
<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>
......@@ -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-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">[%= 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>
[% } %]
[% }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