Commit f93022d6 by felix

每日一更

parent ac609451
...@@ -92,6 +92,23 @@ class Contract_List extends WP_List_Table{ ...@@ -92,6 +92,23 @@ class Contract_List extends WP_List_Table{
left join tospur_house th on th.id = t.houseId left join tospur_house th on th.id = t.houseId
left join tospur_status ts on ts.status_type = 4 and t.status = ts.status_id left join tospur_status ts on ts.status_type = 4 and t.status = ts.status_id
where 1=1 "; where 1=1 ";
//根据房源编号搜索
$search_type = $_REQUEST['search_type'];
if(isset($_REQUEST[$search_type]) && $search_type == 'search_contractId'){
$sql .= " and t.contractId = '".$_REQUEST["search_contractId"]."'";
}
if(isset($_REQUEST["beginDate"]) &&isset($_REQUEST["endDate"]) &&$search_type == 'search_signedDate') {
$sql .= " and t.signedDate between '".$_REQUEST["beginDate"]."' and '".$_REQUEST["endDate"]."'";
}
if(isset($_REQUEST[$search_type]) && $search_type == 'search_OCname'){
$sql .= " and oName like '%".$_REQUEST["search_OCname"]."%' or cName like '%".$_REQUEST["search_OCname"]."%'";
}
if(isset($_REQUEST[$search_type]) && $search_type == 'search_OCbroker'){
$sql .= " and oBroker like '%".$_REQUEST["search_OCbroker"]."%' or cBroker like '%".$_REQUEST["search_OCbroker"]."%'";
}
//置业顾问显示自己的合同 //置业顾问显示自己的合同
if(current_user_can("zygw")){ if(current_user_can("zygw")){
$sql .= " and t.consultantId = ".get_current_user_id(); $sql .= " and t.consultantId = ".get_current_user_id();
......
...@@ -35,12 +35,15 @@ class House extends Tospur_House{ ...@@ -35,12 +35,15 @@ class House extends Tospur_House{
'room_id' => $_POST['baseRoom'], 'room_id' => $_POST['baseRoom'],
"location" => $_POST["location"], "location" => $_POST["location"],
"property_money" => $_POST["property_money"], "property_money" => $_POST["property_money"],
'community_name' => $_POST["community_name"] 'community_name' => $_POST["community_name"],
'publicize' => $_POST["publicize"],
'threeD' => $_POST["threeD"],
'roundLook' => $_POST["roundLook"]
); );
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){ if(isset($_POST['houseId'])){
//修改list中当前状态的方法 //修改list中当前状态的方法
$insert_tospur_house_array = House::list_status_upate($_POST["userType"],$_POST["status"],$insert_tospur_house_array); $insert_tospur_house_array = House::list_status_upate($_POST["houseId"],$_POST["status"],$insert_tospur_house_array);
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array); $result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
if(!is_numeric($result)){ if(!is_numeric($result)){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
...@@ -73,6 +76,7 @@ class House extends Tospur_House{ ...@@ -73,6 +76,7 @@ class House extends Tospur_House{
$context["status"] = searchDao::searchStatusType(1); $context["status"] = searchDao::searchStatusType(1);
} }
$context['canApproval'] = House::canApproval(); $context['canApproval'] = House::canApproval();
$context['canEdit'] = House::canEdit();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
......
...@@ -251,6 +251,7 @@ class Statistics { ...@@ -251,6 +251,7 @@ class Statistics {
} }
foreach($consultant as $key => $item){ foreach($consultant as $key => $item){
if($key>0){
$where = array( $where = array(
"consultantId" => $key, "consultantId" => $key,
"date" => $today "date" => $today
...@@ -258,6 +259,7 @@ class Statistics { ...@@ -258,6 +259,7 @@ class Statistics {
Statistics::updateBusiness($item,$where); Statistics::updateBusiness($item,$where);
} }
} }
}
public static function updateBusiness($params,$where){ public static function updateBusiness($params,$where){
global $wpdb; global $wpdb;
......
...@@ -5,6 +5,10 @@ class Tospur_House{ ...@@ -5,6 +5,10 @@ class Tospur_House{
return current_user_can("houseApproval"); return current_user_can("houseApproval");
} }
public static function canEdit(){
return current_user_can("canEdit");
}
public static function getCurrentRole(){ public static function getCurrentRole(){
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) ) if ( !($current_user instanceof WP_User) )
...@@ -13,9 +17,10 @@ class Tospur_House{ ...@@ -13,9 +17,10 @@ class Tospur_House{
return $roles[0]; return $roles[0];
} }
public static function list_status_upate($userType,$postStatus,$arrayParams){ public static function list_status_upate($houseId,$postStatus,$arrayParams){
//首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态 //首先使用role判断是经理还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($userType == 0){ $role = Tospur_House::getCurrentRole();
if($role == "jl"|| $role == "xzzl"){
//经理 //经理
//通过 //通过
if($postStatus != -2){ if($postStatus != -2){
...@@ -25,19 +30,22 @@ class Tospur_House{ ...@@ -25,19 +30,22 @@ class Tospur_House{
//退回 //退回
$arrayParams["approval"] = $postStatus; $arrayParams["approval"] = $postStatus;
} }
}else{ }else if ($role == "zygw"){
//置业顾问 //置业顾问
//修改了状态 //修改了状态
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]); $currentStatus = SearchDao::getDetailInfo($houseId);
if($currentStatus["result"]->status != $postStatus){ if($currentStatus["result"]->status != $postStatus){
$arrayParams["status"] = 0;
$arrayParams["approval"] = $postStatus; $arrayParams["approval"] = $postStatus;
}else { }else {
//没有修改状态 //没有修改状态
//没有申请审批 //没有申请审批
if($currentStatus["result"]->approval == -2){ if($currentStatus["result"]->approval == -2){
$arrayParams["status"] = 0;
$arrayParams["approval"] = $currentStatus["result"]->status; $arrayParams["approval"] = $currentStatus["result"]->status;
}else{ }else{
//申请了审批,没有修改状态,approval保持原来的 //申请了审批,没有修改状态,approval保持原来的
$arrayParams["status"] = 0;
$arrayParams["approval"] = $currentStatus["result"]->approval; $arrayParams["approval"] = $currentStatus["result"]->approval;
} }
} }
...@@ -45,6 +53,7 @@ class Tospur_House{ ...@@ -45,6 +53,7 @@ class Tospur_House{
return $arrayParams; return $arrayParams;
} }
//获得当前登录置业顾问所在门店的所有置业顾问id
public static function get_oganization_consultant(){ public static function get_oganization_consultant(){
global $wpdb; global $wpdb;
$string = null; $string = null;
......
...@@ -57,7 +57,7 @@ class introduction ...@@ -57,7 +57,7 @@ class introduction
$context['user_id'] = $user_id; $context['user_id'] = $user_id;
if($type == 1){ if($type == 1){
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(!$_POST['oldImg']){ if(!$_POST['oldImg']&&$result->QRcodeImg){
$url = substr_replace(__DIR__,$result->QRcodeImg,strpos(__DIR__,"wp",0)-1); $url = substr_replace(__DIR__,$result->QRcodeImg,strpos(__DIR__,"wp",0)-1);
unlink($url); unlink($url);
} }
......
...@@ -153,7 +153,7 @@ sum(p.stockSellH) as sum_stockSellH,sum(p.stockLeaseH) as sum_stockLeaseH,sum(p. ...@@ -153,7 +153,7 @@ sum(p.stockSellH) as sum_stockSellH,sum(p.stockLeaseH) as sum_stockLeaseH,sum(p.
$statistical_time = $_REQUEST['statistical_time']; $statistical_time = $_REQUEST['statistical_time'];
if (isset($_REQUEST[$statistical_time]) && $statistical_time == 'day') { if (isset($_REQUEST[$statistical_time]) && $statistical_time == 'day') {
$sql .= " and sb.date = " . $_REQUEST[$statistical_time]; $sql .= " and sb.date = '" . $_REQUEST[$statistical_time] . "'";
} }
if (isset($_REQUEST[$statistical_time]) && $statistical_time == 'week') { if (isset($_REQUEST[$statistical_time]) && $statistical_time == 'week') {
$sql .= " and sb.date >= '" . $_REQUEST[$statistical_time] . "' and sb.date < DATE_SUB('" . $_REQUEST[$statistical_time] . "', INTERVAL -1 WEEK)"; $sql .= " and sb.date >= '" . $_REQUEST[$statistical_time] . "' and sb.date < DATE_SUB('" . $_REQUEST[$statistical_time] . "', INTERVAL -1 WEEK)";
......
...@@ -90,6 +90,7 @@ class RentHouse extends Tospur_House{ ...@@ -90,6 +90,7 @@ class RentHouse extends Tospur_House{
$context["status"] = searchDao::searchStatusType(2); $context["status"] = searchDao::searchStatusType(2);
} }
$context['canApproval'] = House::canApproval(); $context['canApproval'] = House::canApproval();
$context['canEdit'] = House::canEdit();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
......
...@@ -89,6 +89,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -89,6 +89,7 @@ class SecHandHouse extends Tospur_House{
} }
$context['canApproval'] = House::canApproval(); $context['canApproval'] = House::canApproval();
$context['canEdit'] = House::canEdit();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
......
...@@ -23,11 +23,35 @@ class upload ...@@ -23,11 +23,35 @@ class upload
echo '<script>alert("解压文件失败");</script>'; echo '<script>alert("解压文件失败");</script>';
} }
@unlink($file); @unlink($file);
upload::delDir($to);
} }
Timber::render('upload.html'); Timber::render('upload.html');
} }
public static function delDir($dir)
{
//先删除目录下的文件
$dh = opendir($dir);
while ($file = readdir($dh)) {
if ($file != "." && $file != "..") {
$fullpath = $dir . "/" . $file;
if (!is_dir($fullpath)) {
unlink($fullpath);
} else {
upload::delDir($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹
if (rmdir($dir)) {
return true;
} else {
return false;
}
}
public static $houseType; public static $houseType;
public static function searchDir($path, &$data) public static function searchDir($path, &$data)
{ {
...@@ -178,7 +202,7 @@ class upload ...@@ -178,7 +202,7 @@ class upload
$district_id = upload::search_district_id($sheet->getCell('B9')->getValue()); $district_id = upload::search_district_id($sheet->getCell('B9')->getValue());
$plate_id = upload::search_plate_id($sheet->getCell('B10')->getValue()); $plate_id = upload::search_plate_id($sheet->getCell('B10')->getValue());
$room_id = upload::search_room_id($sheet->getCell('B23')->getValue()); $room_id = upload::search_room_id($sheet->getCell('B23')->getValue());
$consultant_id = upload::search_consultant_id($sheet->getCell('B7')->getValue()); $organization_id = upload::search_organization_id($sheet->getCell('B7')->getValue());
$data = array( $data = array(
'name' => $sheet->getCell('B1')->getValue(), 'name' => $sheet->getCell('B1')->getValue(),
...@@ -207,7 +231,7 @@ class upload ...@@ -207,7 +231,7 @@ class upload
'district_id' => $district_id, 'district_id' => $district_id,
'plate_id' => $plate_id, 'plate_id' => $plate_id,
'room_id' => $room_id, 'room_id' => $room_id,
'user_id' => $consultant_id, 'organizationId' => $organization_id,
'community_name' => $sheet->getCell('B11')->getValue(), 'community_name' => $sheet->getCell('B11')->getValue(),
'suite' => $sheet->getCell('B12')->getValue(), 'suite' => $sheet->getCell('B12')->getValue(),
'buildproperty_id' => $sheet->getCell('B17')->getValue(), 'buildproperty_id' => $sheet->getCell('B17')->getValue(),
...@@ -258,7 +282,7 @@ class upload ...@@ -258,7 +282,7 @@ class upload
if ($city_id) { if ($city_id) {
return $city_id; return $city_id;
} else { } else {
return 0; return -1;
} }
} }
...@@ -268,7 +292,7 @@ class upload ...@@ -268,7 +292,7 @@ class upload
if ($district_id) { if ($district_id) {
return $district_id; return $district_id;
} else { } else {
return 0; return -1;
} }
} }
...@@ -278,7 +302,7 @@ class upload ...@@ -278,7 +302,7 @@ class upload
if ($plate_id) { if ($plate_id) {
return $plate_id; return $plate_id;
} else { } else {
return 0; return -1;
} }
} }
...@@ -292,11 +316,11 @@ class upload ...@@ -292,11 +316,11 @@ class upload
} }
} }
public static function search_consultant_id($consultant_name) public static function search_organization_id($consultant_name)
{ {
$consultant_id = DBManager::get_var('select id from tospur_consultant where name = "' . $consultant_name . '"'); $organization_id = DBManager::get_var('select subsidiaryId from tospur_consultant where name = "' . $consultant_name . '"');
if ($consultant_id) { if ($organization_id) {
return $consultant_id; return $organization_id;
} else { } else {
return 0; return 0;
} }
......
...@@ -23,10 +23,14 @@ ...@@ -23,10 +23,14 @@
{% endif %} {% endif %}
$(document).ready(function(){ $(document).ready(function(){
//添加置业顾问 //添加置业顾问
init_modal_myConsultantList(addConsultant); init_modal_myConsultantList(addConsultant);
$("#consultantImg").on("click",".consultantCancel",function(){ $("#consultantImg").on("click",".consultantCancel",function(){
$(this).parents("p").remove(); $(this).parents("p").remove();
if( $("#consultantImg > p").length == 0){
$("#subsidiaryId").remove();
}
}); });
}); });
...@@ -45,8 +49,13 @@ ...@@ -45,8 +49,13 @@
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value":data.id}); var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value":data.id});
row.append(left).append(mid).append(right); row.append(left).append(mid).append(right);
var p = $("<p>").append(row).append(recommendConsultant); var p = $("<p>").append(row).append(recommendConsultant);
var subsidiaryId = $("<input>").attr({"type":"hidden","value":data.subsidiaryId,"id":"subsidiaryId"});
if($("#consultantImg > p").length == 0){
$("#consultantImg").append(p).append(subsidiaryId);
}else{
$("#consultantImg").append(p); $("#consultantImg").append(p);
{% if (house_type == 1 or house_type == 2 or page == 'customer' or page == 'view') %} }
{% if (house_type == 1 or house_type == 2 or page == 'customer') %}
controlCommand("consultantImg",1,1); controlCommand("consultantImg",1,1);
{% endif %} {% endif %}
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<form method="get"> <form method="get">
<input type="hidden" name="page" value="commissionList"> <input type="hidden" name="page" value="commissionList">
{% import "selectOrganization.html" as macro %} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("") }} {{ macro.selectOrganization("commission") }}
<div id="search_form"> <div id="search_form">
<label for="year" class="hidden"></label> <label for="year" class="hidden"></label>
<select name="year" id="year"> <select name="year" id="year">
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('form').submit(function () { $('form').submit(function () {
var organization = getOrganization(); var organization = getOrganization('commission');
var select = $('select[data-depth]:not(.hidden)'); var select = $('#commission_organization').find('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) { if (select.length > 1 && organization == -1) {
alert('请选择门店'); alert('请选择门店');
return false; return false;
......
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
</p> </p>
<p> <p>
<label for="oBroker">经纪人:</label> <label for="oBroker">经纪人:</label>
<input name="oBroker" id="oBroker" type="text" value="{{result.oBroker}}" class="form-control"> <input name="oBroker" id="oBroker" type="text" value="{{result.oBroker}}" placeholder="佣金管理设置后自动填充" readonly class="form-control">
</p> </p>
<p> <p>
<label for="oCommission">佣金:</label> <label for="oCommission">佣金:</label>
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
</p> </p>
<p> <p>
<label for="cBroker">经纪人:</label> <label for="cBroker">经纪人:</label>
<input name="cBroker" id="cBroker" type="text" value="{{result.oBroker}}" class="form-control"> <input name="cBroker" id="cBroker" type="text" value="{{result.oBroker}}" placeholder="佣金管理设置后自动填充" readonly class="form-control">
</p> </p>
<p> <p>
<label for="cCommission">佣金:</label> <label for="cCommission">佣金:</label>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<label for="buy[mtime]">应收时间:</label> <label for="buy[mtime]">应收时间:</label>
<input name="buy[mtime]" type="text" class="form-control" {% if commission[0] %}value = "{{commission[0].mtime}}" readonly {% endif %}> <input name="buy[mtime]" type="date" class="form-control" {% if commission[0] %}value = "{{commission[0].mtime}}" readonly {% endif %}>
</div> </div>
</div> </div>
<br/> <br/>
...@@ -355,7 +355,7 @@ ...@@ -355,7 +355,7 @@
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<label for="sell[mtime]">应收时间:</label> <label for="sell[mtime]">应收时间:</label>
<input name="sell[mtime]" type="text" class="form-control" {% if commission[1] %}value = "{{commission[1].mtime}}" readonly {% endif %}> <input name="sell[mtime]" type="date" class="form-control" {% if commission[1] %}value = "{{commission[1].mtime}}" readonly {% endif %}>
</div> </div>
</div> </div>
<br/> <br/>
...@@ -631,7 +631,11 @@ ...@@ -631,7 +631,11 @@
var clickButtonId = $("#myConsultant").data("id"); var clickButtonId = $("#myConsultant").data("id");
var type = clickButtonId.split("_")[1]; var type = clickButtonId.split("_")[1];
var clickButton = $("#"+clickButtonId); var clickButton = $("#"+clickButtonId);
if(type == "buy"){
$("#cBroker").val(data.name);
}else{
$("#oBroker").val(data.name);
}
if($("#staffImg_"+type+" > div").length >0 ){ if($("#staffImg_"+type+" > div").length >0 ){
$("#staffImg_"+type+" > div").remove(); $("#staffImg_"+type+" > div").remove();
} }
......
<style>
div.col-md-4 {
margin-bottom: 10px;
height: 28px;
}
input[type=radio] {
margin: 0 4px 0 0;
}
</style>
<div class="wrap"> <div class="wrap">
<h2>合同列表</h2>
<form method="GET" class="form-inline" id="scores-filter">
<div class="row" style="margin-top: 10px">
<div class="col-md-8">
<label>查询类型:</label>
<input type="radio" name="search_type" value="0" checked>不限
<input type="radio" name="search_type" value="search_contractId">合同编号
<input type="radio" name="search_type" value="search_signedDate">签约日期
<input type="radio" name="search_type" value="search_OCname">业主/客户姓名
<input type="radio" name="search_type" value="search_OCbroker">买/卖方经纪人
</div>
</div>
<div class="row" style="margin-top: 10px">
<div id="search_type_0" style="display: none;" class="col-md-8">
<label for="contractId">合同编号:</label>
<input type="text" name="search_contractId" class="form-control">
</div>
<div id="search_type_1" style="display: none;" class="col-md-8">
<label for="signedDate">签约日期:</label>
<input type="date" name="beginDate" class="form-control"> -
<input type="date" name="endDate" class="form-control">
</div>
<div id="search_type_2" style="display: none;" class="col-md-8">
<label for="signedDate">业主/客户姓名:</label>
<input type="text" name="search_OCname" class="form-control">
</div>
<div id="search_type_3" style="display: none;" class="col-md-8">
<label for="signedDate">买/卖方经纪人:</label>
<input type="text" name="search_OCbroker" class="form-control">
</div>
</div>
<div class="row" style="margin-top: 10px;margin-left: 0px">
<input type="submit" id="submit" class="button action" value="搜索">
<input type="button" id="reset"class="button action" value="重置">
</div>
<input type="hidden" name="page" value="contractList"/>
</form>
{{function("Contract_List::displayTable")}} {{function("Contract_List::displayTable")}}
</div> </div>
<script>
$(document).ready(function(){
var search_type_0 = $('#search_type_0');
var search_type_1 = $('#search_type_1');
var search_type_2 = $('#search_type_2');
var search_type_3 = $('#search_type_3');
$('input[name=search_type]').change(function () {
var value = $(this).val();
switch (value) {
case 'search_contractId':
search_type_0.show();
search_type_1.hide();
search_type_2.hide();
search_type_3.hide();
break;
case 'search_signedDate':
search_type_0.hide();
search_type_1.show();
search_type_2.hide();
search_type_3.hide();
break;
case 'search_OCname':
search_type_0.hide();
search_type_1.hide();
search_type_2.show();
search_type_3.hide();
break;
case 'search_OCbroker':
search_type_0.hide();
search_type_1.hide();
search_type_2.hide();
search_type_3.show();
break;
default:
search_type_0.hide();
search_type_1.hide();
search_type_2.hide();
search_type_3.hide();
break;
}
});
$("#reset").click(function(){
window.location.href="?page=contractList";
});
});
</script>
\ No newline at end of file
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
allot_consultant('customerlist'); allot_consultant('customerlist');
$('form').submit(function () { $('form').submit(function () {
var organization = getOrganization(); var organization = getOrganization('customer');
var select = $('#customer_organization').find('select[data-depth]:not(.hidden)'); var select = $('#customer_organization').find('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) { if (select.length > 1 && organization == -1) {
alert('请选择门店'); alert('请选择门店');
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div> <div>
{% import "selectOrganization.html" as macro %} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("") }} {{ macro.selectOrganization("customerTracking") }}
<label for="status_type" class="hidden"></label> <label for="status_type" class="hidden"></label>
<select name="status_type" id="status_type"> <select name="status_type" id="status_type">
<option value="-1">跟进类型</option> <option value="-1">跟进类型</option>
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
search_form_set_page(); search_form_set_page();
$('form').submit(function () { $('form').submit(function () {
var organization = getOrganization(); var organization = getOrganization('customerTracking');
var select = $('select[data-depth]:not(.hidden)'); var select = $('#customerTracking_organization').find('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) { if (select.length > 1 && organization == -1) {
alert('请选择门店'); alert('请选择门店');
return false; return false;
......
...@@ -14,23 +14,24 @@ ...@@ -14,23 +14,24 @@
<label for="introduction" style="vertical-align: top;">诚信宣言:</label> <label for="introduction" style="vertical-align: top;">诚信宣言:</label>
<textarea name="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ result.introduction }}</textarea> <textarea name="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ result.introduction }}</textarea>
</p> </p>
<table class="form-table"> <div class="row" id="QRcodeDiv">
<tbody id="QRcodeTable" > <div class="col-md-2">
<label for="QRcode" style="vertical-align: top;">微信二维码:</label>
</div>
{% if result.QRcodeImg %} {% if result.QRcodeImg %}
<tr> <p class="col-md-4">
<td> <img src=" {{siteUrl}}{{result.QRcodeImg}}" height="300px" width="350px">
<img src=" {{siteUrl}}{{result.QRcodeImg}}" height="90" width="140" >
<input type="hidden" name="oldImg" value="1"> <input type="hidden" name="oldImg" value="1">
</td>
</tr>
{% endif %}
</tbody>
</table>
<p>
<button type="button" id="QRcode" class="button action" data-toggle="modal" style="margin-top: 10px">
微信二维码
</button>
</p> </p>
{% endif %}
<div class="col-md-2" id="addQRcode">
<input type="file" name="files" id="file" style="display: none;">
<a class="file-input-wrapper btn btn-default" onclick="$('#file').click();" style="margin-bottom: 10px;">
<span id="name">修改二维码</span>
</a>
</div>
</div>
<p> <p>
<input type="hidden" name="user_id" value="{{ user_id }}"> <input type="hidden" name="user_id" value="{{ user_id }}">
<input type="hidden" name="type" value="1"> <input type="hidden" name="type" value="1">
...@@ -40,42 +41,16 @@ ...@@ -40,42 +41,16 @@
<script> <script>
(function ($) { (function ($) {
$(document).ready(function () { $(document).ready(function () {
// $('#submit').click(function () { $("#file").bind("change",function(){
// var introduction = $('#introduction').val();
// var time = $('#time').val();
// var user_id = $('#user_id').val();
// $.ajax({
// type: 'POST',
// url: '{{ url }}/wp-admin/admin-ajax.php/',
// data: 'action=submit_introduction&time=' + time + '&introduction=' + introduction + '&user_id=' + user_id,
// success: function (data) {
// if (data) {
// alert('提交成功');
// }
// }
// });
// });
$("#QRcode").click(function(){
if($("#QRcodeTable > tr").length > 0){
$("#QRcodeTable").find("tr").remove();
}
var tr = $("<tr>");
var td = $("<td>");
var file = $("<input>").attr({"type":"file","name":"files"}).addClass("picFiles form-control").css("width","20%");
var td2 = td.clone().css("width","30%").append(file);
tr.append(td2);
$("#QRcodeTable").append(tr);
});
$("#QRcodeTable").on("change",".picFiles",function(){
var that = this;
if (this.files && this.files[0]){ if (this.files && this.files[0]){
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (e){ reader.onload = function (e){
var img = $("<img>").attr({"src":e.target.result,"heghit":90,"width":140}); if($("#QRcodeDiv > p").length > 0){
$(that).before(img); $("#QRcodeDiv").find("p").remove();
$(that).hide(); }
var img = $("<img>").attr({"src":e.target.result,"height":"300px",width:"350px"});
var p = $("<p>").addClass("col-md-4").append(img);
$("#addQRcode").before(p);
} }
reader.readAsDataURL(this.files[0]); reader.readAsDataURL(this.files[0]);
} }
......
...@@ -72,24 +72,6 @@ ...@@ -72,24 +72,6 @@
} }
//搜索置业顾问的方法
//function searchConsultant(consulCityId,consultantName){
// $.ajax({
// type: "GET",
// url: "/tospur/wp-admin/admin-ajax.php",
// data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
// success:function(json){
// for(var i = 0; i <=json.length-1; i++){
// var name = json[i]["consultantName"];
// var imgUrl = json[i]["imageUrl"];
// var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
// var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
// $("#consultantList").append(li);
// }
// }
// });
//}
//往给定id的select中添加option //往给定id的select中添加option
function addOption(json,select){ function addOption(json,select){
...@@ -98,6 +80,9 @@ ...@@ -98,6 +80,9 @@
for(var i = 0; i <=json.length-1; i++){ for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"]; var id = json[i]["id"];
var value = json[i]["value"]; var value = json[i]["value"];
if(value == ""){
value = "不限";
}
if(selectId.indexOf("creage") > -1|| selectId.indexOf("rice") > -1){ if(selectId.indexOf("creage") > -1|| selectId.indexOf("rice") > -1){
id = value; id = value;
} }
...@@ -264,7 +249,23 @@ ...@@ -264,7 +249,23 @@
} }
}); });
} }
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
};
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<option value="-1">板块</option> <option value="-1">板块</option>
{% if plate %} {% if plate %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{% if not item.value %}不限{% else %}{{ item.value }}{% endif %}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
...@@ -150,8 +150,8 @@ ...@@ -150,8 +150,8 @@
{% endif %} {% endif %}
$('#scores-filter').submit(function () { $('#scores-filter').submit(function () {
var organization = getOrganization(); var organization = getOrganization('list');
var select = $('select[data-depth]:not(.hidden)'); var select = $('#list_organization').find('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) { if (select.length > 1 && organization == -1) {
alert('请选择门店'); alert('请选择门店');
return false; return false;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
<input type="file" name="files[0]" property="0" class = "files form-control"multiple style="width: 30%;margin-top: 5px"> <input type="file" name="files[0]" property="0" class = "files form-control"multiple style="width: 30%;margin-top: 10px;margin-bottom: 10px">
<div id="mainHouseDiv"></div> <div id="mainHouseDiv"></div>
<input type="hidden" name="exists_ids" value="{{exists_ids}}" > <input type="hidden" name="exists_ids" value="{{exists_ids}}" >
</div> </div>
...@@ -67,12 +67,10 @@ ...@@ -67,12 +67,10 @@
div4.append(button); div4.append(button);
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i}); var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i});
var mainHousePic = $("<input>").attr({"type":"hidden","name":"data["+i+"][mainHouse]","value":0,"property":+i}); var mainHousePic = $("<input>").attr({"type":"hidden","name":"data["+i+"][mainHouse]","value":0,"property":+i});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files form-control").css({"width":"30%","margin-top":"10px"}); var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files form-control").css({"width":"30%","margin-top":"10px","margin-bottom":"10px"});
{% for item in buildProperty %} {% for item in buildProperty %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%} {% endfor%}
var div = $("<div>").attr({"property":+i,"style":"margin-top:5px"}).addClass("row").append(div1).append(div2).append(div3).append(div4).append(type).append(mainHousePic); var div = $("<div>").attr({"property":+i,"style":"margin-top:5px"}).addClass("row").append(div1).append(div2).append(div3).append(div4).append(type).append(mainHousePic);
$("form").find("#mainHouseDiv").after(file); $("form").find("#mainHouseDiv").after(file);
$("#mainHouseDiv").append(div); $("#mainHouseDiv").append(div);
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<div class="col-xs-4 "> <div class="col-xs-4 ">
<label for="check_in_time" class="col-xs-5 control-label">入住时间:</label> <label for="check_in_time" class="col-xs-5 control-label">入住时间:</label>
<p class="col-xs-7"> <p class="col-xs-7">
<input name="check_in_time" id="checkin" type="date" value="{{result.check_in_time}}" class="form-control" > <input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" >
</p> </p>
</div> </div>
<div class="col-xs-4 "> <div class="col-xs-4 ">
...@@ -186,3 +186,31 @@ ...@@ -186,3 +186,31 @@
</p> </p>
</div> </div>
</div> </div>
<div class="row form-group">
<div class="col-xs-8">
<label for="publicize" class="col-xs-2 control-label" >项目宣传:</label>
<p class="col-xs-10">
<input name="publicize" type="text" value="{{result.publicize}}" class="form-control" >
</p>
</div>
</div>
<div class="row form-group">
<div class="col-xs-8">
<label for="threeD" class="col-xs-2 control-label" >3D户型:</label>
<p class="col-xs-10">
<input name="threeD" type="text" value="{{result.threeD}}" class="form-control">
</p>
</div>
</div>
<div class="row form-group">
<div class="col-xs-8">
<label for="roundLook" class="col-xs-2 control-label" >360°看房:</label>
<p class="col-xs-10">
<input name="roundLook" type="text" value="{{result.roundLook}}" class="form-control">
</p>
</div>
</div>
...@@ -61,7 +61,8 @@ ...@@ -61,7 +61,8 @@
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;"> <div class="row" style="position: fixed;">
{% if canEdit %}
{% if houseId %} {% if houseId %}
{% if canApproval %} {% if canApproval %}
{% if result.approval != -2 %} {% if result.approval != -2 %}
...@@ -69,7 +70,8 @@ ...@@ -69,7 +70,8 @@
<option value="{{result.approval}}">通过</option> <option value="{{result.approval}}">通过</option>
<option value="-2">退回</option> <option value="-2">退回</option>
</select> </select>
<input type="hidden" name="userType" value="0"> {% else %}
<input type="hidden" name="status" value="{{result.status}}">
{% endif %} {% endif %}
{% else %} {% else %}
<select name="status" class="form-control"> <select name="status" class="form-control">
...@@ -77,10 +79,10 @@ ...@@ -77,10 +79,10 @@
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option> <option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %} {% endfor %}
</select> </select>
<input type="hidden" name="userType" value="{{houseId}}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="float:left"> <input type="submit" id="submit" class="button action" style="float:left">
{% endif %}
</div> </div>
</div> </div>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px;margin-left: 225px"> <button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px;margin-left: 225px;margin-bottom: 10px">
新增 新增
</button> </button>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" > <input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="row" style="margin-top: 10px;"> <div class="row" style="margin-top: 10px;">
<div class="col-md-4"> <div class="col-md-4">
<label>查询类型:</label> <label>查询类型:</label>
<input type="radio" name="search_type" value="0" checked>不限 <input type="radio" name="search_type" value="0">不限
<input type="radio" name="search_type" value="search_consultant_name">置业顾问 <input type="radio" name="search_type" value="search_consultant_name">置业顾问
<input type="radio" name="search_type" value="organization">部门 <input type="radio" name="search_type" value="organization">部门
</div> </div>
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
</div> </div>
<div id="search_type_1" style="display: none;" class="col-md-8"> <div id="search_type_1" style="display: none;" class="col-md-8">
{% import "selectOrganization.html" as macro %} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("") }} {{ macro.selectOrganization("progress") }}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<label>统计时间:</label> <label>统计时间:</label>
<input type="radio" name="statistical_time" value="0" checked>不限 <input type="radio" name="statistical_time" value="0">不限
<input type="radio" name="statistical_time" value="day"> <input type="radio" name="statistical_time" value="day">
<input type="radio" name="statistical_time" value="week"> <input type="radio" name="statistical_time" value="week">
<input type="radio" name="statistical_time" value="month"> <input type="radio" name="statistical_time" value="month">
...@@ -139,8 +139,8 @@ ...@@ -139,8 +139,8 @@
$('form').submit(function () { $('form').submit(function () {
var search_type = $('input[name=search_type]:checked').val(); var search_type = $('input[name=search_type]:checked').val();
if (search_type == 'organization') { if (search_type == 'organization') {
var organization = getOrganization(); var organization = getOrganization('progress');
var select = $('select[data-depth]:not(.hidden)'); var select = $('#progress_organization').find('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) { if (select.length > 1 && organization == -1) {
alert('请选择门店'); alert('请选择门店');
return false; return false;
...@@ -160,6 +160,7 @@ ...@@ -160,6 +160,7 @@
var req_search_type = '{{ req.search_type }}'; var req_search_type = '{{ req.search_type }}';
if (req_statistical_time == 'week') { if (req_statistical_time == 'week') {
week.val('{{ req.select_week }}'); week.val('{{ req.select_week }}');
$('#week').val('{{ req.week }}');
week.show(); week.show();
} else if (req_statistical_time == 'month') { } else if (req_statistical_time == 'month') {
year.show(); year.show();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<form method="get"> <form method="get">
<input type="hidden" name="page" value="quotaList"> <input type="hidden" name="page" value="quotaList">
{% import "selectOrganization.html" as macro %} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("") }} {{ macro.selectOrganization("quota") }}
<div id="search_form"> <div id="search_form">
<select name="year" id="year"> <select name="year" id="year">
<option value="2015">2015</option> <option value="2015">2015</option>
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
{% endif %} {% endif %}
$('form').submit(function () { $('form').submit(function () {
var organization = getOrganization(); var organization = getOrganization('quota');
var select = $('select[data-depth]:not(.hidden)'); var select = $('#quota_organization').find('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) { if (select.length > 1 && organization == -1) {
alert('请选择门店'); alert('请选择门店');
return false; return false;
......
...@@ -2,11 +2,19 @@ ...@@ -2,11 +2,19 @@
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;"> <div class="modal-header">
{% import "selectOrganization.html" as macro %} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("consultant") }} {{ macro.selectOrganization("consultant") }}
<div class="row">
<div class="col-md-6">
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control"> <input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control">
</div>
<div class="col-md-2">
<button type="button" class="button action" id="searchConsult">搜索</button> <button type="button" class="button action" id="searchConsult">搜索</button>
</div>
</div>
</div>
<div class="modal-body" style="height: 300px;overflow: auto;">
<ul id="consultantList"> <ul id="consultantList">
</ul> </ul>
</div> </div>
...@@ -23,15 +31,33 @@ ...@@ -23,15 +31,33 @@
$("#searchConsult").click(function(){ $("#searchConsult").click(function(){
$("#consultantList").find("li").remove(); $("#consultantList").find("li").remove();
var consultantName = $("#consultantName").val(); var consultantName = $("#consultantName").val();
var organizationId = getOrganization(); var organizationId = getOrganization('consultant');
if(organizationId == -1 && consultantName == ""){ var select = $('#consultant_organization').find('select[data-depth]:not(.hidden)');
if(select.length > 1 && organizationId == -1 && consultantName == ""){
alert("请选择部门") alert("请选择部门")
} }
searchConsultant(organizationId,consultantName); searchConsultant(organizationId,consultantName);
}); });
$("#consultantList").on("click",".consultantImg",function(){ $("#consultantList").on("click",".consultantImg",function(){
var firstId = $("#subsidiaryId").val();
if(firstId){
if($(this).data().subsidiaryId != firstId){
alert("请选择相同部门的置业顾问");
return false;
}
}
var consultantArray = [];
$('input[name="data[recConsultant][]"]').each(function (index, item) {
consultantArray.push(Number($(item).val()));
});
if($.inArray(Number($(this).data().id),consultantArray) == -1){
callback($(this).data()); callback($(this).data());
}else{
alert('不能重复置业顾问');
}
}); });
} }
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2">
<div class="row" style="position: fixed;"> <div class="row" style="position: fixed;">
{% if canEdit %}
{% if (result.status != 2 and result.status != 3) %} {% if (result.status != 2 and result.status != 3) %}
{% if houseId %} {% if houseId %}
{% if canApproval %} {% if canApproval %}
...@@ -59,7 +60,8 @@ ...@@ -59,7 +60,8 @@
<option value="{{result.approval}}">通过</option> <option value="{{result.approval}}">通过</option>
<option value="-2">退回</option> <option value="-2">退回</option>
</select> </select>
<input type="hidden" name="userType" value="0"> {% else %}
<input type="hidden" name="status" value="{{result.status}}">
{% endif %} {% endif %}
{% else %} {% else %}
<select name="status" class="form-control"> <select name="status" class="form-control">
...@@ -67,11 +69,11 @@ ...@@ -67,11 +69,11 @@
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option> <option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %} {% endfor %}
</select> </select>
<input type="hidden" name="userType" value="{{houseId}}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="float:left"> <input type="submit" id="submit" class="button action" style="float:left">
{% endif %} {% endif %}
{% endif %}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;"> <div class="row" style="position: fixed;">
{% if canEdit %}
{% if (result.status != 2 and result.status != 3) %} {% if (result.status != 2 and result.status != 3) %}
{% if houseId %} {% if houseId %}
{% if canApproval %} {% if canApproval %}
...@@ -63,7 +64,8 @@ ...@@ -63,7 +64,8 @@
<option value="{{result.approval}}">通过</option> <option value="{{result.approval}}">通过</option>
<option value="-2">退回</option> <option value="-2">退回</option>
</select> </select>
<input type="hidden" name="userType" value="0"> {% else %}
<input type="hidden" name="status" value="{{result.status}}">
{% endif %} {% endif %}
{% else %} {% else %}
<select name="status" class="form-control"> <select name="status" class="form-control">
...@@ -76,6 +78,7 @@ ...@@ -76,6 +78,7 @@
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="float:left"> <input type="submit" id="submit" class="button action" style="float:left">
{% endif %} {% endif %}
{% endif %}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
} }
}); });
function getOrganization() { function getOrganization(prefix) {
return Number($('#{{prefix}}_organization select[data-depth]:not(.hidden):last').val()); return Number($('#' + prefix + '_organization').find('select[data-depth]:not(.hidden):last').val());
} }
</script> </script>
{% endmacro %} {% endmacro %}
\ No newline at end of file
...@@ -41,7 +41,7 @@ class CommissionDao{ ...@@ -41,7 +41,7 @@ class CommissionDao{
public static function search_tospur_commission($contractId){ public static function search_tospur_commission($contractId){
global $wpdb; global $wpdb;
$sql = "select id,accounts,type from ".Config::TOSPUR_COMMISSION." $sql = "select id,accounts,type,mtime from ".Config::TOSPUR_COMMISSION."
where contractId = %d"; where contractId = %d";
$result = $wpdb->get_results($wpdb->prepare($sql,$contractId)); $result = $wpdb->get_results($wpdb->prepare($sql,$contractId));
return $result; return $result;
......
...@@ -34,6 +34,8 @@ class CustomerTrackingDao ...@@ -34,6 +34,8 @@ class CustomerTrackingDao
} else { } else {
return '新增客户跟踪失败'; return '新增客户跟踪失败';
} }
}else{
return 0;
} }
} }
......
...@@ -205,7 +205,7 @@ class SearchDao ...@@ -205,7 +205,7 @@ class SearchDao
" where 1=1 and th.status = 1 "; " where 1=1 and th.status = 1 ";
if ($array['cityId'] > -1) { if ($array['cityId'] > -1) {
$params[] = $array['cityId']; $params[] = $array['cityId'];
$sql = $sql . " and city_id=%d"; $sql = $sql . " and cityId=%d";
} }
if ($array['districtId'] > -1) { if ($array['districtId'] > -1) {
$params[] = $array['districtId']; $params[] = $array['districtId'];
......
...@@ -51,7 +51,6 @@ function tospur_init() ...@@ -51,7 +51,6 @@ function tospur_init()
//Statistics::business(); //Statistics::business();
tospur_register_script_style(); tospur_register_script_style();
tospur_ajax_set(); tospur_ajax_set();
custom_role();
tospur_theme_format(); tospur_theme_format();
} }
add_action('statistics', 'Statistics::business'); add_action('statistics', 'Statistics::business');
...@@ -224,7 +223,8 @@ function custom_role() { ...@@ -224,7 +223,8 @@ function custom_role() {
"fdfw_cs" => true, "fdfw_cs" => true,
"fdfw_cz" => true, "fdfw_cz" => true,
"yyList"=>true, "yyList"=>true,
"plsc"=>true "plsc"=>true,
"canEdit"=>true
); );
add_role("zygw","置业顾问",array( add_role("zygw","置业顾问",array(
...@@ -241,11 +241,18 @@ function custom_role() { ...@@ -241,11 +241,18 @@ function custom_role() {
"fdfw_cs" => true, "fdfw_cs" => true,
"fdfw_cz" => true, "fdfw_cz" => true,
"mySet" => true, "mySet" => true,
"yyList"=>true "yyList"=>true,
"canEdit"=>true
)); ));
add_role("qzzy","权证专员",array( add_role("qzzy","权证专员",array(
"ht"=>true, "ht"=>true,
"htEdit"=>true "htEdit"=>true,
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true
)); ));
add_role("xzzl","行政助理",array( add_role("xzzl","行政助理",array(
...@@ -274,7 +281,8 @@ function custom_role() { ...@@ -274,7 +281,8 @@ function custom_role() {
"fdfw_cs" => true, "fdfw_cs" => true,
"fdfw_cz" => true, "fdfw_cz" => true,
"yyList"=>true, "yyList"=>true,
"plsc"=>true "plsc"=>true,
"canEdit"=>true
)); ));
add_role("jl","经理",array( add_role("jl","经理",array(
...@@ -303,7 +311,8 @@ function custom_role() { ...@@ -303,7 +311,8 @@ function custom_role() {
"fdfw_cs" => true, "fdfw_cs" => true,
"fdfw_cz" => true, "fdfw_cz" => true,
"yyList"=>true, "yyList"=>true,
"plsc"=>true "plsc"=>true,
"canEdit"=>true
)); ));
} }
register_activation_hook( __FILE__, 'custom_role' ); register_activation_hook( __FILE__, 'custom_role' );
......
...@@ -373,7 +373,7 @@ a:hover { ...@@ -373,7 +373,7 @@ a:hover {
padding: 20px 0; padding: 20px 0;
border-bottom: 1px solid #7d7d7d; border-bottom: 1px solid #7d7d7d;
position: relative; position: relative;
height: 94px; height: auto;
} }
#wrapper #scroller ul li p { #wrapper #scroller ul li p {
padding-left: 15px; padding-left: 15px;
...@@ -383,18 +383,18 @@ a:hover { ...@@ -383,18 +383,18 @@ a:hover {
color: #000000; color: #000000;
font-size: 22px; font-size: 22px;
font-weight: bold; font-weight: bold;
margin-bottom: 2px; margin-bottom: 5px;
} }
#wrapper #scroller ul li p.accept { #wrapper #scroller ul li p.accept {
position: absolute; position: absolute;
top: 28px; bottom: 15px;
right: 10px; right: 10px;
} }
#wrapper #scroller ul li p.accept .btn { #wrapper #scroller ul li p.accept .btn {
color: #ffffff; color: #ffffff;
font-weight: bold; font-weight: bold;
margin: 0; margin: 0;
padding: 6px 12px; padding: 4px 12px;
background-color: #008cd7; background-color: #008cd7;
border-top-left-radius: 4px; border-top-left-radius: 4px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
......
...@@ -399,13 +399,13 @@ body { ...@@ -399,13 +399,13 @@ body {
-webkit-border-top-right-radius: 5px; -webkit-border-top-right-radius: 5px;
-webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-right-radius: 5px;
} }
.iconList li:nth-child(1) { .iconList li.eye {
background-image: url("../img/white_3d_icon.png"); background-image: url("../img/white_3d_icon.png");
} }
.iconList li:nth-child(2) { .iconList li.video {
background-image: url("../img/white_videocamera_icon.png"); background-image: url("../img/white_videocamera_icon.png");
} }
.iconList li:nth-child(3) { .iconList li.panorama {
background-image: url("../img/white_panorama_icon.png"); background-image: url("../img/white_panorama_icon.png");
} }
.addWrap { .addWrap {
......
...@@ -500,6 +500,7 @@ a:hover { ...@@ -500,6 +500,7 @@ a:hover {
} }
.container-fluid form a { .container-fluid form a {
display: block; display: block;
text-align: center;
color: #ffffff; color: #ffffff;
font-size: 16px; font-size: 16px;
} }
......
...@@ -356,17 +356,56 @@ body { ...@@ -356,17 +356,56 @@ body {
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
#navWrapper {
width: 100%;
height: 50px;
overflow: hidden;
border-bottom: 1px solid #008cd7;
}
#navWrapper #navScroller {
height: 100%;
float: left;
padding: 0;
}
#navWrapper #navScroller ul {
float: left;
width: 100%;
height: 100%;
margin: 0;
font-size: 0;
}
#navWrapper #navScroller ul li .btn {
color: #000000;
font-weight: bold;
border-width: 1px 0 4px 0;
padding: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
#navWrapper #navScroller ul li .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
}
#navWrapper #navScroller ul li.active a {
border-bottom-color: #008cd7;
}
#tabWrapper { #tabWrapper {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
top: 40px; top: 50px;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
#tabWrapper #tabScroller { #tabWrapper #tabScroller {
padding-bottom: 15px; padding-bottom: 10px;
} }
.tab-content .tab-pane ul li { .tab-content .tab-pane ul li {
width: 100%; width: 100%;
...@@ -459,6 +498,6 @@ a:hover { ...@@ -459,6 +498,6 @@ a:hover {
.tab-content .tab-pane .btn:focus { .tab-content .tab-pane .btn:focus {
outline: 0; outline: 0;
} }
.tab-content .tab-pane:last-child .btn { .tab-content .tab-pane#combined_loan .btn {
margin-top: 5%; margin-top: 4%;
} }
<?php <?php
require_once('const.php'); require_once('const.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/DBManager.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/TospurDao.php'); require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/TospurDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/SearchDao.php'); require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/SearchDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Tools/Image.php'); require_once(dirname(__FILE__) . '/../../plugins/tospur/Tools/Image.php');
...@@ -51,12 +52,6 @@ function page_template($template) ...@@ -51,12 +52,6 @@ function page_template($template)
case 'loan_calculator': case 'loan_calculator':
$page = $theme . '/loan_calculator.php'; $page = $theme . '/loan_calculator.php';
break; break;
case 'tax_calculator':
$page = $theme . '/tax_calculator.php';
break;
case 'ability_calculator':
$page = $theme . '/ability_calculator.php';
break;
case 'manager': case 'manager':
$page = $theme . '/manager.php'; $page = $theme . '/manager.php';
break; break;
...@@ -160,7 +155,7 @@ function add_consultant_score() ...@@ -160,7 +155,7 @@ function add_consultant_score()
$type = TospurDao::search_score_type($_POST['user_id'], $_POST['consultant_id']); $type = TospurDao::search_score_type($_POST['user_id'], $_POST['consultant_id']);
$result = null; $result = null;
if ($type) { if ($type) {
$result = TospurDao::insert_consultant_score($_POST['consultant_id'], $_POST['user_id'], $_POST['score']); $result = TospurDao::insert_consultant_score($_POST['consultant_id'], $_POST['user_id'], $_POST['score'], $type);
} }
$array = array(); $array = array();
if ($type && $result) { if ($type && $result) {
...@@ -225,8 +220,7 @@ function add_collect($house_id) ...@@ -225,8 +220,7 @@ function add_collect($house_id)
'house_id' => $_POST["hid"], 'house_id' => $_POST["hid"],
'user_type' => 0 'user_type' => 0
); );
global $wpdb; $result = DBManager::insert('a_house_user', $insert_a_house_user_array);
$result = $wpdb->insert('a_house_user', $insert_a_house_user_array);
$array = array(); $array = array();
if ($result) { if ($result) {
......
...@@ -131,12 +131,12 @@ function ajax_get_house(url, loading, ajax_data, context) { ...@@ -131,12 +131,12 @@ function ajax_get_house(url, loading, ajax_data, context) {
div.find('[data-attr=price]').html('<em>' + price + '</em>/m<em>2</em>'); div.find('[data-attr=price]').html('<em>' + price + '</em>/m<em>2</em>');
} else if (houseType == 1) { } else if (houseType == 1) {
div.find('[data-attr=community]').text(value.community_name); div.find('[data-attr=community]').text(value.community_name);
div.find('[data-attr=apartment]').text(value.bp_literal); div.find('[data-attr=apartment]').text(value.bp_literal||'未知');
div.find('[data-attr=covered_area]').text(value.covered_area + '平米'); div.find('[data-attr=covered_area]').text(value.covered_area + '平米');
div.find('[data-attr=price]').html('<em>' + value.total_price + '万</em>'); div.find('[data-attr=price]').html('<em>' + value.total_price + '万</em>');
} else if (houseType == 2) { } else if (houseType == 2) {
div.find('[data-attr=community]').text(value.community_name); div.find('[data-attr=community]').text(value.community_name);
div.find('[data-attr=apartment]').text(value.bp_literal); div.find('[data-attr=apartment]').text(value.bp_literal||'未知');
div.find('[data-attr=covered_area]').text(value.covered_area + '平米'); div.find('[data-attr=covered_area]').text(value.covered_area + '平米');
div.find('[data-attr=decoration]').text(value.decoration); div.find('[data-attr=decoration]').text(value.decoration);
var rent = value.rent; var rent = value.rent;
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<title>购房能力评估计算器</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_calculator.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_detail.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/modernizr.custom.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
</head>
<body>
<div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1">
<ul id="tab" class="list-unstyled btn-group-justified tab">
<li class="btn-group active">
<a href="#ability" data-toggle="tab" class="btn">购房能力评估</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="ability">
<ul class="list-unstyled">
<li>
<label class="col-xs-5">现持有资金:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="hold">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">现家庭月收入:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="income">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">家庭月固定支出:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="expense">
</p>
<p class="col-xs-2"></p>
</li>
<li class="arrow">
<label class="col-xs-5">还款年限:</label>
<p class="col-xs-7">
<select class="form-control" id="month">
<option value="12">1年(12期)</option>
<option value="24">2年(24期)</option>
<option value="36">3年(36期)</option>
<option value="48">4年(48期)</option>
<option value="60">5年(60期)</option>
<option value="72">6年(72期)</option>
<option value="84">7年(84期)</option>
<option value="96">8年(96期)</option>
<option value="108">9年(108期)</option>
<option value="120">10年(120期)</option>
<option value="132">11年(132期)</option>
<option value="144">12年(144期)</option>
<option value="156">13年(156期)</option>
<option value="168">14年(168期)</option>
<option value="180">15年(180期)</option>
<option value="192">16年(192期)</option>
<option value="204">17年(204期)</option>
<option value="216">18年(216期)</option>
<option value="228">19年(228期)</option>
<option value="240" selected="selected">20年(240期)</option>
<option value="300">25年(300期)</option>
<option value="360">30年(360期)</option>
</select>
</p>
</li>
<li>
<label class="col-xs-4">房屋面积:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="area">
</p>
<p class="col-xs-3">平方米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
</div>
</div>
<div class="pt-page pt-page-2">
<div id="wrapper" style="top: 0;">
<div id="scroller">
<ul class="list-unstyled" id="result">
</ul>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<script type="text/javascript" src="{{ theme }}/js/pagetransitions.js"></script>
<script>
var page = 0;
var resultList;
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('input[type=submit]').tap(function () {
var hold = Number($('#hold').val().trim());
var income = Number($('#income').val().trim());
var expense = Number($('#expense').val().trim());
var month = Number($('#month').val());
var area = Number($('#area').val().trim());
console.log(hold);
console.log(income);
console.log(expense);
console.log(month);
console.log(area);
if (hold == '') {
notice.html('请输入现持有资金');
myModal.modal('show');
} else if (income == '') {
notice.html('请输入现家庭月收入');
myModal.modal('show');
} else if (expense == '') {
notice.html('请输入家庭月固定支出');
myModal.modal('show');
} else if (month == '') {
notice.html('请输入还款年限');
myModal.modal('show');
} else if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else {
resultList = $('#result');
var abilityResult = abilityCalculator(month, hold, income, expense, area);
resultList.html('<li><span class="col-xs-4">房屋总价:</span><span>' + abilityResult.total + '元</span></li>' +
'<li><span class="col-xs-4">房屋单价:</span><span>' + abilityResult.avgPrice + '元/平方</span></li>');
page = 1;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
if (window.location.hash == '#result') {
window.history.back();
}
window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) {
page = 0;
PageTransitions.nextPage({
animation: 2,
showPage: page
});
resultList.html('');
}
});
});
function abilityCalculator(month, holdMoney, income, outcome, area) {
var year = parseInt(month / 12);
var lilu = 0.00576;
if (year > 5)
lilu = 0.00594;
var d1 = income - outcome;
var d2 = Math.pow(1 + lilu, month) - 1;
var d3 = lilu * Math.pow(1 + lilu, month);
//房屋总价
var total = Math.round(((d1 * d2) / d3) + holdMoney);
//房屋单价
var avgPrice = total / area;
var result = {
total: total,
avgPrice: avgPrice
};
return result;
}
</script>
</body>
</html>
\ No newline at end of file
...@@ -115,6 +115,10 @@ ...@@ -115,6 +115,10 @@
$("#photoModal").modal("show"); $("#photoModal").modal("show");
return false; return false;
}); });
$(".iconList > li").click(function(){
location.href = $(this).attr("data-url");
});
}); });
</script> </script>
</head> </head>
...@@ -122,9 +126,15 @@ ...@@ -122,9 +126,15 @@
<p class="collect"></p> <p class="collect"></p>
<ul class="list-unstyled iconList"> <ul class="list-unstyled iconList">
<li></li> {% if result.publicize %}
<li></li> <li class="video" data-url="{{result.publicize}}"></li>
<li></li> {% endif %}
{% if result.threeD %}
<li class="eye" data-url="{{result.threeD}}"></li>
{% endif %}
{% if result.roundLook %}
<li class="panorama" data-url="{{result.roundLook}}"></li>
{% endif %}
</ul> </ul>
<!-- 图片滚动 --> <!-- 图片滚动 -->
<div class="addWrap"> <div class="addWrap">
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
{% if item.user_id %} {% if item.user_id %}
{% if item.handle==0 %} {% if item.handle==0 %}
<p class="accept"> <p class="accept">
<button type="button" class="btn btn-lg" data-name="handle" data-id="{{ item.id }}">接受</button> <button type="button" class="btn" data-name="handle" data-id="{{ item.id }}">接受</button>
</p> </p>
{% endif %} {% endif %}
{% endif %} {% endif %}
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/> <meta name="format-detection" content="telephone=no"/>
<title>房贷计算器</title> <title>计算器</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
...@@ -24,18 +24,30 @@ ...@@ -24,18 +24,30 @@
{% set accumulationFund_rate = 3.25 %} {% set accumulationFund_rate = 3.25 %}
<div id="pt-main" class="pt-perspective"> <div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1"> <div class="pt-page pt-page-1">
<ul id="tab" class="list-unstyled btn-group-justified tab"> <div id="navWrapper">
<li class="btn-group active"> <div id="navScroller">
<a href="#commerce_loan" data-toggle="tab" class="btn">商业贷款</a> <ul class="list-inline text-nowrap" id="tab">
<li class="active">
<a href="#commerce_loan" data-toggle="tab" class="btn btn-lg">商业贷款</a>
</li> </li>
<li class="btn-group"> <li>
<a href="#accumulationFund_loan" data-toggle="tab" class="btn">公积金贷款</a> <a href="#accumulationFund_loan" data-toggle="tab" class="btn btn-lg">公积金贷款</a>
</li> </li>
<li class="btn-group"> <li>
<a href="#combined_loan" data-toggle="tab" class="btn">组合贷款</a> <a href="#combined_loan" data-toggle="tab" class="btn btn-lg">组合贷款</a>
</li> </li>
</ul> <li>
<a href="#new" data-toggle="tab" class="btn btn-lg">新房税费</a>
</li>
<li>
<a href="#secondhand" data-toggle="tab" class="btn btn-lg">二手房税费</a>
</li>
<li>
<a href="#ability" data-toggle="tab" class="btn btn-lg">购房能力评估</a>
</li>
</ul>
</div>
</div>
<div id="tabWrapper"> <div id="tabWrapper">
<div id="tabScroller" class="tab-content"> <div id="tabScroller" class="tab-content">
<div class="tab-pane fade in active" id="commerce_loan"> <div class="tab-pane fade in active" id="commerce_loan">
...@@ -114,7 +126,7 @@ ...@@ -114,7 +126,7 @@
</li> </li>
</ul> </ul>
<p class="text-right">商业贷款利率{{ commerce_rate }}%</p> <p class="text-right">商业贷款利率{{ commerce_rate }}%</p>
<input type="submit" value="开始计算" class="btn btn-lg"> <input type="submit" value="开始计算" class="btn btn-lg" data-id="loan">
</div> </div>
<div class="tab-pane fade" id="accumulationFund_loan"> <div class="tab-pane fade" id="accumulationFund_loan">
...@@ -193,7 +205,7 @@ ...@@ -193,7 +205,7 @@
</li> </li>
</ul> </ul>
<p class="text-right">公积金贷款利率{{ accumulationFund_rate }}%</p> <p class="text-right">公积金贷款利率{{ accumulationFund_rate }}%</p>
<input type="submit" value="开始计算" class="btn btn-lg"> <input type="submit" value="开始计算" class="btn btn-lg" data-id="loan">
</div> </div>
<div class="tab-pane fade" id="combined_loan"> <div class="tab-pane fade" id="combined_loan">
...@@ -311,7 +323,143 @@ ...@@ -311,7 +323,143 @@
</li> </li>
</ul> </ul>
<p class="text-right">公积金贷款利率{{ accumulationFund_rate }}% 商业贷款利率{{ commerce_rate }}%</p> <p class="text-right">公积金贷款利率{{ accumulationFund_rate }}% 商业贷款利率{{ commerce_rate }}%</p>
<input type="submit" value="开始计算" class="btn btn-lg"> <input type="submit" value="开始计算" class="btn btn-lg" data-id="loan">
</div>
<div class="tab-pane fade" id="new">
<ul class="list-unstyled">
<li>
<label class="col-xs-3">房屋面积:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="area">
</p>
<p class="col-xs-3">平米</p>
</li>
<li>
<label class="col-xs-3">房屋单价:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="average_price">
</p>
<p class="col-xs-3">元/平米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg" data-id="tax">
</div>
<div class="tab-pane fade" id="secondhand">
<ul class="list-unstyled">
<li>
<label class="col-xs-3">房屋面积:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="area">
</p>
<p class="col-xs-3">平米</p>
</li>
<li>
<label class="col-xs-3">房屋单价:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="average_price">
</p>
<p class="col-xs-3">元/平米</p>
</li>
<li>
<label class="col-xs-3">购置年限:</label>
<p class="col-xs-6">
<select class="form-control" data-id="year">
<option selected="selected" value="0">2年以内</option>
<option value="1">2-5年</option>
<option value="2">5年以上</option>
</select>
</p>
<p class="col-xs-3"></p>
</li>
<li>
<label class="col-xs-3">首次购房:</label>
<label for="firstTrue" class="col-xs-4 text-center">
<input type="radio" name="first" id="firstTrue" value="1" checked>
<span></span>
</label>
<label for="firstFalse" class="col-xs-4 text-center">
<input type="radio" name="first" id="firstFalse" value="0">
<span></span>
</label>
</li>
<li>
<label class="col-xs-3">唯一住房:</label>
<label for="onlyTrue" class="col-xs-4 text-center">
<input type="radio" name="only" id="onlyTrue" value="1" checked>
<span></span>
</label>
<label for="onlyFalse" class="col-xs-4 text-center">
<input type="radio" name="only" id="onlyFalse" value="0">
<span></span>
</label>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg" data-id="tax">
</div>
<div class="tab-pane fade" id="ability">
<ul class="list-unstyled">
<li>
<label class="col-xs-5">现持有资金:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="hold">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">现家庭月收入:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="income">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">家庭月固定支出:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="expense">
</p>
<p class="col-xs-2"></p>
</li>
<li class="arrow">
<label class="col-xs-5">还款年限:</label>
<p class="col-xs-7">
<select class="form-control" id="payment_year">
<option value="12">1年(12期)</option>
<option value="24">2年(24期)</option>
<option value="36">3年(36期)</option>
<option value="48">4年(48期)</option>
<option value="60">5年(60期)</option>
<option value="72">6年(72期)</option>
<option value="84">7年(84期)</option>
<option value="96">8年(96期)</option>
<option value="108">9年(108期)</option>
<option value="120">10年(120期)</option>
<option value="132">11年(132期)</option>
<option value="144">12年(144期)</option>
<option value="156">13年(156期)</option>
<option value="168">14年(168期)</option>
<option value="180">15年(180期)</option>
<option value="192">16年(192期)</option>
<option value="204">17年(204期)</option>
<option value="216">18年(216期)</option>
<option value="228">19年(228期)</option>
<option value="240" selected="selected">20年(240期)</option>
<option value="300">25年(300期)</option>
<option value="360">30年(360期)</option>
</select>
</p>
</li>
<li>
<label class="col-xs-4">房屋面积:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="area">
</p>
<p class="col-xs-3">平方米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg" data-id="ability">
</div> </div>
</div> </div>
</div> </div>
...@@ -334,7 +482,15 @@ ...@@ -334,7 +482,15 @@
<div id="wrapper"> <div id="wrapper">
<div id="scroller"> <div id="scroller">
<ul class="list-unstyled" id="result"> <ul class="list-unstyled" id="loan_result">
</ul>
</div>
</div>
</div>
<div class="pt-page pt-page-3">
<div id="wrapper" style="top: 0;">
<div id="scroller">
<ul class="list-unstyled" id="tax_ability_result">
</ul> </ul>
</div> </div>
</div> </div>
...@@ -355,16 +511,21 @@ ...@@ -355,16 +511,21 @@
<script> <script>
var daikuan_money = 0; var daikuan_money = 0;
var page = 0; var page = 0;
var navScroll;
var tabScroll; var tabScroll;
var resultScroll; var resultScroll;
var resultList; var resultList;
$(document).ready(function () { $(document).ready(function () {
tabScroll = new IScroll('#tabWrapper',{ navScroll = new IScroll('#navWrapper',{
click: true eventPassthrough: true,
scrollX: true,
scrollY: false
}); });
resultScroll = new IScroll('#wrapper', { tabScroll = new IScroll('#tabWrapper',{
click: true click: false,
preventDefaultException: {tagName: /.*/}
}); });
resultScroll = new IScroll('#wrapper');
$('#tab a').click(function(){ $('#tab a').click(function(){
tabScroll.scrollTo(0,0); tabScroll.scrollTo(0,0);
setTimeout(function(){ setTimeout(function(){
...@@ -387,7 +548,7 @@ ...@@ -387,7 +548,7 @@
daikuan_money = (fangjia_money * (1 - first_payment / 10)).toFixed(2); daikuan_money = (fangjia_money * (1 - first_payment / 10)).toFixed(2);
tab.find('[data-id=daikuan_money]').val(daikuan_money); tab.find('[data-id=daikuan_money]').val(daikuan_money);
}); });
$('input[type=submit]').tap(function () { $('input[type=submit][data-id=loan]').tap(function () {
var tab = $(this).parents('.active'); var tab = $(this).parents('.active');
var tabId = tab.attr('id'); var tabId = tab.attr('id');
var fangjia_money = Number(tab.find('[data-id=fangjia_money]').val().trim()); var fangjia_money = Number(tab.find('[data-id=fangjia_money]').val().trim());
...@@ -400,7 +561,7 @@ ...@@ -400,7 +561,7 @@
notice.html('请输入利率'); notice.html('请输入利率');
myModal.modal('show'); myModal.modal('show');
} else { } else {
resultList = $('#result'); resultList = $('#loan_result');
if (tabId == 'combined_loan') { if (tabId == 'combined_loan') {
var accumulationFund_money = Number(tab.find('[data-id=daikuan_money]').val().trim()); var accumulationFund_money = Number(tab.find('[data-id=daikuan_money]').val().trim());
var commerce_money = Number(tab.find('[data-id=commerce_money]').val().trim()); var commerce_money = Number(tab.find('[data-id=commerce_money]').val().trim());
...@@ -464,11 +625,94 @@ ...@@ -464,11 +625,94 @@
return false; return false;
}); });
$('input[type=submit][data-id=tax]').click(function () {
var tab = $(this).parents('.active');
var tabId = tab.attr('id');
var area = Number(tab.find('[data-id=area]').val().trim());
var average_price = Number(tab.find('[data-id=average_price]').val().trim());
var year = Number(tab.find('[data-id=year]').val());
if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else if (average_price == '') {
notice.html('请输入房屋单价');
myModal.modal('show');
} else {
resultList = $('#tax_ability_result');
var taxResult = null;
if (tabId == 'new') {
taxResult = newHouseTaxCalculator(area, average_price);
resultList.html('<li><span class="col-xs-4">印花税:</span><span>' + taxResult.stampDuty + '元</span></li>'+
'<li><span class="col-xs-4">契税:</span><span>' + taxResult.deed + '元</span></li>'+
'<li><span class="col-xs-4">公证费:</span><span>' + taxResult.notaryFees + '元</span></li>');
} else {
if (year >= 0) {
var first = (Number($('input[name=first]:checked').val()) == 1);
var only = (Number($('input[name=only]:checked').val()) == 1);
taxResult = secondhandHouseTaxCalculator(area, average_price, first, only, year);
resultList.html('<li><span class="col-xs-5">房屋总价:</span><span>' + taxResult.housePrice + '元</span></li>' +
'<li><span class="col-xs-5">契税:</span><span>' + taxResult.deed + '元</span></li>' +
'<li><span class="col-xs-5">营业税:</span><span>' + taxResult.bt + '元</span></li>' +
'<li><span class="col-xs-5">个人所得税:</span><span>' + taxResult.pit + '元</span></li>' +
'<li><span class="col-xs-5">工本印花税:</span><span>5元</span></li>' +
'<li><span class="col-xs-5">合计:</span><span>' + (taxResult.deed + taxResult.bt + taxResult.pit + 5) + '元</span></li>');
} else {
notice.html('请选择购置年限');
myModal.modal('show');
return false;
}
}
page = 2;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
$('input[type=submit][data-id=ability]').tap(function () {
var hold = Number($('#hold').val().trim());
var income = Number($('#income').val().trim());
var expense = Number($('#expense').val().trim());
var month = Number($('#payment_year').val());
var area = Number($('#area').val().trim());
if (hold == '') {
notice.html('请输入现持有资金');
myModal.modal('show');
} else if (income == '') {
notice.html('请输入现家庭月收入');
myModal.modal('show');
} else if (expense == '') {
notice.html('请输入家庭月固定支出');
myModal.modal('show');
} else if (month == '') {
notice.html('请输入还款年限');
myModal.modal('show');
} else if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else {
resultList = $('#tax_ability_result');
var abilityResult = abilityCalculator(month, hold, income, expense, area);
resultList.html('<li><span class="col-xs-4">房屋总价:</span><span>' + abilityResult.total + '元</span></li>' +
'<li><span class="col-xs-4">房屋单价:</span><span>' + abilityResult.avgPrice.toFixed(2) + '元/平方</span></li>');
page = 2;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
if (window.location.hash == '#result') { if (window.location.hash == '#result') {
window.history.back(); window.history.back();
} }
window.addEventListener("popstate", function (e) { window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) { if (window.location.hash == '' && ( page == 1 || page == 2)) {
page = 0; page = 0;
PageTransitions.nextPage({ PageTransitions.nextPage({
animation: 2, animation: 2,
...@@ -479,6 +723,80 @@ ...@@ -479,6 +723,80 @@
} }
}); });
}); });
function newHouseTaxCalculator(area, avgPrice) {
var area = parseFloat(area);
var avgPrice = parseFloat(avgPrice);
var totle = area * avgPrice;
//契税
var deed = 0;
//印花税
var stampDuty = totle * 0.0005;
//公证费
var notaryFees = totle * 0.003;
if (avgPrice <= 9432)
deed = totle * 0.015;
else if (avgPrice > 9432)
deed = totle * 0.03;
var result = {
stampDuty: stampDuty,
deed: deed,
notaryFees: notaryFees
};
return result;
}
function secondhandHouseTaxCalculator(area, avgPrice, isFirst, onlyOne, year) {
var totle = area * avgPrice;
//契税
var deed = 0;
//个人所得税
var pit = 0;
//营业税
var bt = 0;
if (area > 144)
isFist = false;
if (isFirst) {
deed = totle * 0.01;
if (area >= 90 && area <= 144)
deed = totle * 0.015;
} else {
deed = totle * 0.03;
}
if (year == 2 && onlyOne) {
pit = 0;
} else {
pit = totle * 0.01;
}
if (year == 0) {
bt = totle * 0.056;
}
var result = {
housePrice: totle,
deed: deed,
pit: pit,
bt: bt
};
return result;
}
function abilityCalculator(month, holdMoney, income, outcome, area) {
var year = parseInt(month / 12);
var lilu = 0.00576;
if (year > 5)
lilu = 0.00594;
var d1 = income - outcome;
var d2 = Math.pow(1 + lilu, month) - 1;
var d3 = lilu * Math.pow(1 + lilu, month);
//房屋总价
var total = Math.round(((d1 * d2) / d3) + holdMoney);
//房屋单价
var avgPrice = total / area;
var result = {
total: total,
avgPrice: avgPrice
};
return result;
}
</script> </script>
</body> </body>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<title>税费计算器</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_calculator.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_detail.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/modernizr.custom.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
</head>
<body>
<div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1">
<ul id="tab" class="list-unstyled btn-group-justified tab">
<li class="btn-group active">
<a href="#new" data-toggle="tab" class="btn">新房</a>
</li>
<li class="btn-group">
<a href="#secondhand" data-toggle="tab" class="btn">二手房</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="new">
<ul class="list-unstyled">
<li>
<label class="col-xs-3">房屋面积:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="area">
</p>
<p class="col-xs-3">平米</p>
</li>
<li>
<label class="col-xs-3">房屋单价:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="average_price">
</p>
<p class="col-xs-3">元/平米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
<div class="tab-pane fade" id="secondhand">
<ul class="list-unstyled">
<li>
<label class="col-xs-3">房屋面积:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="area">
</p>
<p class="col-xs-3">平米</p>
</li>
<li>
<label class="col-xs-3">房屋单价:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="average_price">
</p>
<p class="col-xs-3">元/平米</p>
</li>
<li>
<label class="col-xs-3">购置年限:</label>
<p class="col-xs-6">
<select class="form-control" data-id="year">
<option selected="selected" value="0">2年以内</option>
<option value="1">2-5年</option>
<option value="2">5年以上</option>
</select>
</p>
<p class="col-xs-3"></p>
</li>
<li>
<label class="col-xs-3">首次购房:</label>
<label for="firstTrue" class="col-xs-4 text-center">
<input type="radio" name="first" id="firstTrue" value="1" checked>
<span></span>
</label>
<label for="firstFalse" class="col-xs-4 text-center">
<input type="radio" name="first" id="firstFalse" value="0">
<span></span>
</label>
</li>
<li>
<label class="col-xs-3">唯一住房:</label>
<label for="onlyTrue" class="col-xs-4 text-center">
<input type="radio" name="only" id="onlyTrue" value="1" checked>
<span></span>
</label>
<label for="onlyFalse" class="col-xs-4 text-center">
<input type="radio" name="only" id="onlyFalse" value="0">
<span></span>
</label>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
</div>
</div>
<div class="pt-page pt-page-2">
<div id="wrapper" style="top: 0;">
<div id="scroller">
<ul class="list-unstyled" id="result">
</ul>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<script type="text/javascript" src="{{ theme }}/js/pagetransitions.js"></script>
<script>
var page = 0;
var resultList;
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('input[type=submit]').tap(function () {
var tab = $(this).parents('.active');
var tabId = tab.attr('id');
var area = Number(tab.find('[data-id=area]').val().trim());
var average_price = Number(tab.find('[data-id=average_price]').val().trim());
var year = Number(tab.find('[data-id=year]').val());
if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else if (average_price == '') {
notice.html('请输入房屋单价');
myModal.modal('show');
} else {
resultList = $('#result');
var taxResult = null;
if (tabId == 'new') {
taxResult = newHouseTaxCalculator(area, average_price);
resultList.html('<li><span class="col-xs-4">印花税:</span><span>' + taxResult.stampDuty + '元</span></li>'+
'<li><span class="col-xs-4">契税:</span><span>' + taxResult.deed + '元</span></li>'+
'<li><span class="col-xs-4">公证费:</span><span>' + taxResult.notaryFees + '元</span></li>');
} else {
if (year >= 0) {
var first = (Number($('input[name=first]:checked').val()) == 1);
var only = (Number($('input[name=only]:checked').val()) == 1);
taxResult = secondhandHouseTaxCalculator(area, average_price, first, only, year);
resultList.html('<li><span class="col-xs-5">房屋总价:</span><span>' + taxResult.housePrice + '元</span></li>' +
'<li><span class="col-xs-5">契税:</span><span>' + taxResult.deed + '元</span></li>' +
'<li><span class="col-xs-5">营业税:</span><span>' + taxResult.bt + '元</span></li>' +
'<li><span class="col-xs-5">个人所得税:</span><span>' + taxResult.pit + '元</span></li>' +
'<li><span class="col-xs-5">工本印花税:</span><span>5元</span></li>' +
'<li><span class="col-xs-5">合计:</span><span>' + (taxResult.deed + taxResult.bt + taxResult.pit + 5) + '元</span></li>');
} else {
notice.html('请选择购置年限');
myModal.modal('show');
return false;
}
}
page = 1;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
if (window.location.hash == '#result') {
window.history.back();
}
window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) {
page = 0;
PageTransitions.nextPage({
animation: 2,
showPage: page
});
resultList.html('');
}
});
});
function newHouseTaxCalculator(area, avgPrice) {
var area = parseFloat(area);
var avgPrice = parseFloat(avgPrice);
var totle = area * avgPrice;
//契税
var deed = 0;
//印花税
var stampDuty = totle * 0.0005;
//公证费
var notaryFees = totle * 0.003;
if (avgPrice <= 9432)
deed = totle * 0.015;
else if (avgPrice > 9432)
deed = totle * 0.03;
var result = {
stampDuty: stampDuty,
deed: deed,
notaryFees: notaryFees
};
return result;
}
function secondhandHouseTaxCalculator(area, avgPrice, isFirst, onlyOne, year) {
var totle = area * avgPrice;
//契税
var deed = 0;
//个人所得税
var pit = 0;
//营业税
var bt = 0;
if (area > 144)
isFist = false;
if (isFirst) {
deed = totle * 0.01;
if (area >= 90 && area <= 144)
deed = totle * 0.015;
} else {
deed = totle * 0.03;
}
if (year == 2 && onlyOne) {
pit = 0;
} else {
pit = totle * 0.01;
}
if (year == 0) {
bt = totle * 0.056;
}
var result = {
housePrice: totle,
deed: deed,
pit: pit,
bt: bt
};
return result;
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment