Commit 933d8866 authored by agping's avatar agping

分佣提成汇总修改

parent ddda474a
define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) { define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
business = { business = {
pageNo: 1, pageNo: 1,
/*第几页*/ /*第几页*/
pageSize: 10, pageSize: 10,
/*每页显示多少条*/ /*每页显示多少条*/
id: '', id: '',
house_id: '', house_id: '',
type: '', type: '',
valueCurrent: '', valueCurrent: '',
ajaxObj: '', ajaxObj: '',
stopstatus: true, stopstatus: true,
ldHtml: $('.phone_list'), ldHtml: $('.phone_list'),
boxphoto: '', boxphoto: '',
exclusive_id: 0, exclusive_id: 0,
init: function() { init: function() {
//初始化dot //初始化dot
$("body").append(template); $("body").append(template);
business.getList(); business.getList();
business.event(); business.event();
business.getDistrict(); business.getDistrict();
}, },
event: function() { event: function() {
var _doc = $(document); var _doc = $(document);
$("#search").click(function() { $("#search").click(function() {
business.getList(1); business.getList(1);
}); });
$("#export").click(function() { //导出列表 $("#export").click(function() { //导出列表
business.exportList(); business.exportList();
}); });
$("#reset").click(function() { //重置 $("#reset").click(function() { //重置
document.getElementById("form_search").reset(); document.getElementById("form_search").reset();
}); });
$(document).delegate(".del_modal", "click", function() { $(document).delegate(".del_modal", "click", function() {
business.id = $(this).attr("data-id"); business.id = $(this).attr("data-id");
}); });
$(document).delegate(".caozuo", "click", function() { //点击操作记录 $(document).delegate(".caozuo", "click", function() { //点击操作记录
business.Caozuo(); business.Caozuo();
}); });
// 时间轴 // 时间轴
$(document).delegate(".timeline", "click", function() { //时间轴 $(document).delegate(".timeline", "click", function() { //时间轴
// business.house_id = $ (this).attr ("data-id"); // business.house_id = $ (this).attr ("data-id");
business.Timeline(); business.Timeline();
}); });
// 编辑 // 编辑
$(document).delegate(".edit", "click", function() { //点击编辑 $(document).delegate(".edit", "click", function() { //点击编辑
business.house_id = $(this).attr("data-id"); business.house_id = $(this).attr("data-id");
business.Edit(); business.Edit();
}); });
$(document).delegate(".is_pass", "click", function() { //点击编辑 $(document).delegate(".is_pass", "click", function() { //点击编辑
follow.house_id = $(this).attr("data-id"); follow.house_id = $(this).attr("data-id");
console.log(follow.house_id); console.log(follow.house_id);
}); });
$(document).delegate("#confirm_edit", "click", function() { //点击编辑确定 $(document).delegate("#confirm_edit", "click", function() { //点击编辑确定
business.confirmEdit(); business.confirmEdit();
}); });
$(document).delegate("#new-commission", "click", function() { //点击分佣提成 $(document).delegate("#new-commission", "click", function() { //点击分佣提成
business.newCommission(); business.newCommission();
business.Caozuo(); business.Caozuo();
}); });
//table切换 //table切换
$(document).delegate("#information", "click", function() { $(document).delegate("#information", "click", function() {
business.Information(); business.Information();
}); });
$(document).delegate("#fees", "click", function() { $(document).delegate("#fees", "click", function() {
console.log(business.house_id); console.log(business.house_id);
business.Fees(); business.Fees();
}); });
$(document).delegate("#records", "click", function() { $(document).delegate("#records", "click", function() {
business.Records(); business.Records();
}); });
},
Timeline: function() { //获取时间轴
$.ajax({
'type': 'GET',
'url': '/index/selectReportAll',
data: {
"order_id": business.house_id
}, },
Timeline: function() { //获取时间轴 dataType: "json",
$.ajax({ success: function(data) {
'type': 'GET', if(data.code == 200) {
'url': '/index/selectReportAll', if(data.data) {
data: { console.log(data.data);
"order_id": business.house_id
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
if(data.data) {
console.log(data.data);
}
} else {
alert('获取失败!');
}
} }
}); } else {
alert('获取失败!');
}
}
});
},
Edit: function() { //报告详情
$(".Tswitch").eq(0).show();
$(".Tswitch").eq(1).hide();
$(".Tswitch").eq(2).hide();
$("#information").removeClass("btn-default");
$("#information").addClass("btn-info");
$("#fees").removeClass("btn-info");
$("#fees").addClass("btn-default");
$("#records").removeClass("btn-info");
$("#records").addClass("btn-default");
console.log(business.house_id);
$.ajax({
'type': 'GET',
'url': '/index/bargainInfo',
data: {
"id": business.house_id
}, },
Edit: function() { //报告详情 dataType: "json",
$(".Tswitch").eq(0).show(); success: function(data) {
$(".Tswitch").eq(1).hide(); if(data.code == 200) {
$(".Tswitch").eq(2).hide(); if(data.data) {
$("#information").removeClass("btn-default"); $(".create_time").html(data.data.create_time);
$("#information").addClass("btn-info"); $(".user_phone").html(data.data.user_phone);
$("#fees").removeClass("btn-info"); $(".user_name").html(data.data.user_name);
$("#fees").addClass("btn-default"); $(".internal_address").html(data.data.internal_address);
$("#records").removeClass("btn-info"); $(".internal_title").html(data.data.internal_title);
$("#records").addClass("btn-default"); $(".commission").val(data.data.commission);
console.log(business.house_id); $(".practical_fee").val(data.data.practical_fee);
$.ajax({
'type': 'GET',
'url': '/index/bargainInfo',
data: {
"id": business.house_id
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
if(data.data) {
$(".create_time").html(data.data.create_time);
$(".user_phone").html(data.data.user_phone);
$(".user_name").html(data.data.user_name);
$(".internal_address").html(data.data.internal_address);
$(".internal_title").html(data.data.internal_title);
$(".commission").val(data.data.commission);
$(".practical_fee").val(data.data.practical_fee);
}
} else {
alert('获取失败!');
}
} }
}); } else {
alert('获取失败!');
}
}
});
},
confirmEdit: function() { //修改报告详情
$.ajax({
'type': 'POST',
'url': '/index/editBargainInfo',
data: {
"id": business.house_id,
"scale_fee": $(".commission").val(),
"practical_fee": $(".practical_fee").val()
}, },
confirmEdit: function() { //修改报告详情 dataType: "json",
$.ajax({ success: function(data) {
'type': 'POST', if(data.code == 200) {
'url': '/index/editBargainInfo', if(data.data) {}
data: { } else {
"id": business.house_id, alert('获取失败!');
"scale_fee": $(".commission").val(), }
"practical_fee": $(".practical_fee").val() }
}, });
dataType: "json", },
success: function(data) { Caozuo: function() { //分佣提成获取跟进详情的数据
if(data.code == 200) { console.log(business);
if(data.data) {} console.log(business.house_id);
} else { $.ajax({
alert('获取失败!'); 'type': 'GET',
} 'url': '/index/commissionList',
} data: {
}); "id": business.house_id
}, },
Caozuo: function() { //分佣提成获取跟进详情的数据 dataType: "json",
console.log(business); success: function(data) {
console.log(business.house_id); if(data.code == 200) {
$.ajax({ if(data.data) {
'type': 'GET', var caozuo_table = "";
'url': '/index/commissionList', $.each(data['data'], function(i, item) {
data: { caozuo_table += '<tr><td>' + item.role + '</td><td>' + item.agent_name + '</td><td>' + item.store_name +
"id": business.house_id '</td><td>' + item.scale + '</td><td>' + item.scale_fee + '</td><td>' + item.practical_fee + '</td><td>' + item.content + '</td></tr>';
}, });
dataType: "json", $("#caozuo_table").html(caozuo_table);
success: function(data) { $("#caozuo_table tr").each(function(e) { //不能为空
if(data.code == 200) { var temp = $("#caozuo_table").find("tr").eq(e).find("td").eq(6).html(); //获取一列的值
if(data.data) { if(temp == 'null') {
var caozuo_table = ""; $("#caozuo_table").find("tr").eq(e).find("td").eq(6).html(" ")
$.each(data['data'], function(i, item) {
caozuo_table += '<tr><td>' + item.role + '</td><td>' + item.agent_name + '</td><td>' + item.store_name +
'</td><td>' + item.scale + '</td><td>' + item.scale_fee + '</td><td>' + item.practical_fee + '</td><td>' + item.content + '</td></tr>';
});
$("#caozuo_table").html(caozuo_table);
$("#caozuo_table tr").each(function(e) { //不能为空
var temp = $("#caozuo_table").find("tr").eq(e).find("td").eq(6).html(); //获取一列的值
if(temp == 'null') {
$("#caozuo_table").find("tr").eq(e).find("td").eq(6).html(" ")
}
});
} }
} else { });
alert('获取失败!');
}
} }
}); } else {
alert('获取失败!');
}
}
});
},
Records: function() { //分佣提成数据
$(".Tswitch").eq(0).hide();
$(".Tswitch").eq(1).hide();
$(".Tswitch").eq(2).show();
$("#information").removeClass("btn-info");
$("#information").addClass("btn-default");
$("#fees").removeClass("btn-info");
$("#fees").addClass("btn-default");
$("#records").removeClass("btn-default");
$("#records").addClass("btn-info");
$.ajax({
'type': 'GET',
'url': '/index/payLogList',
data: {
"id": business.house_id
}, },
Records: function() { //分佣提成数据 dataType: "json",
$(".Tswitch").eq(0).hide(); success: function(data) {
$(".Tswitch").eq(1).hide(); if(data.code == 200) {
$(".Tswitch").eq(2).show(); if(data.data) {
$("#information").removeClass("btn-info"); var caozuo_table = "";
$("#information").addClass("btn-default"); $.each(data['data'], function(i, item) {
$("#fees").removeClass("btn-info"); caozuo_table += '<tr><td>' + item.create_time + '</td><td>' + item.money + '</td><td>' + item.type +
$("#fees").addClass("btn-default"); '</td><td>' + item.pay_type + '</td><td>' + item.agent_name + '</td></tr>';
$("#records").removeClass("btn-default"); });
$("#records").addClass("btn-info"); $("#tcaozuo_table").html(caozuo_table);
$.ajax({ $("#tcaozuo_table tr").each(function(e) { //不能为空
'type': 'GET', var temp_one = $("#tcaozuo_table").find("tr").eq(e).find("td").eq(4).html();
'url': '/index/payLogList', var temp = $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html(); //获取一列的值
data: { var temp_two = $("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html();
"id": business.house_id // 支付方式 10支付宝 20 微信 30pos机器 40转账 50现金 60其他
}, if(temp * 1 == 10) {
dataType: "json", $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("支付宝")
success: function(data) { }
if(data.code == 200) { if(temp * 1 == 20) {
if(data.data) { $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("微信")
var caozuo_table = ""; }
$.each(data['data'], function(i, item) { if(temp * 1 == 30) {
caozuo_table += '<tr><td>' + item.create_time + '</td><td>' + item.money + '</td><td>' + item.type + $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("pos机器")
'</td><td>' + item.pay_type + '</td><td>' + item.agent_name + '</td></tr>'; }
}); if(temp * 1 == 40) {
$("#tcaozuo_table").html(caozuo_table); $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("转账")
$("#tcaozuo_table tr").each(function(e) { //不能为空 }
var temp_one = $("#tcaozuo_table").find("tr").eq(e).find("td").eq(4).html(); if(temp * 1 == 50) {
var temp = $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html(); //获取一列的值 $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("现金")
var temp_two = $("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html(); }
// 支付方式 10支付宝 20 微信 30pos机器 40转账 50现金 60其他 if(temp * 1 == 60) {
if(temp * 1 == 10) { $("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("其他")
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("支付宝") }
}
if(temp * 1 == 20) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("微信")
}
if(temp * 1 == 30) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("pos机器")
}
if(temp * 1 == 40) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("转账")
}
if(temp * 1 == 50) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("现金")
}
if(temp * 1 == 60) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(3).html("其他")
}
// 付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他
if(temp_two * 1 == 10) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("意向金")
}
if(temp_two * 1 == 20) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("定金")
}
if(temp_two * 1 == 30) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("保管金")
}
if(temp_two * 1 == 40) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("押金")
}
if(temp_two * 1 == 50) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("租金")
}
if(temp_two * 1 == 60) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("进场费")
}
if(temp_two * 1 == 70) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("转让费")
}
if(temp_two * 1 == 80) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("其他")
};
if(temp_one == 'null') {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(4).html(" ")
}
}); // 付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他
if(temp_two * 1 == 10) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("意向金")
} }
} else { if(temp_two * 1 == 20) {
alert('获取失败!'); $("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("定金")
}
}
});
},
newCommission: function() { //新增分佣提成
$.ajax({
'type': 'POST',
'url': '/index/addBargain',
data: {
"id": business.house_id,
"role": $("#is_carefully_chosen").val(),
"scale": $("#commission-rate").val(),
"scale_fee": $("#should-commission").val(),
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
if(data.data) {
console.log(666);
} }
} else { if(temp_two * 1 == 30) {
alert('获取失败!'); $("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("保管金")
} }
if(temp_two * 1 == 40) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("押金")
}
if(temp_two * 1 == 50) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("租金")
}
if(temp_two * 1 == 60) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("进场费")
}
if(temp_two * 1 == 70) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("转让费")
}
if(temp_two * 1 == 80) {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(2).html("其他")
};
if(temp_one == 'null') {
$("#tcaozuo_table").find("tr").eq(e).find("td").eq(4).html(" ")
}
});
} }
}); } else {
}, alert('获取失败!');
// table切换 }
Information: function() { }
$(".Tswitch").eq(0).show(); });
$(".Tswitch").eq(1).hide(); },
$(".Tswitch").eq(2).hide(); newCommission: function() { //新增分佣提成
$("#information").removeClass("btn-default"); $.ajax({
$("#information").addClass("btn-info"); 'type': 'POST',
$("#fees").removeClass("btn-info"); 'url': '/index/addBargain',
$("#fees").addClass("btn-default"); data: {
$("#records").removeClass("btn-info"); "id": business.house_id,
$("#records").addClass("btn-default"); "role": $("#is_carefully_chosen").val(),
"scale": $("#commission-rate").val(),
"scale_fee": $("#should-commission").val(),
}, },
Fees: function() { dataType: "json",
$(".Tswitch").eq(0).hide(); success: function(data) {
$(".Tswitch").eq(1).show(); if(data.code == 200) {
$(".Tswitch").eq(2).hide(); if(data.data) {
$("#information").removeClass("btn-info"); console.log(666);
$("#information").addClass("btn-default"); }
$("#fees").removeClass("btn-default"); } else {
$("#fees").addClass("btn-info"); alert('获取失败!');
$("#records").removeClass("btn-info"); }
$("#records").addClass("btn-default"); }
});
},
// table切换
Information: function() {
$(".Tswitch").eq(0).show();
$(".Tswitch").eq(1).hide();
$(".Tswitch").eq(2).hide();
$("#information").removeClass("btn-default");
$("#information").addClass("btn-info");
$("#fees").removeClass("btn-info");
$("#fees").addClass("btn-default");
$("#records").removeClass("btn-info");
$("#records").addClass("btn-default");
},
Fees: function() {
$(".Tswitch").eq(0).hide();
$(".Tswitch").eq(1).show();
$(".Tswitch").eq(2).hide();
$("#information").removeClass("btn-info");
$("#information").addClass("btn-default");
$("#fees").removeClass("btn-default");
$("#fees").addClass("btn-info");
$("#records").removeClass("btn-info");
$("#records").addClass("btn-default");
}, },
getList: function(pageNo) { getList: function(pageNo) {
business.pageNo = pageNo; business.pageNo = pageNo;
var params = {}; var params = {};
params.pageNo = business.pageNo; params.pageNo = business.pageNo;
params.pageSize = business.pageSize; params.pageSize = business.pageSize;
params.name = $('#user_name').val(); params.name = $('#user_name').val();
params.phone = $('#user_phone').val(); params.phone = $('#user_phone').val();
params.commission_start_date = $('#create_time').val(); params.commission_start_date = $('#create_time').val();
params.commission_end_date = $('#end_time').val(); params.commission_end_date = $('#end_time').val();
params.deal_start_date = $('#create_dealtime').val(); params.deal_start_date = $('#create_dealtime').val();
params.deal_end_date = $('#end_dealtime').val(); params.deal_end_date = $('#end_dealtime').val();
params.operation_start_date = $('#create_ticketTime').val(); params.operation_start_date = $('#create_ticketTime').val();
params.operation_end_date = $('#end_ticketTime').val(); params.operation_end_date = $('#end_ticketTime').val();
params.district_id= $("#qx-store option:selected").val();//部门id 添加字段 params.district_id = $("#qx-store option:selected").val(); //部门id 添加字段
params.store_name = $('#store_name').val(); params.store_name = $('#store_name').val();
$.ajax({ $.ajax({
url: '/index/getCommissionTotalList', //获取列表 url: '/index/getCommissionTotalList', //获取列表
type: 'GET', type: 'GET',
async: true, async: true,
data: params, data: params,
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
console.log(data); console.log(data);
var temp = document.getElementById('commissionTotal_list_tpl').innerHTML; var temp = document.getElementById('commissionTotal_list_tpl').innerHTML;
var doTtmpl = doT.template(temp); var doTtmpl = doT.template(temp);
$("#business_list").html(doTtmpl(data.data.list)); $("#business_list").html(doTtmpl(data.data.list));
console.log(data.data.list); console.log(data.data.list);
/*分页代码*/ /*分页代码*/
add_page(data.data.total, pageNo, business.pageSize, business.getList); add_page(data.data.total, pageNo, business.pageSize, business.getList);
} }
}); });
},
getDistrict: function(name) {
$.ajax({
url: '/index/getDistrictListByName',
type: 'GET',
async: true,
data: {
"pageSize": 50
}, },
getDistrict: function(name) { dataType: 'json',
$.ajax({ success: function(data) {
url: '/index/getDistrictListByName', if(data.code == 200) {
type: 'GET', var _html = '';
async: true, $.each(data.data, function(i, n) {
data: {"pageSize":50}, if(n.district_name == name && (typeof name != undefined)) {
dataType: 'json', _html += '<option value="' + n.id + '">' + n.district_name + '</option>';
success: function(data) {
if(data.code == 200) {
var _html = '';
$.each(data.data, function(i, n) {
if (n.district_name == name && (typeof name != undefined)) {
_html += '<option value="' + n.id + '">' + n.district_name + '</option>';
} else { } else {
_html += '<option value="' + n.id + '">' + n.district_name + '</option>'; _html += '<option value="' + n.id + '">' + n.district_name + '</option>';
} }
}); });
$("#ss-store").html(_html); $("#ss-store").html(_html);
$("#qx-store").append(_html); $("#qx-store").append(_html);
// $("#qx-store").html(_html); // $("#qx-store").html(_html);
} else { } else {
alert('获取部门信息失败'); alert('获取部门信息失败');
} }
} }
});
},
exportList: function(pageNo) {
console.log(2);
business.pageNo = pageNo;
var excel_two = 1;
var name = $('#user_name').val();
var phone = $('#user_phone').val();
var commission_start_date = $('#create_time').val();
var commission_end_date = $('#end_time').val();
var deal_start_date = $('#create_dealtime').val();
var deal_end_date = $('#end_dealtime').val();
var operation_start_date = $('#create_ticketTime').val();
var operation_end_date = $('#end_ticketTime').val();
// var district_id = $('#user_phone').val();
var district_id= $("#qx-store option:selected").val();//部门id 添加字段
var store_name = $('#store_name').val();
window.open('/index/getCommissionTotalList?'+
'excel = '+ excel_two +' &name = ' + name + ' &phone = ' + phone + ' &commission_start_date = ' + commission_start_date + '& commission_end_date = ' + commission_end_date + ' &deal_start_date = ' + deal_start_date + ' &deal_end_date = ' + deal_end_date+ ' &operation_start_date = ' + operation_start_date+ ' &operation_end_date = ' + operation_end_date+ ' &district_id = ' + district_id+ ' &store_name = ' + store_name);
},
};
return business;
}); });
},
\ No newline at end of file exportList: function(pageNo) {
console.log(2);
business.pageNo = pageNo;
var excel_two = 1;
var name = $('#user_name').val();
var phone = $('#user_phone').val();
var commission_start_date = $('#create_time').val();
var commission_end_date = $('#end_time').val();
var deal_start_date = $('#create_dealtime').val();
var deal_end_date = $('#end_dealtime').val();
var operation_start_date = $('#create_ticketTime').val();
var operation_end_date = $('#end_ticketTime').val();
var district_id = $("#qx-store option:selected").val(); //部门id 添加字段
var store_name = $('#store_name').val();
window.open('/index/getCommissionTotalList?' +
'excel=' + excel_two + '&name=' + name + '&phone=' + phone + '&commission_start_date=' + commission_start_date + '&commission_end_date=' + commission_end_date + '&deal_start_date=' + deal_start_date + '&deal_end_date=' + deal_end_date + '&operation_start_date=' + operation_start_date + '&operation_end_date=' + operation_end_date + '&district_id=' + district_id + '&store_name=' + store_name);
},
};
return business;
});
\ 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