Commit 921e3cee authored by agping's avatar agping Committed by hujun

商铺列表修改

parent 90d88fa0
......@@ -2,139 +2,176 @@
* Created by 刘丹 on 2017/12/11.
*/
define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfinder','ckfinderStart','pagination','bootstrapJs'], function (doT, template) {
define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
business = {
pageNo: 1, /*第几页*/
pageSize: 10, /*每页显示多少条*/
id : '',
house_id:'',
type:'',
valueCurrent:'',
ajaxObj:'',
stopstatus:true,
pageNo: 1,
/*第几页*/
pageSize: 10,
/*每页显示多少条*/
id: '',
house_id: '',
type: '',
valueCurrent: '',
ajaxObj: '',
stopstatus: true,
ldHtml: $('.phone_list'),
boxphoto:'',
exclusive_id : 0,
init: function () {
boxphoto: '',
exclusive_id: 0,
init: function() {
//初始化dot
$ ("body").append (template);
business.getList ();
business.event ();
$("body").append(template);
function  getPreMonth(date)  {            
var  arr  =  date.split('-');            
var  year  =  arr[0];             
var  month  =  arr[1];             
var  day  =  arr[2];             
var  days  =  new  Date(year,  month,  0);            
days  =  days.getDate();             
var  year2  =  year;            
var  month2  =  parseInt(month)  -  1;            
if (month2  ==  0)  {                
year2  =  parseInt(year2)  -  1;                
month2  =  12;            
}            
var  day2  =  day;            
var  days2  =  new  Date(year2,  month2,  0);            
days2  =  days2.getDate();            
if (day2  >  days2)  {                
day2  =  days2;            
}            
if (month2  <  10)  {                
month2  =  '0'  +  month2;            
}            
var  t2  =  year2  +  '-'  +  month2  +  '-'  +  day2;            
return  t2;        
}
var myDate = new Date();
var y = myDate.getFullYear();
var m = myDate.getMonth() + 1;
var d = myDate.getDate();
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
var day_start = getPreMonth(day_end);
$('#start_date').val(day_start);
$('#end_date').val(day_end);
business.getList(1);
business.event();
business.resetLoad();
},
event: function () {
event: function() {
var _doc = $(document);
$("#search").click(function () {
$("#search").click(function() {
business.getList(1);
});
$("#reset").click(function () {//重置
$("#reset").click(function() { //重置
document.getElementById("form_search").reset();
});
$ (document).delegate (".del_modal", "click", function () {
business.id = $ (this).attr ("data-id");
$(document).delegate(".del_modal", "click", function() {
business.id = $(this).attr("data-id");
});
$ (document).delegate (".anch", "click", function () {//点击设置案场权限人
$(document).delegate(".anch", "click", function() { //点击设置案场权限人
$("#myModalLabel").html("设置案场权限人");
// 传入data-id
business.house_id = $ (this).attr ("data-id");
business.type="1";
business.Anch();//获取手机号名字的
business.house_id = $(this).attr("data-id");
business.type = "1";
business.Anch(); //获取手机号名字的
});
// 点击设置案场权限人(盘方)
$ (document).delegate (".add_applies", "click", function () {//点击设置案场权限人
$(document).delegate(".add_applies", "click", function() { //点击设置案场权限人
$("#myModalLabel").html("设置盘方");
business.house_id = $ (this).attr ("data-id");
business.type="2";
business.house_id = $(this).attr("data-id");
business.type = "2";
business.Anch();
});
$ (document).delegate (".dujia", "click", function () {//点击独家
business.house_id = $ (this).attr ("data-id");
business.type="3";
$(document).delegate(".dujia", "click", function() { //点击独家
business.house_id = $(this).attr("data-id");
business.type = "3";
business.Dujia();
});
$ (document).delegate (".caozuo", "click", function () {//点击操作记录
business.house_id = $ (this).attr ("data-id");
$(document).delegate(".caozuo", "click", function() { //点击操作记录
business.house_id = $(this).attr("data-id");
business.Caozuo();
});
$ (document).delegate (".submit_follow2", "click", function () {//提交独家
$(document).delegate(".submit_follow2", "click", function() { //提交独家
business.Dujianew();
});
// 提交按钮设置案场权限人
$ (document).delegate (".submit_follow", "click", function () {//提交按钮设置案场权限人
$(document).delegate(".submit_follow", "click", function() { //提交按钮设置案场权限人
var myModalLabel = $("#myModalLabel").html();
if (myModalLabel == '设置案场权限人') {
if(myModalLabel == '设置案场权限人') {
business.Submit_follow();
} else {
business.Submit_follow2(); // 提交按钮设置盘方
}
});
$ (document).delegate ("#confirm_delete", "click", function () {
$(document).delegate("#confirm_delete", "click", function() {
business.delBusiness();
});
$ (document).delegate (".jia", "click", function () {//加号
$(document).delegate(".jia", "click", function() { //加号
business.jiabox();
});
$ (document).delegate (".addphone", "click", function () {//加号
$(document).delegate(".addphone", "click", function() { //加号
business.addphone(this);
});
$ (document).delegate (".jian", "click", function () {//叉号
$(document).delegate(".jian", "click", function() { //叉号
business.jianbox();
});
// 批量修改客方
$ (document).delegate ("#modify_add", "click", function () {
// 批量修改客方
$(document).delegate("#modify_add", "click", function() {
business.modify_add();
});
// 批量修改客方
// 批量修改客方
$(document).on('input','.phone_jia,.phone_add', function(e) {//搜索手机号码/加号搜索
$(document).on('input', '.phone_jia,.phone_add', function(e) { //搜索手机号码/加号搜索
e.preventDefault();
e.stopPropagation();
var _this = $(this);
_this.next().css("display","block");
_this.next().css("display", "block");
valueCurrent = _this.val();
if(valueCurrent != ''){
if(valueCurrent != '') {
business.resetLoad(1);
business.loadMain(valueCurrent,_this.next());
business.loadMain(valueCurrent, _this.next());
console.log(_this.next());
}else{
} else {
business.ldHtml.html('');
return false;
}
});
$ (document).delegate (".is_show", "click", function () {//推荐至首页
if (!confirm('是否继续?')) {
return ;
$(document).delegate(".is_show", "click", function() { //推荐至首页
if(!confirm('是否继续?')) {
return;
}
business.id = $ (this).attr ("data-id");
var params ={
business.id = $(this).attr("data-id");
var params = {
};
params.id = $ (this).attr ("data-id");
params.id = $(this).attr("data-id");
var str = $.trim($(this).html());
if (str === "推荐至首页") {
if(str === "推荐至首页") {
params.type = 1;
$(this).html('已推荐');
} else {
params.type = 0;
$(this).html('推荐至首页');
}
$.ajax({//推荐至首页
$.ajax({ //推荐至首页
'type': 'POST',
'url' : '/index/carefullyChosen',
data: {"houses_id":business.id,"is_carefully_chosen":params.type},
'url': '/index/carefullyChosen',
data: {
"houses_id": business.id,
"is_carefully_chosen": params.type
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
}
success: function(data) {
if(data.code == 200) {
if(data.data) {}
} else {
alert("推荐失败!")
}
......@@ -142,22 +179,22 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
});
});
$ (document).delegate ("#liudan_pic_btn", "click", function () {//上传图片
var img_url="";
BrowseServer ('liudan_pic_btn',function(url){
var alt_img=$("#liudan_pic_btn").val();
alt_img = alt_img.replace('images/','');
img_url+=' <img src="'+url+'" class="jai_dujia" data-img="'+alt_img+'">';
$(document).delegate("#liudan_pic_btn", "click", function() { //上传图片
var img_url = "";
BrowseServer('liudan_pic_btn', function(url) {
var alt_img = $("#liudan_pic_btn").val();
alt_img = alt_img.replace('images/', '');
img_url += ' <img src="' + url + '" class="jai_dujia" data-img="' + alt_img + '">';
$("#liudan_pic_pre").append(img_url);
});
});
// 下拉列表
var _ajaxObjTel = null;
_doc.on('input', '.phone_jia1' ,function(){
_doc.on('input', '.phone_jia1', function() {
var _this = $(this),
_thisVal = $.trim(_this.val());
_this.removeAttr('data-id');//移除之前携带的信息
if(_thisVal != ''){
_this.removeAttr('data-id'); //移除之前携带的信息
if(_thisVal != '') {
_ajaxObjTel && _ajaxObjTel.abort();
_ajaxObjTel = $.ajax({
type: 'GET',
......@@ -170,35 +207,35 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if (data.code == 200) {
if(data['data'].length > 0){
if(data.code == 200) {
if(data['data'].length > 0) {
var _htmlTemp = '';
$.each(data['data'], function(i, item) {
_htmlTemp += '<li data-id="{3}">{2}{0}-{1}<li>'.stringFormatObj({
'0': item['name'],
'1': item['phone'],
'2': _this.parent().nextAll('.input-add-tel').data('hideid')?'':(item['id']+'-'),
'2': _this.parent().nextAll('.input-add-tel').data('hideid') ? '' : (item['id'] + '-'),
'3': item['id']
});
});
// 输出trim
_this.next().show().html(_htmlTemp);
}else{
} else {
_this.next().html('');
};
}else {
} else {
alert(data['msg']);
};
}else{
} else {
alert('数据错误');
};
},
error: function() {
//alert('error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout'){
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
alert('请求超时');
};
}
......@@ -206,9 +243,9 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
};
});
_doc.on('click', '.jian_class1>ul>li', function(){
_doc.on('click', '.jian_class1>ul>li', function() {
var _this = $(this);
_this.parent().prev().val(_this.html()).attr('data-id',_this.attr('data-id'));
_this.parent().prev().val(_this.html()).attr('data-id', _this.attr('data-id'));
_this.parent().html('').hide();
});
......@@ -216,18 +253,21 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
},
// 获取信息 手机号 名字
Anch:function(){//获取手机号名字的
Anch: function() { //获取手机号名字的
$.ajax({
'type': 'GET',
'url' : '/index/getAgentsTohouses',
data: {"houses_id":business.house_id,"type":business.type},
'url': '/index/getAgentsTohouses',
data: {
"houses_id": business.house_id,
"type": business.type
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
$(".jian_class").html('');//写入
$.each(data.data, function(i,data) {
business.jiabox_data(data['id'],data['name'],data['phone']);
success: function(data) {
if(data.code == 200) {
if(data.data) {
$(".jian_class").html(''); //写入
$.each(data.data, function(i, data) {
business.jiabox_data(data['id'], data['name'], data['phone']);
});
business.jiabox();
}
......@@ -237,25 +277,27 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
Dujia:function(){//获取独家的信息
Dujia: function() { //获取独家的信息
$("#modal-dujia").removeClass("yz");
$.ajax({
'type': 'GET',
'url' : '/index/getExclusive',
data: {"houses_id":business.house_id},
'url': '/index/getExclusive',
data: {
"houses_id": business.house_id
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
$("#sel_dujia").val(data.data.is_exclusive_type);//是否独家
$("#start_date_dujia").val(data.data.agent_start_time);//上传时间
success: function(data) {
if(data.code == 200) {
if(data.data) {
$("#sel_dujia").val(data.data.is_exclusive_type); //是否独家
$("#start_date_dujia").val(data.data.agent_start_time); //上传时间
$("#end_date_dujia").val(data.data.agent_end_time);
$("#exclusive").val(data.data.name);
business.exclusive_id=data.data.id;
var img_url="";
business.exclusive_id = data.data.id;
var img_url = "";
$.each(data['data']['exclusive_img'], function(i, item) {
var local_img=location.origin+'/resource/lib/Attachments/images/'+item.img_name;
img_url +='<img src="'+local_img+'" class="jai_dujia" data-img="'+item.img_name+'" >';
var local_img = location.origin + '/resource/lib/Attachments/images/' + item.img_name;
img_url += '<img src="' + local_img + '" class="jai_dujia" data-img="' + item.img_name + '" >';
});
$("#liudan_pic_pre").html(img_url);
}
......@@ -265,30 +307,30 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
Dujianew:function(){//提交独家的信息
var images=[];//图片
var imgs =$(".jai_dujia");
for(var j=0;j<imgs.length;j++){
Dujianew: function() { //提交独家的信息
var images = []; //图片
var imgs = $(".jai_dujia");
for(var j = 0; j < imgs.length; j++) {
images.push(imgs[j].getAttribute("data-img"))
};
console.log($("#sel_dujia").val());
if($("#sel_dujia").val()==null){
if($("#sel_dujia").val() == null) {
alert("请选择是否独家");
return;
}
if(imgs.length==0){
if(imgs.length == 0) {
alert("请选择图片");
return;
}
if($("#start_date_dujia").val()==""){
if($("#start_date_dujia").val() == "") {
alert("请选择独家代理的时间");
return;
}
if($("#end_date_dujia").val()==""){
if($("#end_date_dujia").val() == "") {
alert("请选择独家代理的时间");
return;
}
if($("#exclusive").val()==""){
if($("#exclusive").val() == "") {
alert("请选择姓名或者手机号");
return;
......@@ -296,36 +338,38 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
$("#modal-dujia").addClass("yz");
$.ajax({
'type': 'POST',
'url' : '/index/editExclusive',
data: {"houses_id":business.house_id,//楼盘Id
"is_exclusive_type":$("#sel_dujia").val(),//是否独家
"exclusive_id":business.exclusive_id,//经纪人id
"agent_start_time":$("#start_date_dujia").val(),//开始时间
"agent_end_time":$("#end_date_dujia").val(),//结束时间
"exclusive_img":images//图片
'url': '/index/editExclusive',
data: {
"houses_id": business.house_id, //楼盘Id
"is_exclusive_type": $("#sel_dujia").val(), //是否独家
"exclusive_id": business.exclusive_id, //经纪人id
"agent_start_time": $("#start_date_dujia").val(), //开始时间
"agent_end_time": $("#end_date_dujia").val(), //结束时间
"exclusive_img": images //图片
},
dataType: "json",
success: function(data){
if(data.code == 200){
} else {
success: function(data) {
if(data.code == 200) {} else {
alert('获取失败!');
}
}
});
},
Caozuo:function(){//获取独家的信息
var caozuo_table="";
Caozuo: function() { //获取独家的信息
var caozuo_table = "";
$.ajax({
'type': 'GET',
'url' : '/index/getRecords',//获取操作记录
data: {"houses_id":business.house_id},
'url': '/index/getRecords', //获取操作记录
data: {
"houses_id": business.house_id
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
$.each(data.data,function(i,item){
caozuo_table+='<tr><td>'+item.remark+'</td> <td>'+item.name+'</td> <td>'+item.create_time+'</td></tr>'
success: function(data) {
if(data.code == 200) {
if(data.data) {
$.each(data.data, function(i, item) {
caozuo_table += '<tr><td>' + item.remark + '</td> <td>' + item.name + '</td> <td>' + item.create_time + '</td></tr>'
});
$("#caozuo_table").html(caozuo_table);
}
......@@ -335,27 +379,31 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
Submit_follow:function(){//提交案场权限人数据
var agents_id="";
var _agents_id="";
$("input[name='ues_id']").each(function() {//拼接经纪人id
var s =$(this).val();
Submit_follow: function() { //提交案场权限人数据
var agents_id = "";
var _agents_id = "";
$("input[name='ues_id']").each(function() { //拼接经纪人id
var s = $(this).val();
var m = s.match(/[^-]+(?=[-])/g);
if(m === null){
if(m === null) {
return false;
}else{
agents_id += ","+ m[0];
_agents_id=agents_id.substring(1);
} else {
agents_id += "," + m[0];
_agents_id = agents_id.substring(1);
}
});
$.ajax({
'type': 'POST',
'url' : '/index/addHousesAgents',
data: {"houses_id":business.house_id,"type":business.type,"agents_id":_agents_id},
'url': '/index/addHousesAgents',
data: {
"houses_id": business.house_id,
"type": business.type,
"agents_id": _agents_id
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
success: function(data) {
if(data.code == 200) {
if(data.data) {
$("#modal-anch").hide;
}
} else {
......@@ -364,34 +412,38 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
resetLoad:function (){//手机号
if(business.ajaxObj){
resetLoad: function() { //手机号
if(business.ajaxObj) {
business.ajaxObj.abort();
}
business.ldHtml.html('');
business.stopstatus = true;
},
Submit_follow2:function(){//提交盘方
var agents_id="";
var _agents_id="";
$("input[name='ues_id']").each(function() {//拼接经纪人id
var s =$(this).val();
Submit_follow2: function() { //提交盘方
var agents_id = "";
var _agents_id = "";
$("input[name='ues_id']").each(function() { //拼接经纪人id
var s = $(this).val();
var m = s.match(/[^-]+(?=[-])/g);
if(m === null){
if(m === null) {
return false;
}else{
agents_id += ","+ m[0];
_agents_id=agents_id.substring(1);
} else {
agents_id += "," + m[0];
_agents_id = agents_id.substring(1);
}
});
$.ajax({
'type': 'POST',
'url' : '/index/addHousesAgentsDish',
data: {"houses_id":business.house_id,"type":business.type,"agents_id":_agents_id},
'url': '/index/addHousesAgentsDish',
data: {
"houses_id": business.house_id,
"type": business.type,
"agents_id": _agents_id
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
success: function(data) {
if(data.code == 200) {
if(data.data) {
$("#modal-anch").hide;
}
business.getList(1);
......@@ -401,31 +453,30 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
resetLoad:function (){//手机号
if(business.ajaxObj){
resetLoad: function() { //手机号
if(business.ajaxObj) {
business.ajaxObj.abort();
}
business.ldHtml.html('');
business.stopstatus = true;
},
// 下拉列表
loadMain:function(phone, obj) {//手机号
business.ajaxObj=$.ajax({
loadMain: function(phone, obj) { //手机号
business.ajaxObj = $.ajax({
type: "GET",
url: '/index/getBroker_new' ,
url: '/index/getBroker_new',
data: {
'phone': phone
},
timeout: 10000,
dataType: "json",
beforeSend: function() {
},
beforeSend: function() {},
success: function(data) {
if(data.code === 200){
if(data.code === 200) {
var _html = '';
$.each(data.data, function(i,data) {
_html += '<li class="addphone"><span class="id">'+data['id']+'-</span><span class="phone_name">'+data['name']+'</span><span class="phone_span">-</span><span class="phone-phone">'+data['phone']+'</span> </li>';
$.each(data.data, function(i, data) {
_html += '<li class="addphone"><span class="id">' + data['id'] + '-</span><span class="phone_name">' + data['name'] + '</span><span class="phone_span">-</span><span class="phone-phone">' + data['phone'] + '</span> </li>';
});
obj.html(_html);
}
......@@ -441,60 +492,61 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
addphone:function (obj){//list消失
var phone_name=$(obj).find(".phone_name").html();
var phone_phone=$(obj).find(".phone-phone").html();
var phone_span=$(obj).find(".phone_span").html();
var id= $(obj).find(".id").html();
addphone: function(obj) { //list消失
var phone_name = $(obj).find(".phone_name").html();
var phone_phone = $(obj).find(".phone-phone").html();
var phone_span = $(obj).find(".phone_span").html();
var id = $(obj).find(".id").html();
business.exclusive_id = id.substr(0, id.length - 1);
$(obj).parent().prev().val(id+phone_name+phone_span+phone_phone);
$(obj).parent().prev().val(id + phone_name + phone_span + phone_phone);
$(obj).parent().hide();
business.ldHtml.html('');
return ;
return;
},
jiabox:function () {//加输入框
jiabox: function() { //加输入框
business.boxphoto = '<input name="ues_id" placeholder="请输入" type="tel" style="margin-left: 10px;float: left" class="phone_add">' +
'<ul class="phone_list1"></ul>'+
'<ul class="phone_list1"></ul>' +
'<img src="/resource/image/qdao-sha.png" class="jian">';
$(".jian_class").append(business.boxphoto);//写入
$(".jian_class").append(business.boxphoto); //写入
business.jianbox();
},
jiabox_data:function (id,name,phone) {//显示已经获取的数据
business.boxphoto = '<input name="ues_id" placeholder="请输入" value='+id+'-'+name+'-'+phone+' type="tel" style="margin-left: 10px;float: left" class="phone_add">' +
'<ul class="phone_list1"></ul>'+
'<img src="/resource/image/qdao-sha.png" class="jian"><input type="hidden" value="'+id+'">';
$(".jian_class").append(business.boxphoto);//写入
jiabox_data: function(id, name, phone) { //显示已经获取的数据
business.boxphoto = '<input name="ues_id" placeholder="请输入" value=' + id + '-' + name + '-' + phone + ' type="tel" style="margin-left: 10px;float: left" class="phone_add">' +
'<ul class="phone_list1"></ul>' +
'<img src="/resource/image/qdao-sha.png" class="jian"><input type="hidden" value="' + id + '">';
$(".jian_class").append(business.boxphoto); //写入
},
jianbox: function () {
$(".jian").click(function () {//删除经纪人数据
var ss =$(this).prev().prev().val();
jianbox: function() {
$(".jian").click(function() { //删除经纪人数据
var ss = $(this).prev().prev().val();
var mm = ss.match(/[^-]+(?=[-])/g);
if(mm === null){
if(mm === null) {
$(this).prev().prev().remove();
$(this).prev().remove();
$(this).remove();
return false;
}else{
var mm_id=mm[0];
} else {
var mm_id = mm[0];
}
var r=confirm("确定删除吗!");
if (r==true)
{
var r = confirm("确定删除吗!");
if(r == true) {
$(this).prev().prev().remove();
$(this).prev().remove();
$(this).remove();
$.ajax({
'type': 'POST',
'url' : '/index/delTohouses',
data: {"id":mm_id,"houses_id":business.house_id},
'url': '/index/delTohouses',
data: {
"id": mm_id,
"houses_id": business.house_id
},
dataType: "json",
success: function(data){
if(data.code == 200){
success: function(data) {
if(data.code == 200) {
} else {
alert("删除失败");
......@@ -502,122 +554,82 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
} else {
}
else
{
}
});
},
//
// 批量修改客方
modify_add : function () {//modify_add批量修改客方
modify_add: function() { //modify_add批量修改客方
var old_agents_text = $('.old_agents').val();
var new_agents_text = $('.new_agents').val();
console.log($('.phone_jia1:eq(0)').attr('data-id'));
console.log($('.phone_jia1:eq(1)').attr('data-id'));
if (old_agents_text == '') {
if(old_agents_text == '') {
alert('请输入经纪人内容为空');
return false;
}
if (new_agents_text == '') {
if(new_agents_text == '') {
alert('请输入经纪人内容为空');
return false;
}
$.ajax ({
$.ajax({
url: '/index/batchEditCustomer',
type: 'POST',
async: true,
data: {
"old_agents_id":$('.phone_jia1:eq(0)').attr('data-id'),
"agents_id":$('.phone_jia1:eq(1)').attr('data-id'),
"old_agents_id": $('.phone_jia1:eq(0)').attr('data-id'),
"agents_id": $('.phone_jia1:eq(1)').attr('data-id'),
},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
success: function(data) {
if(data.code == 200) {
console.log(666);
}
}
});
},
//==============批量修改客方===========
getList: function (pageNo) {
getList: function(pageNo, type) {
business.pageNo = pageNo;
var params = {};
// 商铺列表 默认时间显示
if(pageNo!=1){
function getPreMonth(date) {
            var arr = date.split('-');
            var year = arr[0]; 
            var month = arr[1]; 
            var day = arr[2]; 
            var days = new Date(year, month, 0);
            days = days.getDate(); 
            var year2 = year;
            var month2 = parseInt(month) - 1;
            if (month2 == 0) {
                year2 = parseInt(year2) - 1;
                month2 = 12;
            }
            var day2 = day;
            var days2 = new Date(year2, month2, 0);
            days2 = days2.getDate();
            if (day2 > days2) {
                day2 = days2;
            }
            if (month2 < 10) {
                month2 = '0' + month2;
            }
            var t2 = year2 + '-' + month2 + '-' + day2;
            return t2;
        }
var myDate = new Date();
var y = myDate.getFullYear();
var m = myDate.getMonth()+1;
var d = myDate.getDate();
var day_end=y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
var day_start=getPreMonth(day_end);
$('#start_date').val(day_start);
$('#end_date').val(day_end);
}
console.log(type);
params.pageNo = business.pageNo;
params.pageSize = business.pageSize;
params.is_carefully_chosen = $('#is_carefully_chosen option:selected') .val();//首页显示
params.is_show = $('#is_show option:selected') .val();//c端显示
params.shop_type = $('#shop_type option:selected') .val();//商铺类型
params.leased = $('#leased option:selected') .val();//商铺状态
params.rent_price = $('#rent_price option:selected') .val();//月租金
params.is_exclusive_type = $('#is_exclusive_type option:selected') .val();//是否独家
params.internal_title = $('#internal_title') .val();//商铺名称
params.industry_type = $('#industry_type') .val();//业态
params.dish = $('#dish') .val();//盘方
params.id = $('#id') .val();//店铺编号
params.start_date = $('#start_date') .val();//时间1
params.end_date = $('#end_date') .val();//时间2
$.ajax ({
url: '/index/getHouseList.html',//获取列表
params.is_carefully_chosen = $('#is_carefully_chosen option:selected').val(); //首页显示
params.is_show = $('#is_show option:selected').val(); //c端显示
params.shop_type = $('#shop_type option:selected').val(); //商铺类型
params.leased = $('#leased option:selected').val(); //商铺状态
params.rent_price = $('#rent_price option:selected').val(); //月租金
params.is_exclusive_type = $('#is_exclusive_type option:selected').val(); //是否独家
params.internal_title = $('#internal_title').val(); //商铺名称
params.industry_type = $('#industry_type').val(); //业态
params.dish = $('#dish').val(); //盘方
params.id = $('#id').val(); //店铺编号
params.start_date = $('#start_date').val(); //时间1
params.end_date = $('#end_date').val(); //时间2
$.ajax({
url: '/index/getHouseList.html', //获取列表
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function (data) {
var temp = document.getElementById ('house_list_tpl').innerHTML;
var doTtmpl = doT.template (temp);
$ ("#business_list").html (doTtmpl (data.data.list));
success: function(data) {
var temp = document.getElementById('house_list_tpl').innerHTML;
var doTtmpl = doT.template(temp);
$("#business_list").html(doTtmpl(data.data.list));
/*分页代码*/
add_page(data.data.total,pageNo,business.pageSize,business.getList);
add_page(data.data.total, pageNo, business.pageSize, business.getList);
/* $ ("#pagediv").pagination ({
length: data.data.total,
current: pageNo,
......@@ -629,17 +641,19 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
}
});
},
delBusiness : function () {
delBusiness: function() {
$.ajax({
url : '/index/houseDel',
type : 'POST',
url: '/index/houseDel',
type: 'POST',
async: true,
data: {"id":business.id},
data: {
"id": business.id
},
dataType: 'json',
success : function (data) {
if (data.code == 200) {
success: function(data) {
if(data.code == 200) {
business.getList(1);
$("#modal-delete").modal ('hide');
$("#modal-delete").modal('hide');
} else {
$("#del_msg").html('<span style="color: red">删除失败!</span>');
}
......
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