Files
youfang-app/fangija-zsyf/views/house/houseManageList.html
T
2018-05-28 17:34:20 +08:00

361 lines
13 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>房产评估</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="../../css/sm.css">
<link rel="stylesheet" href="../../css/main.css">
<link rel="stylesheet" href="../../css/theme-orange.css">
<style>
.list-block .item-title{font-size:0.85rem;}
.list-block .item-title span.span01{font-size:0.7rem;color:#666;margin-left:0.3rem;}
.icon-add{width:0.6rem;height:0.6rem;background:url(../../images/icon-add.png) no-repeat center center;background-size:100%;margin-right:0.3rem;}
.star .icon{width:0.7rem;height:0.7rem;background:url(../../images/icon-star.png) no-repeat center center;background-size:100%;margin-right:0.1rem;vertical-align:sub;}
.star .icon-star01{background:url(../../images/icon-star01.png) no-repeat center center;background-size:100%;}
.star .icon-star02{background:url(../../images/icon-star02.png) no-repeat center center;background-size:100%;}
.list-block .add{background:none;font-size:0.75rem;color:#F18D00;position:absolute;top:0;right:0;padding:0.5rem 0.75rem;}
.list-block .add01{padding:0 0.5rem;top:1.1rem;right:0.75rem;}
.list-block .item-subtitle em.em02{font-size:0.75rem;color:#EB5F34;}
.list-block .item-subtitle div.price{position:absolute;bottom:-0.3rem;right:0;}
.list-block .item-subtitle div.price em strong{font-size:1.4rem;color:#EB5F34;font-weight:bold;margin-right:0.1rem;}
/**添加loading加载效果**/
.loadingBgDiv{width:100%;height:70%;background:#fff;overflow:hidden;position:absolute;top:2.2rem;left:0;z-index:100;}
.loadingBgDiv .infinite-scroll-preloader{margin-top:60%;}
.list-block{margin-bottom:4rem;}
.content-block{width:100%;background:#fff;position:fixed;bottom:0;z-index:10000;}
@media(min-height:750px){
.list-block{margin-bottom:4.5rem;}
.content-block{bottom:4.5rem;}
}
</style>
</head>
<body>
<div class="page-group">
<div class="page page-current" id="dataList" style="display: none;">
<header class="bar bar-nav">
<!--<button class="button button-link button-nav pull-left" onclick="back(),plus.nativeUI.closeWaiting();">
<span class="icon icon-left"></span>
</button>-->
<h1 class="title">房产评估</h1>
</header>
<div class="loadingBgDiv">
<div class="infinite-scroll-preloader">
<div class="preloader"></div>
</div>
</div>
<div class="content">
<a class="ad bb" href="#"><img id="img"></a>
<div class="list-block media-list">
<!-- 动态封装部分 begin -->
<ul>
</ul>
<!-- 动态封装部分 end -->
</div>
</div>
<div class="content-block bar-footer" style="display: none;">
<p><a onclick="openaddWindow()" class="button button-big button-fill theme">立即评估</a></p>
</div>
</div>
<div class="page page-current" id="noData" style="display: none;">
<header class="bar bar-nav barBorder">
<h1 class="title">房产评估</h1>
</header>
<div class="loadingBgDiv">
<div class="infinite-scroll-preloader">
<div class="preloader"></div>
</div>
</div>
<div class="content contentSuggest">
<div class="noData">
<img src="../../images/noData.png">
<p>评估房产&nbsp;&nbsp;发现价值</p>
<div class="content-block bar-footer">
<p><a onclick="openaddWindow()" class="button button-big button-fill theme">立即评估</a></p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../../js/zepto.js" charset="utf-8"></script>
<script>
/* 关闭路由,以实现不同页面之间的相互跳转(仅开发环境需要) */
Zepto = $
$.config = {router: false}
</script>
<script type="text/javascript" src="../../js/beacon_release.js"></script>
<script type="text/javascript" src="../../js/vue.js"></script>
<script type="text/javascript" src="../../js/light7.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/cn.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/mui.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../../config.js"></script>
<script type="text/javascript" src="../../js/common.js" ></script>
<script type="text/javascript" src="../../js/axios.min.js"></script>
<script type="text/javascript" src="../../js/axiosPlugin.js"></script>
<script type="text/javascript" src="../../js/shara/sharaMine.js" ></script>
<script type="text/javascript" src="../../js/log/log_stat.js" ></script>
<script type="text/javascript" src="../../js/ad_position_image.js"></script>
<script type="text/javascript" src="../../config.js"></script>
<!--加解密 start-->
<script type="text/javascript" src="../../js/aes.js" ></script>
<script type="text/javascript" src="../../js/crypto-js.js" ></script>
<script type="text/javascript" src="../../js/pad-zeropadding.js" ></script>
<script type="text/javascript" src="../../js/AES_UTILS.js" ></script>
<!--加解密 end-->
<script>
//调用mui.init方法
$.init();
/* 房产用途 */
$(document).on('click','.open-vertical-modal', function () {
//获取对应<li>栏目存储的houseinfo id
var id = $(this).attr("id");
var houseStatus = 0;
$.modal({
title: '房产用途',
verticalButtons: true,
buttons: [
{
text: '自住',
onClick: function() {
addManagement(id, houseStatus, "自住");
}
},
{
text: '出租',
onClick: function() {
addManagement(id, houseStatus, "出租");
}
},
{
text: '空置',
onClick: function() {
addManagement(id, houseStatus, "空置");
}
},
{
text: '取消'
}
]
})
});
//删除房产AJAX请求
$(document).on("click",".confirm-ok", function () {
//获取删除的房产id
var id = $(this).attr("id");
$.confirm("确定删除?", function () {
var eventType = "delateEvaluateClick";
var dataMap = {};
dataMap["hid"]=id;
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
axios.post(BASE_PATH + "/rest/index/deleteHouseInfoByStatus",
{
id: id
}).then(function (response) {
var status = response.data.status;
if(status){
$.toast(response.data.data);
$('.loadingBgDiv').show();
checkIsLogin();
//删除评估房产不会影响个人中心房产列表, 不用刷新
/*if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}*/
//plus.webview.getWebviewById('yfindex.html').reload();
}else{
$.toast(response.data.message);
}
}).catch(function (error) {
console.log(error);
});
});
$(".modal-text").css("text-align","center");
});
//添加管理AJAX请求
function addManagement(id, houseStatus, liveStatus){
axios.post(BASE_PATH + "/rest/evaluate/addManagement",
{
id: id,
houseStatus: houseStatus,
liveStatus: liveStatus
}).then(function (response) {
var status = response.data.status;
if(status){
var eventType = "addEvaluateManageClick";
var dataMap = {};
dataMap["hid"]=id;
dataMap["liveStatus"]=liveStatus;
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
$.toast(response.data.data);
$('.loadingBgDiv').show();
checkIsLogin();
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
//plus.webview.getWebviewById('yfindex.html').reload();
}else{
$.toast(response.data.message);
}
}).catch(function (error) {
console.log(error);
});
}
//查询房产评估列表AJAX请求
function selectEvaluateList(){
//先清空列表
$('.list-block ul').html("");
var htmlContent = '';
axios.get(BASE_PATH + "/rest/evaluate/houseinfolist",
{
params: {}
}).then(function (response) {
var resultsMap = response.data.data;
if(response.data.data==null || resultsMap.houseInfoList==null || resultsMap.houseInfoList.length==0){
$('#dataList').hide();
$('#noData').show();
$('.loadingBgDiv').hide()
}else{
$('#dataList').show();
$('#noData').hide();
$('.loadingBgDiv').hide()
var results = resultsMap.houseInfoList;
var xqOneMonthUpDownRangeMap = resultsMap.xqOneMonthUpDownRangeMap;
var cityAvgPriceMap = resultsMap.cityAvgPriceMap;
//构造数据列表
htmlContent = constructHtmlContent(results, xqOneMonthUpDownRangeMap, cityAvgPriceMap, htmlContent);
//动态追加内容
$('.list-block ul').html(htmlContent);
//添加loading等待效果
//$(".loadingBg").hide();
$(".content-block").show();
}
}).catch(function (error) {
console.log(error);
});
}
//动态构造房产评估列表
function constructHtmlContent(results, xqOneMonthUpDownRangeMap, cityAvgPriceMap, htmlContent){
if(results!=null && results.length>0){
for(var i in results){
var result = results[i];
htmlContent = htmlContent +'<li><a onclick="openReportWindow(\''+result.id+'\')" class="item-content">';
htmlContent = htmlContent +"<div class='item-inner'><div class='item-title-row'>";
htmlContent = htmlContent +"<div class='item-title'><label>"+result.name+"</label><span class='span01'>"+result.city+"-"+result.region+"</span></div>";
htmlContent = htmlContent +"</div><div class='item-title-row'>";
//htmlContent = htmlContent +"<div class='item-title'><small>"+result.roomCount+"室"+result.hallCount+"厅";
var houseRoomNum = result.houseRoomNum==""?"暂无":result.houseRoomNum;
htmlContent = htmlContent +"<div class='item-title'><small>"+houseRoomNum;
var floor_height = "";
if(result.floor!=0){
floor_height = result.floor;
}
if(result.height!=0){
floor_height += "/" + result.height;
}
if(floor_height!=""){
floor_height+="层";
}
htmlContent = htmlContent +"&nbsp;&nbsp;"+result.area+"㎡&nbsp;&nbsp;"+floor_height+"</small></div>"
htmlContent = htmlContent +"</div><div class='item-subtitle'>";
//对应城市地区小区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 + "<div>近30天涨跌幅: <em class='up'>"+xqOneMonthUpDownRangeValue+"%<i class='icon icon-arrow-red'></i></em></div>";
}else{
//涨跌幅小于零
htmlContent = htmlContent + "<div>近30天涨跌幅: <em class='down'>"+Math.abs(xqOneMonthUpDownRangeValue)+"%<i class='icon icon-arrow-green'></i></em></div>";
}
}else{
//为非数字清空放空格
htmlContent = htmlContent + "<div>近30天涨跌幅: <em class='down'>暂无<i class='icon'></i></em></div>";
}
//相比对于城市均价
var cityAvgPriceKey = result.city;
//取得对应城市的value
var cityAvgPriceValue = cityAvgPriceMap[cityAvgPriceKey];
if(!isNaN(cityAvgPriceValue) && result.price>0){
if(parseInt(cityAvgPriceValue)>parseInt(result.price)){
htmlContent = htmlContent + "<div>相比"+result.city+"均价: <em class='down'>低"+(parseInt(cityAvgPriceValue)-parseInt(result.price))+"元</em></div>";
}else{
htmlContent = htmlContent + "<div>相比"+result.city+"均价: <em class='up'>高"+(parseInt(result.price)-parseInt(cityAvgPriceValue))+"元</em></div>";
}
}else{
//为非数字清空放空格
htmlContent = htmlContent + "<div>相比"+result.city+"均价: <em class='down'>暂无</em></div>";
}
var tempTotalPrice = (result.totalPrice) == 0?"暂无</strong>":(parseFloat(result.totalPrice)/10000).toFixed(2)+"</strong>万";
var tempPrice = (result.price) == 0?"暂无":result.price+"元/㎡";
htmlContent = htmlContent + "<div>均价: <em class='em02'>"+tempPrice+"</em></div>";
htmlContent = htmlContent + "<div class='price'><em><strong>"+tempTotalPrice+"</em></div>";
htmlContent = htmlContent + "</div></div></a><a class='add open-vertical-modal' id="+result.id+" uid="+result.uid+" houseStatus="+result.houseStatus+"><i class='icon icon-add'></i>添加管理</a>"
htmlContent = htmlContent +"<i class='delete confirm-ok' id="+result.id+"></i></li>";
}
}
return htmlContent;
}
//立即评估
function openaddWindow(){
var eventType = "evaluateClick";
var dataMap = {};
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
clicked('/views/house/add.html',true,false,{},{type:1},function(){
})
}
//评估报告详情
function openReportWindow(id){
clicked('/views/evaluate/evaluateReport.html',true,false,{},{hid:id})
}
//判断是否登录
function checkIsLogin(){
if(localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == ""){
$('#dataList').hide();
$('#noData').show();
$('.loadingBgDiv').hide();
}else{
selectEvaluateList();
}
}
document.addEventListener('plusready', onPlusReady, false);
function onPlusReady(){
checkIsLogin();
var device = plus.device.uuid;
add_imgage("img",EVALUATE_LIST,device);//传入广告位的imgId
}
</script>
</body>
</html>