diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java index 2dd5ab077..5961db2d8 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/CcbRentController.java @@ -13,6 +13,7 @@ import com.fangjia.open.APIConstant; import com.fangjia.open.compatible.model.JsonModel; import com.fangjia.open.dto.DistrictHouseDtao; import com.fangjia.open.interceptors.AuthenticationBean; +import com.fangjia.open.model.AddesssMatchModel; import com.fangjia.open.model.BaseModel; import com.fangjia.open.model.weixin.EvaluationModel; import com.fangjia.open.model.weixin.PropertyEvaluationModel; @@ -91,6 +92,27 @@ public class CcbRentController { return result; } + public Object matchAction(AddesssMatchModel model) { + String result = null; + HttpRequest httpRequest = new HttpRequest(); + try { + Map headers = new HashMap(); + // &__refresh_cache=1 ˢлº´æ + String url = "http://open.fangjia.com/address/match?token=" + APIConstant.SUPER_USER_TOKEN; + Map params = org.apache.commons.beanutils.BeanUtils.describe(model); + result = httpRequest.post(url, params, headers,"UTF-8"); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (HttpRequestException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return result; + } + public Object evaluateRentAction(com.fangjia.open.model.PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException { String result = null; HttpRequest httpRequest = new HttpRequest(); @@ -191,6 +213,7 @@ public class CcbRentController { districtPriceMap.put("fitment", evaluation.getFitment()); districtPriceMap.put("buildYear",district.getFinishBuildingDate()); districtPriceMap.put("hasLift",hasLift); + districtPriceMap.put("room", room); Integer startPrice = (int)(evaluation.getTotalPrice() - evaluation.getTotalPrice()*0.2); Integer endPrice = (int)(evaluation.getTotalPrice() + evaluation.getTotalPrice()*0.2); diff --git a/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl b/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl index a3d233ead..a122c9506 100644 --- a/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl +++ b/projects/fangjia-open/src/main/webapp/ccbRent/detail.ftl @@ -99,7 +99,7 @@
详细地址:
楼盘名称:
- 室号:
+ 室号:
朝向:
建筑面积:平米
所在楼层: 层(共层)
@@ -205,7 +205,7 @@ $("#download").css('color', 'blue') let chartImgUrl = $('#chartImgUrl').val(); window.location.href = "download?city="+params.city+"&district="+params.district+"&name="+params.name+"&address="+params.address+"&size="+params.size+"&floor="+params.floor - +"&height="+params.height+"&room="+params.room+"&hall="+params.hall+"&toilet="+params.toilet+"&direction="+params.direction+"&fitment="+params.fitment+"&chartImgUrl=" + chartImgUrl + "&hasLift=" + (params.hasLift == 'true' ? '有' : '无'); + +"&height="+params.height+"&room="+params.roomNumber+"&hall="+params.hall+"&toilet="+params.toilet+"&direction="+params.direction+"&fitment="+params.fitment+"&chartImgUrl=" + chartImgUrl + "&hasLift=" + (params.hasLift == 'true' ? '有' : '无'); }); // 后台传参过来用 @@ -222,11 +222,13 @@ 'toilet': sessionStorage.toilet, 'direction': sessionStorage.direction, 'fitment': sessionStorage.fitment, - 'hasLift': sessionStorage.hasLift + 'hasLift': sessionStorage.hasLift, + 'roomNumber': sessionStorage.roomNumber }; function init() { $('span[name="hasLift"]').text(params.hasLift == 'true' ? '有' : '无') + $('span[name="roomNumber"]').text(params.roomNumber != '' ? params.roomNumber + '室' : '') $.ajax({ // 注意需要加.. @@ -246,7 +248,7 @@ $('span[name="totalPriceUpper"]').text(result.totalPriceUpper) // 房产状况 - $('span[name="room"]').text(result.room) + //$('span[name="room"]').text(result.room) $('span[name="floor"]').text(result.floor) $('span[name="buildYear"]').text(result.buildYear) $('span[name="direction"]').text(result.direction) diff --git a/projects/fangjia-open/src/main/webapp/ccbRent/downloadPage.ftl b/projects/fangjia-open/src/main/webapp/ccbRent/downloadPage.ftl index 9bf596886..6303c82f4 100644 --- a/projects/fangjia-open/src/main/webapp/ccbRent/downloadPage.ftl +++ b/projects/fangjia-open/src/main/webapp/ccbRent/downloadPage.ftl @@ -54,7 +54,7 @@ 室号 - <#if result.room??>${result.room} + <#if result.room??>${result.room + '室'} 朝向 <#if result.direction??>${result.direction} diff --git a/projects/fangjia-open/src/main/webapp/ccbRent/index.ftl b/projects/fangjia-open/src/main/webapp/ccbRent/index.ftl index 4c8927943..5f4a59fce 100644 --- a/projects/fangjia-open/src/main/webapp/ccbRent/index.ftl +++ b/projects/fangjia-open/src/main/webapp/ccbRent/index.ftl @@ -40,8 +40,9 @@
地址:
- - + + +
@@ -166,6 +167,7 @@ sessionStorage.district = $('input[name="district"]').val() sessionStorage.address = $('input[name="address"]').val() sessionStorage.size = $('input[name="size"]').val() + sessionStorage.roomNumber = $('input[name="roomNumber"]').val() sessionStorage.room = $('input[name="room"]').val() sessionStorage.hall = $('input[name="hall"]').val() sessionStorage.toilet = $('input[name="toilet"]').val() @@ -222,11 +224,11 @@ var fieldVal = $.trim(input.val()) if (input.attr("required") && fieldVal == "") { if (input.attr("name").indexOf("district") != -1) { - $.toast("请选择输入地址时提示的小区") + } else { $.toast(fieldName + "不能为空"); + return } - return } if (input.attr("type") == 'number' && fieldVal != "") { if (input.attr("name").indexOf("size") != -1) { @@ -253,7 +255,6 @@ $.toast("楼层不能大于楼高"); return } - storeSession() if($("#houseHight").val() && parseFloat($("#houseHight").val())>=60){ $.toast("请输入合理的楼层数"); @@ -262,42 +263,31 @@ $("#evaluateBtn").prop("disabled", true) // 用户输入可能为地址,需要匹配,在估价 - // let city = $('input[name="city"]').val() - // let address = $('input[name="address"]').val() - // - // $.ajax({ - // // 注意需要加.. - // url: '../address/match', - // data: {'city': city, 'address': address}, - // dataType: "json", - // type: "post", - // success: function (data) { - // debugger - // if (data.code == 200) { - // - // } - // } - // }) + let city = $('input[name="city"]').val() + let address = $('input[name="address"]').val() - $.ajax({ - // 注意需要加.. - url: '../ccbRent/evaluateRent', - data:$("#evaluateForm").serialize(), - dataType:"json", - type:"post", - success:function(data){ - if(data.code == 200){ - window.location.href = "report?address=" + data.result.address + "&totalPrice=" + data.result.totalPrice - }else{ - $.toast("估价失败,请重新评估"); - $("#evaluateBtn").prop("disabled", false) + if ($('input[name="district"]').val() == '') { + $.ajax({ + // 注意需要加.. + url: '../ccbRent/match', + data: {'city': city, 'address': address}, + dataType: "json", + type: "post", + success: function (data) { + if (data.code == 200) { + let result = data.result + $('input[name="name"]').val(result.name) + $('input[name="district"]').val(result.district) + $('input[name="roomNumber"]').val(result.searchAddress.orgRoomNumber) + evaluateRent() + } else { + $.toast("估价失败,暂不支持该小区估价"); + } } - }, - error: function () { - //$.toast("服务器异常,请重新评估"); - $("#evaluateBtn").prop("disabled", false) - } - }) + }) + } else { + evaluateRent() + } }) // 选择操作-房型-室 $(document).on('click', '.create-actions01-now', function () { @@ -326,6 +316,30 @@ $.actions(groups); }); + let evaluateRent = function() { + $.ajax({ + // 注意需要加.. + url: '../ccbRent/evaluateRent', + data:$("#evaluateForm").serialize(), + dataType:"json", + type:"post", + success:function(data){ + if(data.code == 200){ + let name = $('input[name="name"]').val() + let roomNumber = $('input[name="roomNumber"]').val() + window.location.href = "report?address=" + data.result.address + "&totalPrice=" + data.result.totalPrice + storeSession() + }else{ + $.toast("估价失败,请重新评估"); + $("#evaluateBtn").prop("disabled", false) + } + }, + error: function () { + //$.toast("服务器异常,请重新评估"); + $("#evaluateBtn").prop("disabled", false) + } + }) + } // 选择操作-装修情况 $(document).on('click', '.create-actions05-now', function () { diff --git a/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js b/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js index fb00849df..28f9d9968 100644 --- a/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js +++ b/projects/fangjia-open/src/main/webapp/static/js/autoCompletion.js @@ -28,6 +28,8 @@ $(function () { success: function (data) { if(data && data.length == 0){ if ($("#t").val() == "c") { + $('input[name="name"]').val('') + $('input[name="district"]').val('') $("#searchSpan ul").empty() return ; } else { @@ -56,7 +58,7 @@ $(function () { location.href = "districtDetail?id=" + id+"&city="+city } else if ($("#t").val() == "c") { $('#districtSearch').val(name) - $('input[name="address"]').val(addr) + $('input[name="name"]').val(name) $('input[name="district"]').val(region) $("#searchSpan ul").empty() } else {