137 lines
5.8 KiB
JavaScript
137 lines
5.8 KiB
JavaScript
// 加载flag
|
|
var mh_loading = false;
|
|
|
|
//分页部分参数定义
|
|
var mh_page;
|
|
var mh_pageSize;
|
|
var mh_totalPages;
|
|
var mh_totalRecords;
|
|
|
|
// 上次加载的序号
|
|
var mh_lastIndex;
|
|
// 每次加载添加多少条目
|
|
var mh_itemsPerLoad;
|
|
// 最多可加载的条目
|
|
var mh_maxItems = 100;
|
|
|
|
//我的收藏查询请求
|
|
function selectHouseInfoList(){
|
|
axios.get(BASE_PATH + "/rest/index/ourHouseInfoList",
|
|
{
|
|
params: {
|
|
page: mh_page,
|
|
pageSize: mh_pageSize
|
|
}
|
|
}).then(function (response) {
|
|
var resultsMap = response.data.data;
|
|
var resultList = resultsMap.houseInfoPageList.list;
|
|
var xqOneMonthUpDownRangeMap = resultsMap.xqOneMonthUpDownRangeMap;
|
|
var xqPotentialIndexMap = resultsMap.xqPotentialIndexMap;
|
|
var houseInfoTotalMap = resultsMap.houseInfoTotalMap;
|
|
if(resultList != null && resultList.length == 0){
|
|
// 删除加载提示符
|
|
$('#loadTip1').remove();
|
|
//$('.infinite-scroll-preloader').remove();
|
|
// 加载完毕,则注销无限加载事件,以防不必要的加载
|
|
//$.detachInfiniteScroll($('.infinite-scroll'));
|
|
return;
|
|
}
|
|
if(resultsMap.houseInfoPageList.currentPage == resultsMap.houseInfoPageList.totalPages){
|
|
//如果此次查询刚好是page = totalPages
|
|
// 删除加载提示符
|
|
$('#loadTip1').remove();
|
|
//$('.infinite-scroll-preloader').remove();
|
|
// 加载完毕,则注销无限加载事件,以防不必要的加载
|
|
//$.detachInfiniteScroll($('.infinite-scroll'));
|
|
}
|
|
//封装list数据
|
|
var dataObj = [];
|
|
for(var i in resultList){
|
|
dataObj.push(resultList[i])
|
|
}
|
|
// 上次加载的序号
|
|
mh_lastIndex = $('.cardInfo').length;
|
|
//每次加载添加多少条目
|
|
mh_itemsPerLoad = resultList.length;
|
|
//请求后对page进行赋值
|
|
mh_page = resultsMap.houseInfoPageList.currentPage;
|
|
mh_pageSize = resultsMap.houseInfoPageList.limit;
|
|
mh_totalPages = resultsMap.houseInfoPageList.totalPages;
|
|
mh_totalRecords = resultsMap.houseInfoPageList.totalRecords;
|
|
tab.mh_num = mh_totalRecords;
|
|
mhAddItems(mh_itemsPerLoad, mh_lastIndex, dataObj, xqOneMonthUpDownRangeMap, xqPotentialIndexMap, houseInfoTotalMap);
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
/* 分页构造数据 */
|
|
function mhAddItems(itemsPerLoad, lastIndex, dataObj, xqOneMonthUpDownRangeMap, xqPotentialIndexMap, houseInfoTotalMap) {
|
|
var html = '';
|
|
for(var i in dataObj) {
|
|
var result = dataObj[i];
|
|
var tempTotalPrice = result.totalPrice;
|
|
//可抵押贷额度
|
|
var tempTotalPricePercent;
|
|
//考虑是否为数字,加强逻辑判断
|
|
if(!isNaN(tempTotalPrice)){
|
|
//转换成元,四舍五入
|
|
tempTotalPricePercent = (parseFloat(tempTotalPrice)*0.7/10000).toFixed(2);
|
|
tempTotalPrice = (parseFloat(tempTotalPrice)/10000).toFixed(2);
|
|
}
|
|
html += '<li onclick="gotoHouseDetail(\''+result.id+'\')"><a href="#" class="item-content">';
|
|
html += "<div class='item-inner'><div class='item-title-row'>";
|
|
html += "<div class='item-title'>"+result.name+" <em>"+tempTotalPrice+"万</em><span class='tag'><small>"+result.liveStatus+"</small></span></div>";
|
|
html += "</div><div class='item-subtitle'>";
|
|
|
|
//对应城市地区小区30天涨跌幅
|
|
var xqOneMonthUpDownRangeKey = result.city+"-"+result.region +"-"+result.name;
|
|
var xqOneMonthUpDownRangeValue = xqOneMonthUpDownRangeMap[xqOneMonthUpDownRangeKey];
|
|
if(!isNaN(xqOneMonthUpDownRangeValue)){
|
|
//涨跌幅大于零
|
|
if(parseFloat(xqOneMonthUpDownRangeValue)>=0){
|
|
html += "<div>近30天涨跌幅: <em class='up'>"+xqOneMonthUpDownRangeValue+"%<i class='icon icon-arrow-red'></i></em></div>";
|
|
}else{
|
|
html += "<div>近30天涨跌幅: <em class='down'>"+Math.abs(xqOneMonthUpDownRangeValue)+"%<i class='icon icon-arrow-green'></i></em></div>";
|
|
}
|
|
}else{
|
|
html += "<div>近30天涨跌幅: <em class='down'> %<i class='icon icon-arrow-green'></i></em></div>";
|
|
}
|
|
|
|
//下跌概率
|
|
var xqPotentialIndexValue = xqPotentialIndexMap[xqOneMonthUpDownRangeKey];
|
|
if(!isNaN(xqPotentialIndexValue)){
|
|
//涨跌幅大于零
|
|
if(parseInt(xqPotentialIndexValue)>=50){
|
|
html += "<div>下跌概率: <em class='up'>"+xqPotentialIndexValue+"%<i class='icon icon-arrow-red'></i></em></div>";
|
|
}else{
|
|
html += "<div>下跌概率: <em class='down'>"+(parseInt(100)-parseInt(xqPotentialIndexValue))+"%<i class='icon icon-arrow-green'></i></em></div>";
|
|
}
|
|
}else{
|
|
html += "<div>下跌概率: <em class='down'> %<i class='icon icon-arrow-green'></i></em></div>";
|
|
}
|
|
|
|
html += "<div>抵押可贷额度: <em style='color:#EB5F34;'>"+tempTotalPricePercent+"万</em></div></div></div></a>";
|
|
|
|
if(result.level!=null && result.level == 1){
|
|
html += "<a class='add alert-text-title'><i class='icon icon-houseLevel'></i>豪宅级</a>";
|
|
}else if(result.level!=null && result.level == 2){
|
|
html += "<a class='add alert-text-title'><i class='icon icon-houseLevel'></i>公寓级</a>";
|
|
}else if(result.level!=null && result.level == 3){
|
|
html += "<a class='add alert-text-title'><i class='icon icon-houseLevel'></i>平房级</a>";
|
|
}else if(result.level!=null && result.level == 4){
|
|
html += "<a class='add alert-text-title'><i class='icon icon-houseLevel'></i>草屋级</a>";
|
|
}else if(result.level!=null && result.level == 5){
|
|
html += "<a class='add alert-text-title'><i class='icon icon-houseLevel'></i>山洞级</a>";
|
|
}else{
|
|
html += "<a class='add alert-text-title'><i class='icon icon-houseLevel'></i>其他</a>";
|
|
}
|
|
html += '<a class="button theme add add01 add01a" href="#" onclick="gotoLoanApply(\''+result.id+'\', \''+result.city+'\')">立即申请</a></li>';
|
|
}
|
|
$('#myhouse').append(html);
|
|
}
|
|
|
|
/* 说明-房产等级 */
|
|
$(document).on('click','.alert-text-title', function () {
|
|
$.alert('房产等级是房屋在城市中的综合评级,由高至低分别为 豪宅、公寓、平房、草屋、山洞共5个级别。', '房产等级');
|
|
}); |