Commit 792eea0b by felix

每日一更

parent 230ebc0f
......@@ -12,6 +12,8 @@ class Contract {
$context['city'] = SearchDao::searchCity();
$context['managers'] = get_users( 'role=editor' );
$context['status'] = SearchDao::searchStatusType(4);
$context['buildProperty'] = SearchDao::searchBuildProperty();
$context['room'] = SearchDao::searchRoom();
$params = array(
'business' => $_REQUEST['business'],
......
<?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/InsertDao.php');
class customer extends Tospur_House
{
//二手房信息
public static function customer_html()
{
global $wpdb;
$context = array();
$context['siteUrl'] = get_site_url();
$insert_tospur_house_array = array(
//customerInfo(4)
'name' => $_POST['name'],
'customer_type' => $_POST['customer_type'],
'phone' => $_POST['phone'],
'customer_remark' => $_POST['customer_remark'],
//customerDemand(14)
'new_house' => $_POST['new_house'],
'secondHand_house' => $_POST['secondHand_house'],
'rent_house' => $_POST['rent_house'],
'character' => $_POST['character'],
'origin' => $_POST['origin'],
'payment_mode' => $_POST['payment_mode'],
'min_totalPrice' => $_POST['min_totalPrice'],
'max_totalPrice' => $_POST['max_totalPrice'],
'min_unitPrice' => $_POST['min_unitPrice'],
'max_unitPrice' => $_POST['max_unitPrice'],
'min_rent' => $_POST['min_rent'],
'max_rent' => $_POST['max_rent'],
'rent' => $_POST['rent'],
'tenancy' => $_POST['tenancy'],
//customerDetail(name 19)
'city_id' => $_POST['baseCity'],
'district_id' => $_POST['baseAreaId'],
'plate_id' => $_POST['basePlateId'],
'community_name' => $_POST['community_name'],
'room_id' => $_POST['baseRoom'],
'check_in_time' => $_POST['check_in_time'],
'min_coveredArea' => $_POST['min_coveredArea'],
'max_coveredArea' => $_POST['max_coveredArea'],
'min_floor' => $_POST['min_floor'],
'max_floor' => $_POST['max_floor'],
'propertyRight' => $_POST['propertyRight'],
'decoration' => $_POST['decoration'],
'age' => $_POST['age'],
'faceto' => $_POST['faceto'],
'bedroom' => $_POST['bedroom'],
'hall' => $_POST['hall'],
'bathroom' => $_POST['bathroom'],
'origin_remark' => $_POST['origin_remark'],
'consultant_id' => $_POST['consultant_id'],
'status' => $_POST['status']
);
if ($_POST) {
$wpdb->query("START TRANSACTION");
if (isset($_POST['houseId'])) {
$result = $wpdb->update(Config::TOSPUR_CUSTOMER_TABLE,
$insert_tospur_house_array,
array('id' => $_POST['houseId'])
);
if ($result) {
$wpdb->query("COMMIT");
echo "修改客源成功";
} else {
$wpdb->query("ROLLBACK");
echo "修改客源失败";
}
} else {
$id = CustomerDao::insert_customer($insert_tospur_house_array);
if ($id) {
$wpdb->query("COMMIT");
echo "新增客源成功";
} else {
$wpdb->query("ROLLBACK");
echo "新增客源失败";
}
}
exit;
} else if (isset($_GET['edit'])) {
$context['houseId'] = $_GET['id'];
$context = array_merge($context, CustomerDao::searchCustomer($_GET['id']));
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id, $context['result']->district_id);
}
$context['role'] = customer::getCurrentRole();
$context['city'] = SearchDao::searchCity();
$context['buildProperty'] = SearchDao::searchBuildProperty();
$context['room'] = SearchDao::searchRoom();
$context['status'] = searchDao::searchStatusType(5);
$context['customer_type'] = searchDao::searchStatusType(6);
for ($i = 1970; $i <= 2020; $i++) {
$context['age'][] = $i;
}
Timber::render('customer.html', $context);
}
}
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class customerList extends WP_List_Table
{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'customerList', //singular name of the listed records
'plural' => 'customerLists', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
switch ($column_name) {
case'id':
case 'name':
case 'address':
case 'average_price':
case 'developer':
case 'check_in_time':
case 'room_id':
case 'property_age':
case 'decoration':
case 'covered_area':
case 'status':
case 'volume_rate':
case 'greening_rate':
case 'households':
case 'parking_spaces':
case 'property_management':
case 'property_money':
default:
return '<a href="' . admin_url() . 'admin.php?page=newHouse&edit=true&id=' . $item['id'] . '">' . $item[$column_name] . '</a>';
}
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
/*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
);
}
function get_columns()
{
if (current_user_can('administrator')) {
$columns = array(
'cb' => '<input type="checkbox" />'
);
}
$columns['name'] = '姓名';
$columns['demand_type'] = '需求类型';
$columns['customer_remark'] = '客户备注';
$columns['consultant'] = '置业顾问';
$columns['check_in_time'] = '状态';
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array();
return $sortable_columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$sql = "select * from tospur_customer tc";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function function_customerList()
{
$context = array();
Timber::render("customerList.html", $context);
}
function addCustomerTable()
{
$customerList = new customerList();
$customerList->prepare_items();
$customerList->display();
}
?>
......@@ -155,6 +155,7 @@ class newHouseList extends WP_List_Table
function prepare_items()
{
global $wpdb;
$params = array();
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
......@@ -170,37 +171,57 @@ class newHouseList extends WP_List_Table
left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id
left join (select value as did,literal as room_type from dic_room) dr on dr.did = th.room_id
where 1=1 and house_type=0";
if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"];
$params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"];
$params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"];
$params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"];
$params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$sql = $sql." and room_id=".$_POST["room"];
$params[] = $_POST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$sql = $sql." and status=".$_POST["status"];
$params[] = $_POST["status"];
$sql = $sql." and status=%d";
}
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']);
$sql = $sql . " and average_price between ".$priceArray[0]." and ".$priceArray[1];
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
$sql = $sql . " and covered_area between ".$areaArray[0]." and ".$areaArray[1];
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$sql = $sql . " and name like '%".$_POST['searchText']."%'";
$params[] = '%'.$_POST['searchText'].'%';
$sql = $sql . " and name like %s";
}
$sql = $sql . " group by id";
$result = $wpdb->get_results($sql);
if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"];
$order = $_GET["order"];
$sql = $sql ." order by ".$orderby." ".$order;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......@@ -272,7 +293,8 @@ function function_newHouseList()
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
}
Timber::render("newHouseList.html",$contest);
$contest["house_type"] = 0;
Timber::render("houseList.html",$contest);
}
function addNewHouseTable(){
......
......@@ -166,6 +166,7 @@ class rentHouseList extends WP_List_Table
function prepare_items()
{
global $wpdb;
$params = array();
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
......@@ -176,14 +177,6 @@ class rentHouseList extends WP_List_Table
$this->process_bulk_action();
//$data = $this->example_data;
$params = array(
"city_id" => $_POST["listCity"],
"district_id" => $_POST["listDistrict"],
"plate_id" =>$_POST["listPlate"],
"buildproperty_id"=>$_POST["buildProperty"],
"status" => $_POST["status"],
);
$sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id
......@@ -191,29 +184,51 @@ class rentHouseList extends WP_List_Table
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=2 and ahu.user_type=1";
if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"];
$params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"];
$params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"];
$params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"];
$params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$params[] = $_POST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$sql = $sql." and status=".$_POST["status"];
$params[] = $_POST["status"];
$sql = $sql." and status=%d";
}
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']);
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
$sql = $sql . " and covered_area between ".$areaArray[0]." and ".$areaArray[1];
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$sql = $sql . " and name like '%".$_POST['searchText']."%'";
$params[] = '%'.$_POST['searchText'].'%';
$sql = $sql . " and name like %s";
}
if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"];
$order = $_GET["order"];
$sql = $sql ." order by ".$orderby." ".$order;
}
$result = $wpdb->get_results($sql);
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......@@ -277,17 +292,18 @@ function function_rentHouseList()
if(isset($_POST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_POST['listCity']);
$contest['plate'] = SearchDao::searchCity($_POST['listCity'],$_POST['listDistrict']);
$contest['dicTotalPrice'] = searchDao::searchTotalPrice($_POST['listCity']);
$contest['dicRentalPrice'] = searchDao::searchRentalPrice($_POST['listCity']);
$contest['dicArea'] = searchDao::searchArea($_POST['listCity']);
$contest['cityId'] = $_POST['listCity'];
$contest['districtId'] = $_POST['listDistrict'];
$contest['plateId' ]= $_POST['listPlate'];
$contest['buildPropertyId']= $_POST['buildProperty'];
$contest['totalPrice'] = $_POST['totalPrice'];
$contest['rentalPrice'] = $_POST['rentalPrice'];
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
}
Timber::render("rentHouseList.html",$contest);
$contest["house_type"] = 2;
Timber::render("houseList.html",$contest);
}
function addRentTable(){
......
......@@ -165,6 +165,7 @@ class secHandHouseList extends WP_List_Table
function prepare_items()
{
global $wpdb;
$params = array();
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
......@@ -182,33 +183,52 @@ class secHandHouseList extends WP_List_Table
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=1 and ahu.user_type=1";
if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"];
$params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"];
$params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"];
$params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"];
$params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$params[] = $_POST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$sql = $sql." and status=".$_POST["status"];
$params[] = $_POST["status"];
$sql = $sql." and status=%d";
}
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']);
$sql = $sql . " and average_price between ".$priceArray[0]." and ".$priceArray[1];
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
$sql = $sql . " and covered_area between ".$areaArray[0]." and ".$areaArray[1];
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$sql = $sql . " and name like '%".$_POST['searchText']."%'";
$params[] = '%'.$_POST['searchText'].'%';
$sql = $sql . " and name like %s";
}
if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"];
$order = $_GET["order"];
$sql = $sql ." order by ".$orderby." ".$order;
}
$result = $wpdb->get_results($sql);
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......@@ -278,7 +298,8 @@ function function_secHandHouseList()
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
}
Timber::render("secHandHouseList.html",$contest);
$contest["house_type"] = 1;
Timber::render("houseList.html",$contest);
}
function addSecTable(){
$secHandHouseList = new secHandHouseList();
......
{% block addCustomer %}
<div class="modal fade" id="addCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-6">
<input type="text" placeholder="请输入姓名/手机号搜索" id="addCustomer_searchtext" class="form-control">
</div>
<div class="col-md-2">
<button type="button" class="button action" id="addCustomer_search">搜索</button>
</div>
</div>
</div>
<div class="modal-body " style="height: 500px;overflow: auto;">
<ul id="addCustomer_list">
</ul>
</div>
</div>
</div>
</div>
<script>
function close_modal_addCustomer(){
$("#addCustomer").modal('hide');
}
function init_modal_addCustomer(callback){
$("#addCustomer").on("shown.bs.modal",function(){
});
$("#addCustomer_search").click(function(){
searchCustomer();
});
$("#addCustomer_list").on("click",".row",function(){
callback($(this).data());
});
searchCustomer();
}
function searchCustomer(){
var params = {
action:"searchCustomerByNameOrPhone",
search:$("#addCustomer_searchtext").val()
};
$.ajax({
type: "post",
url: "admin-ajax.php",
data: params,
success:function(json){
$("#addCustomer_list").find(".row").remove();
if(json){
for(var i = 0; i <json.length; i++){
var item = json[i];
var name = item["name"];
var id = item['id'];
var phone = item['phone'];
var row = $("<div>").addClass("row").css("margin-bottom","10px");
var left = $("<div>").addClass("col-md-3");
var phoneDiv = $("<label>").append(phone);
var right = $("<div>").addClass("col-md-3");
var nameDiv = $("<label>").append(name);
right.append(phoneDiv);
left.append(nameDiv);
row.append(left).append(right).data(item);
$("#addCustomer_list").append(row);
}
}
}
});
}
</script>
{% endblock %}
\ No newline at end of file
......@@ -17,8 +17,8 @@
{% if recommends %}
var data = {{ recommends|json_encode()}};
$.each(data,function(i,item){
url = "{{siteUrl}}"+item.path;
addRecHouse(item.id,url);
item.path = "{{siteUrl}}"+item.path;
addRecHouse(item);
});
{% endif %}
$(document).ready(function(){
......
......@@ -16,6 +16,7 @@
<li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">合同信息</a></li>
<li role="presentation"><a href="#soInfo" aria-controls="soInfo" role="tab" data-toggle="tab">业主/买方信息</a></li>
<li role="presentation" style="display: none;"><a id="houseInfo" data-toggle="tab">房源信息</a></li>
<li role="presentation" style="display: none;"><a id="customerInfo" data-toggle="tab">客源信息</a></li>
</ul>
<!-- Tab panes -->
......@@ -32,20 +33,22 @@
<option value="2">租房</option>
</select>
</div>
{% if result.contractId %}
<div class="col-md-6" class="form-control">
<label>合同编号:</label>
<label>{{result.contractId}}</label>
</div>
{% endif %}
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="houseNumber">房源编号:</label>
<input name="houseNumber" id="houseNumber" type="text" value="{{result.houseNumber}}" class="form-control" >
<input name="houseNumber" id="houseNumber" type="text" value="{{result.houseNumber}}" class="form-control" disabled>
</div>
<div class="col-md-6">
<label for="address">房源地址:</label>
<input id="address" type="text" value="{{result.address}}" class="form-control" style="width:60%;">
<input id="address" type="text" value="{{result.address}}" class="form-control" style="width:60%;" disabled>
<input type="button" id="select_house" value="选择" data-toggle="modal" data-target="#myModal" class="form-control" {{disabled}}>
</div>
</div>
......@@ -53,8 +56,8 @@
<div class="row">
<div class="col-md-6">
<label for="customerNumber">客源编号:</label>
<input id="customerNumber" name="customerNumber" type="text" value="{{result.customerNumber}}" class="form-control" style="width:60%;">
<input type="button" id="customerNumber" value="选择" class="form-control" {{disabled}}>
<input id="customerNumber" name="customerNumber" type="text" value="{{result.customerNumber}}" class="form-control" style="width:60%;" disabled>
<input type="button" id="select_customer" value="选择" data-toggle="modal" data-target="#addCustomer" class="form-control" {{disabled}}>
</div>
<div class="col-md-6">
<label for="signedDate">签约日:</label>
......@@ -172,6 +175,7 @@
</div>
<div class="col-md-2">
<input type="text" name="type" value="1" hidden="hidden">
<input type="text" name="houseId" hidden="hidden">
<input type="submit" id="submit" class="button action" style="position: fixed;">
</div>
</div>
......@@ -186,10 +190,25 @@
$("#select_house").click(function(){
init_modal_houseList(selectHouse,$("#business").val());
});
$("#select_customer").click(function(){
init_modal_addCustomer(selectCustomer);
});
});
function selectCustomer(data){
$("#customerNumber").val(data.id);
$("#customerInfo").parent().show();
$("#customerInfo").unbind().click(function(){
window.open("{{adminUrl}}admin.php?page=customer&edit=true&id="+data.id);
});
close_modal_addCustomer();
}
function selectHouse(data){
$("#address").val(data.address);
$("#houseNumber").val(data.house_number);
$("#houseId").val(data.id);
var houseType = $("#business").val();
if(houseType != -1){
$("#houseInfo").parent().show();
......@@ -215,5 +234,7 @@
</script>
{% include 'recommendHouse.html' %}
{{ block('recommendHouse') }}
{% include 'addCustomer.html' %}
{{ block('addCustomer') }}
</body>
</html>
\ No newline at end of file
<br>
<div class="row">
<div class="col-md-10">
<input type="checkbox" name="new_house" id="new_house" value="{{ result.new_house }}" style="margin: 0;"{% if
result.new_house == 1 %} checked {% endif %}>
<label for="new_house">新房</label>
<input type="checkbox" name="secondHand_house" id="secondHand_house" value="{{ result.secondHand_house }}"
style="margin: 0;"{% if result.secondHand_house == 1 %} checked {% endif %}>
<label for="secondHand_house">二手房</label>
<input type="checkbox" name="rent_house" id="rent_house" value="{{ result.rent_house }}" style="margin: 0;"{% if
result.rent_house == 1 %} checked {% endif %}>
<label for="rent_house">租房</label>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label for="character">性质:</label>
<select name="character" id="character" class="form-control">
<option value="公客">公客</option>
<option value="私客">私客</option>
</select>
</div>
<div class="col-md-6">
<label for="origin">来源:</label>
<select name="origin" id="origin" class="form-control">
<option value="来电">来电</option>
<option value="来访">来访</option>
<option value="扫街">扫街</option>
<option value="网络">网络</option>
<option value="派单">派单</option>
<option value="广告">广告</option>
<option value="陌拜">陌拜</option>
<option value="微信">微信</option>
<option value="内部推荐">内部推荐</option>
<option value="老带新">老带新</option>
<option value="租转售">租转售</option>
<option value="售转租">售转租</option>
<option value="盘源">盘源</option>
<option value="CALL客">CALL客</option>
<option value="其他">其他</option>
</select>
</div>
</div>
<br>
<div id="new_secondHand_house_input">
<div class="row">
<div class="col-md-6">
<label for="payment_mode">付款:</label>
<select name="payment_mode" id="payment_mode" class="form-control" disabled="disabled">
<option value="其它">其它</option>
<option value="商业贷款">商业贷款</option>
<option value="公积金贷款">公积金贷款</option>
<option value="组合贷款">组合贷款</option>
<option value="全款">全款</option>
</select>
</div>
<br>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label>总价:</label>
<label for="min_totalPrice" class="hidden"></label>
<input type="text" name="min_totalPrice" id="min_totalPrice" value="{{ result.min_totalPrice }}"
class="form-control" disabled="disabled">
<label for="max_totalPrice" class="hidden"></label>
<input type="text" name="max_totalPrice" id="max_totalPrice" value="{{ result.max_totalPrice }}"
class="form-control" disabled="disabled">
</div>
<div class="col-md-6">
<label>单价:</label>
<label for="min_unitPrice" class="hidden"></label>
<input type="text" name="min_unitPrice" id="min_unitPrice" value="{{ result.min_unitPrice }}"
class="form-control" disabled="disabled">
<label for="max_unitPrice" class="hidden"></label>
<input type="text" name="max_unitPrice" id="max_unitPrice" value="{{ result.max_unitPrice }}"
class="form-control" disabled="disabled">
元/m²
</div>
</div>
</div>
<br>
<div id="rent_house_input">
<div class="row">
<div class="col-md-6">
<label>月租:</label>
<label for="min_rent" class="hidden"></label>
<input type="text" name="min_rent" id="min_rent" value="{{ result.min_rent }}" class="form-control"
disabled="disabled">
<label for="max_rent" class="hidden"></label>
<input type="text" name="max_rent" id="max_rent" value="{{ result.max_rent }}" class="form-control"
disabled="disabled">
元/月
</div>
<div class="col-md-3">
<label for="rent">整租:</label>
<select name="rent" id="rent" class="form-control" disabled="disabled">
<option value="不限">不限</option>
<option value="整租">整租</option>
<option value="合租">合租</option>
</select>
</div>
<div class="col-md-3">
<label for="tenancy">租期:</label>
<select name="tenancy" id="tenancy" class="form-control" disabled="disabled">
<option value="不限">不限</option>
<option value="一个月">一个月</option>
<option value="三个月">三个月</option>
<option value="半年">半年</option>
<option value="一年">一年</option>
<option value="一年以上">一年以上</option>
</select>
</div>
</div>
</div>
<script>
(function ($) {
var new_house_checkbox, secondHand_house_checkbox, rent_house_checkbox;
$(document).ready(function () {
new_house_checkbox = $('input[name=new_house]');
secondHand_house_checkbox = $('input[name=secondHand_house]');
rent_house_checkbox = $('input[name=rent_house]');
$('input[type=checkbox]').change(function () {
if ($(this).is(':checked')) {
$(this).val(1);
} else {
$(this).val(0);
}
changeCheckBox();
});
changeCheckBox();
});
function changeCheckBox() {
if (new_house_checkbox.is(':checked') || secondHand_house_checkbox.is(':checked')) {
$('#new_secondHand_house_input').find('select, input').removeAttr('disabled');
} else if (!new_house_checkbox.is(':checked') && !secondHand_house_checkbox.is(':checked')) {
$('#new_secondHand_house_input').find('select, input').attr('disabled', 'disabled');
}
if (rent_house_checkbox.is(':checked')) {
$('#rent_house_input').find('select, input').removeAttr('disabled');
} else {
$('#rent_house_input').find('select, input').attr('disabled', 'disabled');
}
}
})(jQuery);
</script>
\ No newline at end of file
<br>
<div class="row">
<div class="col-md-12">
<label>城市:</label>
<label for="baseCity"></label>
<select id="baseCity" name="baseCity" class="form-control">
<option value="-1">城市</option>
{% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="baseAreaId"></label>
<select id="baseAreaId" name="baseAreaId" class="form-control">
<option value="-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="basePlateId"></label>
<select id="basePlateId" name="basePlateId" class="form-control">
<option value="-1">板块</option>
{% if district %}
{% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label for="community_name">小区名称:</label>
<input type="text" name="community_name" id="community_name" value="{{ result.community_name }}" class="form-control">
</div>
<div class="col-md-6">
<label for="baseRoom">建筑类型:</label>
<select id="baseRoom" name="baseRoom" class="form-control">
{% for item in room %}
<option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-4">
<label for="check_in_time">入住时间:</label>
<input type="text" name="check_in_time" id="check_in_time" value="{{ result.check_in_time }}" class="form-control">
</div>
</div>
<br>
<div class="row">
<div class="col-md-10">
<label>面积:</label>
<label for="min_coveredArea" class="hidden"></label>
<input type="text" name="min_coveredArea" id="min_coveredArea" value="{{ result.min_coveredArea }}" class="form-control">
<label for="max_coveredArea" class="hidden"></label>
<input type="text" name="max_coveredArea" id="max_coveredArea" value="{{ result.max_coveredArea }}" class="form-control">
</div>
</div>
<br>
<div class="row">
<div class="col-md-10">
<label>楼层:</label>
<label for="min_floor" class="hidden"></label>
<input type="text" name="min_floor" id="min_floor" value="{{ result.min_floor }}" class="form-control">
<label for="max_floor" class="hidden"></label>
<input type="text" name="max_floor" id="max_floor" value="{{ result.max_floor }}" class="form-control">
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label for="propertyRight">产权:</label>
<select name="propertyRight" id="propertyRight" class="form-control">
<option value="个人产权">个人产权</option>
<option value="单位产权">单位产权</option>
<option value="售后产权">售后产权</option>
<option value="家庭成员共有">家庭成员共有</option>
<option value="使用权">使用权</option>
<option value="小产权">小产权</option>
<option value="协议房">协议房</option>
<option value="私产">私产</option>
<option value="公产">公产</option>
<option value="合同发票">合同发票</option>
<option value="三联单">三联单</option>
<option value="其他">其他</option>
</select>
</div>
<div class="col-md-6">
<label for="decoration">装修:</label>
<select name="decoration" id="decoration" class="form-control">
<option value="不限">不限</option>
<option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option>
<option value="中等装修">中等装修</option>
<option value="精装修">精装修</option>
<option value="豪华装修">豪华装修</option>
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label for="age">年代:</label>
<select name="age" id="age" class="form-control">
<option value="不限">不限</option>
{% for item in age %}
<option value="{{ item }}">{{ item }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label for="faceto">朝向:</label>
<select name="faceto" id="faceto" class="form-control">
<option value="其他">其他</option>
<option value="东"></option>
<option value="南"></option>
<option value="西">西</option>
<option value="北"></option>
<option value="东西">东西</option>
<option value="南北">南北</option>
<option value="南南">南南</option>
<option value="东南">东南</option>
<option value="东北">东北</option>
<option value="西南">西南</option>
<option value="西北">西北</option>
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label>户型:</label>
<select name="bedroom" id="bedroom" class="form-control">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
<label for="bedroom"></label>
<select name="hall" id="hall" class="form-control">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<label for="hall"></label>
<select name="bathroom" id="bathroom" class="form-control">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<label for="bathroom"></label>
</div>
</div>
<br>
<div class="row">
<div class="col-md-8">
<label for="origin_remark">客源备注:</label><br>
<textarea name="origin_remark" id="origin_remark" rows="5" cols="50" class="form-control">{{ result.origin_remark }}</textarea>
</div>
</div>
<br>
<table class="form-table">
<tbody>
<tr>
<th><label>置业顾问</label></th>
<td>
<div id="consultantImg">
{% for item in consultant %}
<p>
<img src="{{ item.imageUrl }}" height="100" width="100" style="margin-right: 50px">
<span style="margin-right: 50px">{{ item.name }}</span>
<input type="button" value="删除" class="button action consultantCancel existsCancel">
<input type="hidden" name="consultant_id" value="{{ item.id }}">
</p>
{% endfor %}
</div>
<br>
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择置业顾问
</button>
</td>
</tr>
</tbody>
</table>
\ No newline at end of file
<br>
<div class="row">
<div class="col-md-6">
<label for="name">姓名:</label>
<input type="text" name="name" id="name" value="{{ result.name }}" class="form-control">
</div>
<div class="col-md-6">
<label for="customer_type">等级:</label>
<select name="customer_type" id="customer_type" class="form-control">
{% for item in customer_type %}
<option{% if(item.id == result.customer_type) %} selected="selected"{% endif %} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-8">
<label for="phone">电话:</label>
<input type="text" name="phone" id="phone" value="{{ result.phone }}" class="form-control">
</div>
</div>
<br>
<div class="row">
<div class="col-md-8">
<label for="customer_remark">客户备注:</label><br>
<textarea name="customer_remark" id="customer_remark" rows="5" cols="50" class="form-control">{{ result.customer_remark }}</textarea>
</div>
</div>
<div class="wrap">
<h2>新房列表</h2>
<form id="scores-filter" method="POST">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<h2>客户列表</h2>
<form id="scores-filter" method="post">
<input type="hidden" name="page" value="{{page}}"/>
<select id="listCity" name="listCity">
<option value="0"> 城市</option>
......@@ -63,82 +62,12 @@
<input type="hidden" name="hasSearch" value="1"/>
<input type="submit" id="submit" class="button action" value="搜索">
<!-- Now we can render the completed list table -->
{{function("addNewHouseTable")}}
{{function("addCustomerTable")}}
</form>
</div>
<script>
(function ($) {
$(document).ready(function(){
$("#listCity").change(function(){
var listCityId = $("#listCity").val();
var district =$("#listDistrict");
var acreage =$("#acreage");
var totalPrice = $("#totalPrice");
$('#listDistrict').find('option:not(:first-child)').remove();
$('#listPlate').find('option:not(:first-child)').remove();
$('#acreage').find('option:not(:first-child)').remove();
$('#totalPrice').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+listCityId,
success:function(json){
addOption(json,district);
}
});
//面积
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+listCityId,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": value}).append(value);
$("#acreage").append(Option);
}
}
});
//城市联动房子价格
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTotalPrice&cityId="+listCityId,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": value}).append(value);
$("#totalPrice").append(Option);
}
}
});
})
$("#listDistrict").change(function(){
var listCityId = $("#listCity").val();
var listDistrict = $("#listDistrict").val();
var listPlate = $("#listPlate");
$('#listPlate').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+listCityId+"&districtId="+listDistrict,
success:function(json){
addOption(json,listPlate);
}
});
})
function addOption(json,select){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
});
})(jQuery);
</script>
\ No newline at end of file
{% include 'listBlock.html' %}
{{ block('listBlock') }}
\ No newline at end of file
//城市区域联动
function setCity(){
$("#baseCity").change(function(){
var cityId = $("#baseCity").val();
var baserArea = $("#baseAreaId");
$('#baseAreaId').find('option:not(:first-child)').remove();
$('#basePlateId').find('option:not(:first-child)').remove();
function setCity(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var baseArea = $("#"+areaSelector);
var basePlate = $("#"+plateSelector);
baseArea.find('option:not(:first-child)').remove();
basePlate.find('option:not(:first-child)').remove();
//城市联动区域
searchCity(cityId,baserArea)
});
searchCity(cityId,baseArea)
}
//区域联动板块
function setArea(){
$("#baseAreaId").change(function(){
var basePlate = $("#basePlateId");
var areaId = $("#baseAreaId").val();
var cityId = $("#baseCity").val();
$('#basePlateId').find('option:not(:first-child)').remove();
function setArea(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var areaId = $("#"+areaSelector).val();
var basePlate = $("#"+plateSelector);
basePlate.find('option:not(:first-child)').remove();
searchArea(cityId,areaId,basePlate);
});
}
//搜索城市的方法
......@@ -97,10 +94,11 @@
//往给定id的select中添加option
function addOption(json,select){
var selectId = select.attr("id");
select.find('option:not(:first-child)').remove();
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId == "acreage" || selectId == "price"){
if(selectId.indexOf("creage") > -1|| selectId.indexOf("rice") > -1){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
......@@ -178,6 +176,28 @@
});
}
function searchTotalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTotalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchRentalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchRentalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//城市区域联动
function setCity(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var baseArea = $("#"+areaSelector);
var basePlate = $("#"+plateSelector);
baseArea.find('option:not(:first-child)').remove();
basePlate.find('option:not(:first-child)').remove();
//城市联动区域
searchCity(cityId,baseArea)
}
//区域联动板块
function setArea(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var areaId = $("#"+areaSelector).val();
var basePlate = $("#"+plateSelector);
basePlate.find('option:not(:first-child)').remove();
searchArea(cityId,areaId,basePlate);
}
//搜索城市的方法
function searchCity(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//搜索区域的方法
function searchArea(cityId,areaId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,optionId);
}
});
}
function existsCancel(){
$("#preview,#houseImg,#feature").on("click",".existsCancel,.featureCancel",function(){
$(this).parent().remove();
});
}
//租房与二手房中钥匙与车库的选项
function setCheckBox(){
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
}
//控制当二手房租房中钥匙与车库被勾选时,后面的文本域可使用
function textDisable(checkId,textId){
if($('input[id="'+checkId+'"]:checked').length > 0){
$("#"+textId).removeAttr("disabled");
}else{
$("#"+textId).attr("disabled","true");
}
}
//搜索置业顾问的方法
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
function addOption(json,select){
var selectId = select.attr("id");
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId.indexOf("creage") > -1|| selectId.indexOf("rice") > -1){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
//控制推荐房源与置业顾问的个数
function controlCommand(id,number,type){
var num = $("#"+id+" > p").length;
if(num>number){
if(type==0){
alert("最多只能推荐3个房源");
}else if(type==1){
alert("您只能推荐一位置业顾问");
}
$("#"+id).find("p:last-child").remove();
}
}
function getUrlParmas(){
var href = location.search.substr(1,location.search.length-1);
var params = href.split("&");
var map = {};
for(item in params){
var key = params[item].split("=")[0] || "";
var value = params[item].split("=")[1] || "";
map[key] = value;
}
return map;
}
function setDate(id){
$("#"+id).datepicker({
dateFormat: "yy-mm-dd"
});
}
//建筑年代的下拉框
function setAge(){
for(var i = 1981; i<= 2020; i++){
var option = $("<option>").append(i);
$("#pageAge").append(option);
}
}
//租房二手房中,修改界面下拉框的信息还原
function revertOption(data){
$.each(data,function(i,item){
$("form").find("select[name='"+i+"']").val(item);
});
}
//搜索面积的方法
function searchAcreage(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//搜索单价的方法
function searchPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchUnitPriceRange&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchTotalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTotalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchRentalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchRentalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
{% block listBlock %}
<div class="wrap">
<h2>租房房列表</h2>
<h2> {% if house_type == 0%}新房列表{% elseif house_type == 1 %}二手房列表{% else %}租房房列表{% endif %}</h2>
<form id="scores-filter" method="POST">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="{{page}}"/>
<input type="hidden" name="hasSearch" value="1"/>
<select id="listCity" name="listCity">
<option value="0"> 城市</option>
{% for item in city %}
......@@ -27,6 +26,16 @@
{% endfor %}
{% endif %}
</select>
{% if house_type == 2%}
<select id="rentalPrice" name="rentalPrice">
<option value ="">租金</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% else%}
<select id="totalPrice" name="totalPrice">
<option value ="">价格</option>
{% if dicTotalPrice %}
......@@ -35,12 +44,20 @@
{% endfor %}
{% endif %}
</select>
{% endif %}
{% if house_type == 0%}
<select id="room" name="room">
<option value="0">类型</option>
{% for item in room %}
<option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
{% endif %}
<select id="buildProperty" name="buildProperty">
<option value="0"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage">
<option value ="">面积</option>
......@@ -56,83 +73,46 @@
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入楼盘名/地段名搜索" name="searchText">
<input type="text" placeholder="请出入楼盘名" name="searchText">
<input type="hidden" name="hasSearch" value="1"/>
<input type="hidden" id="house_type" value="{{house_type}}"/>
<input type="submit" id="submit" class="button action" value="搜索">
<!-- Now we can render the completed list table -->
{% if house_type == 0 %}
{{function("addNewHouseTable")}}
{% elseif house_type == 1%}
{{function("addSecTable")}}
{% else %}
{{function("addRentTable")}}
{% endif %}
</form>
</div>
<script>
(function ($) {
$(document).ready(function(){
$("#listCity").change(function(){
var listCityId = $("#listCity").val();
var district =$("#listDistrict");
var acreage =$("#acreage");
var totalPrice = $("#totalPrice");
$('#listDistrict').find('option:not(:first-child)').remove();
$('#listPlate').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+listCityId,
success:function(json){
addOption(json,district);
}
});
var rentalPrice = $("#rentalPrice");
$("#listCity").change(function() {
var cityId = $("#listCity").val();
setCity("listCity", "listDistrict", "listPlate");
acreage.find('option:not(:first-child)').remove();
totalPrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove();
//面积
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+listCityId,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": value}).append(value);
$("#acreage").append(Option);
}
}
});
searchAcreage(cityId, acreage);
//城市联动房子价格
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchUnitPriceRange&cityId="+listCityId,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": value}).append(value);
$("#totalPrice").append(Option);
}
if ($("#house_type").val() == 2) {
searchRentalPrice(cityId, rentalPrice);
}else{
searchTotalPrice(cityId,totalPrice);
}
});
})
//设置区域
$("#listDistrict").change(function(){
var listCityId = $("#listCity").val();
var listDistrict = $("#listDistrict").val();
var listPlate = $("#listPlate");
$('#listPlate').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+listCityId+"&districtId="+listDistrict,
success:function(json){
addOption(json,listPlate);
}
});
setArea("listCity","listDistrict","listPlate");
})
function addOption(json,select){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
});
})(jQuery);
</script>
{% endblock %}
\ No newline at end of file
......@@ -63,9 +63,8 @@
{% endif %}
</div>
<div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:50px;">
<div class="row" style="position: fixed;top:200px;">
<select id="status" name="status">
{% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
......@@ -73,6 +72,7 @@
</select>
</div>
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div>
</div>
</form>
......
......@@ -6,7 +6,7 @@
<div class="modal-header">
<div class="row">
<div class="col-md-3">
<select id="cityId" class="form-control">
<select id="myModal_cityId" class="form-control">
<option value="-1"> 城市</option>
{% for item in city %}
<option value="{{ item.id }}">{{ item.value }}</option>
......@@ -14,22 +14,22 @@
</select>
</div>
<div class="col-md-3">
<select id="areaId" class="form-control">
<select id="myModal_areaId" class="form-control">
<option value = "-1">区域</option>
</select>
</div>
<div class="col-md-3">
<select id="plateId" class="form-control">
<select id="myModal_plateId" class="form-control">
<option value = "-1">板块</option>
</select>
</div>
<div class="col-md-3">
<select id="price" class="form-control">
<select id="myModal_price" class="form-control">
<option value = "-1">价格</option>
</select>
</div>
<div class="col-md-3">
<select id="buildProperty" class="form-control">
<select id="myModal_buildProperty" class="form-control">
<option value = "-1">房型</option>
{% for item in buildProperty %}
<option value="{{ item.id }}">{{ item.value }}</option>
......@@ -37,7 +37,7 @@
</select>
</div>
<div class="col-md-3">
<select id="room" class="form-control">
<select id="myModal_room" class="form-control">
<option value = "-1">类型</option>
{% for item in room %}
<option value="{{ item.id }}">{{ item.value }}</option>
......@@ -45,15 +45,15 @@
</select>
</div>
<div class="col-md-3">
<select id="acreage" class="form-control">
<select id="myModal_acreage" class="form-control">
<option value = "-1">面积</option>
</select>
</div>
<div class="col-md-6">
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext" class="form-control">
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="myModal_searchtext" class="form-control">
</div>
<div class="col-md-2">
<button type="button" class="button action" id="search">搜索</button>
<button type="button" class="button action" id="myModal_search">搜索</button>
</div>
</div>
</div>
......@@ -76,12 +76,12 @@
setCityArea();
});
$("#cityId,#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
$("#myModal").find("select").change(function(){
judgeHouseType(houseType);
});
//添加房源中搜索框的搜索
$("#search").click(function(){
$("#myModal_search").click(function(){
judgeHouseType(houseType);
});
......@@ -91,22 +91,28 @@
});
};
function setCityArea(){
var acreage =$("#acreage");
var price = $("#price");
var city = $("#cityId");
var area = $("#areaId");
var plate = $('#plateId');
var acreage =$("#myModal_acreage");
var price = $("#myModal_price");
var city = $("#myModal_cityId");
var area = $("#myModal_areaId");
var plate = $('#myModal_plateId');
if($("#baseCity").length>0){
var cityId = $("#baseCity").val();
$("#cityId").val(cityId);
city.val(cityId);
}else{
var cityId = city.val();
}
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();
searchCity($(this).val(),area)
//城市面积联动
searchAcreage(cityId, acreage);
//城市联动房子价格
searchTotalPrice(cityId, price);
});
area.change(function () {
......@@ -139,14 +145,14 @@
function addList(houseType){
var params = {
action:"searchHouse",
cityId:$("#cityId").val(),
districtId:$("#areaId").val(),
plateId:$("#plateId").val(),
buildPropertyId:$("#buildProperty").val(),
roomId:$("#room").val(),
acreage:$("#acreage").val(),
totalPrice:$("#price").val(),
searchText:$("#searchtext").val(),
cityId:$("#myModal_cityId").val(),
districtId:$("#myModal_areaId").val(),
plateId:$("#myModal_plateId").val(),
buildPropertyId:$("#myModal_buildProperty").val(),
roomId:$("#myModal_room").val(),
acreage:$("#myModal_acreage").val(),
totalPrice:$("#myModal_price").val(),
searchText:$("#myModal_searchtext").val(),
houseType:houseType
};
$.ajax({
......@@ -155,6 +161,7 @@
data: params,
success:function(json){
$("#modal_houseList").find(".row").remove();
if(json.result){
var result = json.result;
var urlParams = getUrlParmas();
for(var i = 0; i <result.length; i++){
......@@ -175,6 +182,7 @@
}
}
}
}
});
}
</script>
......
......@@ -58,9 +58,8 @@
{% endif %}
</div>
<div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:50px;">
<div class="row" style="position: fixed;top:200px;">
<select id="status" name="status">
{% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
......@@ -68,6 +67,7 @@
</select>
</div>
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div>
</div>
</form>
......
......@@ -65,9 +65,8 @@
{% endif %}
</div>
<div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:50px;">
<div class="row" style="position: fixed;top:200px;">
<select id="status" name="status">
{% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
......@@ -75,6 +74,7 @@
</select>
</div>
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div>
</div>
</form>
......
<div class="wrap">
<h2>二手房列表</h2>
<form id="scores-filter" method="POST">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="{{page}}"/>
<input type="hidden" name="hasSearch" value="1"/>
<select id="listCity" name="listCity">
<option value="0"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="listDistrict" name="listDistrict">
<option value="0">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="listPlate" name="listPlate">
<option value="0">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="totalPrice" name="totalPrice">
<option value ="">价格</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="buildProperty" name="buildProperty">
<option value="0"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage">
<option value ="">面积</option>
{% if acreage %}
{% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select name="status" name="status">
<option value="-1">状态</option>
{% for item in status%}
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入楼盘名/地段名搜索" name="searchText">
<input type="submit" id="submit" class="button action" value="搜索">
<!-- Now we can render the completed list table -->
{{function("addSecTable")}}
</form>
</div>
<script>
(function ($) {
$(document).ready(function(){
$("#listCity").change(function(){
var listCityId = $("#listCity").val();
var district =$("#listDistrict");
var acreage =$("#acreage");
var totalPrice = $("#totalPrice");
$('#listDistrict').find('option:not(:first-child)').remove();
$('#listPlate').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+listCityId,
success:function(json){
addOption(json,district);
}
});
//面积
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+listCityId,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": value}).append(value);
$("#acreage").append(Option);
}
}
});
//城市联动房子价格
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTotalPrice&cityId="+listCityId,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": value}).append(value);
$("#totalPrice").append(Option);
}
}
});
})
$("#listDistrict").change(function(){
var listCityId = $("#listCity").val();
var listDistrict = $("#listDistrict").val();
var listPlate = $("#listPlate");
$('#listPlate').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+listCityId+"&districtId="+listDistrict,
success:function(json){
addOption(json,listPlate);
}
});
})
function addOption(json,select){
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
});
})(jQuery);
</script>
......@@ -26,6 +26,7 @@ class Config {
const TOSPUR_SALE_TABLE = 'tospur_sale';
const TOSPUR_STATUS_TABLE = 'tospur_status';
const TOSPUR_CUSTOMER_TRACKING_TABLE = 'tospur_customer_tracking';
const TOSPUR_CUSTOMER_TABLE = 'tospur_customer';
const TOSPUR_CONTRACT = 'tospur_contract';
......
<?php
class CustomerDao
{
public static function insert_customer($params){
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_CUSTOMER_TABLE, $params);
$insert_id = $wpdb->insert_id;
if($result){
return $insert_id;
}else{
return 0;
}
}
public static function searchCustomer($id)
{
global $wpdb;
$sql = "SELECT tcs.* FROM tospur_customer tcs where tcs.id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql, $id));
$context = array();
if($result){
$context['result'] = $result;
$consultant_sql = "SELECT * FROM tospur_consultant where id = %d";
$consultant = $wpdb->get_results($wpdb->prepare($consultant_sql, $result->consultant_id));
$context['consultant'] = $consultant;
}
return $context;
}
public static function searchCustomerByNameOrPhone(){
global $wpdb;
$search = "%".$_REQUEST['search']."%";
$sql = "SELECT tcs.id,tcs.name,tcs.phone FROM ".Config::TOSPUR_CUSTOMER_TABLE." tcs where tcs.name like %s or tcs.phone like %s";
$result = $wpdb->get_results($wpdb->prepare($sql, $search,$search));
wp_send_json($result);
}
}
?>
\ No newline at end of file
......@@ -195,9 +195,9 @@ class SearchDao
$orderbySql = " order by th.creattime DESC";
}
$sql = "select th.id,th.house_type,th.name,th.latest_news,th.address,th.average_price,th.community_name,th.covered_area,th.total_price,th.decoration,th.rent,".
"ti.path,dr.literal,dbp.bp_literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht".
"ti.path,dr.literal,th.house_number,dbp.bp_literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht".
" LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id".
" where aht.house_id = th.id) as tags from tospur_house th".
" where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th".
$addSql.
" left join ".Config::DIC_CITY_TABLE." dc on th.plate_id = dc.plateId".
" left join (select id as rid,value as r_value,literal from ".Config::DIC_ROOM_TABLE.") dr on th.room_id = dr.r_value".
......
......@@ -18,7 +18,10 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/TospurDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerDao.php');
require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php');
require_once(PLUGIN_DIR . 'Admin/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouseList.php');
......@@ -98,7 +101,8 @@ function tospur_register_script_style(){
wp_register_script('publicjs',plugins_url('Admin/views', __FILE__)."/js/public.js");
wp_register_style('jquery-ui_css', plugins_url('Admin/views', __FILE__)."/css/jquery-ui.css");
wp_register_style('publicCss', plugins_url('Admin/views', __FILE__)."/css/public.css"); wp_register_style('bootstrapcss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.css");
wp_register_style('publicCss', plugins_url('Admin/views', __FILE__)."/css/public.css");
wp_register_style('bootstrapcss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.css");
wp_register_style('bootstrapMinCss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.min.css");
}
......@@ -116,6 +120,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_searchUnitPriceRange', 'SearchDao::ajax_searchUnitPriceRange');
add_action('wp_ajax_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice');
add_action('wp_ajax_nopriv_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice');
add_action('wp_ajax_searchRentalPrice', 'SearchDao::ajax_searchRentalPrice');
add_action('wp_ajax_nopriv_searchRentalPrice', 'SearchDao::ajax_searchRentalPrice');
add_action('wp_ajax_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' );
......@@ -126,6 +132,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_add_feature', 'feature::ajax_add_feature');
add_action('wp_ajax_submit_introduction', 'introduction::ajax_submit_introduction');
add_action('wp_ajax_nopriv_submit_introduction', 'introduction::ajax_submit_introduction');
add_action('wp_ajax_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
add_action('wp_ajax_nopriv_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
//后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
//后台处理 置业顾问
......@@ -175,6 +183,8 @@ function reset_menu()
add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('合同列表','合同列表', 'edit_published_posts', 'contractList', 'Contract_List::showTableView', 'dashicons-menu', 10);
add_submenu_page('contractList', '合同管理', '合同管理', 'moderate_comments', 'contract', 'Contract::init_view');
add_menu_page('客户列表','客户列表', 'moderate_comments', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'moderate_comments', 'customer', 'customer::customer_html');
add_menu_page("同步数据", "同步数据", "manage_options", "sync", "TCSyncView::display", 'dashicons-menu');
//移除更新信息
......
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