Commit 1ac1a719 authored by xishifeng's avatar xishifeng

成交报告相关修改

parent 605cb18b
......@@ -163,8 +163,8 @@
</div>
<div class="detail-modal-body-sec">
<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 class="btn btn-success" id="maid_new_btn" href="#modal_new_maid" data-toggle="modal">新增</a>
<a id="maid_add_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>
......
......@@ -135,11 +135,11 @@ addtax_
.detail-modal-maid-bottom-btn-area>a{
}
[href="#modal_new_maid"]{
#maid_new_btn{
float: left;
display: none;
}
#maid_new_btn,
#maid_add_btn,
#maid_count_btn{
float: right;
}
......@@ -149,12 +149,25 @@ addtax_
#maid_table_main>thead th:nth-last-of-type(-n+7){
width: 91px;
}
#maid_table_main>thead th:nth-of-type(1){
width: 54px;
}
#maid_table_main>thead th:nth-of-type(2){
width: 170px;
}
#maid_table_main>thead th:nth-last-of-type(2){
width: 149px;
}
#maid_table_main>thead th:nth-last-of-type(1){
width: 40px;
width: 100px;
}
#maid_table_main>tbody td:nth-last-of-type(1)>a{
padding: 0 5px;
border-radius: 5px;
}
#maid_table_main>tbody td:nth-last-of-type(1)>a+a{
margin-left: 5px;
}
#maid_count_tips_p>span{
......
......@@ -168,13 +168,37 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
bargain.newAddTaxOk();
});
//详情弹出框,点击删除时的提交
_doc.on('click', '.detail-modal-shuiFee-del-btn', function(e){
e.preventDefault();
e.stopPropagation();
if(confirm('确认删除吗?')){
bargain.delTaxOk($(this).attr('data-recordid'));
}else{
}
});
//详情弹出框,分佣提成里,点击新增
_doc.on('click', '[href="#modal_new_maid"]', function(e){
_doc.on('click', '#maid_new_btn', function(e){
e.preventDefault();
e.stopPropagation();
$('#modal_new_maid').removeAttr('data-id').find('.modal-title').html('新增分佣提成');
bargain.newAddMaid();
});
//详情弹出框,分佣提成里,点击编辑
_doc.on('click', '.detail-modal-maid-a-edit', function(e){
e.preventDefault();
e.stopPropagation();
var _id = $(this).closest('tr').attr('data-id');
$('#modal_new_maid').attr('data-id', _id).find('.modal-title').html('编辑分佣提成');
bargain.newAddMaid(function(){
bargain.getMaidInfo(_id);
});
});
//详情弹出框,分佣提成里,点击新增,分佣方选择时触发的事件
_doc.on('input', '#addmaid_input_servant', function(e){
var _this = $(this);
......@@ -241,7 +265,14 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
_doc.on('click', '#addmaid_ok_btn', function(e){
e.preventDefault();
e.stopPropagation();
var _id = $('#modal_new_maid').attr('data-id');
if(_id === undefined){
//新增
bargain.newAddMaidOk();
}else{
//编辑
bargain.editMaidOk();
}
});
//详情弹出框,分佣提成里,点击确认分佣触发的事件
......@@ -263,7 +294,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
});
//详情弹出框,分佣提成里,点击增加实收按钮
_doc.on('click', '#maid_new_btn', function(e){
_doc.on('click', '#maid_add_btn', function(e){
e.preventDefault();
e.stopPropagation();
var _temp = $('.detail-modal-maid-span-time');
......@@ -568,7 +599,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
});
},
maidShow: function() {
$('[href="#modal_new_maid"]').hide();//默认隐藏新增按钮
$('#maid_new_btn').hide();//默认隐藏新增按钮
$("#maid_new_table_list").html('');
$.ajax({
type: 'GET',
......@@ -591,7 +622,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
});
//如果确认时间都有,都不为空,则把新增按钮显示出来
if(_isShowAddBtnFlag){
$('[href="#modal_new_maid"]').show();
$('#maid_new_btn').show();
};
bargain.maidCount(2);//计算合计的内容
} else {
......@@ -686,7 +717,46 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
}
});
},
newAddMaid: function(){
// 获取之前的分佣信息
getMaidInfo: function(id) {
$.ajax({
type: 'GET',
url: '/index/getBargainCommission',
data: {
'bargain_id': id
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(_data['code'] == '200') {
$('#addmaid_input_servant').val(_data.data.role);
$('#addmaid_input_ywy').val(_data.data.name+'-'+_data.data.phone).attr('data-id',_data.data.agent_id);
$('#addmaid_input_ratio').val(_data.data.scale);
$('#addmaid_input_cash').val(_data.data.scale_fee);
bargain.getDepart(_data.data.agent_id, function(obj){
$('#addmaid_input_shop').val(obj.district_name+'-'+obj.store_name);
});
} else {
layerTipsX(_data['msg']);
}
} else {
layerTipsX('数据错误');
};
},
error: function() {
layerTipsX('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
layerTipsX('请求超时,请重试');
};
}
});
},
newAddMaid: function(fn){
$.ajax({
type: 'GET',
url: '/index/searchOrderAgents',
......@@ -701,6 +771,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
if(_data['code'] == '200') {
bargain.panfangData = _data.data;
console.log(bargain.panfangData);
fn && fn();
} else {
layerTipsX(_data['msg']);
}
......@@ -719,8 +790,8 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
}
});
},
//新增时,点确定按钮
newAddMaidOk: function(){
console.log(7789);
$.ajax({
type: 'POST',
url: '/index/addBargain',
......@@ -759,6 +830,44 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
}
});
},
//编辑时,点确定按钮
editMaidOk: function(){
$.ajax({
type: 'POST',
url: '/index/getBargainCommission',
data: {
'bargain_id': $('#modal_new_maid').attr('data-id'),
'agent_id': $('#addmaid_input_ywy').attr('data-id'),
'scale_fee': $('#addmaid_input_cash').val(),
'role': $('#addmaid_input_servant').val(),
'scale': $('#addmaid_input_ratio').val()
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(_data['code'] == '200') {
alert('编辑成功!');
bargain.maidShow();
} else {
layerTipsX(_data['msg']);
}
} else {
layerTipsX('数据错误');
};
},
error: function() {
layerTipsX('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
layerTipsX('请求超时,请重试');
};
}
});
},
maidCount: function(type){
//计算每个实收佣金
var _rateTotal = 0;//分佣比例
......@@ -1066,6 +1175,40 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
}
});
},
//删除开票税费调用接口
delTaxOk: function(id) {
$.ajax({
type: 'POST',
url: '/index/delTaxes',
data: {
'taxes_id': id
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(_data['code'] == '200') {
alert('删除成功!');
bargain.taxShow();
} else {
layerTipsX(_data['msg']);
}
} else {
layerTipsX('数据错误');
};
},
error: function() {
layerTipsX('enter error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout') {
//处理超时的逻辑
layerTipsX('请求超时,请重试');
};
}
});
},
//分佣提成,删除
deletMaid: function(id){
$.ajax({
......
......@@ -73,6 +73,8 @@
</div>
<div>
<a class="btn btn-default" href="#modal_new_tax" data-recordid="[%= it[item]['id'] %]" data-toggle="modal">编辑</a>
<br /><br />
<a class="btn btn-danger detail-modal-shuiFee-del-btn" href="javascript:;" data-recordid="[%= it[item]['id'] %]">删除</a>
</div>
</section>
[% } %]
......@@ -115,8 +117,11 @@
[% } %]
</td>
<td>
[% if(check_auth('index/getBargainCommission')) { %]
<a href="#modal_new_maid" class="btn-success detail-modal-maid-a-edit" data-toggle="modal">编辑</a>
[% } %]
[% if(check_auth('index/delPartialCommission') && (it['data'][i]['father_id'] != 0)) { %]
<a href="javascript:;" class="detail-modal-maid-a-del">删除</a>
<a href="javascript:;" class="btn-danger detail-modal-maid-a-del">删除</a>
[% } %]
</td>
</tr>
......
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