Commit bafaed0d by shz

每日一更

parent 6527ff71
......@@ -129,7 +129,7 @@ class House extends Tospur_House{
}
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
$res = InsertDao::addRecConsultant($houseId,$data);
$res = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
if($res == 505){
$result = $res;
echo "推荐置业顾问修改失败";
......@@ -154,7 +154,7 @@ class House extends Tospur_House{
InsertDao::addRecommend($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
......
......@@ -89,13 +89,18 @@ class customerList extends WP_List_Table
$this->process_bulk_action();
$sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name FROM tospur_customer tcs" .
$sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name,tc.subsidiaryId 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";
" left join tospur_consultant tc on tcs.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1";
$current_user = wp_get_current_user();
if($current_user->roles[0] == 'author'){
$sql = $sql . " and tcs.consultant_id = " . $current_user->ID;
}
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and tc.subsidiaryId = " . $_REQUEST['organization'];
}
if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_REQUEST['status'];
}
......@@ -128,11 +133,11 @@ class customerList extends WP_List_Table
if (isset($_REQUEST['listPlate']) && $_REQUEST["listPlate"] != -1) {
$sql = $sql . " and tcs.plate_id = " . $_REQUEST["listPlate"];
}
if ($_REQUEST["totalPrice"] != null) {
if (isset($_REQUEST['totalPrice']) && $_REQUEST["totalPrice"] != -1) {
$priceArray = explode("-", $_REQUEST['totalPrice']);
$sql = $sql . " and (tcs.min_totalPrice >= " . $priceArray[0] . " and tcs.max_totalPrice <= " . $priceArray[1] . ")";
}
if ($_REQUEST["rentalPrice"] != null) {
if (isset($_REQUEST['rentalPrice']) && $_REQUEST["rentalPrice"] != -1) {
$priceArray = explode("-", $_REQUEST['rentalPrice']);
$sql = $sql . " and (tcs.min_rent >= " . $priceArray[0] . " and tcs.max_rent <= " . $priceArray[1] . ")";
}
......@@ -143,7 +148,7 @@ class customerList extends WP_List_Table
$sql = $sql . " and (tcs.bedroom = " . $_REQUEST["buildProperty"] . " or tcs.bedroom = -1)";
}
}
if ($_REQUEST["acreage"] != null) {
if (isset($_REQUEST['acreage']) && $_REQUEST["acreage"] != -1) {
$areaArray = explode("-", $_REQUEST['acreage']);
$sql = $sql . " and (tcs.min_coveredArea >= " . $areaArray[0] . " and tcs.max_coveredArea <= " . $areaArray[1] . ")";
}
......@@ -208,43 +213,18 @@ class customerList extends WP_List_Table
function function_customerList()
{
$context = array();
//
$context['city'] = SearchDao::searchCity();
$context['buildProperty'] = SearchDao::searchBuildProperty();
//
$context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6);
$context['city'] = SearchDao::searchCity();
if (isset($_REQUEST['hasSearch'])) {
$context['district'] = SearchDao::searchCity($_REQUEST['listCity']);
$context['plate'] = SearchDao::searchCity($_REQUEST['listCity'], $_REQUEST['listDistrict']);
$context['dicTotalPrice'] = searchDao::searchTotalPrice($_REQUEST['listCity']);
$context['dicRentalPrice'] = searchDao::searchRentalPrice($_REQUEST['listCity']);
$context['dicArea'] = searchDao::searchArea($_REQUEST['listCity']);
$context['cityId'] = $_REQUEST['listCity'];
$context['districtId'] = $_REQUEST['listDistrict'];
$context['plateId'] = $_REQUEST['listPlate'];
$context['buildPropertyId'] = $_REQUEST['buildProperty'];
$context['totalPrice'] = $_REQUEST['totalPrice'];
$context['rentalPrice'] = $_REQUEST['rentalPrice'];
$context['acreage'] = $_REQUEST['acreage'];
}
$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'];
$context['req'] = $_REQUEST;
}
Timber::render("customerList.html", $context);
}
function addCustomerTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', $_SERVER['REQUEST_URI']);
$customerList = new customerList();
$customerList->prepare_items();
$customerList->display();
......
......@@ -37,13 +37,18 @@ class customerTrackingList extends WP_List_Table
$this->_column_headers = array($columns, $hidden);
$sql = "SELECT tct.*,ts.status_name,tc.name as consultant_name FROM tospur_customer_tracking tct" .
$sql = "SELECT tct.*,ts.status_name,tc.name as consultant_name,tc.subsidiaryId 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";
" left join tospur_consultant tc on tct.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1";
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and tc.subsidiaryId = " . $_REQUEST['organization'];
}
if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) {
$sql = $sql . " and tct.status_type = " . $_REQUEST['status_type'];
}
if (isset($_REQUEST['search_consultant_name'])) {
if (isset($_REQUEST['search_consultant_name']) && $_REQUEST['search_consultant_name'] != null) {
$sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
......@@ -92,17 +97,14 @@ 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'];
$context['req'] = $_REQUEST;
Timber::render("customerTrackingList.html", $context);
}
function addCustomerTrackingTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', $_SERVER['REQUEST_URI']);
$customerTrackingList = new customerTrackingList();
$customerTrackingList->prepare_items();
$customerTrackingList->display();
......
......@@ -113,7 +113,7 @@ class RentHouse extends Tospur_House{
InsertDao::addRecommend($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
}else{
......@@ -151,7 +151,7 @@ class RentHouse extends Tospur_House{
InsertDao::addRecommend($houseId,$data);
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data);
InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
return $result;
......
......@@ -41,11 +41,10 @@ class rentHouseList extends WP_List_Table
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
'<input type="checkbox" name="%1$s[]" value="%2$s" data-consultant="%3$s"/>',
$this->_args['singular'],
$item['id'],
$item['consultant_id']
);
}
......@@ -111,6 +110,9 @@ class rentHouseList extends WP_List_Table
if ($action) {
$string = null;
$status = null;
if($action == 'allot'){
HouseDao::houseAllotConsultant($_POST['allot_consultant_id'], $_POST['sechandhouselist']);
}else{
switch ($action) {
case 'noCheck':
$id = $_POST['renthouselist'];
......@@ -160,6 +162,7 @@ class rentHouseList extends WP_List_Table
$result = $wpdb->query('update tospur_house SET status='.$status .' where id in ' . $string);
}
}
}
......@@ -183,44 +186,44 @@ class rentHouseList extends WP_List_Table
left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=2 ";
if($_POST["listCity"]!=0 ){
$params[] = $_POST["listCity"];
if($_REQUEST["listCity"]!=0 ){
$params[] = $_REQUEST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$params[] = $_POST["listDistrict"];
if($_REQUEST["listDistrict"] != 0 ){
$params[] = $_REQUEST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$params[] = $_POST["listPlate"];
if($_REQUEST["listPlate"] != 0){
$params[] = $_REQUEST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$params[] = $_POST["buildProperty"];
if($_REQUEST["buildProperty"]!=0){
$params[] = $_REQUEST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$params[] = $_POST["room"];
if($_REQUEST["room"]!=0){
$params[] = $_REQUEST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$params[] = $_POST["status"];
if(isset($_REQUEST["status"]) && $_REQUEST["status"]!=-1){
$params[] = $_REQUEST["status"];
$sql = $sql." and status=%d";
}
if($_POST["rentalPrice"]!=NULL){
$priceArray = explode("-", $_POST['rentalPrice']);
if($_REQUEST["rentalPrice"]!=NULL){
$priceArray = explode("-", $_REQUEST['rentalPrice']);
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and rent between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
if($_REQUEST["acreage"]!= NULL){
$areaArray = explode("-", $_REQUEST['acreage']);
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$params[] = '%'.$_POST['searchText'].'%';
if($_REQUEST["searchText"]!=NULL){
$params[] = '%'.$_REQUEST['searchText'].'%';
$sql = $sql . " and name like %s";
}
if(isset($_GET["orderby"])){
......@@ -244,6 +247,7 @@ class rentHouseList extends WP_List_Table
'age' => $value->age,
'matching_facilities'=> $value->matching_facilities,
'user_id' => $value->consul_name,
'consultant_id' => $value->consul_id
);
if($value->status == 0){
......@@ -289,18 +293,18 @@ function function_rentHouseList()
$contest['city'] = SearchDao::searchCity();
$contest['status'] = SearchDao::searchStatusType(2);
$contest['buildProperty'] = SearchDao::searchBuildProperty();
if(isset($_POST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_POST['listCity']);
$contest['plate'] = SearchDao::searchCity($_POST['listCity'],$_POST['listDistrict']);
$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['rentalPrice'] = $_POST['rentalPrice'];
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
if(isset($_REQUEST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_REQUEST['listCity']);
$contest['plate'] = SearchDao::searchCity($_REQUEST['listCity'],$_REQUEST['listDistrict']);
$contest['dicRentalPrice'] = searchDao::searchRentalPrice($_REQUEST['listCity']);
$contest['dicArea'] = searchDao::searchArea($_REQUEST['listCity']);
$contest['cityId'] = $_REQUEST['listCity'];
$contest['districtId'] = $_REQUEST['listDistrict'];
$contest['plateId' ]= $_REQUEST['listPlate'];
$contest['buildPropertyId']= $_REQUEST['buildProperty'];
$contest['rentalPrice'] = $_REQUEST['rentalPrice'];
$contest['acreage'] = $_REQUEST['acreage'];
$contest['statusId'] = $_REQUEST['status'];
}
$contest["house_type"] = 2;
Timber::render("houseList.html",$contest);
......
......@@ -118,7 +118,7 @@ class SecHandHouse extends Tospur_House{
$recommendRes = InsertDao::addRecommend($houseId,$data);
$recConsultant=InsertDao::addRecConsultant($houseId,$data);
$recConsultant=InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addHouseTag($houseId, $data['houseTag']);
......@@ -159,7 +159,7 @@ class SecHandHouse extends Tospur_House{
InsertDao::addRecommend($houseId,$data);
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data);
InsertDao::addRecConsultant($houseId, $data['recConsultant']);
$wpdb->query(
$wpdb->prepare(
......
......@@ -40,11 +40,10 @@ class secHandHouseList extends WP_List_Table
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
'<input type="checkbox" name="%1$s[]" value="%2$s" data-consultant="%3$s"/>',
$this->_args['singular'],
$item['id'],
$item['consultant_id']
);
}
......@@ -99,7 +98,8 @@ class secHandHouseList extends WP_List_Table
'selfSale'=>'自售',
'otherSale'=>'他售',
'invalid'=>'无效',
'reactivation'=>'重激活'
'reactivation'=>'重激活',
'allot' => '分配置业顾问'
);
return $actions;
}
......@@ -110,6 +110,9 @@ class secHandHouseList extends WP_List_Table
if ($action) {
$string = null;
$status = null;
if($action == 'allot'){
HouseDao::houseAllotConsultant($_POST['allot_consultant_id'], $_POST['sechandhouselist']);
}else{
switch ($action) {
case 'noCheck':
$id = $_POST['sechandhouselist'];
......@@ -159,6 +162,7 @@ class secHandHouseList extends WP_List_Table
$result = $wpdb->query('update tospur_house SET status='.$status .' where id in ' . $string);
}
}
}
......@@ -182,44 +186,44 @@ class secHandHouseList extends WP_List_Table
left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=1 ";
if($_POST["listCity"]!=0 ){
$params[] = $_POST["listCity"];
if($_REQUEST["listCity"]!=0 ){
$params[] = $_REQUEST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$params[] = $_POST["listDistrict"];
if($_REQUEST["listDistrict"] != 0 ){
$params[] = $_REQUEST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$params[] = $_POST["listPlate"];
if($_REQUEST["listPlate"] != 0){
$params[] = $_REQUEST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$params[] = $_POST["buildProperty"];
if($_REQUEST["buildProperty"]!=0){
$params[] = $_REQUEST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$params[] = $_POST["room"];
if($_REQUEST["room"]!=0){
$params[] = $_REQUEST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$params[] = $_POST["status"];
if(isset($_REQUEST["status"]) && $_REQUEST["status"]!=-1){
$params[] = $_REQUEST["status"];
$sql = $sql." and status=%d";
}
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']);
if($_REQUEST["totalPrice"]!=NULL){
$priceArray = explode("-", $_REQUEST['totalPrice']);
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
if($_REQUEST["acreage"]!= NULL){
$areaArray = explode("-", $_REQUEST['acreage']);
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$params[] = '%'.$_POST['searchText'].'%';
if($_REQUEST["searchText"]!=NULL){
$params[] = '%'.$_REQUEST['searchText'].'%';
$sql = $sql . " and name like %s";
}
......@@ -244,6 +248,7 @@ class secHandHouseList extends WP_List_Table
'decoration' => $value->decoration,
'age' => $value->age,
'user_id' => $value->consul_name,
'consultant_id' => $value->consul_id
);
if($value->status == 0){
$data[$key]['status'] ="未审核";
......@@ -285,18 +290,18 @@ function function_secHandHouseList()
$contest['city'] = SearchDao::searchCity();
$contest['status'] = SearchDao::searchStatusType(2);
$contest['buildProperty'] = SearchDao::searchBuildProperty();
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['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['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
if(isset($_REQUEST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_REQUEST['listCity']);
$contest['plate'] = SearchDao::searchCity($_REQUEST['listCity'],$_REQUEST['listDistrict']);
$contest['dicTotalPrice'] = searchDao::searchTotalPrice($_REQUEST['listCity']);
$contest['dicArea'] = searchDao::searchArea($_REQUEST['listCity']);
$contest['cityId'] = $_REQUEST['listCity'];
$contest['districtId'] = $_REQUEST['listDistrict'];
$contest['plateId' ]= $_REQUEST['listPlate'];
$contest['buildPropertyId']= $_REQUEST['buildProperty'];
$contest['totalPrice'] = $_REQUEST['totalPrice'];
$contest['acreage'] = $_REQUEST['acreage'];
$contest['statusId'] = $_REQUEST['status'];
}
$contest["house_type"] = 1;
Timber::render("houseList.html",$contest);
......
<div class="wrap">
<h2>客户列表</h2>
<form method="get">
<form method="get" id="search_form">
<input type="hidden" name="page" value="customerList">
<div id="search_form">
<div>
<input type="hidden" name="hasSearch" value="1"/>
{% include 'selectOrganization.html' %}
<label for="status" class="hidden"></label>
<select name="status" id="status">
<option value="-1">状态</option>
{% for item in status %}
<option {{ item.id == status_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% set customer_status_array = function('SearchDao::searchStatusType', 5) %}
{% for item in customer_status_array %}
<option {{ item.id == req.status ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="customer_type" class="hidden"></label>
<select name="customer_type" id="customer_type">
<option value="-1">客户类型</option>
{% for item in customer_type %}
<option {{ item.id == customer_type_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% set customer_type_array = function('SearchDao::searchStatusType', 6) %}
{% for item in customer_type_array %}
<option {{ item.id == req.customer_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="demand_type" class="hidden"></label>
......@@ -29,74 +32,80 @@
<select id="listCity" name="listCity">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == req.listCity ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="listDistrict" class="hidden"></label>
<select id="listDistrict" name="listDistrict">
<option value="-1">区域</option>
{% set district = function('SearchDao::searchCity', req.listCity) %}
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == req.listDistrict ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="listPlate" class="hidden"></label>
<select id="listPlate" name="listPlate">
<option value="-1">板块</option>
{% set plate = function('SearchDao::searchCity', req.listCity, req.listDistrict) %}
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == req.listPlate ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="totalPrice" class="hidden"></label>
<select id="totalPrice" name="totalPrice" class="hidden">
<option value="">总价</option>
<option value="-1">总价</option>
{% set dicTotalPrice = function('SearchDao::searchTotalPrice', req.listCity) %}
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
<option {{ item.value == req.totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="rentalPrice" class="hidden"></label>
<select id="rentalPrice" name="rentalPrice" class="hidden">
<option value ="">月租</option>
<option value ="-1">月租</option>
{% set dicRentalPrice = function('SearchDao::searchRentalPrice', req.listCity) %}
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
<option {{ item.value == req.rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="buildProperty" class="hidden"></label>
<select id="buildProperty" name="buildProperty">
<option value="-1">房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% set buildProperty_array = function('SearchDao::searchBuildProperty') %}
{% for item in buildProperty_array %}
<option {{ item.id == req.buildProperty ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="acreage" class="hidden"></label>
<select id="acreage" name="acreage">
<option value="">面积</option>
{% if acreage %}
<option value="-1">面积</option>
{% set dicArea = function('SearchDao::searchArea', req.listCity) %}
{% if dicArea %}
{% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
<option {{ item.value == req.acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
<div style="margin-top: 10px;">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ req.search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ req.search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ req.search_phone }}">
</div>
<div style="margin-top: 10px;">
<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 }}">
<input type="date" name="search_min_time" id="search_min_time" value="{{ req.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="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
......@@ -110,7 +119,7 @@
<script>
$(document).ready(function () {
var demand_type_select = $('#demand_type');
demand_type_select.val('{{ demand_type }}');
demand_type_select.val('{{ req.demand_type|default(-1) }}');
search_form_set_page();
var acreage = $("#acreage");
......@@ -156,44 +165,16 @@
}
}
//批量操作
$('select[name=action]').change(function(){
//分配置业顾问
if ($(this).find('option:selected').val() == 'allot') {
//选择房/客源
var checkbox = $('input[name="customerlist[]"]');
if(checkbox.is(':checked')){
var array = [];
$('input[name="customerlist[]"]:checked').map(function() {
var consultant_id = Number($(this).data('consultant'));
if (array.indexOf(consultant_id) == -1) {
array.push(consultant_id);
}
});
var confirmFlag = true;
if(array.length>1){
confirmFlag = confirm('当前选择的房/客源置业顾问不同,是否继续');
}
if(confirmFlag){
$('#myConsultant').modal('show');
}
//未选择房/客源,下拉框显示批量操作
}else{
$(this).find('option:first').attr('selected', 'selected');
alert('请选择房/客源');
return false;
}
}
});
init_modal_myConsultantList(function (data) {
var consultant_id = Number(data.id);
$('#allot_consultant_id').val(consultant_id);
});
allot_consultant('customerlist');
$("#myConsultant").on("hide.bs.modal", function () {
var allot_consultant_id = Number($('#allot_consultant_id').val());
if (!allot_consultant_id) {
$('select[name=action]').find('option:first').attr('selected', 'selected');
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
});
......
<div class="wrap">
<h2>签约-房客跟进</h2>
<form method="get">
<form method="get" id="search_form">
<input type="hidden" name="page" value="customerTrackingList">
<div id="search_form">
<div>
{% include 'selectOrganization.html' %}
<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>
{{ item.id == (req.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 }}">
value="{{ req.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 }}">
<input type="date" name="search_min_time" id="search_min_time" value="{{ req.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="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
<form method="post">
{{ function("addCustomerTrackingTable") }}
</form>
</div>
<script>
$(document).ready(function () {
search_form_set_page();
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
});
</script>
\ No newline at end of file
......@@ -200,9 +200,10 @@
function search_form_set_page(){
var search_flag = false;
var search_form = $('#search_form');
$('form').submit(function () {
var search_select = $(this).find('#search_form select');
var search_input = $(this).find('#search_form input[type=text],input[type=date]');
var search_select = search_form.find('select');
var search_input = search_form.find('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) {
......@@ -221,6 +222,49 @@
});
}
function allot_consultant(name) {
//批量操作
$('select[name=action],select[name=action2]').change(function () {
//分配置业顾问
if ($(this).find('option:selected').val() == 'allot') {
//选择房/客源
var checkbox = $('input[name="' + name + '[]"]');
if (checkbox.is(':checked')) {
var array = [];
$('input[name="' + name + '[]"]:checked').map(function () {
var consultant_id = Number($(this).data('consultant'));
if (array.indexOf(consultant_id) == -1) {
array.push(consultant_id);
}
});
var confirmFlag = true;
if (array.length > 1) {
confirmFlag = confirm('当前选择的房/客源置业顾问不同,是否继续');
}
if (confirmFlag) {
$('#myConsultant').modal('show');
}
//未选择房/客源,下拉框显示批量操作
} else {
$(this).find('option:first').attr('selected', 'selected');
alert('请选择房/客源');
return false;
}
}
});
init_modal_myConsultantList(function (data) {
var consultant_id = Number(data.id);
$('#allot_consultant_id').val(consultant_id);
});
$("#myConsultant").on("hide.bs.modal", function () {
var allot_consultant_id = Number($('#allot_consultant_id').val());
if (!allot_consultant_id) {
$('select[name=action],select[name=action2]').find('option:first').attr('selected', 'selected');
}
});
}
......@@ -78,6 +78,8 @@
<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 -->
</form>
<form method="post">
{% if house_type == 0 %}
{{function("addNewHouseTable")}}
{% elseif house_type == 1%}
......@@ -85,8 +87,11 @@
{% else %}
{{function("addRentTable")}}
{% endif %}
<input type="hidden" name="allot_consultant_id" id="allot_consultant_id">
</form>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
(function ($) {
$(document).ready(function(){
......@@ -112,6 +117,12 @@
$("#listDistrict").change(function(){
setArea("listCity","listDistrict","listPlate");
})
{% if house_type == 1 %}
allot_consultant('sechandhouselist');
{% elseif house_type == 2 %}
allot_consultant('renthouselist');
{% endif %}
});
})(jQuery);
</script>
......
{% set organization = function('SearchDao::searchOrganization')|json_encode() %}
<div id="organization" style="margin-bottom: 10px;">
<span>门店</span>
<label for="depth_1" class="hidden"></label>
<select data-depth="1" id="depth_1">
<option value="-1">请选择</option>
</select>
<label for="depth_2" class="hidden"></label>
<select data-depth="2" id="depth_2" class="hidden">
<option value="-1">请选择</option>
</select>
<label for="depth_3" class="hidden"></label>
<select data-depth="3" id="depth_3" class="hidden">
<option value="-1">请选择</option>
</select>
<label for="depth_4" class="hidden"></label>
<select data-depth="4" id="depth_4" class="hidden">
<option value="-1">请选择</option>
</select>
</div>
<script>
$(document).ready(function () {
var organization = eval('{{ organization }}');
$.each(organization, function (index, item) {
var select = $('#depth_' + item.Depth);
var css = '';
if (item.Depth != 1) {
css = 'class="hidden"';
}
select.append('<option value="' + item.Id + '" data-parent="' + item.ParentId + '" ' + css + '>' + item.Name + '</option>');
});
$.each($('select[data-depth]:not(:last)'), function (index, item) {
var next_depth = Number($(item).data('depth')) + 1;
var next_select = $('#depth_' + next_depth);
$(item).change(function () {
var parent_id = $(this).val();
$(this).nextAll().find('option:not(:first)').addClass('hidden');
$(this).nextAll().find('option:first').attr('selected', 'selected');
$(this).nextAll().addClass('hidden');
$.each(next_select.find('option[data-parent=' + parent_id + ']'), function (index, item) {
$(item).removeClass('hidden');
next_select.removeClass('hidden');
});
});
});
var search_organization = Number('{{ req.organization }}');
if (search_organization > 0) {
var organization_select = $('select[data-depth]');
var search_option = organization_select.find('option[value=' + search_organization + ']');
var index = search_option.parent().index('[data-depth]');
for (var i = 0; i <= index; i++) {
var option = organization_select.find('option[value=' + search_organization + ']');
//显示 筛选门店
option.attr('selected', 'selected');
search_organization = option.data('parent');
//显示 筛选门店 相同parent门店
var same_parent_option = organization_select.find('option[data-parent=' + search_organization + ']');
same_parent_option.removeClass('hidden');
//下拉框
option.parent().removeClass('hidden');
}
}
});
function getOrganization() {
return Number($('select[data-depth]:not(.hidden):last').val());
}
</script>
\ No newline at end of file
......@@ -22,4 +22,18 @@ class HouseDao {
return $wpdb->last_error;
return $result;
}
public static function houseAllotConsultant($consultant_id, $house_ids)
{
if ($consultant_id) {
$string = '(' . implode(',', array_map('intval', $house_ids)) . ')';
global $wpdb;
$result = $wpdb->query('update ' . Config::A_HOUSE_USER_TABLE
. ' SET user_id = ' . $consultant_id
. ' where house_id in ' . $string);
if($result){
echo '<script>alert("分配置业顾问成功");</script>';
}
}
}
}
\ No newline at end of file
......@@ -187,23 +187,26 @@ class InsertDao{
}
}
public static function addRecConsultant($houseId,$data){
public static function addRecConsultant($houseId, $consultant){
global $wpdb;
if($data["recConsultant"]){
if($consultant){
//插入推荐置业顾问user_id与新房id到关联表a_house_recommend
foreach($data["recConsultant"] as $val){
foreach($consultant as $val){
$a_house_userArray = array(
"user_id" => $val,
"house_id" => $houseId,
"user_type" =>1
"user_type" => 1
);
$a_house_userRes = $wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
if(!$a_house_userRes){
return 505;
if($a_house_userRes){
return $a_house_userRes;
}else{
return $wpdb->last_error;
}
}
}
}
public static function addHouseFeature($houseId,$houseFeature){
global $wpdb;
if($houseFeature){
......
......@@ -133,7 +133,7 @@ class SearchDao
if ($parentId != NULL) {
$where .= " and ParentId =" . $parentId;
}
$result = $wpdb->get_results($wpdb->prepare('select Id as id,Name as name from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
$result = $wpdb->get_results($wpdb->prepare('select * from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
return $result;
}
......@@ -477,4 +477,17 @@ class SearchDao
$results = $wpdb->get_row($wpdb->prepare($rentSql,$hid));
return $results;
}
public static function ajax_search_organization()
{
wp_send_json(SearchDao::search_organization());
}
public static function search_organization()
{
global $wpdb;
$rentSql = "SELECT * FROM tospur_organization where ParentId = 0 and Depth = 1;";
$results = $wpdb->get_row($wpdb->prepare($rentSql,$hid));
return $results;
}
}
\ No newline at end of file
......@@ -41,7 +41,10 @@ class TCSync {
'cityId' => $item['CityId'],
'imageUrl' => $item['ImageUrl'],
'mobile' => $item['Mobile'],
'name' => $item['Name']
'name' => $item['Name'],
'subsidiaryId' => $item['SubsidiaryId'],
'filedNameId' => $item['FiledNameId'],
'filedName' => $item['FiledName']
);
$wpdb->query(TCSync::create_insert_update_sql(Config::TOSPUR_CONSULTANT,$info,array('id')));
}
......
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