Commit e403b707 authored by agping's avatar agping

楼盘字典

parent 66de0b5d
......@@ -270,7 +270,7 @@
<div class="pull-right">
<ul class="bread_btn">
<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>
</ul>
</div>
......@@ -355,10 +355,10 @@
<div class="modal-body">
<form class="form-horizontal" action="/agents/add_user" id="add_user_form">
<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>
<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="请输入楼盘编号">-->
</div>
</div>
......@@ -484,7 +484,7 @@
</form>
</div>
<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 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
agent_name: '',
/*每页显示多少条*/
id: '',
house_id: '',
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,
isAdd: 1,
init: function() {
//初始化dot
$("body").append(template);
......@@ -112,54 +93,18 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
document.getElementById("form_search").reset();
$('#business_circle_id').html('');
});
$(".add").click(function() { //点击新增 获取城市
$.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_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);
}
}
});
$(".add").click(function(e) { //点击新增 置空数据
business.isAdd = 1;
$('.isshowLou').hide();
});
_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
});
//楼盘字典 百度地图相关
/************************************************百度地址定位相关*************************************************************/
var _provinceInternalObj = $('#province_internal'), //对内地址省
_provinceInternalObj = $('#province_internal'), //对内地址省
_cityInternalObj = $('#city_internal'), //对内地址市
_discInternalObj = $('#disc_internal'), //对内地址区
_addressInternalObj = $('#address_internal'), //对内地址详细地址
......@@ -411,7 +356,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
_ajaxObjSearchRepeatShop && _ajaxObjSearchRepeatShop.abort();
_ajaxObjSearchRepeatShop = $.ajax({
type: 'GET',
url: '/broker/getHouseAddress',
url: '/broker/getHouseAddress',//是否重盘
data: {
'address': _valAddress,
'city': _valCity,
......@@ -510,7 +455,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
$('#file_input_pic').on('change', function(){
var _this = $(this);
var formData = new FormData();
formData.append('type', 'chat');
formData.append('type', 'house_img');
formData.append('image', _this[0].files[0]);
$.ajax({
type: 'post',
......@@ -525,7 +470,7 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
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({
'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 {
alert(_data.msg);
......@@ -563,26 +508,31 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
var _this = $(this);
e.preventDefault();
e.stopPropagation();
var imgname = [];
var imgname1 = [];
var imgname2 = [];
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(',')) {
var imgOffice = imgname.join(',');
if(imgname1.join(',')) {
// var imgOffice = imgname.join(',');
// var imgOffice = imgname;
} else {
return
alert("请选择图片");
};
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
var _data = {
// id: id_pic//新增 不传id
'title': $('#loupan_title').val(),
'type': $('#loupan_type').val(),
'building_images': imgOffice,
'building_images': imgname1.concat(imgname2),
'intro': $('#introOffice').val(),
'agent_id':user_info_obj.id,
// 'add_building_stations': id_pic,//交通 暂无
'floor_total': $('#loucengOffice').val(),
'province': _provinceInternalObj.val(),
'city': _cityInternalObj.val(),
'disc': _discInternalObj.val(),
......@@ -590,27 +540,29 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
'longitude': _longitudeObj.val(),
'latitude': _latitudeObj.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({
type: 'POST',
url: '/office_index/houseDictionaryAdd',
url: business.url,
data: _data,
dataType: 'json',
beforeSend: function() {},
success: function(_data) {
if(typeof _data === 'object') {
if(typeof _data === 'object' && _data.code == 200) {
alert('保存成功');
$('#container_body_img_area').html("");
$('.pic-con2').show();
$('.pic-con1').hide();
$('.active').removeClass("active");
$('.shoukuanxiangqing').addClass("active");
$("#modal_add_loupan").modal('hide');//提交成功后 关闭弹窗
business.getList(1);
} else {
alert('数据错误');
alert(_data.msg);
};
},
error: function() {
......@@ -635,11 +587,21 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
// 楼盘字典列表
params.pageNo = business.pageNo;
params.pageSize = business.pageSize;
params.title = $('#shop_title').val();
params.type = $('#shop_type').val();
params.city = $('.shop_city_choose_site_list').val(); //城市筛选
params.disc = $('#shop_area_id').val(); //区域筛选
params.business_district_id=$('#business_circle_id').val();//商圈筛选
if($('#shop_title').val()){
params.title = $('#shop_title').val();
}
if($('#shop_type').val()){
params.type = $('#shop_type').val();
}
if($('#shop_city_choose_site_list').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({
url: '/office_index/getBuildingList', //获取楼盘字典列表
type: 'GET',
......@@ -654,15 +616,6 @@ define(['doT', 'text!temp/building_dictionary_list_template_tpl.html','css!style
var doTtmpl = doT.template(temp);
$("#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);
......@@ -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('');//每回先清空所有图片
var id_pic = id;//follow.house_fatherid > 0?follow.house_fatherid:follow.house_id;
$('.result2,.result').remove(); //删除之前存在的图片 显示从接口获取的数据 用来区分新添加的 和 已经保存的
$.ajax({
'type': 'GET',
'url': '/index/receiptImgList',
'url': '/office_index/houseDictionaryEdit',
data: {
"id": id_pic,
"id": business.id,
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
//渲染已经有的列表
// <img src='[%= it[item]["agent_img"] %]' class="diagram-image J_preview"
// data-bimg='[%= it[item]["agent_img"] %]'>
for(i = 0; i < data.data.length; i++) {
$('#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({
'0': data.data[i].id,
'1': data.data[i].img_name?urlDeal(data.data[i].img_name):data.data[i].img_name
for(i = 0; i < data.data.building_images.length; i++) {
$('#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({
'0': data.data.building_images[i].id,
'1': ServerHostImageLiu+'/resource/lib/Attachments/images/'+data.data.building_images[i].img_name,
'2': data.data.building_images[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 {
alert(data.msg)
......
<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) { %]
[% for(var item in it){ %]
<tr class="text-center">
<td>[%= it[item]['id'] %]</td>
<td>
[% if(it[item]["shop_type"] == 0) { %]
[%= 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){ %]
上架
[% if(it[item]["type"] == 1) { %]
写字楼
[% }else if (it[item]["status"] == 2){ %]
下架
商住两用
[% }else if (it[item]["status"] == 3){ %]
无效
园区
[% }else if (it[item]["status"] == 4){ %]
洋房
[% }else if(it[item]["status"] == 5){ %]
联合办公
[% }else if(it[item]["status"] == 6){ %]
厂房
[% } %]
</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>
[%if(it[item]["residue_num"] == 0) { %]
已租
[% }else{ %]
求租
[% } %]
</td>
<td>
[%if(it[item]["is_show"] == 0) { %]
[% }else if(it[item]["is_show"] == 1 ) { %]
[% } %]
</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>
</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