Commit 21d16a6f authored by agping's avatar agping

新增罚款

parent 9607de30
...@@ -2,6 +2,20 @@ ...@@ -2,6 +2,20 @@
<input type="hidden" class="page-load" id="fineMoney" /> <input type="hidden" class="page-load" id="fineMoney" />
<!--关联经纪人列表liudanjs文件--> <!--关联经纪人列表liudanjs文件-->
<style> <style>
.user-ul-office,.user-ul-store{
float: right;
position: relative;
overflow-y:scroll ;
height:100px;
left: 162px;
width:100%;
line-height: 30px;
}
.user-ul-office li,.user-ul-store li{
list-style: none;
line-height: 20px;
font-size: 12px;
}
.form-group{ .form-group{
margin-bottom: 6px; margin-bottom: 6px;
} }
...@@ -90,6 +104,13 @@ ...@@ -90,6 +104,13 @@
height: 80px; height: 80px;
margin-top: 3px; margin-top: 3px;
} }
.result-positive{
width: 80px;
float: left;
text-align: center;
margin-right: 20px;
margin-top: 15px;
}
#container_body{ #container_body{
position: relative; position: relative;
overflow: hidden; overflow: hidden;
...@@ -214,28 +235,30 @@ ...@@ -214,28 +235,30 @@
× ×
</button> </button>
<h4 class="modal-title" id="title_add"> <h4 class="modal-title" id="title_add">
新增经纪人 新增罚款
</h4> </h4>
</div> </div>
<div class="modal-body" style="height: 560px;overflow-y: auto;overflow-x: hidden;"> <div class="modal-body" style="height: 560px;overflow-y: auto;overflow-x: hidden;">
<form class="form-horizontal form-horizontal-add"> <form class="form-horizontal form-horizontal-add">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">罚款金额:</label> <label class="col-sm-4 control-label">罚款金额:</label>
<input class="form-control btn6" data-rule-buga="false" data-rule-required="true" name="name_add" type="text" value="" id="title_add"> <input class="form-control btn6" data-rule-buga="false" data-rule-required="true" name="" type="text" value="" id="money_add">
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">罚款类型:</label> <label class="col-sm-4 control-label">罚款类型:</label>
<select name="district_id_add" class="form-control btn6"> <select name="" class="form-control btn6" id="fine_type">
<option value="">选择罚款类型</option> <option value="">选择罚款类型</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">处罚当事人:</label> <label class="col-sm-4 control-label">处罚当事人:</label>
<input class="form-control btn6" data-rule-buga="false" data-rule-required="true" name="name_add" type="text" value="" id="title_add"> <input class="form-control btn6" data-rule-buga="false" data-rule-required="true" name="" type="text" value="" id="agent_id">
<ul class="user-ul-office" style="display:none"></ul>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">备注(选填):</label> <label class="col-sm-4 control-label">备注(选填):</label>
<input class="form-control btn6" data-rule-buga="false" data-rule-required="true" name="name_add" type="text" value="" id="title_add"> <input class="form-control btn6" data-rule-buga="false" data-rule-required="true" name="name_add" type="text" value="" id="remark_add">
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-5 control-label">图片上传(选填,最多4张):</label> <label class="col-sm-5 control-label">图片上传(选填,最多4张):</label>
......
...@@ -20,89 +20,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -20,89 +20,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
//列表选择城市 //列表选择城市
agent.getDistrictList(); agent.getDistrictList();
}); });
agent.getDistrict(function() {
_doc.on('input', '[name=district_id],#district_id2,[name=district_id_add],[name=district_id_business],[name=district_id_city]', function() {
var _this = $(this);
var _id = _this.val();
_this.next().html(''); //先清空
//新增 编辑
var _objTemp = _this.parent().next().find('select');
_objTemp.html(''); //先清空
if(_id && _id != '0') {
agent.getDistrictStoreList(_id, function(_data) {
// var _str = '';
var _str = '<option value="">选择门店</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.id + '">' + item.store_name + '</option>';
});
_objTemp.html(_str);
_this.next().html(_str);
});
} else {};
});
});
var NV = {};
var UA = navigator.userAgent.toLowerCase();
try {
NV.name = !-[1, ] ? 'ie' :
(UA.indexOf("firefox") > 0) ? 'firefox' :
(UA.indexOf("chrome") > 0) ? 'chrome' :
window.opera ? 'opera' :
window.openDatabase ? 'safari' :
'unkonw';
} catch(e) {};
try {
NV.version = (NV.name == 'ie') ? UA.match(/msie ([\d.]+)/)[1] :
(NV.name == 'firefox') ? UA.match(/firefox\/([\d.]+)/)[1] :
(NV.name == 'chrome') ? UA.match(/chrome\/([\d.]+)/)[1] :
(NV.name == 'opera') ? UA.match(/opera.([\d.]+)/)[1] :
(NV.name == 'safari') ? UA.match(/version\/([\d.]+)/)[1] :
'0';
} catch(e) {};
try {
NV.shell = (UA.indexOf('360ee') > -1) ? '360极速浏览器' :
(UA.indexOf('360se') > -1) ? '360安全浏览器' :
(UA.indexOf('qqbrowser') > -1) ? 'QQ浏览器' :
(UA.indexOf('se') > -1) ? '搜狗浏览器' :
(UA.indexOf('aoyou') > -1) ? '遨游浏览器' :
(UA.indexOf('theworld') > -1) ? '世界之窗浏览器' :
(UA.indexOf('worldchrome') > -1) ? '世界之窗极速浏览器' :
(UA.indexOf('greenbrowser') > -1) ? '绿色浏览器' :
(UA.indexOf('baidu') > -1) ? '百度浏览器' :
NV.name;
} catch(e) {};
//判断 谷歌 360 application/vnd.chromium.remoting-viewer 可能为360特有
if(NV.name=='chrome'){
var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
if(isChrome() && is360) {
NV.shell='360浏览器'
}
//检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
function isChrome() {
var ua = navigator.userAgent.toLowerCase();
return ua.indexOf("chrome") > 1;
}
//测试mime
function _mime(option, value) {
var mimeTypes = navigator.mimeTypes;
for(var mt in mimeTypes) {
if(mimeTypes[mt][option] == value) {
return true;
}
}
return false;
}
}
// alert('浏览器UA=' + UA +
// '\n\n浏览器名称=' + NV.name +
// '\n\n浏览器版本=' + NV.version +
// //'\n\n浏览器版本='+parseInt(NV.version)+
// '\n\n浏览器外壳=' + NV.shell);
var browser_version=NV.shell+'/'+NV.version;
// alert(browser_version)
$('#search').click(function(pageNo) { $('#search').click(function(pageNo) {
agent.getList(1); agent.getList(1);
}); });
...@@ -113,15 +30,25 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -113,15 +30,25 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
$("#reset").click(function() { //重置 $("#reset").click(function() { //重置
document.getElementById("form_search").reset(); document.getElementById("form_search").reset();
}); });
$(document).delegate(".agent_business", "click", function() { //点击 编辑 跨城市转勤 //新增 选择处罚人
$(".form-horizontal-turn")[0].reset(); //重置表单 $(document).on("input", "#agent_id", function() {
if($("#agent_id").val() == '') {
agent.agent_id_add='';
$(".user-ul-office").html('');
} else {
agent.search_office();
}
}); });
//点击新增处罚人
$(document).delegate(".addphoneOffice", "click", function() {
agent.addphoneOffice(this);
});
$(document).delegate(".agent_add", "click", function() { //点击新增 $(document).delegate(".agent_add", "click", function() { //点击新增
$(".form-horizontal-add")[0].reset(); //重置表单 $(".form-horizontal-add")[0].reset(); //重置表单
agent.confirm_old=''//是否转勤 置空
//置空图片 //置空图片
$('#container_body_img_area_positive').html(''); $('#container_body_img_area_positive').html('');
$('#container_body_img_area_reverse').html(''); agent.getDistrict();
}); });
$(document).delegate(".edit", "click", function() { //点击编辑 $(document).delegate(".edit", "click", function() { //点击编辑
...@@ -132,35 +59,8 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -132,35 +59,8 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
$('#container_body_img_area_reverse_edit').html(''); $('#container_body_img_area_reverse_edit').html('');
agent.Edit(); agent.Edit();
}); });
$(document).delegate("#password", "click", function() {
$(this).val('').attr('type', 'password');
});
$(document).on("click", ".black-list", function() { //点击黑名单
agent.agent_id = $(this).attr("data-id");
});
$(document).on("click", ".edit-phone-btn", function() { //点击修改手机号
agent.agent_id = $(this).attr("data-id");
$('#edit-phone').val($(this).attr("data-phone"));
});
$(document).on("click", ".edit-phone-save", function() { //保存修改手机号
agent.Submit_edit_phone();//获取编辑内容
});
$(document).on("click", ".phone-bundling", function() { //点击绑定手机
agent.agent_id = $(this).attr("data-id");
agent.getPhoneBindingList(browser_version);
});
$(document).on("click", ".del-record", function() { //点击绑定电脑(清除绑定)
agent.getPhoneBindingDelList();
});
$(document).on("click", ".pc-bundling", function() { //点击绑定电脑
agent.agent_id = $(this).attr("data-id");
agent.getPcBindingList();
});
$(document).on("click", ".state-record", function() { //点击记录状态
agent.agent_id = $(this).attr("data-id");
agent.stateRecordList();
});
$(document).delegate(".submit_add", "click", function(e) { //提交新增 $(document).delegate(".submit_add", "click", function(e) { //提交新增
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -171,179 +71,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -171,179 +71,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
e.stopPropagation(); e.stopPropagation();
agent.Submit_edit(); agent.Submit_edit();
}); });
$(document).delegate(".submit_user_turn", "click", function(e) { //提交 编辑(跨城市 转勤)
e.preventDefault();
e.stopPropagation();
agent.Submit_edit_turn();
});
$(document).delegate(".submit_city_turn", "click", function(e) { //提交 编辑(跨城市 转勤)
e.preventDefault();
e.stopPropagation();
agent.Submit_edit_city_turn();
});
$(document).delegate("#role", "click", function(e) { //变更角色
var _this = $(this);
var _tempVal = _this.closest('tr').attr('data-groupname');
agent.agent_id = $(this).attr("data-id");
agent.getRole(_tempVal);
});
$(document).delegate(".submit_user", "click", function() { //提交变更
agent.Submit_user();
});
//冻结状态选中与取消事件2.9.5版本;
$(document).on('click','.yetai_checkbox',function(e){
if(!confirm('是否继续?')) {
return;
};
var params = {};
params.id = $(this).attr("data-id");
if ( $(this).hasClass("isCheck") ){ //取消选中
if($(this).html() == '已离职'){
$(this).html('离职');
params.type=0;
}
if($(this).html() == '已长假'){
$(this).html('长假');
params.type=0;
}
$(this).removeClass("isCheck").addClass("btn-info").removeClass('btn-warning');
} else {//选中
if($(this).html() == '离职'){
$(this).html('已离职');
$(this).next().html('长假');
params.type=2;
}
if($(this).html() == '长假'){
$(this).html('已长假');
$(this).prev().html('离职');
params.type=1;
}
$(this).siblings(".yetai_checkbox").removeClass("isCheck").addClass("btn-info").removeClass('btn-warning');
$(this).addClass("isCheck").removeClass("btn-info").addClass('btn-warning');
};
$.ajax({ //经纪人 离职 长假
'type': 'POST',
'url': '/index/updateStatus',
data: {
"ids": params.id,
"status": params.type
},
dataType: "json",
success: function(data) {
if(data.code != 200) {
alert(data.msg)
}
}
});
});
//解除自动锁定
$(document).on('click','.automatic-locking',function(e){
var params={};
params.id = $(this).attr("data-id");
if(!confirm('是否解锁此账号为正常状态?')) {
return;
};
var hideAutomatic={};
hideAutomatic=$(this);
$.ajax({ //经纪人
'type': 'POST',
'url': '/index/updateStatus',
data: {
"ids": params.id,
"status": 0
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
hideAutomatic.hide();
// console.log( $(this));
}else{
alert(data.msg)
}
}
});
});
//手机绑定状态切换
$(document).delegate(".is_show2", "click", function() { //点击禁用
if(!confirm('是否继续?')) {
return;
}
agent.id = $(this).attr("data-id");
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
var params = {
};
params.id = $(this).attr("data-id");
var str = $.trim($(this).html());
if(str === "允许") {
$(this).attr('class', 'btn1 btn-default is_show2');
params.type = 0;
$(this).html('解绑');
} else if(str === "解绑") {
$(this).attr('class', 'btn1 btn-info is_show2');
params.type = 1;
$(this).html('允许');
};
$.ajax({ //禁用
'type': 'POST',
'url': '/index/updateDevice',
data: {
"agent_id": agent.agent_id,
"id": params.id,
"operator_id": user_info_obj.id,
"is_forbidden": params.type
},
dataType: "json",
success: function(data) {
if(data.code != 200) {
alert("禁用失败!")
}
}
});
});
//电脑绑定状态切换
$(document).delegate(".is_showpc", "click", function() { //点击禁用
if(!confirm('是否继续?')) {
return;
}
agent.id = $(this).attr("data-id");
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
var params = {
};
params.id = $(this).attr("data-id");
var str = $.trim($(this).html());
if(str === "允许") {
$(this).attr('class', 'btn1 btn-default is_showpc');
params.type = 0;
$(this).html('解绑');
} else if(str === "解绑") {
$(this).attr('class', 'btn1 btn-info is_showpc');
params.type = 1;
$(this).html('允许');
};
$.ajax({ //禁用
'type': 'POST',
'url': '/index/updateDevice',
data: {
"agent_id": agent.agent_id,
"id": params.id,
"operator_id": user_info_obj.id,
"is_forbidden": params.type
},
dataType: "json",
success: function(data) {
if(data.code != 200) {
alert("禁用失败!")
}
}
});
});
//收款图片-点击添加图片事件 //收款图片-点击添加图片事件
$('#file_input').on('change', function(){ $('#file_input').on('change', function(){
...@@ -382,7 +109,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -382,7 +109,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
} }
}); });
}); });
//图片删除事件 //图片删除事件
_doc.on('click', '.span-del,.span-del-positive,.span-del-reverse', function(e) { _doc.on('click', '.span-del,.span-del-positive,.span-del-reverse', function(e) {
e.preventDefault(); e.preventDefault();
...@@ -400,106 +126,15 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -400,106 +126,15 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
agent.spandelList(_this.prev().attr('data-imgid')); agent.spandelList(_this.prev().attr('data-imgid'));
}; };
}); });
//保存上传的图片
_doc.on('click', '#saveBtn', function(e) {
var _this = $(this);
e.preventDefault();
e.stopPropagation();
var _data={};
_data['content']=$('.black-list-text').val();
_data['agents_id']=agent.agent_id;
var imgname = [];
for(var i = 0; i < $('.result').length; i++) {
imgname[i] = $('.result>img').eq(i).attr('data-imgname');
};
console.log(imgname.join(','));
_data['img_info'] = imgname.join(',');
if($.trim($('.black-list-text').val()) == ''){
alert('违反公司事项内容未填写!');
return;
};
$.ajax({
type: 'GET',
url: '/index/addAgentsBlackList',
data: _data,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(_data.code == 200){
alert('保存成功');
$("#modal-blackList").modal('hide');//提交成功后 关闭弹窗
agent.getList(0);
}else{
alert(_data.msg);
$("#modal-blackList").modal('hide');//提交成功后 关闭弹窗
agent.getList(0);
}
} else {
alert('数据错误');
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
});
});
//新增经纪人 上传身份证反面图片
$('#file_input_reverse').on('change', function(){
var _this = $(this);
var formData = new FormData();
formData.append('type', 'user_id_card');
formData.append('image', _this[0].files[0]);
$.ajax({
type: 'post',
url: ServerHostImageLiu + '/index/uploadImg',
data: formData,
dataType: 'json',
contentType: false,
cache: false,
processData: false,
beforeSend: function() {},
success: function(_data) {
if(_data.code == 200) {
$('#container_body_img_area_reverse').append('<div class="result-reverse"><img data-imgname="{0}" src="{1}" alt=""/> <span class="span-del-reverse">删除</span></div>'.stringFormatObj({
'0': _data.data.img_path,
'1':ServerHostImageLiu + '/static/user_id_card/' + _data.data.internet_img_name
}));
} else {
alert(_data.msg);
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
});
});
//新增经纪人 上传身份证正面图片 //新增经纪人 上传身份证正面图片
$('#file_input_positive').on('change', function(){ $('#file_input_positive').on('change', function(){
var _this = $(this); var _this = $(this);
var formData = new FormData(); var formData = new FormData();
// formData.append('AuthToken', user_info_obj.AuthToken); formData.append('type', 'amercement_img');
formData.append('type', 'user_id_card');
formData.append('image', _this[0].files[0]); formData.append('image', _this[0].files[0]);
$.ajax({ $.ajax({
type: 'post', type: 'post',
url: ServerHostImageLiu + '/index/uploadImg', url: ServerHostImageLiu + '/index/uploadImg',
// url: '/index/uploadImg',
data: formData, data: formData,
dataType: 'json', dataType: 'json',
contentType: false, contentType: false,
...@@ -510,44 +145,7 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -510,44 +145,7 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
if(_data.code == 200) { if(_data.code == 200) {
$('#container_body_img_area_positive').append('<div class="result-positive"><img data-imgname="{0}" src="{1}" alt=""/> <span class="span-del-positive">删除</span></div>'.stringFormatObj({ $('#container_body_img_area_positive').append('<div class="result-positive"><img data-imgname="{0}" src="{1}" alt=""/> <span class="span-del-positive">删除</span></div>'.stringFormatObj({
'0': _data.data.img_path, '0': _data.data.img_path,
'1':ServerHostImageLiu + '/static/user_id_card/' + _data.data.internet_img_name '1':ServerHostImageLiu + '/static/amercement_img/' + _data.data.internet_img_name
}));
} else {
alert(_data.msg);
};
},
error: function() {
alert('enter error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
//处理超时的逻辑
alert('请求超时,请重试');
};
}
});
});
//编辑经纪人 上传身份证反面图片
$('#file_input_reverse_edit').on('change', function(){
var _this = $(this);
var formData = new FormData();
formData.append('type', 'user_id_card');
formData.append('image', _this[0].files[0]);
$.ajax({
type: 'post',
url: ServerHostImageLiu + '/index/uploadImg',
data: formData,
dataType: 'json',
contentType: false,
cache: false,
processData: false,
beforeSend: function() {},
success: function(_data) {
if(_data.code == 200) {
$('#container_body_img_area_reverse_edit').append('<div class="result-reverse-edit"><img data-imgname="{0}" src="{1}" alt=""/> <span class="span-del-reverse">删除</span></div>'.stringFormatObj({
'0': _data.data.img_path,
'1':ServerHostImageLiu + '/static/user_id_card/' + _data.data.internet_img_name
})); }));
} else { } else {
alert(_data.msg); alert(_data.msg);
...@@ -564,6 +162,7 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -564,6 +162,7 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
} }
}); });
}); });
//编辑经纪人 上传身份证正面图片 //编辑经纪人 上传身份证正面图片
$('#file_input_positive_edit').on('change', function(){ $('#file_input_positive_edit').on('change', function(){
var _this = $(this); var _this = $(this);
...@@ -604,21 +203,40 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -604,21 +203,40 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
}, },
//将li里的值 赋给input(办公室)
Submit_user: function() { //提交变更的信息 addphoneOffice: function(obj) {//新增客户 input赋值
var group_id = $("#edit_role").val(); var that = agent ;
var user_ht = $(obj).html();
$("#agent_id").val(user_ht);
$(".user-ul-office").html('');
$(".user-ul-office").hide();
that.agent_id_add= $(obj).attr("data-id");
},
search_office: function() { //搜索处罚人
$.ajax({ $.ajax({
'type': 'POST', url: '/index/getOfficeList',
'url': '/index/updateRole', type: 'POST',
async: true,
data: { data: {
'ids': agent.agent_id, "pageNo": 1,
'group_id': group_id "pageSize": 100,
"office_address": $("#comit_office").val(),
}, },
dataType: "json", dataType: 'json',
success: function(data) { success: function(data) {
if(data.code == 200) {} else { if(data.code == 200) {
alert("重复提交"); var user_ul = "";
if(data.data.list){
$.each(data.data.list, function(i, item) {
user_ul += '<li class="addphoneOffice" data-site="' + item.site_id + '" data-id="' + item.id + '">' + item.office_address + ';-ID:' + item.id + '</li>';
});
}
$(".user-ul-office").html(user_ul);
$(".user-ul-office").show();
} else {
} }
} }
}); });
}, },
...@@ -696,59 +314,32 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -696,59 +314,32 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
Submit_add: function() { Submit_add: function() {
//提交新增的信息 //提交新增的信息
var params = {} var params = {}
// params.id = agent.agent_id; params.type = $("#fine_type").val();
params.name = $("input[name = name_add]").val(); params.money = $("#money_add").val();
params.password = $("#password_add").val();
params.district_id = $("[name = district_id_add]").val();
params.store_id = $("[name = store_id_add]").val();
params.phone = $("input[name = phone_add]").val();
params.admin_off = $("#admin_off_add").val();
params.sex = $("input[name =sex_add]:checked").val();
params.remarks = $("#remarks_add").val(); params.remarks = $("#remarks_add").val();
params.status = $("#status_add").val(); params.agent_id = agent.agent_id_add;//新增处罚人id
params.password = $("input[name='password_add']").val(); var imgname = [];//图片
params.confirm_old = agent.confirm_old; for(var i = 0; i < $('.result-positive').length; i++) {
//新增经纪人 正反面图片 imgname[i] = $('.result-positive>img').eq(i).attr('data-imgname');
params.id_card_image_front = $('.result-positive>img').attr('data-imgname'); };
params.id_card_image_back = $('.result-reverse>img').attr('data-imgname'); params.img = JSON.stringify(imgname);
params.id_card = $("input[name = identity_add]").val();
if(params.phone == '') { if(params.money == '') {
alert('手机号必填!'); alert('罚款金额必填!');
return false; return false;
} }
if(params.type == '') {
if(params.district_id == '') { alert('罚款类型必填!');
alert('所属部门必填');
return false; return false;
} }
if(params.agent_id == '') {
if(params.store_id == '') { alert('处罚当事人必填!');
alert('所属门店必填');
return false; return false;
} }
if(params.phone.length != 11) {
alert('手机号码错误!');
return false;
}
var imgname1 = [];//正面图片
for(var i = 0; i < $('.result-positive').length; i++) {
imgname1[i] = $('.result-positive>img').eq(i).attr('data-imgname');
};
var imgname2 = [];//反面图片
for(var i = 0; i < $('.result-reverse').length; i++) {
imgname2[i] = $('.result-reverse>img').eq(i).attr('data-imgname');
};
if(imgname1.length > 1 || imgname2.length > 1 ){
alert('身份证正面图片,反面图片最多传一张');
return;
}
$.ajax({ $.ajax({
'type': 'POST', 'type': 'POST',
'url': '/index/saveAgent', 'url': '/index/addAmercement',
data: params, data: params,
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
...@@ -756,55 +347,8 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -756,55 +347,8 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
alert('提交成功'); alert('提交成功');
$("#modal-add").modal('hide'); $("#modal-add").modal('hide');
agent.getList(agent.pageNo); agent.getList(agent.pageNo);
}else if(data.code == 101){ }else {
if(data.msg == '转勤'){ alert(data.msg);
layer.open({
content: '该账号已经有相同账号,请问是否转勤?(转勤 即人员调配另外一个城市)转勤后,所有商铺和客户也都会转到新建的相同手机号里,请确定是否转勤。',
btn: ['确定转勤', '取消转勤'],
yes: function(_index){
layer.close(_index);
agent.confirm_old=1;
agent.Submit_add();
}
});
}else{
alert(data.msg);
}
} else {
}
}
});
},
Submit_edit_phone: function() {//修改手机号
//提交编辑的信息
var params = {}
params.id = agent.agent_id;
params.phone = $("#edit-phone").val();
if(params.phone == '') {
alert('手机号必填!');
return false;
}
if(params.phone.length != 11) {
alert('手机号码错误!');
return false;
}
$.ajax({
'type': 'POST',
'url': '/index/updatePhone',
data: params,
dataType: "json",
success: function(data) {
if(data.code == 200) {
alert('提交成功');
$("#modal-editPhone").modal('hide');
agent.getList(agent.pageNo);
}else if(data.code == 101){
alert(data.msg);
} else {
} }
} }
}); });
...@@ -879,134 +423,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -879,134 +423,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
}, },
Submit_edit_city_turn: function() {
if ( $('#modal-turncity').find("#same_city_Start_time").val() == "") {
alert("请选择业绩调整开始时间")
return false ;
}
//提交编辑的信息(跨城市 转勤)
var params = {}
params.id = agent.agent_id;
params.name = $("input[name = name]").val();
params.password = $("#password").val();
params.district_id = $('#modal-turncity').find("[name = district_id_city]").val();
params.store_id = $('#modal-turncity').find("[name = store_id_city]").val();
params.phone = $("input[name = phone]").val();
params.admin_off = $("#admin_off").val();
params.sex = $("input[name =sex]:checked").val();
params.remarks = $("#remarks").val();
params.status = $("#status").val();
params.password = $("input[name='password']").val();
params.confirm_old = 2;
params.performance_time = $('#modal-turncity').find("#same_city_Start_time").val()
console.log($('#modal-turncity').find("#same_city_Start_time").val())
if(params.phone == '') {
alert('手机号必填!');
return false;
}
if(params.district_id == '') {
alert('所属部门必填');
$("#modal-edit").show();
return false;
}
if(params.store_id == '') {
alert('所属门店必填');
$("#modal-edit").show();
return false;
}
if(params.phone.length != 11) {
alert('手机号码错误!');
$("#modal-edit").show();
return false;
}
$.ajax({
'type': 'POST',
'url': '/index/saveAgent',
data: params,
dataType: "json",
success: function(data) {
if(data.code == 200) {
alert('提交成功');
$("#modal-turncity").modal('hide');//转勤 提交成功之后 关闭弹出框
$("#modal-edit").modal('hide');
agent.getList(agent.pageNo);
}else if(data.code == 101){
alert(data.msg);
} else {
}
}
});
},
Submit_edit_turn: function() {
//提交编辑的信息(跨城市 转勤)
var params = {}
params.id = agent.agent_id;
params.name = $("input[name = name]").val();
params.password = $("#password").val();
params.district_id = $('#modal-business').find("[name = district_id_business]").val();
params.store_id = $('#modal-business').find("[name = store_id_business]").val();
params.phone = $("input[name = phone]").val();
params.admin_off = $("#admin_off").val();
params.sex = $("input[name =sex]:checked").val();
params.remarks = $("#remarks").val();
params.status = $("#status").val();
params.password = $("input[name='password']").val();
params.confirm_old = 1;
params.performance_time = $('#city_Start_time').val();
if(params.phone == '') {
alert('手机号必填!');
return false;
}
if(params.district_id == '') {
alert('所属部门必填');
$("#modal-edit").show();
return false;
}
if(params.store_id == '') {
alert('所属门店必填');
$("#modal-edit").show();
return false;
}
if(params.phone.length != 11) {
alert('手机号码错误!');
$("#modal-edit").show();
return false;
}
$.ajax({
'type': 'POST',
'url': '/index/saveAgent',
data: params,
dataType: "json",
success: function(data) {
if(data.code == 200) {
alert('提交成功');
$("#modal-business").modal('hide');//转勤 提交成功之后 关闭弹出框
$("#modal-edit").modal('hide');
agent.getList(agent.pageNo);
}else if(data.code == 101){
alert(data.msg);
} else {
}
}
});
},
emptyInput: function() { emptyInput: function() {
console.count('emptyInput'); console.count('emptyInput');
$("input[name = name]").val(''); $("input[name = name]").val('');
...@@ -1080,131 +496,22 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -1080,131 +496,22 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
} }
}); });
}, },
//手机绑定权限 getDistrict: function() {
getPhoneBindingList: function(v,pageNo) {
var params = {};
params.agent_id = agent.agent_id;
// params.model = v;
$.ajax({
url: '/index/deviceList',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
var temp = document.getElementById('phone_binding_tpl').innerHTML;
var doTempl = doT.template(temp);
$("#agent_phone_binding").html(doTempl(data.data));
/*分页代码*/
add_page(data.data.total, pageNo, agent.pageSize, agent.getList);
$('.J_preview').preview();
}
})
},
//手机绑定权限(清除绑定)
getPhoneBindingDelList: function(pageNo) {
var params = {};
params.agent_id = agent.agent_id;
$.ajax({ $.ajax({
url: '/index/deviceList', //电脑绑定权限 url: '/broker/getAmercementType',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
var temp = document.getElementById('phone_del_binding_tpl').innerHTML;
var doTempl = doT.template(temp);
$("#agent_phone_binding").html(doTempl(data.data));
console.log(555)
/*分页代码*/
add_page(data.data.total, pageNo, agent.pageSize, agent.getList);
$('.J_preview').preview();
}
})
},
//电脑绑定权限
getPcBindingList: function(pageNo) {
var params = {};
params.agent_id = agent.agent_id;
$.ajax({
url: '/index/deviceList', //电脑绑定权限
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
var temp = document.getElementById('pc_binding_tpl').innerHTML;
var doTempl = doT.template(temp);
// $("#agent_pc_binding").html(doTempl(data.data));
/*分页代码*/
add_page(data.data.total, pageNo, agent.pageSize, agent.getList);
$('.J_preview').preview();
}
})
},
//记录状态
stateRecordList: function(pageNo) {
var params = {};
params.agent_id = agent.agent_id;
$.ajax({
url: '/index/getRecordsList', //电脑绑定权限
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
var temp = document.getElementById('state_record_list_tpl').innerHTML;
var doTempl = doT.template(temp);
$("#state_record_pc").html(doTempl(data.data.data));
/*分页代码*/
add_page(data.data.total, pageNo, agent.pageSize, agent.getList);
$('.J_preview').preview();
}
})
},
getRole: function(tempval) {
$.ajax({
url: '/index/getAuth2',
type: 'GET',
data: {},
async: true,
dataType: 'json',
success: function(data) {
var User_add = "";
var _tempid;
$.each(data.data.list, function(i, item) {
User_add += '<option value="' + item.id + '">' + item.title + '</option>';
if(item.title == tempval) {
_tempid = item.id;
};
});
$("#edit_role").html(User_add).val(_tempid);
}
});
},
getDistrict: function(fn) {
$.ajax({
url: '/index/getDistrict',
type: 'GET', type: 'GET',
async: true, async: true,
data: { data: {
"pageSize": 1000 "AuthToken": user_info_obj.AuthToken
}, },
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if(data.code == 200 && data.data != null) { if(data.code == 200 && data.data != null) {
var str = ''; var str = '<option value="">选择罚款类型</option>';
$.each(data.data, function(i, item) { $.each(data.data, function(i, item) {
str += '<option value="' + item.id + '">' + item.district_name + '</option>'; str += '<option value="' + item.id + '">' + item.name + '</option>';
}); });
$('[name=district_id]').append(str); $('#fine_type').html(str);
$('[name=district_id_add]').append(str);
$('[name=district_id_business]').append(str);
$('[name=district_id_city]').append(str);
fn && fn();
} }
} }
}); });
...@@ -1252,27 +559,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin ...@@ -1252,27 +559,6 @@ define(['doT', 'text!temp/fineMoney_list_template_tpl.html', 'text!temp/phoneBin
} }
}); });
}, },
getEvaluationList: function(n) {
var _data = {
'agents_id': n.join(',')
}
$.ajax({
url: '/index/agentEvaluateNumAndFraction',
type: 'GET',
async: true,
data: _data,
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
$("#agentlist tr").each(function(e) {
//e代表索引 从0开始 eq(0)就是第一行
$("#agentlist").find("tr").eq(e).find("td").eq(9).html(data.data[e].agent_evaluate_num); //获取一列的值
$("#agentlist").find("tr").eq(e).find("td").eq(10).html(data.data[e].agent_evaluate_fraction);
})
}
}
});
}
}; };
return agent; return agent;
}); });
\ 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