新增建设银行租金报告页面
This commit is contained in:
+126
@@ -0,0 +1,126 @@
|
||||
package com.fangjia.open.controllers.weixin;
|
||||
|
||||
import com.fangjia.core.util.BeanUtils;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.GeocodeUtils;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.SdQuery;
|
||||
import com.fangjia.dal.SrQuery;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.compatible.model.JsonModel;
|
||||
import com.fangjia.open.controllers.PropertyController;
|
||||
import com.fangjia.open.dto.CcbRentDto;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.model.BaseModel;
|
||||
import com.fangjia.open.model.PropertyEvaluationModel;
|
||||
import com.fangjia.service.api.AutoCompleteBo;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 建设银行租金控制类
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/4/6
|
||||
*/
|
||||
public class CcbRentController {
|
||||
|
||||
private DistrictService districtService;
|
||||
private PropertyController propertyController;
|
||||
|
||||
public Object indexAction(BaseModel result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object reportAction(BaseModel result) {
|
||||
JsonModel model = new JsonModel();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object evaluateRentAction(CcbRentDto ccbRentDto, HttpServletRequest request) throws IllegalAccessException {
|
||||
PropertyEvaluationModel evaluationModel = new PropertyEvaluationModel();
|
||||
BeanUtils.copyProperties(ccbRentDto, evaluationModel);
|
||||
return propertyController.evaluateRentAction(evaluationModel, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法同DistrictController#suggestAction
|
||||
*/
|
||||
public Object suggestAction(@Param(name = "city") String city, @Param(name = "cat") String cat, @Param(name = "keyword") String keyword,
|
||||
@Param(name = "limit") Integer limit, @Param(name="lat")Double lat, @Param(name="lng")Double lng) {
|
||||
JsonModel model = new JsonModel();
|
||||
if (limit == null || limit > 100 || limit <= 0) {
|
||||
limit = 10;
|
||||
}
|
||||
System.out.println(cat + "#" + city + "#" + keyword + "#" + limit + "#" + lng + "#" + lat);
|
||||
List<AutoCompleteBo> suggestList = getDistrictByKeyword(cat, city, keyword, limit, lng, lat);
|
||||
model.setJsonModel(suggestList);
|
||||
return model;
|
||||
}
|
||||
|
||||
private List<AutoCompleteBo> getDistrictByKeyword(String cat, String city, String keyword, int limit, final Double lng, final Double lat) {
|
||||
|
||||
keyword = DataUtil.escapeSolr(keyword);
|
||||
if (StringUtils.isBlank(keyword) || keyword.length() >= 30) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("category", cat));
|
||||
params.add(new QueryParam("visible", 0));
|
||||
|
||||
|
||||
BooleanQuery srQuery1 = new BooleanQuery();
|
||||
BooleanQuery nameQuery = new BooleanQuery();
|
||||
// nameQuery.add(new TermQuery(new Term("district_name", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("alias_std", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("address", keyword)), BooleanClause.Occur.SHOULD);
|
||||
// nameQuery.add(new TermQuery(new Term("addr_alias_std", keyword)), BooleanClause.Occur.SHOULD);
|
||||
nameQuery.add(new TermQuery(new Term("keyword", keyword)), BooleanClause.Occur.SHOULD);
|
||||
//nameQuery.add(new TermQuery(new Term("keyword_cjk", keyword)), BooleanClause.Occur.SHOULD);//这个重要,因seaweed不支持模糊搜索,当输入"中远两"需用此进行搜索
|
||||
srQuery1.add(nameQuery, BooleanClause.Occur.SHOULD);
|
||||
if(lat != null && lng != null && lat != 0 && lng != 0){
|
||||
Map<String, Double> geo = GeocodeUtils.geoconvBaiduToGoogle(lng, lat);
|
||||
SdQuery sdQuery = new SdQuery();
|
||||
sdQuery.setPoint(geo.get("lat") + "," + geo.get("lng"));
|
||||
sdQuery.setField("lat_lng");
|
||||
sdQuery.setDistance("500");
|
||||
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
|
||||
}
|
||||
params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
|
||||
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[]{"region", "name", "address", "addrAlias","id"});
|
||||
List<AutoCompleteBo> ret = new ArrayList<AutoCompleteBo>(districts.size());
|
||||
for (District district : districts) {
|
||||
AutoCompleteBo bo = new AutoCompleteBo();
|
||||
bo.setKeyword(district.getName());
|
||||
bo.setVal(district.getName());
|
||||
bo.setDesc(district.getAddress());
|
||||
bo.setRegion(district.getRegion());
|
||||
bo.setId(district.getId());
|
||||
ret.add(bo);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setDistrictService(DistrictService districtService) {
|
||||
this.districtService = districtService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPropertyController(PropertyController propertyController) {
|
||||
this.propertyController = propertyController;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.fangjia.open.dto;
|
||||
|
||||
import groovy.transform.builder.Builder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 建行租金dto
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/4/6
|
||||
*/
|
||||
@Builder
|
||||
public class CcbRentDto implements Serializable {
|
||||
|
||||
private String city;
|
||||
// 区域
|
||||
private String district;
|
||||
// 小区名
|
||||
private String name;
|
||||
// 面积
|
||||
private Double size;
|
||||
// 半径
|
||||
private Integer radius;
|
||||
// 室
|
||||
private Integer room;
|
||||
// 厅
|
||||
private Integer hall;
|
||||
// 卫
|
||||
private Integer toilet;
|
||||
// 所在楼层
|
||||
private Integer floor;
|
||||
// 总楼层
|
||||
private Integer height;
|
||||
// 朝向
|
||||
private String direction;
|
||||
// 装修情况
|
||||
private String fitment;
|
||||
// 电梯配套
|
||||
private Boolean hasLift;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(Integer radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public Integer getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(Integer room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public Integer getHall() {
|
||||
return hall;
|
||||
}
|
||||
|
||||
public void setHall(Integer hall) {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
public Integer getToilet() {
|
||||
return toilet;
|
||||
}
|
||||
|
||||
public void setToilet(Integer toilet) {
|
||||
this.toilet = toilet;
|
||||
}
|
||||
|
||||
public Integer getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(Integer floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getFitment() {
|
||||
return fitment;
|
||||
}
|
||||
|
||||
public void setFitment(String fitment) {
|
||||
this.fitment = fitment;
|
||||
}
|
||||
|
||||
public Boolean getHasLift() {
|
||||
return hasLift;
|
||||
}
|
||||
|
||||
public void setHasLift(Boolean hasLift) {
|
||||
this.hasLift = hasLift;
|
||||
}
|
||||
|
||||
public Double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>租金评估</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
<style>
|
||||
.list-block .item-content .item-inner{margin-left:0;padding-left:0.75rem;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="page-group">
|
||||
<div class="page page-current">
|
||||
<input type="hidden" id="t" value="c">
|
||||
<form id="evaluateForm">
|
||||
<div class="content">
|
||||
<div class="list-block" style="margin-bottom:60px;">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<input id="cityName" value="上海" name="city" type="hidden">
|
||||
<!-- 区域 -->
|
||||
<input value="" name="district" type="hidden">
|
||||
<input value="2000" name="radius" type="hidden">
|
||||
<div class="item-title label">城市:<font>上海</font></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">地址:</div>
|
||||
<div class="item-input">
|
||||
<input type="text" placeholder="请输入小区名或地址" id="districtSearch" name="name" class="search_input" required>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="searchSpan" style="margin-bottom:50px;z-index:999;position: absolute; width: 100%;" >
|
||||
<ul></ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">面积:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" name="size" placeholder="请输入建筑面积(平米)" id="houseArea" min="0" max="1000" value="" required>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">户型:</div>
|
||||
<input name="room" type="hidden" id="room">
|
||||
<input name="hall" type="hidden" id="hall">
|
||||
<input name="toilet" type="hidden" id="toilet">
|
||||
<p class="di">
|
||||
<a href="#" class="create-actions01-now">1</a>室 <a
|
||||
href="#" class="create-actions02-now">0</a>厅 <a
|
||||
href="#" class="create-actions03-now">0</a>卫
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">楼层:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" name="floor" id="houseFloor" placeholder="请输入所在楼层" min="1" max="200" required value="">
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">总楼层:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" name="height" id="houseHight" placeholder="请输入总楼层" min="1" max="200" value="" required>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="moreInput dn">
|
||||
<li>
|
||||
<div class="item-content">
|
||||
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">朝向:</div>
|
||||
<input id="direction" type="hidden" name="direction">
|
||||
<p class="di"><a href="#" class="create-actions04">请选择朝向</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">装修情况:</div>
|
||||
<input type="hidden" id="fitment" name="fitment">
|
||||
<p class="di"><a href="#" class="create-actions05">请选择装修情况</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="content-block">
|
||||
<div class="item-title label di">电梯配套:</div>
|
||||
<input type="hidden" id="hasLift" name="hasLift" placeholder="请选择电梯配套">
|
||||
<p class="di"><a href="#" class="create-actions14-now">请选择电梯配套</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<div class="more_btn">继续填写,租金更加精准↓</div>
|
||||
<div class="little_btn dn">收起</div>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><a id="evaluateBtn" class="button button-big button-fill">查看租金结果</a></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/select.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/wx.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/autoCompletion.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='../static/js/jquery.cookie.js' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
$("#evaluateBtn").on('click', function(){
|
||||
if(parseFloat($("#houseHight").val()) < parseFloat($("#houseFloor").val())){
|
||||
$.toast("楼层不能大于楼高");
|
||||
return
|
||||
}
|
||||
$.ajax({
|
||||
url: '../property/evaluateRent',
|
||||
data:$("#evaluateForm").serialize(),
|
||||
dataType:"json",
|
||||
type:"post",
|
||||
success:function(data){
|
||||
debugger
|
||||
if(data.success){
|
||||
if(data.msg){
|
||||
$.toast(data.msg);
|
||||
}
|
||||
location.href = "report?address=" + data.address + "&totalPrice=" + data.totalPrice
|
||||
}else{
|
||||
$.toast(data.msg);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
// 选择操作-房型-室
|
||||
$(document).on('click', '.create-actions01-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择室',
|
||||
label: true
|
||||
}
|
||||
];
|
||||
for (var i = 1; i < 10; i++) {
|
||||
buttons1.push({
|
||||
text: i + '',
|
||||
onClick: function () {
|
||||
$("#room").val(this.text)
|
||||
$(".create-actions01-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
})
|
||||
}
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
// 选择操作-房型-号
|
||||
$(document).on('click', '.create-actions02-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择厅',
|
||||
label: true
|
||||
}
|
||||
];
|
||||
for (var i = 0; i < 10; i++) {
|
||||
buttons1.push({
|
||||
text: i + '',
|
||||
onClick: function () {
|
||||
$("#hall").val(this.text)
|
||||
$(".create-actions02-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
})
|
||||
}
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
// 选择操作-房型-卫
|
||||
$(document).on('click', '.create-actions03-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择卫',
|
||||
label: true
|
||||
}
|
||||
];
|
||||
for (var i = 0; i < 10; i++) {
|
||||
buttons1.push({
|
||||
text: i + '',
|
||||
onClick: function () {
|
||||
$("#toilet").val(this.text)
|
||||
$(".create-actions03-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
})
|
||||
}
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
// 电梯配套
|
||||
$(document).on('click', '.create-actions14-now', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择是否有电梯',
|
||||
label: true
|
||||
},
|
||||
{
|
||||
text: '是',
|
||||
bold: true,
|
||||
onClick: function () {
|
||||
$('#hasLift').val(true)
|
||||
$("a.create-actions14-now").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
onClick: function () {
|
||||
$('#hasLift').val(false)
|
||||
$("a.create-actions14").empty().text(this.text).addClass("selected")
|
||||
}
|
||||
}
|
||||
];
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,69 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>租金报告中心</title>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.css">
|
||||
<link rel="stylesheet" href="../static/style/wx.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-group">
|
||||
您评估的地址:永泰路630弄66号
|
||||
租金:6500元/月
|
||||
</div>
|
||||
<div class="page-group">
|
||||
<div class="page page-current">
|
||||
<div class="content">
|
||||
<div class="list-block" style="margin-bottom:60px;">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">您评估的地址:</div>
|
||||
<div class="item-input">
|
||||
<input type="text" disabled id="districtSearch" name="name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">租金:</div>
|
||||
<div class="item-input">
|
||||
<input name="mount" disabled name="evaluation.mount" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><a id="evaluateBtn" class="button button-big button-fill">查看租金报告</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type="text/javascript">
|
||||
init()
|
||||
|
||||
init = function() {
|
||||
$alert('报告')
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -1,10 +1,15 @@
|
||||
/**小区搜索功能js*/
|
||||
$(function () {
|
||||
resumeHistory()
|
||||
if ($("#t").val() != "c") {
|
||||
resumeHistory()
|
||||
}
|
||||
/**小区自动完成*/
|
||||
$("#districtSearch").on('click input',function () {
|
||||
var city = $("#cityName").val()
|
||||
if($.trim($("#districtSearch").val()) == ""){
|
||||
if ($("#t").val() == "c") {
|
||||
return false;
|
||||
}
|
||||
resumeHistory()
|
||||
return;
|
||||
}
|
||||
@@ -21,26 +26,33 @@ $(function () {
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if(data.length == 0){
|
||||
if(data && data.length == 0){
|
||||
var content = '<li><a class="item-content" style="color:#333;text-align: center"><div class="item-inner"><div class="item-subtitle">未搜索到小区</div></div></a></li>'
|
||||
$("#searchSpan ul").empty().append(content)
|
||||
return
|
||||
}
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr ="{2}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr ="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var content = ""
|
||||
$(data).each(function () {
|
||||
var district = this
|
||||
content = content + template.template(district.id, district.keyword, district.desc)
|
||||
content = content + template.template(district.id, district.keyword, district.desc, district.region)
|
||||
})
|
||||
$("#searchSpan ul").empty().append(content).find("li>a.item-link").click(function () {
|
||||
var li = $(this).parent();
|
||||
var addr = $(li).attr("data-addr");
|
||||
var id = $(li).attr("data-id")+"";
|
||||
var name = $(li).attr("data-name");
|
||||
var region = $(li).attr("data-region");
|
||||
var isCompany=$("#t").val();
|
||||
saveCookie(id, name, addr)
|
||||
if ($("#t").val() != "c") {
|
||||
saveCookie(id, name, addr)
|
||||
}
|
||||
if ($("#t").val() == "b") {
|
||||
location.href = "districtDetail?id=" + id+"&city="+city
|
||||
} else if ($("#t").val() == "c") {
|
||||
$('#districtSearch').val(addr)
|
||||
$('input[name="district"]').val(region)
|
||||
$("#searchSpan ul").empty()
|
||||
} else {
|
||||
location.href = "../weiXinEvaluation/input?id=" + id
|
||||
}
|
||||
@@ -98,6 +110,8 @@ function resumeHistory() {
|
||||
var id = $(li).attr("data-id")
|
||||
if ($("#t").val() == "b") {
|
||||
location.href = "districtDetail?id=" + id+"&city="+city
|
||||
} else if ($("#t").val() == "c") {
|
||||
location.href = "../ccbRent/index?city="+city
|
||||
} else {
|
||||
location.href = "../weiXinEvaluation/input?id=" + id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user