Commit e403b707 authored by agping's avatar agping

楼盘字典

parent 66de0b5d
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
<div class="pull-right"> <div class="pull-right">
<ul class="bread_btn"> <ul class="bread_btn">
<li> <li>
<a href="#modal_add_loupan" class="btn btn-default add" data-toggle="modal"><i class="icon-plus"></i>新增楼盘</a> <a class="btn btn-default add" href="#modal_add_loupan" data-toggle="modal" >新增楼盘</a>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -355,10 +355,10 @@ ...@@ -355,10 +355,10 @@
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" action="/agents/add_user" id="add_user_form"> <form class="form-horizontal" action="/agents/add_user" id="add_user_form">
<div class="form-group form-group-bottom"> <div class="form-group form-group-bottom">
<div class="col-sm-6"> <div class="col-sm-6 isshowLou">
<label for="inputEmail3" class="col-sm-4 control-label">楼盘编号:</label> <label for="inputEmail3" class="col-sm-4 control-label">楼盘编号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<span style="margin-top: 6px;display: inline-block;">6666</span> <span class="louceng_num" style="margin-top: 6px;display: inline-block;">6666</span>
<!--<input type="text" class="form-control" name="user_name" id="inputEmail3" placeholder="请输入楼盘编号">--> <!--<input type="text" class="form-control" name="user_name" id="inputEmail3" placeholder="请输入楼盘编号">-->
</div> </div>
</div> </div>
...@@ -484,7 +484,7 @@ ...@@ -484,7 +484,7 @@
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">关闭 <button type="button" class="btn btn-default" id="close">关闭
</button> </button>
<button type="button" class="btn btn-primary btn-guanbi" id="saveBtn"> <button type="button" class="btn btn-primary btn-guanbi" id="saveBtn">
提交 提交
......
...@@ -25,26 +25,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -25,26 +25,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
agent_name: '', agent_name: '',
/*每页显示多少条*/ /*每页显示多少条*/
id: '', id: '',
house_id: '', isAdd: 1,
type: '',
valueCurrent: '',
ajaxObj: '',
stopstatus: true,
ldHtml: $('.phone_list'),
boxphoto: '',
exclusive_id: 0,
isFollowupSaving: false,
detailTabIndex:0,//查看 弹出框 tab切换 初始化
all_shop : true , // false: 本人商铺,true:所有商铺
is_exclusive_type : 0 , //0非独家 1:独家
auth_edit_exclusive : 0 ,//0:无独家权限 1:有独家权限
main_select : false , // true : 开启高级搜索 ,false :关闭高级搜索
file_id_str:'',
file_id_arr:[],
agent_id_choose:'',
agent_id_choose_p:'',
generalize_id:1,
detailTabIndexTuiGuang:0,
init: function() { init: function() {
//初始化dot //初始化dot
$("body").append(template); $("body").append(template);
...@@ -112,54 +93,18 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -112,54 +93,18 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
document.getElementById("form_search").reset(); document.getElementById("form_search").reset();
$('#business_circle_id').html(''); $('#business_circle_id').html('');
}); });
$(".add").click(function() { //点击新增 获取城市 $(".add").click(function(e) { //点击新增 置空数据
$.ajax({ business.isAdd = 1;
url: '/index/getAgentGroupSite', $('.isshowLou').hide();
type: 'GET',
async: true,
data: {
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data.length != 0) {
var str = '<option value="">选择城市</option>';
$.each(data.data, function(i, item) {
str += '<option value="' + item.city + '">' + item.city + '</option>';
});
$(".shop_city_choose_site_list_add").append(str);
}else{
var _city = user_info_obj.city;
var _str1 = '<option value="">选择城市</option>';
var _str = _str1 + '<option value="' + _city + '">' + _city+ '</option>';
$(".shop_city_choose_site_list_add").append(_str);
}
}
});
//地铁
$.ajax({
url: '/index/getAgentGroupSite',
type: 'GET',
async: true,
data: {
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data.length != 0) {
var str = '<option value="">选择地铁</option>';
$.each(data.data, function(i, item) {
str += '<option value="' + item.city + '">' + item.city + '</option>';
});
$(".shop_city_choose_site_list_line").append(str);
}else{
var _city = user_info_obj.city;
var _str1 = '<option value="">选择地铁</option>';
var _str = _str1 + '<option value="' + _city + '">' + _city+ '</option>';
$(".shop_city_choose_site_list_line").append(_str);
}
}
});
});
_doc.on('click', '.edit', function(e) {//点击编辑 获取数据
e.preventDefault();
e.stopPropagation();
business.isAdd = 0;
$('.isshowLou').show();
business.id=$(this).attr('data-id');
business.getEditDetail();
}); });
...@@ -199,7 +144,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -199,7 +144,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
}); });
//楼盘字典 百度地图相关 //楼盘字典 百度地图相关
/************************************************百度地址定位相关*************************************************************/ /************************************************百度地址定位相关*************************************************************/
var _provinceInternalObj = $('#province_internal'), //对内地址省 _provinceInternalObj = $('#province_internal'), //对内地址省
_cityInternalObj = $('#city_internal'), //对内地址市 _cityInternalObj = $('#city_internal'), //对内地址市
_discInternalObj = $('#disc_internal'), //对内地址区 _discInternalObj = $('#disc_internal'), //对内地址区
_addressInternalObj = $('#address_internal'), //对内地址详细地址 _addressInternalObj = $('#address_internal'), //对内地址详细地址
...@@ -411,7 +356,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -411,7 +356,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
_ajaxObjSearchRepeatShop && _ajaxObjSearchRepeatShop.abort(); _ajaxObjSearchRepeatShop && _ajaxObjSearchRepeatShop.abort();
_ajaxObjSearchRepeatShop = $.ajax({ _ajaxObjSearchRepeatShop = $.ajax({
type: 'GET', type: 'GET',
url: '/broker/getHouseAddress', url: '/broker/getHouseAddress',//是否重盘
data: { data: {
'address': _valAddress, 'address': _valAddress,
'city': _valCity, 'city': _valCity,
...@@ -510,7 +455,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -510,7 +455,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
$('#file_input_pic').on('change', function(){ $('#file_input_pic').on('change', function(){
var _this = $(this); var _this = $(this);
var formData = new FormData(); var formData = new FormData();
formData.append('type', 'chat'); formData.append('type', 'house_img');
formData.append('image', _this[0].files[0]); formData.append('image', _this[0].files[0]);
$.ajax({ $.ajax({
type: 'post', type: 'post',
...@@ -525,7 +470,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -525,7 +470,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
if(_data.code == 200) { if(_data.code == 200) {
$('#container_body_img_area').append('<div class="result"><img data-imgname="{0}" src="{1}" alt=""/> <span class="span-del">删除</span></div>'.stringFormatObj({ $('#container_body_img_area').append('<div class="result"><img data-imgname="{0}" src="{1}" alt=""/> <span class="span-del">删除</span></div>'.stringFormatObj({
'0': _data.data.img_path, '0': _data.data.img_path,
'1': _data.data.internet_img_name?urlDeal(_data.data.internet_img_name):_data.data.internet_img_name '1': ServerHostImageLiu+'/resource/lib/Attachments/images/'+_data.data.internet_img_name
})); }));
} else { } else {
alert(_data.msg); alert(_data.msg);
...@@ -563,26 +508,31 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -563,26 +508,31 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
var _this = $(this); var _this = $(this);
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var imgname = []; var imgname1 = [];
var imgname2 = [];
for(var i = 0; i < $('.result').length; i++) { for(var i = 0; i < $('.result').length; i++) {
imgname[i] = $('.result>img').eq(i).attr('data-imgname'); imgname1[i] = $('.result>img').eq(i).attr('data-imgname');
}; };
for(var i = 0; i < $('.result2').length; i++) {
imgname2[i] = $('.result2>img').eq(i).attr('data-imgname');
};
console.log(imgname1);
console.log(imgname2);
//无新的图片上传 不调用接口 //无新的图片上传 不调用接口
if(imgname.join(',')) { if(imgname1.join(',')) {
var imgOffice = imgname.join(','); // var imgOffice = imgname.join(',');
// var imgOffice = imgname;
} else { } else {
return alert("请选择图片");
}; };
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存 var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
var _data = { var _data = {
// id: id_pic//新增 不传id
'title': $('#loupan_title').val(), 'title': $('#loupan_title').val(),
'type': $('#loupan_type').val(), 'type': $('#loupan_type').val(),
'building_images': imgOffice, 'building_images': imgname1.concat(imgname2),
'intro': $('#introOffice').val(), 'intro': $('#introOffice').val(),
'agent_id':user_info_obj.id, 'floor_total': $('#loucengOffice').val(),
// 'add_building_stations': id_pic,//交通 暂无
'province': _provinceInternalObj.val(), 'province': _provinceInternalObj.val(),
'city': _cityInternalObj.val(), 'city': _cityInternalObj.val(),
'disc': _discInternalObj.val(), 'disc': _discInternalObj.val(),
...@@ -590,27 +540,29 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -590,27 +540,29 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
'longitude': _longitudeObj.val(), 'longitude': _longitudeObj.val(),
'latitude': _latitudeObj.val(), 'latitude': _latitudeObj.val(),
'business_district_id' : $('#business_rong').val(), 'business_district_id' : $('#business_rong').val(),
// del_building_stations:id_pic//编辑
}; };
if(business.isAdd == 0){
_data.id = business.id;//编辑 传id
business.url = '/office_index/houseDictionaryEdit';
}else{
business.url = '/office_index/houseDictionaryAdd';
}
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/office_index/houseDictionaryAdd', url: business.url,
data: _data, data: _data,
dataType: 'json', dataType: 'json',
beforeSend: function() {}, beforeSend: function() {},
success: function(_data) { success: function(_data) {
if(typeof _data === 'object') { if(typeof _data === 'object' && _data.code == 200) {
alert('保存成功'); alert('保存成功');
$('#container_body_img_area').html(""); $('#container_body_img_area').html("");
$('.pic-con2').show(); $("#modal_add_loupan").modal('hide');//提交成功后 关闭弹窗
$('.pic-con1').hide();
$('.active').removeClass("active");
$('.shoukuanxiangqing').addClass("active");
business.getList(1); business.getList(1);
} else { } else {
alert('数据错误'); alert(_data.msg);
}; };
}, },
error: function() { error: function() {
...@@ -635,11 +587,21 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -635,11 +587,21 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
// 楼盘字典列表 // 楼盘字典列表
params.pageNo = business.pageNo; params.pageNo = business.pageNo;
params.pageSize = business.pageSize; params.pageSize = business.pageSize;
if($('#shop_title').val()){
params.title = $('#shop_title').val(); params.title = $('#shop_title').val();
}
if($('#shop_type').val()){
params.type = $('#shop_type').val(); params.type = $('#shop_type').val();
params.city = $('.shop_city_choose_site_list').val(); //城市筛选 }
params.disc = $('#shop_area_id').val(); //区域筛选 if($('#shop_city_choose_site_list').val()){
params.business_district_id=$('#business_circle_id').val();//商圈筛选 params.city = $('#shop_city_choose_site_list').val();
}
if($('#shop_area_id').val()){
params.disc = $('#shop_area_id').val();
}
if($('#business_circle_id').val()){
params.business_district_id = $('#business_circle_id').val();
}
$.ajax({ $.ajax({
url: '/office_index/getBuildingList', //获取楼盘字典列表 url: '/office_index/getBuildingList', //获取楼盘字典列表
type: 'GET', type: 'GET',
...@@ -654,15 +616,6 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -654,15 +616,6 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
var doTtmpl = doT.template(temp); var doTtmpl = doT.template(temp);
$("#business_list").html(doTtmpl(data.data.list)); $("#business_list").html(doTtmpl(data.data.list));
//显示优化
var _tempObj = $('.btn-default-show-caozuo');
$.each(_tempObj, function(i, v) {
var _$this = $(v);
_$this.nextAll().hide();//默认按钮只显示两个
if(_$this.index() == 0){
_$this.click();
}
});
/*分页代码*/ /*分页代码*/
add_page(data.data.total, pageNo, business.pageSize, business.getList); add_page(data.data.total, pageNo, business.pageSize, business.getList);
...@@ -674,30 +627,79 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style ...@@ -674,30 +627,79 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
}); });
}, },
//获取图片 编辑 //获取楼盘字典 编辑
getaddPicList: function(id) { getEditDetail: function() {
//获取收款图片 //获取收款图片
$('#container_body_img_area').html('');//每回先清空所有图片 $('#container_body_img_area').html('');//每回先清空所有图片
var id_pic = id;//follow.house_fatherid > 0?follow.house_fatherid:follow.house_id;
$('.result2,.result').remove(); //删除之前存在的图片 显示从接口获取的数据 用来区分新添加的 和 已经保存的 $('.result2,.result').remove(); //删除之前存在的图片 显示从接口获取的数据 用来区分新添加的 和 已经保存的
$.ajax({ $.ajax({
'type': 'GET', 'type': 'GET',
'url': '/index/receiptImgList', 'url': '/office_index/houseDictionaryEdit',
data: { data: {
"id": id_pic, "id": business.id,
}, },
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
if(data.code == 200) { if(data.code == 200) {
//渲染已经有的列表 //渲染已经有的列表
// <img src='[%= it[item]["agent_img"] %]' class="diagram-image J_preview" for(i = 0; i < data.data.building_images.length; i++) {
// data-bimg='[%= it[item]["agent_img"] %]'> $('#container_body_img_area').append('<div class="result2"><img data-imgid="{0}" src="{1}" alt="" class="diagram-image J_preview" data-bimg="{1}" data-imgname="{2}"/> <span class="span-del2">删除</span></div>'.stringFormatObj({
for(i = 0; i < data.data.length; i++) { '0': data.data.building_images[i].id,
$('#container_body_img_area').append('<div class="result2"><img data-imgid="{0}" src="{1}" alt="" class="diagram-image J_preview" data-bimg="{1}"/> <span class="span-del2">删除</span></div>'.stringFormatObj({ '1': ServerHostImageLiu+'/resource/lib/Attachments/images/'+data.data.building_images[i].img_name,
'0': data.data[i].id, '2': data.data.building_images[i].img_name,
'1': data.data[i].img_name?urlDeal(data.data[i].img_name):data.data[i].img_name
})); }));
}; };
//取数据
$('#loupan_title').val(data.data.title),
$('#loupan_type').val(data.data.type),
$('#introOffice').val(data.data.intro),
$('#loucengOffice').val(data.data.floor_total),
_provinceInternalObj.val(data.data.province),
_cityInternalObj.val(data.data.city),
_discInternalObj.val(data.data.disc),
$.trim(_addressInternalObj.val(data.data.address)),
_longitudeObj.val(data.data.longitude),
_latitudeObj.val(data.data.latitude),
$('.louceng_num').html(data.data.id);
$('#business_rong').html('');
$.ajax({
type: 'GET',
url: 'getBusinessAll',
data: {"disc" : data.data.disc},
timeout: 30000,
dataType: 'json',
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
var tag = "" ;
$.each(data.data,function(i,target){
if ( target.id == data.data.business_district_id){
tag += '<option value="'+target.id+'" selected>'+target.name+'</option>'
} else {
tag += '<option value="'+target.id+'">'+target.name+'</option>'
}
});
$('#business_rong').append(tag);
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus) {
// _loadMainItem.hide();
if(textStatus === 'timeout') {
alert('请求超时');
};
}
});
//获取商圈
} else { } else {
alert(data.msg) alert(data.msg)
......
<script id="building_dictionary_list" type="text/template"> <script id="building_dictionary_list" type="text/template">
[% var sw=function(s){switch(Number(s)){case 2:return"btn-info";case 1:return"btn-default"}}; %]
[% var sw2=function(s){switch(Number(s)){case 0:return"btn-info";case 1:return"btn-default"}}; %]
[% var sw3=function(s){switch(Number(s)){case 0:return"btn-info";case 1:return"btn-default"}}; %]
[% if(it&&it.length!=0) { %] [% if(it&&it.length!=0) { %]
[% for(var item in it){ %] [% for(var item in it){ %]
<tr class="text-center"> <tr class="text-center">
<td>[%= it[item]['id'] %]</td>
<td> <td>
[% if(it[item]["shop_type"] == 0) { %] [% if(it[item]["type"] == 1) { %]
[%= it[item]["shop_area_start"] + '-' + it[item]["shop_area_end"] %] 写字楼
[% }else{ %]
[%= it[item]["shop_area_start"] %]
[% } %]
</td>
<td width="10%">[%= hideStr(it[item]['industry_type']) %]</td>
<td>[%= it[item]['dish_name'] %]</td>
<td width="10%">[%= it[item]['create_time'] %]</td>
<td>
[% if(it[item]["status"] == 0) { %]
审核
[% }else if (it[item]["status"] == 1){ %]
上架
[% }else if (it[item]["status"] == 2){ %] [% }else if (it[item]["status"] == 2){ %]
下架 商住两用
[% }else if (it[item]["status"] == 3){ %] [% }else if (it[item]["status"] == 3){ %]
无效 园区
[% } %] [% }else if (it[item]["status"] == 4){ %]
</td> 洋房
<td> [% }else if(it[item]["status"] == 5){ %]
[%if(it[item]["residue_num"] == 0) { %] 联合办公
已租 [% }else if(it[item]["status"] == 6){ %]
[% }else{ %] 厂房
求租
[% } %]
</td>
<td>
[%if(it[item]["is_show"] == 0) { %]
[% }else if(it[item]["is_show"] == 1 ) { %]
[% } %] [% } %]
</td> </td>
<td>[%= it[item]['address'] %]</td>
<td>[%= it[item]['business_name'] %]</td>
<td>[%= it[item]['title'] %]</td>
<td>[%= it[item]['floor_total'] %]</td>
<td>[%= it[item]['intro'] %]</td>
<td> <td>
<a class="btn1 btn-success" href="#modal_add_loupan" data-toggle="modal">编辑</a> <a class="btn1 btn-success edit" href="#modal_add_loupan" data-toggle="modal" data-id='[%= it[item]["id"] %]'>编辑</a>
</td> </td>
</tr> </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