634 lines
24 KiB
JavaScript
634 lines
24 KiB
JavaScript
//房产详情页面传入houseId
|
|
var houseId;
|
|
var disName;
|
|
var disRegion;
|
|
var disCity;
|
|
var _evalDate;
|
|
var totalPricePart;
|
|
|
|
var houseInfo = new Vue({
|
|
el: '#houseInfo',
|
|
data: {
|
|
name: "",
|
|
city: "",
|
|
price: "",
|
|
liveStatus: "",
|
|
totalPrice: "",
|
|
houseRoomNum: "",
|
|
houseArea: "",
|
|
floorHeight: "",
|
|
evalDate: "",
|
|
roseRanking: "",
|
|
avgpriceRanking: "",
|
|
minSellPrice: "",
|
|
maxSellPrice: "",
|
|
minAndMaxTotalPrice: "",
|
|
minAndMaxPrice: "",
|
|
agencyCount: "",
|
|
famousAgency: "",
|
|
otherAgency: "",
|
|
agencyLevel: "",
|
|
maxCityAgency: ""
|
|
}
|
|
})
|
|
|
|
/* 增长率及收益-打开 */
|
|
$(document).on('click','.open-modal01', function () {
|
|
$.closeModal('.my-popover01');
|
|
$('.modal01').show();
|
|
$('.modal01-overlay').show();
|
|
});
|
|
|
|
/* 增长率及收益-取消 */
|
|
$(document).on('click','.modal01 .cancel_btn', function () {
|
|
$('.modal01').hide();
|
|
$('.modal01-overlay').hide();
|
|
//清空对于的输入框
|
|
// $("#input_time").val('');
|
|
$("#input_price").val('');
|
|
});
|
|
|
|
/* 增长率及收益-关闭 */
|
|
$(document).on('click','.modal01 .close', function () {
|
|
$('.modal01').hide();
|
|
$('.modal01-overlay').hide();
|
|
//清空对于的输入框
|
|
// $("#input_time").val('');
|
|
$("#input_price").val('');
|
|
});
|
|
|
|
/* 增长率及收益-确定 */
|
|
$(document).on('click','.modal01 .confirm_btn', function () {
|
|
var a = $("#input_time").val();
|
|
var b = $("#input_price").val();
|
|
//_evalDate 已经是由date转换成long类型了
|
|
var evalDate = _evalDate;
|
|
var d = new Date($("#input_time").val()).getTime();
|
|
var _houseId = houseId;
|
|
if(a == ""){
|
|
$.toast("购入时间不能为空");
|
|
return false;
|
|
}
|
|
else if(b == ""){
|
|
$.toast("购入价格不能为空");
|
|
return false;
|
|
}
|
|
else if(b <= 0){
|
|
$.toast("购入价格大于0");
|
|
return false;
|
|
}
|
|
else if(d > evalDate){
|
|
$.toast("购入时间不能大于估价时间");
|
|
return false;
|
|
}
|
|
var days = evalDate - d;
|
|
var year = parseInt(days / (1000 * 60 * 60 * 24) / 365) + 1;
|
|
var basePrice = totalPricePart;
|
|
var up = Number(basePrice) * Math.pow(2, year);
|
|
var down = Number(basePrice) * Math.pow(2, -year);
|
|
if(Number($("#input_price").val()) > up || Number($("#input_price").val()) < down){
|
|
$('.modal01').hide();
|
|
$.modal({
|
|
title: '购入价格与实际情况偏差较大,是否继续?',
|
|
buttons: [
|
|
{
|
|
text: '否,修改',
|
|
onClick: function() {
|
|
$("#input_price").focus();
|
|
$('.modal').remove();
|
|
$('.modal01').show();
|
|
}
|
|
},
|
|
{
|
|
text: '继续',
|
|
onClick: function() {
|
|
axios.post(BASE_PATH + "/rest/saleAnalysis/updateEvaluation",
|
|
{
|
|
houseId: houseId,
|
|
purchaseDate: $("#input_time").val(),
|
|
purchasePrice: $("#input_price").val()
|
|
}).then(function (response) {
|
|
var status = response.data.status;
|
|
if(status){
|
|
window.location.reload();
|
|
}else{
|
|
$.toast(response.data.message);
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
}
|
|
]
|
|
})
|
|
$(".modal-text").css("text-align","center");
|
|
} else{
|
|
axios.post(BASE_PATH + "/rest/saleAnalysis/updateEvaluation",
|
|
{
|
|
houseId: houseId,
|
|
purchaseDate: $("#input_time").val(),
|
|
purchasePrice: $("#input_price").val()
|
|
}).then(function (response) {
|
|
var status = response.data.status;
|
|
if(status){
|
|
window.location.reload();
|
|
}else{
|
|
$.toast(response.data.message);
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
});
|
|
|
|
/* 点击遮罩弹窗隐藏 */
|
|
$(document).on('click','.modal01-overlay', function () {
|
|
$('.modal01').hide();
|
|
$('.modal01-overlay').hide();
|
|
});
|
|
|
|
/* 选择-购入时间 */
|
|
$("#input_time").datetimePicker({
|
|
toolbarTemplate: '<header class="bar bar-nav bar-nav01 bar-nav01a">\
|
|
<button class="button button-link pull-right close-picker">确定</button>\
|
|
<h1 class="title">购入时间</h1>\
|
|
</header>'
|
|
});
|
|
|
|
/* 说明-交易活跃度 */
|
|
$(document).on('click','.alert-text-title02', function () {
|
|
$.alert('交易活跃度是根据房产的价值、周边配套、供需关系等情况来衡量,能否在市场中快速交易变现的评级。', '交易活跃度');
|
|
});
|
|
|
|
|
|
/**
|
|
* 请求构造Chart数据
|
|
* @param {Object} type
|
|
*/
|
|
function loadingChart(type){
|
|
axios.get(BASE_PATH + "/rest/saleAnalysis/getDistrictPriceZouShi",
|
|
{
|
|
params: {
|
|
id: houseId,
|
|
type: type
|
|
}
|
|
}).then(function (response) {
|
|
if(response.data.status){
|
|
var categories = new Array();
|
|
var series = new Array();
|
|
var cityObj = new Object();
|
|
var regionObj = new Object();
|
|
var districtObj = new Object();
|
|
|
|
//城市 地区 小区
|
|
districtObj.name = disName;
|
|
regionObj.name = disRegion;
|
|
cityObj.name = disCity;
|
|
|
|
//构造series系列
|
|
series.push(districtObj);
|
|
series.push(regionObj);
|
|
series.push(cityObj);
|
|
|
|
//构造数据集
|
|
var cityDatas = new Array();
|
|
var regionDatas = new Array();
|
|
var districtDatas = new Array();
|
|
|
|
var m = response.data.data.timeKeys;
|
|
for(var i = 0; i < m.length; i++){
|
|
var date_ = new Date(Number(m[i]))
|
|
categories.push(formatTime_(date_));
|
|
if(response.data.data.cityAvgZouShi[m[i]] == undefined){
|
|
cityDatas.push(null);
|
|
}else {
|
|
cityDatas.push(response.data.data.cityAvgZouShi[m[i]]);
|
|
}
|
|
if (response.data.data.regionAvgZouShi[m[i]] == undefined) {
|
|
regionDatas.push(null);
|
|
}else {
|
|
regionDatas.push(response.data.data.regionAvgZouShi[m[i]]);
|
|
}
|
|
if (response.data.data.districtAvgZouShi[m[i]] == undefined){
|
|
districtDatas.push(null);
|
|
}else {
|
|
districtDatas.push(response.data.data.districtAvgZouShi[m[i]]);
|
|
}
|
|
}
|
|
cityObj.data = cityDatas;
|
|
regionObj.data = regionDatas;
|
|
districtObj.data = districtDatas;
|
|
//调用图标方法
|
|
showAvgPriceChat(categories, series);
|
|
}else{
|
|
$.toast(response.data.message);
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 均价走势
|
|
* @param {Object} categories
|
|
* @param {Object} series
|
|
*/
|
|
function showAvgPriceChat(categories, series) {
|
|
charts = Highcharts.chart('chart', {
|
|
title: {
|
|
text: ''
|
|
},
|
|
subtitle: {
|
|
text: '',
|
|
x: -20
|
|
},
|
|
colors: ['#F88C9F', '#AAD672', '#AE94E9'],
|
|
xAxis: {
|
|
categories: categories,
|
|
boundaryGap: false,
|
|
tickInterval: 2,
|
|
tickLength: 6,
|
|
labels: {
|
|
style: {
|
|
fontSize: 12
|
|
}
|
|
}
|
|
},
|
|
yAxis: {
|
|
allowDecimals: false,
|
|
title: {
|
|
text: ''
|
|
},
|
|
plotLines: [{
|
|
value: 0,
|
|
width: 1,
|
|
color: '#666'
|
|
}]
|
|
},
|
|
tooltip: {
|
|
shared: true,
|
|
valueSuffix: '元/㎡'
|
|
},
|
|
legend: {
|
|
layout: 'horizontal',
|
|
align: 'center',
|
|
verticalAlign: 'bottom',
|
|
y: 0,
|
|
borderWidth: 0
|
|
},
|
|
plotOptions: {
|
|
line: {
|
|
connectNulls: true //该设置会连接空值点
|
|
},
|
|
series: {
|
|
events: {
|
|
legendItemClick: function(e) {
|
|
return false;
|
|
}
|
|
},
|
|
marker: {
|
|
//enabled: false 当系类点太多,可以用这个属性去掉图标上面的symbol, 既显示成直线
|
|
radius: 3, //曲线点半径,默认是4
|
|
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
|
|
}
|
|
}
|
|
},
|
|
series: series,
|
|
credits: {
|
|
enabled: false
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 出售分析页面详情AJAX请求
|
|
*/
|
|
function getAnalysisDetail(){
|
|
axios.get(BASE_PATH + "/rest/saleAnalysis/analysisDetail",
|
|
{
|
|
params: {
|
|
id: houseId
|
|
}
|
|
}).then(function (response) {
|
|
var resultsMap = response.data.data;
|
|
var _houseInfo = resultsMap.hInfo;
|
|
var tags = resultsMap.tags;
|
|
if(response.data.status){
|
|
houseInfo.name = _houseInfo.name;
|
|
if(_houseInfo.liveStatus!=null && _houseInfo.liveStatus.length>0){
|
|
houseInfo.liveStatus = "<small>"+_houseInfo.liveStatus+"</small>";
|
|
}else{
|
|
houseInfo.liveStatus = "<small>其它</small>";
|
|
}
|
|
$('#liveStatus').html(houseInfo.liveStatus);
|
|
houseInfo.totalPrice = (_houseInfo.totalPrice) == 0?"暂无":(parseFloat(_houseInfo.totalPrice)/10000).toFixed(2)+"万";
|
|
houseInfo.houseRoomNum = _houseInfo.houseRoomNum==""?"暂无":_houseInfo.houseRoomNum;
|
|
houseInfo.houseArea = _houseInfo.area + "㎡";
|
|
houseInfo.floorHeight = (_houseInfo.floor == 0 || _houseInfo.height == 0)?"暂无":_houseInfo.floor + "/" + _houseInfo.height + "层";
|
|
houseInfo.evalDate = _houseInfo.evalDate == null?"暂无":formatTime(_houseInfo.evalDate) + "估值";
|
|
if(tags!=null && tags.length>0){
|
|
var tempTag = "";
|
|
for(var i in tags){
|
|
tempTag += "<small>"+tags[i]+"</small>"
|
|
}
|
|
}else{
|
|
tempTag = "<small>暂无</small>";
|
|
}
|
|
$('#moreTag').html(tempTag);
|
|
//暂无先用riskScore03样式,后期需求有要求在调整
|
|
if(_houseInfo.totalScore == null){
|
|
$('#riskScore').addClass('riskScore03');
|
|
$('#riskScore').html("暂无");
|
|
}else if(_houseInfo.totalScore>=0 && _houseInfo.totalScore<=26){
|
|
$('#riskScore').addClass('riskScore01');
|
|
$('#riskScore').html("很差");
|
|
}else if(_houseInfo.totalScore>26 && _houseInfo.totalScore<=38){
|
|
$('#riskScore').addClass('riskScore02');
|
|
$('#riskScore').html("较差");
|
|
}else if(_houseInfo.totalScore>38 && _houseInfo.totalScore<=70){
|
|
$('#riskScore').addClass('riskScore03');
|
|
$('#riskScore').html("良好");
|
|
}else if(_houseInfo.totalScore>70 && _houseInfo.totalScore<=100){
|
|
$('#riskScore').addClass('riskScore04');
|
|
$('#riskScore').html("很好");
|
|
}
|
|
//控制增长率及收益显示/隐藏
|
|
if(_houseInfo.purchaseDate != null){
|
|
$('#showRateBox01').hide();
|
|
$('#showRateBox02').show();
|
|
//年增长率大于零
|
|
if(resultsMap.rate > 0 && resultsMap.increment > 0){
|
|
$('#rateTre').addClass("up");
|
|
$('#incrementTre').addClass("up");
|
|
$('#rateValue').html(resultsMap.rate + "<font>%</font>")
|
|
$('#incrementValue').html(resultsMap.increment + "<font>万</font>");
|
|
}else if(resultsMap.rate < 0 && resultsMap.increment < 0){
|
|
$('#rateTre').addClass("down");
|
|
$('#incrementTre').addClass("down");
|
|
$('#rateValue').html(resultsMap.rate + "<font>%</font>")
|
|
$('#incrementValue').html(resultsMap.increment + "<font>万</font>");
|
|
}else{
|
|
$('#rateValue').css("color", "#EB5F34");
|
|
$('#incrementValue').css("color", "#EB5F34");
|
|
$('#rateValue').html("暂无")
|
|
$('#incrementValue').html("暂无");
|
|
}
|
|
}else{
|
|
$('#showRateBox01').show();
|
|
$('#showRateBox02').hide();
|
|
}
|
|
//增长率及收益跳转链接是否显示
|
|
if(resultsMap.ad!=null){
|
|
$('#showAdBox1').show();
|
|
//如果link有值,添加调整路径
|
|
if(resultsMap.ad.link!=null && resultsMap.ad.link.length>0 && resultsMap.ad.content!=null && resultsMap.ad.content.length>0){
|
|
$('#showAdBox1Content').html(resultsMap.ad.content + "<i class='icon icon-right icon-right01'></i>");
|
|
$("#showAdBox1").click(function(){
|
|
clicked('../../views/webview_embed.html', true,false,{},{url:resultsMap.ad.link})
|
|
})
|
|
}
|
|
}
|
|
houseInfo.city = _houseInfo.city;
|
|
houseInfo.roseRanking = _houseInfo.roseRanking;
|
|
houseInfo.avgpriceRanking = _houseInfo.avgpriceRanking;
|
|
houseInfo.price = _houseInfo.price;
|
|
houseInfo.minSellPrice = _houseInfo.minSellPrice == 0?"暂无": _houseInfo.minSellPrice + "元/㎡";
|
|
houseInfo.maxSellPrice = _houseInfo.maxSellPrice == 0?"暂无": _houseInfo.maxSellPrice + "元/㎡";
|
|
$('#roseRankingPercent').css("width", houseInfo.roseRanking+"%");
|
|
$('#sliderNotePercent').css("left", resultsMap.priceRateContent+"%");
|
|
$('#curRatePercent').css("width", resultsMap.curRate+"%");
|
|
//挂牌建议
|
|
houseInfo.minAndMaxTotalPrice = (resultsMap.minTotalPrice==0 || resultsMap.maxTotalPrice==0)?"暂无":(parseFloat(resultsMap.minTotalPrice)/10000).toFixed(2)+"万"+" - "+(parseFloat(resultsMap.maxTotalPrice)/10000).toFixed(2)+"万";
|
|
houseInfo.minAndMaxPrice = (resultsMap.minPrice==0 || resultsMap.maxPrice==0)?"暂无":(parseFloat(resultsMap.minPrice)/10000).toFixed(2)+"万/㎡"+" - "+(parseFloat(resultsMap.maxPrice)/10000).toFixed(2)+"万/㎡";
|
|
//挂牌建议跳转链接是否显示
|
|
if(resultsMap.ad1!=null){
|
|
$('#showAdBox2').show();
|
|
//如果link有值,添加调整路径
|
|
if(resultsMap.ad1.link!=null && resultsMap.ad1.link.length>0 && resultsMap.ad1.content!=null && resultsMap.ad1.content.length>0){
|
|
$('#showAdBox2Content').html(resultsMap.ad1.content + "<i class='icon icon-right icon-right01'></i>");
|
|
$("#showAdBox2").click(function(){
|
|
clicked('../../views/webview_embed.html', true,false,{},{url:resultsMap.ad1.link})
|
|
})
|
|
}
|
|
}
|
|
houseInfo.agencyCount = resultsMap.agencyCount;
|
|
houseInfo.famousAgency = resultsMap.famousAgency;
|
|
houseInfo.otherAgency = resultsMap.otherAgency;
|
|
houseInfo.agencyLevel = resultsMap.agencyLevel;
|
|
houseInfo.maxCityAgency = resultsMap.maxCityAgency;
|
|
$('#agencyLevelPercent').css("width", resultsMap.agencyLevel+"%");
|
|
|
|
//全局变量赋值
|
|
_evalDate = _houseInfo.evalDate;
|
|
totalPricePart = resultsMap.totalPricePart1;
|
|
|
|
//调用构造数据方法
|
|
addItemsGuaPai(resultsMap);
|
|
addItemsChengJiao(resultsMap);
|
|
}else{
|
|
$.toast(response.data.message);
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 构造挂牌参考数据
|
|
* @param {Object} resultsMap
|
|
*/
|
|
function addItemsGuaPai(resultsMap){
|
|
if((resultsMap.disHouses!=null && resultsMap.disHouses.length>0) || (resultsMap.houses!=null && resultsMap.houses.length>0)){
|
|
var htmlGuaPai = "";
|
|
htmlGuaPai += '<div class="topicTitle" style="position:relative;">挂牌参考';
|
|
htmlGuaPai += '<div class="content-block"><div class="buttons-row theme">';
|
|
if(resultsMap.houses!=null && resultsMap.houses.length>0){
|
|
htmlGuaPai += '<a href="#tabListing1" class="tab-link button active">周边</a>';
|
|
}
|
|
if(resultsMap.disHouses!=null && resultsMap.disHouses.length>0){
|
|
if(resultsMap.houses!=null && resultsMap.houses.length>0){
|
|
htmlGuaPai += '<a href="#tabListing2" class="tab-link button">本小区</a>';
|
|
}else{
|
|
htmlGuaPai += '<a href="#tabListing2" class="tab-link button active">本小区</a>';
|
|
}
|
|
}
|
|
htmlGuaPai += '</div></div></div><div class="tabs">';
|
|
if(resultsMap.houses!=null && resultsMap.houses.length>0){
|
|
htmlGuaPai += '<div id="tabListing1" class="tab active"><div class="list-block media-list"><ul>';
|
|
for(var i in resultsMap.houses){
|
|
htmlGuaPai += '<li><a class="item-content"><div class="item-inner"><div class="item-title-row">';
|
|
htmlGuaPai += "<div class='item-title'><span class='c3 c3a'>"+resultsMap.houses[i].district_name+"</span><span class='c6 c6a'>"+resultsMap.houses[i].area+"㎡</span></div>";
|
|
var tempTotalPrice = resultsMap.houses[i].total_price == 0?"暂无":(parseFloat(resultsMap.houses[i].total_price)/10000).toFixed(2)+"万";
|
|
var tempAvgPrice = resultsMap.houses[i].avg_price == 0?"暂无":resultsMap.houses[i].avg_price+"元/㎡";
|
|
var roomHallDirectionFitment = "";
|
|
if(resultsMap.houses[i].room != undefined && resultsMap.houses[i].room != 0 && resultsMap.houses[i].hall != undefined && resultsMap.houses[i].hall != 0){
|
|
roomHallDirectionFitment += resultsMap.houses[i].room+"室"+resultsMap.houses[i].hall+"厅";
|
|
if((resultsMap.houses[i].direction != undefined && resultsMap.houses[i].direction != "") || (resultsMap.houses[i].fitment != undefined && resultsMap.houses[i].fitment != "")){
|
|
roomHallDirectionFitment += "/";
|
|
}
|
|
}
|
|
if(resultsMap.houses[i].direction != undefined && resultsMap.houses[i].direction != ""){
|
|
roomHallDirectionFitment += resultsMap.houses[i].direction;
|
|
if(resultsMap.houses[i].fitment != undefined && resultsMap.houses[i].fitment != ""){
|
|
roomHallDirectionFitment += "/";
|
|
}
|
|
}
|
|
if(resultsMap.houses[i].fitment != undefined && resultsMap.houses[i].fitment != ""){
|
|
roomHallDirectionFitment += resultsMap.houses[i].fitment;
|
|
}
|
|
htmlGuaPai += "<div class='item-after'><em>"+tempTotalPrice+"</em></div></div><div class='item-title-row'>";
|
|
htmlGuaPai += "<div class='item-title'><span>"+roomHallDirectionFitment+"</span></div>";
|
|
htmlGuaPai += "<div class='item-after''><span>"+tempAvgPrice+"</span></div></div></div></a></li>";
|
|
}
|
|
htmlGuaPai += '</ul></div></div>';
|
|
}
|
|
if(resultsMap.disHouses!=null && resultsMap.disHouses.length>0){
|
|
if(resultsMap.houses!=null && resultsMap.houses.length>0){
|
|
htmlGuaPai += '<div id="tabListing2" class="tab"><div class="list-block media-list"><ul>';
|
|
}else{
|
|
htmlGuaPai += '<div id="tabListing2" class="tab active"><div class="list-block media-list"><ul>';
|
|
}
|
|
for(var i in resultsMap.disHouses){
|
|
htmlGuaPai += '<li><a class="item-content"><div class="item-inner"><div class="item-title-row">';
|
|
htmlGuaPai += "<div class='item-title'><span class='c3 c3a'>"+resultsMap.disHouses[i].districtName+"</span><span class='c6 c6a'>"+resultsMap.disHouses[i].area+"㎡</span></div>";
|
|
var tempTotalPrice = resultsMap.disHouses[i].totalPrice == 0?"暂无":(parseFloat(resultsMap.disHouses[i].totalPrice)/10000).toFixed(2)+"万";
|
|
var tempAvgPrice = resultsMap.disHouses[i].avgPrice == 0?"暂无":resultsMap.disHouses[i].avgPrice+"元/㎡";
|
|
var roomHallDirectionFitment = "";
|
|
if(resultsMap.disHouses[i].room != undefined && resultsMap.disHouses[i].room != 0 && resultsMap.disHouses[i].hall != undefined && resultsMap.disHouses[i].hall != 0){
|
|
roomHallDirectionFitment += resultsMap.disHouses[i].room+"室"+resultsMap.disHouses[i].hall+"厅";
|
|
if((resultsMap.disHouses[i].direction != undefined && resultsMap.disHouses[i].direction != "") || (resultsMap.disHouses[i].fitment != undefined && resultsMap.disHouses[i].fitment != "")){
|
|
roomHallDirectionFitment += "/";
|
|
}
|
|
}
|
|
if(resultsMap.disHouses[i].direction != undefined && resultsMap.disHouses[i].direction != ""){
|
|
roomHallDirectionFitment += resultsMap.disHouses[i].direction;
|
|
if(resultsMap.disHouses[i].fitment != undefined && resultsMap.disHouses[i].fitment != ""){
|
|
roomHallDirectionFitment += "/";
|
|
}
|
|
}
|
|
if(resultsMap.disHouses[i].fitment != undefined && resultsMap.disHouses[i].fitment != ""){
|
|
roomHallDirectionFitment += resultsMap.disHouses[i].fitment;
|
|
}
|
|
htmlGuaPai += "<div class='item-after'><em>"+tempTotalPrice+"</em></div></div><div class='item-title-row'>";
|
|
htmlGuaPai += "<div class='item-title'><span>"+roomHallDirectionFitment+"</span></div>";
|
|
htmlGuaPai += "<div class='item-after'><span>"+tempAvgPrice+"</span></div></div></div></a></li>";
|
|
}
|
|
htmlGuaPai += '</ul></div></div>';
|
|
}
|
|
htmlGuaPai += '</div>';
|
|
$('#showTopic1').html(htmlGuaPai);
|
|
$('#showTopic1').show();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 构造成交情况数据
|
|
* @param {Object} resultsMap
|
|
*/
|
|
function addItemsChengJiao(resultsMap){
|
|
if((resultsMap.disSellHouses!=null && resultsMap.disSellHouses.length>0) || (resultsMap.sells!=null && resultsMap.sells.length>0)){
|
|
var htmlChengJiao = "";
|
|
htmlChengJiao += '<div class="topicTitle" style="position:relative;">成交情况';
|
|
htmlChengJiao += '<div class="content-block"><div class="buttons-row theme">';
|
|
if(resultsMap.sells!=null && resultsMap.sells.length>0){
|
|
htmlChengJiao += '<a href="#tabDeal1" class="tab-link button active">周边</a>';
|
|
}
|
|
if(resultsMap.disSellHouses!=null && resultsMap.disSellHouses.length>0){
|
|
if(resultsMap.sells!=null && resultsMap.sells.length>0){
|
|
htmlChengJiao += '<a href="#tabDeal2" class="tab-link button">本小区</a>';
|
|
}else{
|
|
htmlChengJiao += '<a href="#tabDeal2" class="tab-link button active">本小区</a>';
|
|
}
|
|
}
|
|
htmlChengJiao += '</div></div></div><div class="tabs">';
|
|
if(resultsMap.sells!=null && resultsMap.sells.length>0){
|
|
htmlChengJiao += '<div id="tabDeal1" class="tab active"><div class="list-block media-list"><ul>';
|
|
for(var i in resultsMap.sells){
|
|
htmlChengJiao += '<li><a class="item-content"><div class="item-inner"><div class="item-title-row">';
|
|
htmlChengJiao += "<div class='item-title'><span class='c3 c3a'>"+resultsMap.sells[i].district_name+"</span></div>";
|
|
var tempTotalPrice = resultsMap.sells[i].total_price == 0?"暂无":(parseFloat(resultsMap.sells[i].total_price)/10000).toFixed(2)+"万";
|
|
var tempAvgPrice = resultsMap.sells[i].avg_price == 0?"暂无":resultsMap.sells[i].avg_price+"元/㎡";
|
|
var tradeDate = (resultsMap.sells[i].trade_date == undefined || resultsMap.sells[i].trade_date == null)?"暂无":formatTime(resultsMap.sells[i].trade_date)+"签约";
|
|
var direction_floor = (resultsMap.sells[i].direction == undefined || resultsMap.sells[i].direction == "")?"":resultsMap.sells[i].direction;
|
|
//如果direction/floor同时存在, 中间加一个"/"
|
|
if(resultsMap.sells[i].direction != undefined && resultsMap.sells[i].direction != "" && resultsMap.sells[i].floor != undefined && resultsMap.sells[i].floor != 0){
|
|
direction_floor += "/";
|
|
}
|
|
direction_floor += (resultsMap.sells[i].floor == undefined || resultsMap.sells[i].floor == 0)?"":resultsMap.sells[i].floor + "层";
|
|
htmlChengJiao += "<div class='item-after'><em>"+tempTotalPrice+"</em></div></div>";
|
|
htmlChengJiao += "<div class='item-title-row'><div class='item-title'><span>"+direction_floor+"</span></div>";
|
|
htmlChengJiao += "<div class='item-after'><span>"+tempAvgPrice+"</span></div></div>";
|
|
htmlChengJiao += "<div class='item-subtitle'><span class='tag'><small>"+tradeDate+"</small></span></div></div></a></li>";
|
|
}
|
|
htmlChengJiao += '</ul></div></div>';
|
|
}
|
|
if(resultsMap.disSellHouses!=null && resultsMap.disSellHouses.length>0){
|
|
if(resultsMap.sells!=null && resultsMap.sells.length>0){
|
|
htmlChengJiao += '<div id="tabDeal2" class="tab"><div class="list-block media-list"><ul>';
|
|
}else{
|
|
htmlChengJiao += '<div id="tabDeal2" class="tab active"><div class="list-block media-list"><ul>';
|
|
}
|
|
for(var i in resultsMap.disSellHouses){
|
|
htmlChengJiao += '<li><a class="item-content"><div class="item-inner"><div class="item-title-row">';
|
|
htmlChengJiao += "<div class='item-title'><span class='c3 c3a'>"+resultsMap.disSellHouses[i].districtName+"</span></div>";
|
|
var tempTotalPrice = resultsMap.disSellHouses[i].totalPrice == 0?"暂无":(parseFloat(resultsMap.disSellHouses[i].totalPrice)/10000).toFixed(2)+"万";
|
|
var tempAvgPrice = resultsMap.disSellHouses[i].avgPrice == 0?"暂无":resultsMap.disSellHouses[i].avgPrice+"元/㎡";
|
|
var tradeDate = (resultsMap.disSellHouses[i].tradeDate == undefined || resultsMap.disSellHouses[i].tradeDate == null)?"暂无":formatTime(resultsMap.disSellHouses[i].tradeDate)+"签约";
|
|
var direction_floor = (resultsMap.disSellHouses[i].direction == undefined || resultsMap.disSellHouses[i].direction == "")?"":resultsMap.disSellHouses[i].direction;
|
|
//如果direction/floor同时存在, 中间加一个"/"
|
|
if(resultsMap.disSellHouses[i].direction != undefined && resultsMap.disSellHouses[i].direction != "" && resultsMap.disSellHouses[i].floor != undefined && resultsMap.disSellHouses[i].floor != 0){
|
|
direction_floor += "/";
|
|
}
|
|
direction_floor += (resultsMap.disSellHouses[i].floor == undefined || resultsMap.disSellHouses[i].floor == 0)?"":resultsMap.disSellHouses[i].floor + "层";
|
|
htmlChengJiao += "<div class='item-after'><em>"+tempTotalPrice+"</em></div></div>";
|
|
htmlChengJiao += "<div class='item-title-row'><div class='item-title'><span>"+direction_floor+"</span></div>";
|
|
htmlChengJiao += "<div class='item-after'><span>"+tempAvgPrice+"</span></div></div>";
|
|
htmlChengJiao += "<div class='item-subtitle'><span class='tag'><small>"+tradeDate+"</small></span></div></div></a></li>";
|
|
}
|
|
htmlChengJiao += '</ul></div></div>';
|
|
}
|
|
htmlChengJiao += '</div>';
|
|
$('#showTopic2').html(htmlChengJiao);
|
|
$('#showTopic2').show();
|
|
}
|
|
}
|
|
|
|
//按照时间范围加载数据
|
|
$(".avgPriceTrend a").click(function(){
|
|
var type = $(this).attr("data-id");
|
|
$(".avgPriceTrend a").removeClass("active")
|
|
$(this).addClass('active');
|
|
loadingChart(type);
|
|
});
|
|
|
|
//时间格式方法
|
|
function formatTime(_time){
|
|
var _now = new Date(_time);
|
|
var _year = _now.getFullYear();
|
|
var _month = _now.getMonth()+1;
|
|
var _date = _now.getDate();
|
|
return _year + "/" + _month + "/" + _date;
|
|
}
|
|
|
|
//时间格式方法
|
|
function formatTime_(_time){
|
|
var _now = new Date(_time);
|
|
var _year = _now.getFullYear();
|
|
var _month = _now.getMonth()+1;
|
|
var _date = _now.getDate();
|
|
return _year + "-" + _month + "-" + _date;
|
|
}
|
|
|
|
document.addEventListener('plusready', onPlusReady, false);
|
|
|
|
function onPlusReady(){
|
|
var self = plus.webview.currentWebview();
|
|
houseId = self.houseId;
|
|
disName = self.name;
|
|
disRegion = self.region;
|
|
disCity = self.city;
|
|
//初始化数据
|
|
getAnalysisDetail();
|
|
//初始化图表
|
|
loadingChart($(".avgPriceTrend").find("a.active").attr("data-id"));
|
|
} |