Commit fa8bb9d2 by shz

tospur

parent 5d92fe11
<?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/InsertDao.php');
class customer extends Tospur_House
{
......@@ -50,7 +48,7 @@ class customer extends Tospur_House
'hall' => $_POST['hall'],
'bathroom' => $_POST['bathroom'],
'origin_remark' => $_POST['origin_remark'],
'consultant_id' => $_POST['consultant_id'],
'consultant_id' => $_POST['data']['recConsultant'][0],
//(1)
'status' => $_POST['status']
);
......@@ -61,7 +59,8 @@ class customer extends Tospur_House
$insert_tospur_house_array,
array('id' => $_POST['houseId'])
);
if ($result) {
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
if ($result >= 0) {
$wpdb->query("COMMIT");
echo "修改客源成功";
} else {
......@@ -71,6 +70,7 @@ class customer extends Tospur_House
} else {
$id = CustomerDao::insert_customer($insert_tospur_house_array);
if ($id) {
CustomerTrackingDao::insert($id, $_REQUEST);
$wpdb->query("COMMIT");
echo "新增客源成功";
} else {
......@@ -96,6 +96,7 @@ class customer extends Tospur_House
$context['room'] = SearchDao::searchRoom();
$context['status'] = searchDao::searchStatusType(5);
$context['customer_type'] = searchDao::searchStatusType(6);
$context['page'] = 'customer';
for ($i = 1970; $i <= 2020; $i++) {
$context['age'][] = $i;
}
......
......@@ -42,15 +42,15 @@ class customerList extends WP_List_Table
$sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name FROM tospur_customer tcs" .
" left join (SELECT * FROM tospur_status where status_type = 5) as ts on tcs.status = ts.status_id" .
" left join tospur_consultant tc on tcs.consultant_id = tc.id where 1 = 1";
if (isset($_POST['status']) && $_POST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_POST['status'];
if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_REQUEST['status'];
}
if (isset($_POST['customer_type']) && $_POST['customer_type'] != -1) {
$sql = $sql . " and tcs.customer_type = " . $_POST['customer_type'];
if (isset($_REQUEST['customer_type']) && $_REQUEST['customer_type'] != -1) {
$sql = $sql . " and tcs.customer_type = " . $_REQUEST['customer_type'];
}
if (isset($_POST['demand_type']) && $_POST['demand_type'] != -1) {
if (isset($_REQUEST['demand_type']) && $_REQUEST['demand_type'] != -1) {
$demand_type = null;
switch ($_POST['demand_type']) {
switch ($_REQUEST['demand_type']) {
case 0:
$demand_type = 'tcs.new_house';
break;
......@@ -65,20 +65,20 @@ class customerList extends WP_List_Table
$sql = $sql . " and " . $demand_type . " = 1";
}
}
if (isset($_POST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_POST['search_name'] . "%'";
if (isset($_REQUEST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_REQUEST['search_name'] . "%'";
}
if (isset($_POST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_POST['search_consultant_name'] . "%'";
if (isset($_REQUEST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
if (isset($_POST['search_phone'])) {
$sql = $sql . " and tcs.phone like '%" . $_POST['search_phone'] . "%'";
if (isset($_REQUEST['search_phone'])) {
$sql = $sql . " and tcs.phone like '%" . $_REQUEST['search_phone'] . "%'";
}
if (isset($_POST['search_min_time'])) {
$sql = $sql . " and tcs.time >= '" . $_POST['search_min_time'] . "'";
if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
$sql = $sql . " and tcs.time >= '" . $_REQUEST['search_min_time'] . "'";
}
if (isset($_POST['search_max_time'])) {
$sql = $sql . " and tcs.time <= '" . $_POST['search_max_time'] . "'";
if (isset($_REQUEST['search_max_time']) && $_REQUEST['search_max_time'] != null) {
$sql = $sql . " and tcs.time <= '" . $_REQUEST['search_max_time'] . "'";
}
$result = $wpdb->get_results($sql);
$data = array();
......@@ -102,11 +102,13 @@ class customerList extends WP_List_Table
}
$current_page = $this->get_pagenum();
if (isset($_POST['paged'])) {
$current_page = $_POST['paged'];
}
$total_items = count($data);
$total_pages = ceil($total_items / $per_page);
if ($_REQUEST['paged'] > $total_pages) {
$current_page = $total_pages;
}
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
......@@ -126,20 +128,21 @@ function function_customerList()
$context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6);
$context['status_id'] = $_POST['status'];
$context['demand_type'] = isset($_POST['demand_type']) ? $_POST['demand_type'] : -1;
$context['customer_type_id'] = isset($_POST['customer_type']) ? $_POST['customer_type'] : -1;
$context['search_name'] = $_POST['search_name'];
$context['search_consultant_name'] = $_POST['search_consultant_name'];
$context['search_phone'] = $_POST['search_phone'];
$context['search_min_time'] = $_POST['search_min_time'];
$context['search_max_time'] = $_POST['search_max_time'];
$context['status_id'] = $_REQUEST['status'];
$context['demand_type'] = isset($_REQUEST['demand_type']) ? $_REQUEST['demand_type'] : -1;
$context['customer_type_id'] = isset($_REQUEST['customer_type']) ? $_REQUEST['customer_type'] : -1;
$context['search_name'] = $_REQUEST['search_name'];
$context['search_consultant_name'] = $_REQUEST['search_consultant_name'];
$context['search_phone'] = $_REQUEST['search_phone'];
$context['search_min_time'] = $_REQUEST['search_min_time'];
$context['search_max_time'] = $_REQUEST['search_max_time'];
Timber::render("customerList.html", $context);
}
function addCustomerTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$customerList = new customerList();
$customerList->prepare_items();
$customerList->display();
......
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class customerTrackingList extends WP_List_Table
{
function __construct()
{
}
function column_default($item, $column_name)
{
switch ($column_name) {
default:
return $item[$column_name];
}
}
function get_columns()
{
$columns['status_name'] = '跟进类型';
$columns['consultant_name'] = '置业顾问';
$columns['time'] = '时间';
$columns['description'] = '跟进说明';
$columns['origin'] = '客/房源';
return $columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$sql = "SELECT tct.*,ts.status_name,tc.name as consultant_name FROM tospur_customer_tracking tct" .
" left join (SELECT * FROM tospur_status where status_type = 3) as ts on tct.status_type = ts.status_id" .
" left join tospur_consultant tc on tct.consultant_id = tc.id where 1 = 1";
if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) {
$sql = $sql . " and tct.status_type = " . $_REQUEST['status_type'];
}
if (isset($_REQUEST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
$sql = $sql . " and tct.time >= '" . $_REQUEST['search_min_time'] . "'";
}
if (isset($_REQUEST['search_max_time']) && $_REQUEST['search_max_time'] != null) {
$sql = $sql . " and tct.time <= '" . $_REQUEST['search_max_time'] . "'";
}
$sql = $sql . " order by tct.time desc";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'status_id' => $value->status_id,
'status_name' => $value->status_name,
'consultant_name' => $value->consultant_name,
'time' => $value->time,
'description' => $value->description,
'origin' => ($value->origin == 1) ? '房源' : (($value->origin == 2) ? '客源' : '')
);
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$total_pages = ceil($total_items / $per_page);
if ($_REQUEST['paged'] > $total_pages) {
$current_page = $total_pages;
}
$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_customerTrackingList()
{
$context = array();
$context['status'] = SearchDao::searchStatusType(3);
$context['status_type'] = isset($_REQUEST['status_type']) ? $_REQUEST['status_type'] : -1;
$context['search_consultant_name'] = $_REQUEST['search_consultant_name'];
$context['search_min_time'] = $_REQUEST['search_min_time'];
$context['search_max_time'] = $_REQUEST['search_max_time'];
Timber::render("customerTrackingList.html", $context);
}
function addCustomerTrackingTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$customerTrackingList = new customerTrackingList();
$customerTrackingList->prepare_items();
$customerTrackingList->display();
}
?>
......@@ -11,7 +11,6 @@ class SecHandHouse extends Tospur_House{
$context['siteUrl'] = get_site_url();
$insert_tospur_house_array = array(
'name' => $_POST['housename'],
'house_number' =>$_POST['house_number'],
'total_price' =>$_POST['total_price'],
'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'],
......@@ -20,7 +19,6 @@ class SecHandHouse extends Tospur_House{
'faceto'=>$_POST['faceto'],
'decoration' => $_POST['decoration'],
'age'=>$_POST['age'],
'flat'=>$_POST['flat'],
'suite'=>$_POST["suite"],
'overview' => $_POST['overview'],
'city_id' => $_POST['baseCity'],
......@@ -46,8 +44,11 @@ class SecHandHouse extends Tospur_House{
"structure"=>$_POST["structure"],
"key"=>$_POST["key"],
"matching_facilities"=>$_POST["matching_facilities"],
"garage"=>$_POST["garage"]
"garage"=>$_POST["garage"],
"entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"]
);
if($type==2){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
......@@ -55,6 +56,7 @@ class SecHandHouse extends Tospur_House{
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 201){
$wpdb->query("ROLLBACK");
print_r( $result);;
echo "二手房房源修改失败";
}else{
......@@ -81,7 +83,7 @@ class SecHandHouse extends Tospur_House{
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context['featureOld'] = SearchDao::searchFeatureOld($_GET['id']);
$context['featureOld'] = json_encode(SearchDao::searchFeatureOld($_GET['id']));
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
}
......@@ -91,10 +93,8 @@ class SecHandHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2);
$context["feature"] = searchDao::searchFeature();
for($i = 1981; $i<= 2020; $i++){
$context["age"][]=$i;
}
$context["feature"] = searchDao::searchTagOrFeature(1);
$context["house_type"] = 1;
Timber::render("secHandHouse.html",$context);
}
......@@ -110,13 +110,14 @@ class SecHandHouse extends Tospur_House{
//获取新房信息,存入tospur_house表
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT);
if(!$res){
$houseId = InsertDao::insert_tospur_house($params);
InsertDao::addMainImage($houseId,$data);
InsertDao::addRecommend($houseId,$data);
$recommendRes = InsertDao::addRecommend($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
$recConsultant=InsertDao::addRecConsultant($houseId,$data);
if(isset($_POST['mark'])&&$_POST['mark']!=""){
InsertDao::addHouseTag($_POST['mark'],$houseId);
......
<table class="form-table">
<tbody>
<tr>
<th><label for="periphery">置业顾问</label></th>
<td>
<div id="consultantImg">
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择置业顾问
</button>
</td>
</tr>
</tbody>
</table>
<script>
(function($){
{% if consultant %}
var data = {{ consultant|json_encode()}};
$.each(data,function(i,item){
addConsultant(item);
});
{% endif %}
$(document).ready(function(){
//添加置业顾问
init_modal_myConsultantList(addConsultant);
$("#consultantImg").on("click",".consultantCancel",function(){
$(this).parents("p").remove();
});
});
//点击模态框中的置业顾问后显示
function addConsultant(data){
var row = $("<div>").addClass("row").css("margin-bottom","10px");
var left = $("<div>").addClass("col-md-3");
var img = $("<img>").attr({"src":data.imageUrl,"height":100,"width":100,"style":"margin-right:50px"});
left.append(img);
var mid = $("<div>").addClass("col-md-3");
var label = $("<label>").append(data.name);
mid.append(label);
var right = $("<div>").addClass("col-md-3");
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
right.append(cancel);
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value":data.id});
row.append(left).append(mid).append(right);
var p = $("<p>").append(row).append(recommendConsultant);
$("#consultantImg").append(p);
{% if (house_type == 1 or house_type == 2 or page == 'customer') %}
controlCommand("consultantImg",1,1);
{% endif %}
}
})(jQuery);
</script>
\ No newline at end of file
<table class="form-table">
<tbody>
<tr>
<th><label for="feature">房源特色</label></th>
<td>
<div id="feature" class="row">
</div><br/>
<button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt">
添加特色
</button>
</td>
</tr>
</tbody>
</table>
<script>
$(document).ready(function () {
{% if featureOld %}
var data = {{ featureOld }};
$.each(data, function (i, item) {
addFeature(item.tag_id, item.name);
});
{% endif %}
//显示选中的特色
init_modal_addTag(1, function (id, value) {
addFeature(id, value);
});
existsCancel();
});
function addFeature(id, value) {
var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel ");
var span = $("<span>").attr("style", "margin-right:5px").append(value);
var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#feature").append(divCol);
}
</script>
\ No newline at end of file
<table class="form-table">
<tbody>
<tr>
<th><label for="traffic">推荐房源</label></th>
<td>
<div id="houseImg">
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
添加房源
</button>
</td>
</tr>
</tbody>
</table>
<script>
(function($){
{% if recommends %}
var data = {{ recommends|json_encode()}};
$.each(data,function(i,item){
item.path = "{{siteUrl}}"+item.path;
addRecHouse(item);
});
{% endif %}
$(document).ready(function(){
var urlParams = getUrlParmas();
init_modal_houseList(addRecHouse,urlParams.page);
//删除推荐房源
$("#houseImg").on("click",".imgCancel",function(){
$(this).parents("p").remove();
});
});
function addRecHouse(data){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id});
var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseImg").append(p);
controlCommand("houseImg",3,0);
}
})(jQuery);
</script>
\ No newline at end of file
......@@ -11,16 +11,7 @@
<div class="modal-content">
<div class="row" id="featureTable">
<div class="col-md-12">
<table class="table">
{% for item in feature %}
{% if loop.index0%4 == 0%}
<tr>
{% endif %}
<td>{{ item.value }}</td>
{% if loop.index0%4 == 3%}
</tr>
{% endif %}
{% endfor %}
<table class="table" id="tagList">
</table>
</div>
</div>
......@@ -28,4 +19,31 @@
</div>
</div>
{% endif %}
<script>
function init_modal_addTag(type, callback) {
var tagList = $('#tagList');
$("#houseFeature").on("show.bs.modal", function () {
tagList.html('');
$.ajax({
type: "POST",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTagOrFeature&type=" + type,
success: function (data) {
var tr;
$.each(data, function (index, item) {
if (index % 4 == 0) {
tr = $('<tr>');
}
tr.append('<td id="' + item.id + '">' + item.value + '</td>');
tagList.append(tr);
});
tagList.find("tr > td").on("click", function () {
callback($(this).attr('id'), $(this).text());
});
}
});
});
}
</script>
{% endblock %}
\ No newline at end of file
<br />
<div class="row">
{% if house_type == 1%}
<div class="col-md-6">
<label for="total_price">总价:</label>
<input name="total_price" id="total_price" type="text" value="{{result.total_price}}" class="form-control"> 万元
......@@ -8,4 +9,15 @@
<label for="average_price">单价:</label>
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control">
</div>
{% elseif house_type== 2 %}
<div class="col-md-6">
<label for="rent">租金:</label>
<input name="rent" id="rent" type="text" value="{{rent.value}}" class="form-control"> 元/月
</div>
{% else %}
<div class="col-md-6">
<label for="average_price">均价:</label>
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control">
</div>
{% endif %}
</div>
\ No newline at end of file
label.my-error-class {
padding-left: 16px;
padding-bottom: 2px;
font-weight: bold;
color: #EA5200;
}
\ No newline at end of file
......@@ -180,31 +180,3 @@
<textarea name="origin_remark" id="origin_remark" rows="5" cols="50" class="form-control">{{ result.origin_remark }}</textarea>
</div>
</div>
\ No newline at end of file
<br>
{% if role == 'administrator' or role == 'editor' %}
<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>
{% elseif role == 'author' %}
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
{% endif %}
\ No newline at end of file
<div class="wrap">
<h2>客户列表</h2>
<form id="" method="post">
<div>
<form action="http://192.168.3.79/tospur/wp-admin/admin.php/" method="get">
<input type="hidden" name="page" value="customerList">
<div id="search_form">
<label for="status" class="hidden"></label>
<select name="status" id="status">
<option value="-1">状态</option>
......@@ -37,13 +38,11 @@
<input type="submit" id="submit" class="button action" value="搜索">
</div>
{{ function("addCustomerTable") }}
<input type="hidden" name="paged" value="1">
</form>
</div>
<script>
(function ($) {
$(document).ready(function(){
$(document).ready(function () {
$('#demand_type').val('{{ demand_type }}');
search_form_set_page();
});
})(jQuery);
</script>
\ No newline at end of file
<div class="wrap">
<h2>签约-房客跟进</h2>
<form method="get">
<input type="hidden" name="page" value="customerTrackingList">
<div id="search_form">
<label for="status_type" class="hidden"></label>
<select name="status_type" id="status_type">
<option value="-1">跟进类型</option>
{% for item in status %}
<option
{{ item.id == status_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="search_consultant_name" class="hidden"></label>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
value="{{ search_consultant_name }}">
<span>日期</span>
<label for="search_min_time" class="hidden"></label>
<input type="date" name="search_min_time" id="search_min_time" value="{{ search_min_time }}">
<label for="search_max_time" class="hidden"></label>
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
{{ function("addCustomerTrackingTable") }}
</form>
</div>
<script>
$(document).ready(function () {
search_form_set_page();
});
</script>
\ No newline at end of file
......@@ -65,9 +65,8 @@
<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>
......@@ -76,29 +75,14 @@
</div>
<div class="col-md-6">
<label for="age">建筑年代:</label>
<!--<input name="age" type="text" value="{{result.age}}" class="form-control">-->
<select name="age" class="form-control">
<option>未知</option>
{% for item in age%}
<option {{ item == result.age?"selected":"" }}value="{{item}}">{{item}}</option>
{% endfor %}
<select name="age" id="pageAge" class="form-control">
<option value="未知">未知</option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="address">小区名称:</label>
<input name="community_name" type="text" value="{{result.community_name}}" class="form-control">
</div>
<div class="col-md-6">
<label for="suite">门牌号码:</label></th>
<input name="suite" type="text" value="{{result.suite}}" class="form-control">
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="from">户型:</label>
<select name="roomNum" class="form-control">
<option value="0">0</option>
......@@ -228,6 +212,17 @@
<br />
<div class="row">
<div class="col-md-6">
<label for="entrustDay">委托日:</label>
<input type="text" name="entrustDay" id="entrustDay" value="{{result.entrustDay}}" class="form-control">
</div>
<div class="col-md-6">
<label for="deadLine">到期日:</label>
<input name="deadLine" type="text" id="deadLine" value="{{result.deadLine}}" class="form-control">
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="street">街道:</label>
<input type="text" name="street" value="{{result.street}}" class="form-control">
</div>
......
(function($){
function searchConsultant(consulCityId,consultantName){
//城市区域联动
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=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
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");
//select.find('option:not(:first-child)').remove();
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);
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);
}
});
}
function search_form_set_page(){
var search_flag = false;
$('form').submit(function () {
var search_select = $(this).find('#search_form select');
var search_input = $(this).find('#search_form input[type=text],input[type=date]');
$.each(search_select, function (index, item) {
var search_select_value = $(item).find('option:selected').val();
if (search_select_value != -1) {
search_flag = true;
}
});
$.each(search_input, function (index, item) {
var search_input_value = $(item).val();
if (search_input_value != '') {
search_flag = true;
}
});
if (search_flag) {
$('input[name=paged]').val('1');
}
});
}
})(jQuery);
\ No newline at end of file
{# 定义宏以便多次调用 #}
{% macro customer_tracking_list(houseId) %}
{% set list = function('CustomerTrackingDao::search', houseId) %}
<button class="button" style="margin-bottom: 20px;">房源跟进</button>
{% macro customer_tracking_list(houseId, origin) %}
{% set list = function('CustomerTrackingDao::search', houseId, origin) %}
{% if list %}
<br>
<table class="table table-bordered">
<tr>
<th class="col-md-2 text-center">跟进类型</th>
......
......@@ -30,6 +30,7 @@
</td>
<td>
<input type="button" value="删除" class="button action cancel existsCancel">
</td>
</div>
</tr>
{% endfor %}
......@@ -44,20 +45,19 @@
(function($){
$(document).ready(function(){
//新增房源相册
var j = 0;
$("#housePicture").click(function(){
var tr = $("<tr>");
var td = $("<td>");
var select = $("<select>").attr({"name":"data["+j+"][type]"}).addClass("form-control");
var select = $("<select>").attr({"name":"data["+i+"][type]"}).addClass("form-control");
{% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var td1 = td.clone().append(select);
var file = $("<input>").attr({"type":"file","name":"files["+j+"]"}).addClass("picFiles form-control");
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles form-control");
var td2 = td.clone().append(file);
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":j}).addClass("form-control");
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i}).addClass("form-control");
var td3 = td.clone().append(radio);
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel form-control");
......@@ -67,7 +67,7 @@
$("#photosTbody").append(tr);
j++
i++
});
$("#photosTbody").on("change",".picFiles",function(){
var that = this;
......
{% block recConsultant %}
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="consultCity">
<option value="-1"> 城市</option>
{% for item in city %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control">
<button type="button" class="button action" id="searchConsult">搜索</button>
<ul id="consultantList">
</ul>
</div>
</div>
</div>
</div>
<script>
function close_modal_consultantList(){
$("#myConsultant").modal('hide');
}
function init_modal_myConsultantList(callback){
$("#myConsultant").on("shown.bs.modal",function(){
setConsultantCity();
});
// $("#myConsultant").find("select").change(function(){
// searchConsultant(consulCityId,consultantName);
// });
//添加置业顾问弹出层中搜索框的搜索内容
$("#searchConsult").click(function(){
$("#consultantList").find("li").remove();
var consulCityId = $("#consultCity").val();
var consultantName = $("#consultantName").val();
searchConsultant(consulCityId,consultantName);
});
$("#consultantList").on("click",".consultantImg",function(){
callback($(this).data());
});
}
function setConsultantCity(){
var city = $("#consultCity");
var consultantName =$("#consultantName").val();
if($("#baseCity").length>0){
var consultCity = $("#baseCity").val();
city.val(consultCity);
searchConsultant(consultCity,consultantName);
}else{
var consultCity = city.val();
}
city.change(function(){
var consultCity = city.val();
searchConsultant(consultCity,consultantName);
})
}
function searchConsultant(consulCityId,consultantName){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
success:function(json){
$("#consultantList").find("li").remove();
if(json){
for(var i = 0; i <=json.length-1; i++){
var item = json[i];
var name = item["name"];
var imgUrl = item["imageUrl"];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
var li = $("<li>").attr("id",item["id"]).append(img).append(name).addClass("consultantImg").data(item);
$("#consultantList").append(li);
}
}
}
});
}
</script>
{% endblock %}
\ No newline at end of file
{% block recommendHouse %}
<!-- 新增房源弹出层 -->
<div class="modal fade" id="myModal" 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-3">
<select id="myModal_cityId" class="form-control">
<option value="-1"> 城市</option>
{% for item in city %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<select id="myModal_areaId" class="form-control">
<option value = "-1">区域</option>
</select>
</div>
<div class="col-md-3">
<select id="myModal_plateId" class="form-control">
<option value = "-1">板块</option>
</select>
</div>
<div class="col-md-3">
<select id="myModal_price" class="form-control">
<option value = "-1">价格</option>
</select>
</div>
<div class="col-md-3">
<select id="myModal_buildProperty" class="form-control">
<option value = "-1">房型</option>
{% for item in buildProperty %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<select id="myModal_room" class="form-control">
<option value = "-1">类型</option>
{% for item in room %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<select id="myModal_acreage" class="form-control">
<option value = "-1">面积</option>
</select>
</div>
<div class="col-md-6">
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="myModal_searchtext" class="form-control">
</div>
<div class="col-md-2">
<button type="button" class="button action" id="myModal_search">搜索</button>
</div>
</div>
</div>
<div class="modal-body " style="height: 500px;overflow: auto;">
<ul id="modal_houseList">
</ul>
</div>
</div>
</div>
</div>
<script>
function close_modal_houseList(){
$("#myModal").modal('hide');
}
function init_modal_houseList(callback,houseType){
judgeHouseType(houseType);
$("#myModal").on("shown.bs.modal",function(){
setCityArea();
});
$("#myModal").find("select").change(function(){
judgeHouseType(houseType);
});
//添加房源中搜索框的搜索
$("#myModal_search").click(function(){
judgeHouseType(houseType);
});
//将推荐房源模态框中选中的房源显示到界面中
$("#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){
var cityId = $("#baseCity").val();
city.val(cityId);
searchCity(cityId,area);
}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(cityId,area);
//城市面积联动
searchAcreage(cityId, acreage);
//城市联动房子价格
searchTotalPrice(cityId, price);
});
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)
});
//城市面积联动
searchAcreage(cityId, acreage);
//城市联动房子价格
searchTotalPrice(cityId, price);
}
function judgeHouseType(type){
if($.isNumeric(type)){
addList(type);
return;
}
if(type == "newHouse"){
addList(0);
}else if(type == "secHandHouse"){
addList(1);
}else if(type == "rentHouse"){
addList(2);
}
}
function addList(houseType){
var params = {
action:"searchHouse",
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({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
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++){
var item = result[i];
var name = item["name"];
var id = item['id'];
var imgUrl = item['path'];
var row = $("<div>").addClass("row").css("margin-bottom","10px");
var left = $("<div>").addClass("col-md-3");
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
left.append(img);
var right = $("<div>").addClass("col-md-3");
var label = $("<label>").append(name);
right.append(label);
row.append(left).append(right).data(item);
if(urlParams["id"]!=id){
$("#modal_houseList").append(row);
}
}
}
}
});
}
</script>
{% endblock %}
\ No newline at end of file
......@@ -12,3 +12,20 @@
<input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</div>
</div>
<script>
$(document).ready(function () {
//显示选中的特色
init_modal_addTag(1, function (id, value) {
addFeature(id, value);
});
existsCancel();
});
function addFeature(id, value) {
var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel ");
var span = $("<span>").attr("style", "margin-right:5px").append(value);
var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#feature").append(divCol);
}
</script>
\ No newline at end of file
......@@ -35,13 +35,13 @@ class CustomerTrackingDao
}
}
public static function search($house_id)
public static function search($house_id, $origin)
{
global $wpdb;
$sql = 'SELECT tct.*,ts.status_name,tc.name FROM ' . Config::TOSPUR_CUSTOMER_TRACKING_TABLE . ' tct' .
' left join (SELECT * FROM ' . Config::TOSPUR_STATUS_TABLE . ' where status_type = 3) as ts on tct.status_type = ts.status_id' .
' left join ' . Config::TOSPUR_CONSULTANT . ' tc on tct.consultant_id = tc.id' .
' where tct.house_id = ' . $house_id;
' where tct.house_id = ' . $house_id . ' and tct.origin = ' . $origin;
return $wpdb->get_results($sql);
}
......
......@@ -295,7 +295,7 @@ class SearchDao
public static function searchConsultant($consulCityId = NULL,$consultantName = NULL){
global $wpdb;
$sql = "select id,name as consultantName,imageUrl from ".Config::TOSPUR_CONSULTANT." where 1=1";
$sql = "select id,name,imageUrl from ".Config::TOSPUR_CONSULTANT." where 1=1";
$params = array();
if($consulCityId != NULL){
$params[] = $consulCityId;
......@@ -337,11 +337,23 @@ class SearchDao
return $feature;
}
public static function searchFeature()
/*public static function searchFeature()
{
global $wpdb;
$sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;';
return $wpdb->get_results($sql);
}*/
public static function ajax_searchTagOrFeature()
{
wp_send_json(SearchDao::searchTagOrFeature($_POST['type']));
}
public static function searchTagOrFeature($type)
{
global $wpdb;
$sql = 'select id,name as value from ' . Config::TOSPUR_TAG_TABLE . ' where type = ' . $type;
return $wpdb->get_results($sql);
}
public static function getDetailInfo($hid,$type = NULL){
......
......@@ -27,6 +27,7 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Admin/rentHouseList.php');
require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php');
require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php');
require_once(PLUGIN_DIR . 'Admin/feature.php');
require_once(PLUGIN_DIR . 'Admin/introduction.php');
require_once(PLUGIN_DIR . 'Admin/Contract.php');
......@@ -78,6 +79,7 @@ function tospur_theme_format(){
function tospur_load_resources(){
wp_enqueue_script('jqueryjs');
wp_enqueue_script('jquery-ui');
wp_enqueue_script('bootstrapjs');
wp_enqueue_script('publicjs');
......@@ -85,10 +87,11 @@ function tospur_load_resources(){
wp_enqueue_script('validate');
wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('bootstrapMinCss');
wp_enqueue_style('publicCss');
}
function tospur_register_script_style(){
wp_register_script('jqueryjs',plugins_url('Admin/views', __FILE__)."/js/jquery.min.js");
wp_register_script('jquery-ui',plugins_url('Admin/views', __FILE__)."/js/jquery-ui.js");
wp_register_script('validate',plugins_url('Admin/views', __FILE__)."/js/jquery.validate.js");
wp_register_script('bootstrapjs',plugins_url('Admin/views', __FILE__)."/js/bootstrap.min.js");
......@@ -97,6 +100,7 @@ function tospur_register_script_style(){
wp_register_style('jquery-ui_css', plugins_url('Admin/views', __FILE__)."/css/jquery-ui.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");
wp_register_style('publicCss', plugins_url('Admin/views', __FILE__)."/css/public.css");
}
function tospur_ajax_set()
......@@ -123,6 +127,9 @@ 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_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
add_action('wp_ajax_nopriv_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
//后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
//后台处理 置业顾问
......@@ -168,12 +175,14 @@ function reset_menu()
add_menu_page('secHandHouseList','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'edit_published_posts', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html');
add_menu_page('rentHouseList','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("introduction", "诚信宣言", "editor", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('contract','合同管理', 'edit_published_posts', 'contract', 'Contract::init_view', 'dashicons-menu', 10);
add_menu_page('客户列表','客户列表', 'edit_published_posts', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html');
add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
//移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 );
global $menu;
......
......@@ -25,7 +25,7 @@ foreach ($context['select']['district'] as $item) {
$context['select']['plate'] = json_encode($plateArray);
$context['select']['buildProperty'] = SearchDao::searchBuildProperty();
$context['select']['room'] = json_encode(SearchDao::searchRoom());
$context['select']['feature'] = json_encode(SearchDao::searchFeature());
$context['select']['feature'] = json_encode(SearchDao::searchTagOrFeature(1));
$context['select']['unitPriceRange'] = SearchDao::searchUnitPriceRange($cityId);
if ($houseType == 2) {
$context['select']['rentalPrice'] = SearchDao::searchRentalPrice($cityId);
......
......@@ -327,7 +327,6 @@
}
});
form.find('input[type=submit]').tap(function () {
alert('111');
form.submit();
return false;
});
......
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