From e01253754ceecf63383a45f748c5732a00662f81 Mon Sep 17 00:00:00 2001 From: raoyanhui Date: Fri, 30 Mar 2018 09:39:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4js=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fangija-zsyf/views/evaluate/evaluateList.html | 126 ++++++++++-------- 1 file changed, 68 insertions(+), 58 deletions(-) diff --git a/fangija-zsyf/views/evaluate/evaluateList.html b/fangija-zsyf/views/evaluate/evaluateList.html index 4780695..fb0bf9e 100644 --- a/fangija-zsyf/views/evaluate/evaluateList.html +++ b/fangija-zsyf/views/evaluate/evaluateList.html @@ -96,19 +96,21 @@ $(document).on('click','.open-vertical-modal', function () { { text: '自住', onClick: function() { - window.location.href = "01_index01_myHouse01_index.html"; + //window.location.href = "01_index01_myHouse01_index.html"; + + } }, { text: '出租', onClick: function() { - window.location.href = "01_index01_myHouse01_index.html"; + //window.location.href = "01_index01_myHouse01_index.html"; } }, { text: '空置', onClick: function() { - window.location.href = "01_index01_myHouse01_index.html"; + //window.location.href = "01_index01_myHouse01_index.html"; } }, { @@ -118,6 +120,7 @@ $(document).on('click','.open-vertical-modal', function () { }) }); +//查询房产评估列表 function selectEvaluateList(){ //先清空列表 $('.list-block ul').html(""); @@ -132,62 +135,11 @@ function selectEvaluateList(){ var results = resultsMap.houseInfoList; var xqOneMonthUpDownRangeMap = resultsMap.xqOneMonthUpDownRangeMap; var cityAvgPriceMap = resultsMap.cityAvgPriceMap; + //构造数据列表 + htmlContent = constructHtmlContent(results, xqOneMonthUpDownRangeMap, cityAvgPriceMap, htmlContent); - if(results!=null && results.length>0){ - for(var i in results){ - var result = results[i]; - var tempTotalPrice = result.totalPrice; - //考虑是否为数字,加强逻辑判断 - if(!isNaN(tempTotalPrice)){ - //转换成元,四舍五入 - tempTotalPrice = (parseFloat(tempTotalPrice)/10000).toFixed(2); - } - htmlContent = htmlContent +"
  • "; - htmlContent = htmlContent +"
    "; - htmlContent = htmlContent +"
    "+result.name+""+result.city+"-"+result.region+"
    "; - htmlContent = htmlContent +"
    "; - htmlContent = htmlContent +"
    "+result.roomCount+"室"+result.hallCount+"厅  "+result.area+"m  "+result.floor+"/"+result.height+"层
    "; - htmlContent = htmlContent +"
    "; - //对应城市地区小区30天涨跌幅 - //动态构建key - var xqOneMonthUpDownRangeKey = result.city+"-"+result.region +"-"+result.name; - //取得key对于的value - var xqOneMonthUpDownRangeValue = xqOneMonthUpDownRangeMap[xqOneMonthUpDownRangeKey]; - if(!isNaN(xqOneMonthUpDownRangeValue)){ - //涨跌幅大于零 - if(parseFloat(xqOneMonthUpDownRangeValue)>=0){ - htmlContent = htmlContent + "
    近30天涨跌幅: "+xqOneMonthUpDownRangeValue+"%
    "; - }else{ - //涨跌幅小于零 - htmlContent = htmlContent + "
    近30天涨跌幅: "+Math.abs(xqOneMonthUpDownRangeValue)+"%
    "; - } - }else{ - //为非数字清空放空格 - htmlContent = htmlContent + "
    近30天涨跌幅: "+ +"%
    "; - } - - //相比对于城市均价 - var cityAvgPriceKey = result.city; - //取得对应城市的value - var cityAvgPriceValue = cityAvgPriceMap[cityAvgPriceKey]; - if(!isNaN(cityAvgPriceValue)){ - if(parseInt(cityAvgPriceValue)>=parseInt(result.price)){ - htmlContent = htmlContent + "
    相比"+result.city+"均价: "+'高'+(parseInt(cityAvgPriceValue)-parseInt(result.price))+'元'+"
    "; - }else{ - htmlContent = htmlContent + "
    相比"+result.city+"均价: "+'低'+(parseInt(result.price)-parseInt(cityAvgPriceValue))+'元'+"
    "; - } - }else{ - //为非数字清空放空格 - htmlContent = htmlContent + "
    相比"+result.city+"均价: "+' '+"
    "; - } - htmlContent = htmlContent + "
    均价: "+result.price+"元/㎡
    "; - htmlContent = htmlContent + "
    "+tempTotalPrice+"万
    "; - htmlContent = htmlContent + "
    添加管理" - htmlContent = htmlContent +"
  • "; - } - //动态追加内容 - $('.list-block ul').html(htmlContent); - } + //动态追加内容 + $('.list-block ul').html(htmlContent); //添加loading等待效果 $(".loadingBg").hide(); $(".content-block").show(); @@ -196,6 +148,64 @@ function selectEvaluateList(){ }); } +//动态构造房产评估列表 +function constructHtmlContent(results, xqOneMonthUpDownRangeMap, cityAvgPriceMap, htmlContent){ + if(results!=null && results.length>0){ + for(var i in results){ + var result = results[i]; + var tempTotalPrice = result.totalPrice; + //考虑是否为数字,加强逻辑判断 + if(!isNaN(tempTotalPrice)){ + //转换成元,四舍五入 + tempTotalPrice = (parseFloat(tempTotalPrice)/10000).toFixed(2); + } + htmlContent = htmlContent +"
  • "; + htmlContent = htmlContent +"
    "; + htmlContent = htmlContent +"
    "+result.name+""+result.city+"-"+result.region+"
    "; + htmlContent = htmlContent +"
    "; + htmlContent = htmlContent +"
    "+result.roomCount+"室"+result.hallCount+"厅  "+result.area+"m  "+result.floor+"/"+result.height+"层
    "; + htmlContent = htmlContent +"
    "; + //对应城市地区小区30天涨跌幅 + //动态构建key + var xqOneMonthUpDownRangeKey = result.city+"-"+result.region +"-"+result.name; + //取得key对于的value + var xqOneMonthUpDownRangeValue = xqOneMonthUpDownRangeMap[xqOneMonthUpDownRangeKey]; + if(!isNaN(xqOneMonthUpDownRangeValue)){ + //涨跌幅大于零 + if(parseFloat(xqOneMonthUpDownRangeValue)>=0){ + htmlContent = htmlContent + "
    近30天涨跌幅: "+xqOneMonthUpDownRangeValue+"%
    "; + }else{ + //涨跌幅小于零 + htmlContent = htmlContent + "
    近30天涨跌幅: "+Math.abs(xqOneMonthUpDownRangeValue)+"%
    "; + } + }else{ + //为非数字清空放空格 + htmlContent = htmlContent + "
    近30天涨跌幅: "+ +"%
    "; + } + + //相比对于城市均价 + var cityAvgPriceKey = result.city; + //取得对应城市的value + var cityAvgPriceValue = cityAvgPriceMap[cityAvgPriceKey]; + if(!isNaN(cityAvgPriceValue)){ + if(parseInt(cityAvgPriceValue)>=parseInt(result.price)){ + htmlContent = htmlContent + "
    相比"+result.city+"均价: "+'高'+(parseInt(cityAvgPriceValue)-parseInt(result.price))+'元'+"
    "; + }else{ + htmlContent = htmlContent + "
    相比"+result.city+"均价: "+'低'+(parseInt(result.price)-parseInt(cityAvgPriceValue))+'元'+"
    "; + } + }else{ + //为非数字清空放空格 + htmlContent = htmlContent + "
    相比"+result.city+"均价: "+' '+"
    "; + } + htmlContent = htmlContent + "
    均价: "+result.price+"元/㎡
    "; + htmlContent = htmlContent + "
    "+tempTotalPrice+"万
    "; + htmlContent = htmlContent + "
    添加管理" + htmlContent = htmlContent +"
  • "; + } + } + return htmlContent; +} + //界面加载 $(document).ready(function () { selectEvaluateList();