Commit 12ffe958 by felix

每日一更

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