Commit 12ffe958 by felix

每日一更

parent a6ba1c7d
...@@ -81,6 +81,7 @@ class House extends Tospur_House{ ...@@ -81,6 +81,7 @@ class House extends Tospur_House{
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType(); $context["photoType"] = SearchDao::searchPhotoType();
$context["house_type"] = 0;
Timber::render("newhouse.html",$context); Timber::render("newhouse.html",$context);
} }
......
...@@ -212,6 +212,8 @@ function function_customerList() ...@@ -212,6 +212,8 @@ function function_customerList()
$context = array(); $context = array();
$context['city'] = SearchDao::searchCity(); $context['city'] = SearchDao::searchCity();
$current_user = wp_get_current_user();
$context['role'] = $current_user->roles[0];
if (isset($_REQUEST['hasSearch'])) { if (isset($_REQUEST['hasSearch'])) {
$context['req'] = $_REQUEST; $context['req'] = $_REQUEST;
} }
......
...@@ -100,6 +100,8 @@ function function_customerTrackingList() ...@@ -100,6 +100,8 @@ function function_customerTrackingList()
$context = array(); $context = array();
$context['status'] = SearchDao::searchStatusType(3); $context['status'] = SearchDao::searchStatusType(3);
$context['req'] = $_REQUEST; $context['req'] = $_REQUEST;
$current_user = wp_get_current_user();
$context['role'] = $current_user->roles[0];
Timber::render("customerTrackingList.html", $context); Timber::render("customerTrackingList.html", $context);
} }
......
...@@ -38,7 +38,7 @@ if ($result->consultant_id && !$role_flag) { ...@@ -38,7 +38,7 @@ if ($result->consultant_id && !$role_flag) {
); );
} }
$context['cityId'] = $result->cityId; $context['cityId'] = $result->cityId;
$context['page'] = 'view'; $context['page'] = 'view_house';
$context['house_result'] = $result; $context['house_result'] = $result;
Timber::render('handle.html', $context); Timber::render('handle.html', $context);
......
...@@ -336,10 +336,10 @@ class newHouseList extends WP_List_Table ...@@ -336,10 +336,10 @@ class newHouseList extends WP_List_Table
if (isset($_REQUEST["organization"]) && $_REQUEST["organization"] != -1) { if (isset($_REQUEST["organization"]) && $_REQUEST["organization"] != -1) {
$params[] = $_REQUEST["organization"]; $params[] = $_REQUEST["organization"];
$sql = $sql . " and subsidiaryId=%d "; $sql = $sql . " and subsidiaryId=%d ";
} else if ($_REQUEST["searchText"] != NULL) { } else if (trim($_REQUEST["searchText"]) != NULL) {
$params[] = '%' . $_REQUEST['searchText'] . '%'; $params[] = '%' . $_REQUEST['searchText'] . '%';
$sql = $sql . " and name like %s"; $sql = $sql . " and name like %s";
} else if ($_REQUEST["stuff"] != NULL) { } else if (trim($_REQUEST["stuff"]) != NULL) {
$params[] = '%' . $_REQUEST['stuff'] . '%'; $params[] = '%' . $_REQUEST['stuff'] . '%';
$sql = $sql . " and consul_name like %s"; $sql = $sql . " and consul_name like %s";
} }
...@@ -352,7 +352,6 @@ class newHouseList extends WP_List_Table ...@@ -352,7 +352,6 @@ class newHouseList extends WP_List_Table
$order = $_REQUEST["order"]; $order = $_REQUEST["order"];
$sql = $sql . " order by " . $orderby . " " . $order; $sql = $sql . " order by " . $orderby . " " . $order;
} }
$result = DBManager::get_results($wpdb->prepare($sql, $params)); $result = DBManager::get_results($wpdb->prepare($sql, $params));
$data = array(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
......
...@@ -14,7 +14,7 @@ class RentHouse extends Tospur_House{ ...@@ -14,7 +14,7 @@ class RentHouse extends Tospur_House{
'name' => $_POST['housename'], 'name' => $_POST['housename'],
'total_price' =>$_POST['total_price'], 'total_price' =>$_POST['total_price'],
'average_price' => $_POST['average_price'], 'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'], 'buildproperty_id'=>$_POST['roomNum'],
'covered_area' =>$_POST['covered_area'], 'covered_area' =>$_POST['covered_area'],
'floor' =>$_POST['floor'], 'floor' =>$_POST['floor'],
'faceto'=>$_POST['faceto'], 'faceto'=>$_POST['faceto'],
......
...@@ -357,13 +357,13 @@ class rentHouseList extends WP_List_Table ...@@ -357,13 +357,13 @@ class rentHouseList extends WP_List_Table
$sql = $sql . " and creattime between %s and %s"; $sql = $sql . " and creattime between %s and %s";
} }
if (isset($_REQUEST["organization"]) && $_REQUEST["organization"] != -1) { if (isset($_REQUEST["organization"]) && $_REQUEST["organization"] != -1 && $_REQUEST["organization"] != 0) {
$params[] = $_REQUEST["organization"]; $params[] = $_REQUEST["organization"];
$sql = $sql . " and subsidiaryId=%d "; $sql = $sql . " and subsidiaryId=%d ";
} else if ($_REQUEST["searchText"] != NULL) { } else if (trim($_REQUEST["searchText"] != NULL)) {
$params[] = '%' . $_REQUEST['searchText'] . '%'; $params[] = '%' . $_REQUEST['searchText'] . '%';
$sql = $sql . " and name like %s"; $sql = $sql . " and name like %s";
} else if ($_REQUEST["stuff"] != NULL) { } else if (trim($_REQUEST["stuff"] != NULL)) {
$params[] = '%' . $_REQUEST['stuff'] . '%'; $params[] = '%' . $_REQUEST['stuff'] . '%';
$sql = $sql . " and consul_name like %s"; $sql = $sql . " and consul_name like %s";
} }
...@@ -373,6 +373,7 @@ class rentHouseList extends WP_List_Table ...@@ -373,6 +373,7 @@ class rentHouseList extends WP_List_Table
$order = $_GET["order"]; $order = $_GET["order"];
$sql = $sql . " order by " . $orderby . " " . $order; $sql = $sql . " order by " . $orderby . " " . $order;
} }
$result = DBManager::get_results($wpdb->prepare($sql, $params)); $result = DBManager::get_results($wpdb->prepare($sql, $params));
$data = array(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
......
...@@ -382,13 +382,13 @@ class secHandHouseList extends WP_List_Table ...@@ -382,13 +382,13 @@ class secHandHouseList extends WP_List_Table
$sql = $sql . " and creattime between %s and %s"; $sql = $sql . " and creattime between %s and %s";
} }
if (isset($_REQUEST["organization"]) && $_REQUEST["organization"] != -1) { if (isset($_REQUEST["organization"]) && $_REQUEST["organization"] != -1 && $_REQUEST["organization"] != 0) {
$params[] = $_REQUEST["organization"]; $params[] = $_REQUEST["organization"];
$sql = $sql . " and subsidiaryId=%d "; $sql = $sql . " and subsidiaryId=%d ";
} else if ($_REQUEST["searchText"] != NULL) { } else if (trim($_REQUEST["searchText"] != NULL)) {
$params[] = '%' . $_REQUEST['searchText'] . '%'; $params[] = '%' . $_REQUEST['searchText'] . '%';
$sql = $sql . " and name like %s"; $sql = $sql . " and name like %s";
} else if ($_REQUEST["stuff"] != NULL) { } else if (trim($_REQUEST["stuff"] != NULL)) {
$params[] = '%' . $_REQUEST['stuff'] . '%'; $params[] = '%' . $_REQUEST['stuff'] . '%';
$sql = $sql . " and consul_name like %s"; $sql = $sql . " and consul_name like %s";
} }
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
}else{ }else{
$("#consultantImg").append(p); $("#consultantImg").append(p);
} }
{% if (house_type == 1 or house_type == 2 or page == 'customer') %} {% if (house_type == 1 or house_type == 2 or page == 'customer' or page == 'view_house') %}
controlCommand("consultantImg",1,1); controlCommand("consultantImg",1,1);
{% endif %} {% endif %}
} }
......
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
<input type="hidden" name="page" value="customerList"> <input type="hidden" name="page" value="customerList">
<div> <div>
<input type="hidden" name="hasSearch" value="1"/> <input type="hidden" name="hasSearch" value="1"/>
{% import "selectOrganization.html" as macro %} {% if role != 'zygw' %}
{{ macro.selectOrganization("customer") }} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("customer") }}
{% endif %}
<label for="status" class="hidden"></label> <label for="status" class="hidden"></label>
<select name="status" id="status"> <select name="status" id="status">
<option value="-1">状态</option> <option value="-1">状态</option>
...@@ -87,11 +89,13 @@ ...@@ -87,11 +89,13 @@
<label for="acreage" class="hidden"></label> <label for="acreage" class="hidden"></label>
<select id="acreage" name="acreage"> <select id="acreage" name="acreage">
<option value="-1">面积</option> <option value="-1">面积</option>
{% set dicArea = function('SearchDao::searchArea', req.listCity) %} {% if req.listCity != null %}
{% if dicArea %} {% set dicArea = function('SearchDao::searchArea', req.listCity) %}
{% for item in dicArea %} {% if dicArea %}
<option {{ item.value == req.acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> {% for item in dicArea %}
{% endfor %} <option {{ item.value == req.acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
{% endif %} {% endif %}
</select> </select>
</div> </div>
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
<input type="hidden" name="page" value="customerTrackingList"> <input type="hidden" name="page" value="customerTrackingList">
<div> <div>
{% import "selectOrganization.html" as macro %} {% if role != 'zygw' %}
{{ macro.selectOrganization("customerTracking") }} {% import "selectOrganization.html" as macro %}
{{ macro.selectOrganization("customerTracking") }}
{% endif %}
<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>
......
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
setCity("listCity", "listDistrict", "listPlate"); setCity("listCity", "listDistrict", "listPlate");
acreage.find('option:not(:first-child)').remove(); acreage.find('option:not(:first-child)').remove();
totalPrice.find('option:not(:first-child)').remove(); totalPrice.find('option:not(:first-child)').remove();
averagePrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove(); rentalPrice.find('option:not(:first-child)').remove();
//面积 //面积
searchAcreage(cityId, acreage); searchAcreage(cityId, acreage);
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
var organizationId = getOrganization('consultant'); var organizationId = getOrganization('consultant');
var select = $('#consultant_organization').find('select[data-depth]:not(.hidden)'); var select = $('#consultant_organization').find('select[data-depth]:not(.hidden)');
if(select.length > 1 && organizationId == -1 && consultantName == ""){ if(select.length > 1 && organizationId == -1 && consultantName == ""){
alert("请选择部门") alert("请选择部门");
return false;
} }
searchConsultant(organizationId,consultantName); searchConsultant(organizationId,consultantName);
}); });
......
...@@ -69,11 +69,14 @@ ...@@ -69,11 +69,14 @@
function close_modal_houseList(){ function close_modal_houseList(){
$("#myModal").modal('hide'); $("#myModal").modal('hide');
} }
var flag = 0;
function init_modal_houseList(callback,houseType){ function init_modal_houseList(callback,houseType){
judgeHouseType(houseType); judgeHouseType(houseType);
$("#myModal").on("shown.bs.modal",function(){ $("#myModal").on("shown.bs.modal",function(){
setCityArea(); if(flag == 0){
setCityArea();
flag = 1;
}
}); });
$("#myModal").find("select").change(function(){ $("#myModal").find("select").change(function(){
...@@ -89,46 +92,56 @@ ...@@ -89,46 +92,56 @@
$("#modal_houseList").on("click",".row",function(){ $("#modal_houseList").on("click",".row",function(){
callback($(this).data()); callback($(this).data());
}); });
}; };
function setCityArea(){ function setCityArea(){
var acreage =$("#myModal_acreage"); var acreage =$("#myModal_acreage");
var price = $("#myModal_price"); var price = $("#myModal_price");
var city = $("#myModal_cityId"); var city = $("#myModal_cityId");
var area = $("#myModal_areaId"); var area = $("#myModal_areaId");
var plate = $('#myModal_plateId'); var plate = $('#myModal_plateId');
if($("#baseCity").length>0){ //增加!=null 时因为在添加合同模块中调用这个方法,合同模块没有这个baseCity的Id
if( $("#baseCity").val() != null && $("#baseCity").val()!= -1){
var cityId = $("#baseCity").val(); var cityId = $("#baseCity").val();
city.val(cityId); searchCity(cityId,area);
searchCity(cityId,area); searchAcreage(cityId, acreage);
//城市联动房子价格
{% if house_type == 0 %}
searchPrice(cityId,price)
{% elseif house_type == 1 %}
searchTotalPrice(cityId, price);
{% else %}
searchRentalPrice(cityId,price);
{% endif %}
}else{ }else{
var cityId = city.val(); var cityId = city.val();
} }
city.val(cityId);
city.change(function(){ city.change(function(){
var cityId = city.val(); var cityId = city.val();
var areaId = area.val(); area.find('option:not(:first-child)').remove();
area.find('option:not(:first-child)').remove(); plate.find('option:not(:first-child)').remove();
plate.find('option:not(:first-child)').remove(); price.find('option:not(:first-child)').remove();
searchCity(cityId,area); acreage.find('option:not(:first-child)').remove();
//城市面积联动 searchCity(cityId,area);
searchAcreage(cityId, acreage); //城市面积联动
//城市联动房子价格 searchAcreage(cityId, acreage);
searchTotalPrice(cityId, price); //城市联动房子价格
}); {% if house_type == 0 %}
searchPrice(cityId,price)
area.change(function () { {% elseif house_type == 1 %}
var cityId = city.val(); searchTotalPrice(cityId, price);
var areaId = area.val(); {% else %}
$("#modal_houseList").find(".row").remove(); searchRentalPrice(cityId,price);
plate.find('option:not(:first-child)').remove(); {% endif %}
searchArea(cityId, areaId, plate) });
}); area.change(function () {
//城市面积联动 var cityId = city.val();
searchAcreage(cityId, acreage); var areaId = area.val();
//城市联动房子价格 $("#modal_houseList").find(".row").remove();
searchTotalPrice(cityId, price); plate.find('option:not(:first-child)').remove();
searchArea(cityId, areaId, plate);
});
} }
function judgeHouseType(type){ function judgeHouseType(type){
...@@ -154,10 +167,16 @@ ...@@ -154,10 +167,16 @@
buildPropertyId:$("#myModal_buildProperty").val(), buildPropertyId:$("#myModal_buildProperty").val(),
roomId:$("#myModal_room").val(), roomId:$("#myModal_room").val(),
acreage:$("#myModal_acreage").val(), acreage:$("#myModal_acreage").val(),
totalPrice:$("#myModal_price").val(),
searchText:$("#myModal_searchtext").val(), searchText:$("#myModal_searchtext").val(),
houseType:houseType houseType:houseType
}; };
{% if house_type == 0 %}
params["unitPrice"] =$("#myModal_price").val();
{% elseif house_type == 1 %}
params["totalPrice"]=$("#myModal_price").val();
{% else %}
params["rentalPrice"]=$("#myModal_price").val();
{% endif %}
$.ajax({ $.ajax({
type: "post", type: "post",
url: "/tospur/wp-admin/admin-ajax.php", url: "/tospur/wp-admin/admin-ajax.php",
......
...@@ -157,6 +157,7 @@ class SearchDao ...@@ -157,6 +157,7 @@ class SearchDao
'buildPropertyId' => $_POST['buildPropertyId'], 'buildPropertyId' => $_POST['buildPropertyId'],
'roomId' => $_POST['roomId'], 'roomId' => $_POST['roomId'],
'acreage' => $_POST['acreage'], 'acreage' => $_POST['acreage'],
'unitPrice'=> $_POST['unitPrice'],
'totalPrice' => $_POST['totalPrice'], 'totalPrice' => $_POST['totalPrice'],
'rentalPrice' => $_POST['rentalPrice'], 'rentalPrice' => $_POST['rentalPrice'],
'searchText' => $_POST['searchText'], 'searchText' => $_POST['searchText'],
...@@ -236,12 +237,20 @@ class SearchDao ...@@ -236,12 +237,20 @@ class SearchDao
$sql = $sql . " and covered_area between %d and %d"; $sql = $sql . " and covered_area between %d and %d";
} }
} }
if ($array['totalPrice'] > -1) { if ($array['unitPrice'] > -1) {
$priceArray = explode("-", $array['totalPrice']); $priceArray = explode("-", $array['unitPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
$params[] = $priceArray[1]; $params[] = $priceArray[1];
$sql = $sql . " and total_price/10000 between %d and %d"; $sql = $sql . " and average_price between %d and %d";
} }
if ($array['totalPrice'] > -1) {
$priceArray = explode("-", $array['totalPrice']);
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and total_price/10000 between %d and %d";
}
if ($array['rentalPrice'] > -1) { if ($array['rentalPrice'] > -1) {
$priceArray = explode("-", $array['rentalPrice']); $priceArray = explode("-", $array['rentalPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
......
...@@ -243,6 +243,7 @@ ...@@ -243,6 +243,7 @@
}); });
function validate_sale_form(form) { function validate_sale_form(form) {
form.validate({ form.validate({
focusInvalid: false,
onkeyup: false, onkeyup: false,
onfocusout: false, onfocusout: false,
rules: { rules: {
......
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