Files
youfang-app/fangija-zsyf/views/component/baseInfoComponent.js
T
2018-04-08 19:24:29 +08:00

176 lines
4.9 KiB
JavaScript

var dataParam = {
finishBuildingDate:"",
householdCount:"",
cubagePercent:"",
carSiteCount:"",
virescencePercent:"",
estateCharge:"",
moreArea:"",
developer:"",
estateCompany:""
};
Vue.component('base-info-component', {
template: `
<ul>
<li>
<a class="item-content">
<div class="item-inner" style="padding-top:0.75rem;padding-bottom:0.25rem;">
<div class="item-title-row">
<div class="item-title">基本信息</div>
</div>
</div>
</a>
</li>
<li>
<a class="item-content">
<div class="item-inner" style="padding-top:0;">
<div class="item-title-row">
<div class="item-title row">
<div class="col-50">
<p>
<label>竣工年代:</label>
<span>{{finishBuildingDate}}</span>
</p>
<p>
<label>容<small class="spacing01a">&nbsp;</small>积<small class="spacing01a">&nbsp;</small>率:</label>
<span>{{cubagePercent}}</span>
</p>
<p>
<label>绿<small class="spacing01a">&nbsp;</small>化<small class="spacing01a">&nbsp;</small>率:</label>
<span>{{virescencePercent}}</span>
</p>
<p>
<label>主力面积:</label>
<span>{{moreArea}}</span>
</p>
<p>
<label>开<small class="spacing01a">&nbsp;</small>发<small class="spacing01a">&nbsp;</small>商:</label>
<span class="span01">{{developer}}</span>
</p>
<p>
<label>物业公司:</label>
<span class="span01">{{estateCompany}}</span>
</p>
</div>
<div class="col-50">
<p>
<label>总<small class="spacing01a">&nbsp;</small>户<small class="spacing01a">&nbsp;</small>数:</label>
<span>{{householdCount}}</span>
</p>
<p>
<label>停<small class="spacing01a">&nbsp;</small>车<small class="spacing01a">&nbsp;</small>位:</label>
<span>{{carSiteCount}}</span>
</p>
<p>
<label>物<small class="spacing01a">&nbsp;</small>业<small class="spacing01a">&nbsp;</small>费:</label>
<span>{{estateCharge}}元/㎡/月</span>
</p>
</div>
</div>
</div>
</div>
</a>
</li>
</ul>
`,
data: function(){
return dataParam;
},
methods: {
loadDistrictInfo:function(){
axios.get("/rest/districts/detail", {
params: {
city: city,
region:region,
name: name
}
}).then(function (response) {
var vo = response.data.data.detail
var cityPrice = response.data.data.cityPrice
var collected = response.data.data.collected
// if(cityPrice){
// baseInfo.cityPrice = cityPrice
// }
// if(collected){
// baseInfo.collect = true;
// }else{
// baseInfo.collect = false;
// }
if(vo){
if(vo.avgPrice){
lat = vo.lat2;
lng = vo.lng2;
alert("lng-1:"+lng);
// loadMapPoi();
//
// baseInfo.city = vo.city
// baseInfo.region = vo.region
// baseInfo.address = vo.address;
// baseInfo.districtName = vo.name
// baseInfo.avgPrice = vo.avgPrice;
// baseInfo.oneMonthUpDownRange = vo.oneMonthUpDownRange;
// if(vo.rank){
// baseInfo.priceRate = vo.rank.substring(0, vo.rank.indexOf("/"));
// }
//baseInfo.cityPrice = vo.cityPrice;
var finishDate = ""
if(vo.finishBuildingDate){
if(vo.finishBuildingDate.indexOf("~")!=-1){
finishDate = vo.finishBuildingDate.replace("年","");
}else{
finishDate = vo.finishBuildingDate.substring(0,4)+"年"
}
}
dataParam.finishBuildingDate = finishDate;
dataParam.householdCount = vo.householdCount;
dataParam.cubagePercent = vo.cubagePercent;
dataParam.carSiteCount = vo.carSiteCount;
dataParam.virescencePercent = vo.virescencePercent;
dataParam.estateCharge = vo.estateCharge;
dataParam.moreArea = vo.moreArea;
dataParam.developer = vo.developer;
dataParam.estateCompany = vo.estateCompany;
// address = vo.address;
// tags = vo.poiTags;
// if(vo.poiTags){
// if(vo.poiTags.length>=3){
// baseInfo.tags = vo.poiTags.slice(0,3);
// }else{
// baseInfo.tags = vo.poiTags;
// }
// }
// loadNearDistrict(vo.lat2, vo.lng2);
}else{
$("#noDataDiv").show()
//baseInfo.districtName = "小区详情"
}
}
}).catch(function (error) {
alert(error)
console.log(error);
});
}
},mounted:function(){
this.loadDistrictInfo();
}
})