Commit 58841056 by felix

每日一更

parent 3c86f481
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
require_once(PLUGIN_DIR . 'Dao/ContractDao.php'); require_once(PLUGIN_DIR . 'Dao/ContractDao.php');
require_once(PLUGIN_DIR . 'Dao/SearchDao.php'); require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/HouseDao.php'); require_once(PLUGIN_DIR . 'Dao/HouseDao.php');
require_once(PLUGIN_DIR . 'Dao/CommissionDao.php');
class Contract { class Contract {
public static function init_view(){ public static function init_view(){
...@@ -38,13 +39,60 @@ class Contract { ...@@ -38,13 +39,60 @@ class Contract {
'cPayBack' =>$_REQUEST['cPayBack'] 'cPayBack' =>$_REQUEST['cPayBack']
); );
$wpdb->query("START TRANSACTION");
if($type==1){ if($type==1){
$wpdb->query("START TRANSACTION");
$prefix = "新增"; $prefix = "新增";
if(isset($_REQUEST["id"])) {
$prefix = "修改";
}
$result = Contract::doSqlAction();
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
$context["error"] = $result;
print_r($result);
echo $prefix."合同失败";
}else{
$wpdb->query("COMMIT");
echo $prefix."合同成功";
}
exit;
}else if(isset($_GET['edit'])){
$id = $_REQUEST["id"];
$context['result'] = ContractDao::searchContract($id);
$context["consultant"] = CommissionDao::search_commission_consultant($_GET["id"]);
$context["commission"] = CommissionDao::search_tospur_commission($_GET["id"]);
$context["commissionLog"] = CommissionDao::search_commission_log($context["commission"]->id);
}
Timber::render("contract.html",$context);
}
private static function doSqlAction(){
$params = array(
'signedDate' =>$_REQUEST['signedDate'],
'status' =>$_REQUEST['status'],
'area' =>$_REQUEST['area'],
'permitNumber' =>$_REQUEST['permitNumber'],
'managerId' =>$_REQUEST['managerId'],
'paymentMethod' =>$_REQUEST['paymentMethod'],
'codicil' =>$_REQUEST['codicil'],
'oName' =>$_REQUEST['oName'],
'oID' =>$_REQUEST['oID'],
'oBroker' =>$_REQUEST['oBroker'],
'oAddress' =>$_REQUEST['oAddress'],
'oMoney' =>$_REQUEST['oMoney'],
'oPayBack' =>$_REQUEST['oPayBack'],
'cName' =>$_REQUEST['cName'],
'cID' =>$_REQUEST['cID'],
'cBroker' =>$_REQUEST['cBroker'],
'cAddress' =>$_REQUEST['cAddress'],
'cMoney' =>$_REQUEST['cMoney'],
'cPayBack' =>$_REQUEST['cPayBack']
);
if(isset($_REQUEST["id"])){ if(isset($_REQUEST["id"])){
$result = ContractDao::update($_REQUEST["id"],$params); $result = ContractDao::update($_REQUEST["id"],$params);
$prefix = "修改"; if(!is_numeric($result)){
if(is_numeric($result)){ return $result;
}
$status = 0; $status = 0;
if($params['status'] == 4) { if($params['status'] == 4) {
$status = 0; $status = 0;
...@@ -52,7 +100,10 @@ class Contract { ...@@ -52,7 +100,10 @@ class Contract {
$status = 2; $status = 2;
} }
$result = HouseDao::updateStatus($status,$_REQUEST['id']); $result = HouseDao::updateStatus($status,$_REQUEST['id']);
if(!is_numeric($result)){
return $result;
} }
$commissionId = $_REQUEST['commissionId'];
}else{ }else{
$params['business'] = $_REQUEST['businessId']; $params['business'] = $_REQUEST['businessId'];
$params['houseNumber'] = $_REQUEST['houseNumber']; $params['houseNumber'] = $_REQUEST['houseNumber'];
...@@ -66,31 +117,50 @@ class Contract { ...@@ -66,31 +117,50 @@ class Contract {
$params['consultantId'] = get_current_user_id(); $params['consultantId'] = get_current_user_id();
$result = ContractDao::insert($params); $result = ContractDao::insert($params);
if(!is_numeric($result)){
return $result;
}
$pre = "CJCS"; $pre = "CJCS";
if($_REQUEST['type'] > 1){ if($_REQUEST['type'] > 1){
$pre = "CJCZ"; $pre = "CJCZ";
} }
$contractId = $pre.str_pad($result,6,'0',STR_PAD_LEFT); $contractId = $pre.str_pad($result,6,'0',STR_PAD_LEFT);
$result = ContractDao::setContractId($result,$contractId); $result = ContractDao::setContractId($result,$contractId);
if(!is_numeric($result)){
return $result;
}
$contractId = $result;
//二手房、租房创建合同时修改房源的状态 //二手房、租房创建合同时修改房源的状态
if(intval($_REQUEST['businessId']) >=1 ){ if(intval($_REQUEST['businessId']) >=1 ){
$result = HouseDao::updateStatus(-1,$params['houseId']); $result = HouseDao::updateStatus(-1,$params['houseId']);
if(!is_numeric($result)){
return $result;
} }
} }
$commissionParams = array(
"intent" => $_REQUEST["intent"],
"accounts" => $_REQUEST["accounts"],
"type" => $_REQUEST["businessType"],
"contractId" => $contractId,
"consultantId" => $_REQUEST["consultantId"]
);
$result = CommissionDao::insert_touspur_commission($commissionParams);
if(!is_numeric($result)){ if(!is_numeric($result)){
$wpdb->query("ROLLBACK"); return $result;
$context["error"] = $result;
echo $prefix."合同失败";
}else{
$wpdb->query("COMMIT");
echo $prefix."合同成功";
} }
exit; $commissionId = $result;
}else if(isset($_GET['edit'])){
$id = $_REQUEST["id"];
$context['houseId'] = $id;
$context['result'] = ContractDao::searchContract($id);
} }
Timber::render("contract.html",$context); if(isset( $_POST["log"])) {
foreach ($_POST["log"] as $value) {
$logParams = array(
"commissionId" => $commissionId,
"time" => $value["time"],
"paid" => $value["paid"]
);
$logRes = CommissionDao::insert_commission_log($logParams);
}
return $logRes;
}
return $result;
} }
} }
\ No newline at end of file
...@@ -36,10 +36,10 @@ class House extends Tospur_House{ ...@@ -36,10 +36,10 @@ class House extends Tospur_House{
"location" => $_POST["location"], "location" => $_POST["location"],
"property_money" => $_POST["property_money"], "property_money" => $_POST["property_money"],
'community_name' => $_POST["community_name"], 'community_name' => $_POST["community_name"],
'status' => $_POST["status"]
); );
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){ if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0;
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array); $result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 203){ if($result != 203){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
...@@ -50,7 +50,6 @@ class House extends Tospur_House{ ...@@ -50,7 +50,6 @@ class House extends Tospur_House{
echo "新房房源修改成功"; echo "新房房源修改成功";
} }
}else{ }else{
$insert_tospur_house_array['status'] = $_POST['status'];
$result = House::data_insert($insert_tospur_house_array); $result = House::data_insert($insert_tospur_house_array);
if($result != 200){ if($result != 200){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
...@@ -62,13 +61,14 @@ class House extends Tospur_House{ ...@@ -62,13 +61,14 @@ class House extends Tospur_House{
} }
} }
exit; exit;
}else if(isset($_GET['edit'])){ }else if(isset($_GET['edit']))
{
$context['houseId'] = $_GET['id']; $context['houseId'] = $_GET['id'];
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'],"edit")); $context = array_merge($context,SearchDao::getDetailInfo($_GET['id'],"edit"));
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); $context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],1); $context["status"] = searchDao::searchStatusType(1);
} }
$context['role'] = House::getCurrentRole(); $context['role'] = House::getCurrentRole();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
...@@ -134,8 +134,8 @@ class House extends Tospur_House{ ...@@ -134,8 +134,8 @@ class House extends Tospur_House{
$result = $res; $result = $res;
echo "推荐置业顾问修改失败"; echo "推荐置业顾问修改失败";
} }
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($houseId, $data['houseTag']);
return $result; CustomerTrackingDao::insert($houseId, $_REQUEST); return $result;
} }
public static function data_insert($params){ public static function data_insert($params){
...@@ -156,7 +156,9 @@ class House extends Tospur_House{ ...@@ -156,7 +156,9 @@ class House extends Tospur_House{
InsertDao::addRecConsultant($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
}else{ }else{
return 506; return 506;
......
<?php <?php
class commissionManage{ require_once(PLUGIN_DIR . 'Dao/CommissionDao.php');
function commissionManage_html(){ class CommissionManage{
public static function commissionManage_html(){
global $wpdb;
$context = array(); $context = array();
$type = $_POST["type"];
if($type == 4){
$commissionParams = array(
"intent" => $_POST["intent"],
"accounts" => $_POST["accounts"],
"type" => $_POST["businessType"],
"contractId" => 1
);
$wpdb->query("START TRANSACTION");
if(isset($_POST['contractId'])){
$res = CommissionManage::commission_update($_POST['contractId']);
if(is_numeric($res)){
$wpdb->query("COMMIT");
echo "收佣管理修改成功";
}else{
$wpdb->query("ROLLBACK");
print_r($res);
echo "收佣管理修改失败";
}
}else{
$res = CommissionManage::commission_insert($commissionParams);
if(is_numeric($res)){
$wpdb->query("COMMIT");
echo "收佣管理录入成功";
}else{
$wpdb->query("ROLLBACK");
print_r($res);
echo "收佣管理录入失败";
}
}
exit;
}else if(isset($_GET["id"])){
$context["id"] = $_GET["id"];
$context["consultant"] = CommissionDao::search_commission_consultant($_GET["id"]);
$context["commission"] = CommissionDao::search_tospur_commission($_GET["id"]);
$context["commissionLog"] = CommissionDao::search_commission_log($context["commission"]->id);
}
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
Timber::render("commissionManage.html",$context); Timber::render("commissionManage.html",$context);
} }
public static function commission_insert($comParams){
$data = $_POST["data"];
$log = $_POST["log"];
$comParams["consultantId"] = $data["recConsultant"];
$comRes = CommissionDao::insert_touspur_commission($comParams);
if(is_numeric($comRes)){
if(isset( $_POST["log"])) {
foreach ($log as $value) {
$logParams = array(
"commissionId" => $comRes,
"time" => $value["time"],
"paid" => $value["paid"]
);
$logRes = CommissionDao::insert_commission_log($logParams);
}
return $logRes;
}
}else{
return $comRes;
}
}
public static function commission_update($contractId){
global $wpdb;
$data = $_POST["data"];
$log = $_POST["log"];
$updateParam = array(
"consultanId" => $data["recConsultant"],
"type" => $_POST["businessType"]
);
$updateRes = $wpdb->update(Config::TOSPUR_COMMISSION,$updateParam,array("contractId" => $contractId));
$commission = CommissionDao::search_tospur_commission($contractId);
if(is_numeric($updateRes)){
if(isset( $_POST["log"])) {
foreach ($log as $value) {
$logParams = array(
"commissionId" => $commission->id,
"time" => $value["time"],
"paid" => $value["paid"]
);
$logRes = CommissionDao::insert_commission_log($logParams);
}
return $logRes;
}
}else{
$updateRes = $wpdb->last_error;
return $updateRes;
}
}
} }
\ No newline at end of file
...@@ -42,15 +42,15 @@ class customerList extends WP_List_Table ...@@ -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" . $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 (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 where 1 = 1";
if (isset($_POST['status']) && $_POST['status'] != -1) { if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_POST['status']; $sql = $sql . " and tcs.status = " . $_REQUEST['status'];
} }
if (isset($_POST['customer_type']) && $_POST['customer_type'] != -1) { if (isset($_REQUEST['customer_type']) && $_REQUEST['customer_type'] != -1) {
$sql = $sql . " and tcs.customer_type = " . $_POST['customer_type']; $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; $demand_type = null;
switch ($_POST['demand_type']) { switch ($_REQUEST['demand_type']) {
case 0: case 0:
$demand_type = 'tcs.new_house'; $demand_type = 'tcs.new_house';
break; break;
...@@ -65,20 +65,20 @@ class customerList extends WP_List_Table ...@@ -65,20 +65,20 @@ class customerList extends WP_List_Table
$sql = $sql . " and " . $demand_type . " = 1"; $sql = $sql . " and " . $demand_type . " = 1";
} }
} }
if (isset($_POST['search_name'])) { if (isset($_REQUEST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_POST['search_name'] . "%'"; $sql = $sql . " and tcs.name like '%" . $_REQUEST['search_name'] . "%'";
} }
if (isset($_POST['search_consultant_name'])) { if (isset($_REQUEST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_POST['search_consultant_name'] . "%'"; $sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
} }
if (isset($_POST['search_phone'])) { if (isset($_REQUEST['search_phone'])) {
$sql = $sql . " and tcs.phone like '%" . $_POST['search_phone'] . "%'"; $sql = $sql . " and tcs.phone like '%" . $_REQUEST['search_phone'] . "%'";
} }
if (isset($_POST['search_min_time']) && $_POST['search_min_time'] != null) { if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
$sql = $sql . " and tcs.time >= '" . $_POST['search_min_time'] . "'"; $sql = $sql . " and tcs.time >= '" . $_REQUEST['search_min_time'] . "'";
} }
if (isset($_POST['search_max_time']) && $_POST['search_max_time'] != null) { if (isset($_REQUEST['search_max_time']) && $_REQUEST['search_max_time'] != null) {
$sql = $sql . " and tcs.time <= '" . $_POST['search_max_time'] . "'"; $sql = $sql . " and tcs.time <= '" . $_REQUEST['search_max_time'] . "'";
} }
$result = $wpdb->get_results($sql); $result = $wpdb->get_results($sql);
$data = array(); $data = array();
...@@ -102,11 +102,13 @@ class customerList extends WP_List_Table ...@@ -102,11 +102,13 @@ class customerList extends WP_List_Table
} }
$current_page = $this->get_pagenum(); $current_page = $this->get_pagenum();
if (isset($_POST['paged'])) {
$current_page = $_POST['paged'];
}
$total_items = count($data); $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); $data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
...@@ -126,20 +128,21 @@ function function_customerList() ...@@ -126,20 +128,21 @@ function function_customerList()
$context['status'] = SearchDao::searchStatusType(5); $context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6); $context['customer_type'] = SearchDao::searchStatusType(6);
$context['status_id'] = $_POST['status']; $context['status_id'] = $_REQUEST['status'];
$context['demand_type'] = isset($_POST['demand_type']) ? $_POST['demand_type'] : -1; $context['demand_type'] = isset($_REQUEST['demand_type']) ? $_REQUEST['demand_type'] : -1;
$context['customer_type_id'] = isset($_POST['customer_type']) ? $_POST['customer_type'] : -1; $context['customer_type_id'] = isset($_REQUEST['customer_type']) ? $_REQUEST['customer_type'] : -1;
$context['search_name'] = $_POST['search_name']; $context['search_name'] = $_REQUEST['search_name'];
$context['search_consultant_name'] = $_POST['search_consultant_name']; $context['search_consultant_name'] = $_REQUEST['search_consultant_name'];
$context['search_phone'] = $_POST['search_phone']; $context['search_phone'] = $_REQUEST['search_phone'];
$context['search_min_time'] = $_POST['search_min_time']; $context['search_min_time'] = $_REQUEST['search_min_time'];
$context['search_max_time'] = $_POST['search_max_time']; $context['search_max_time'] = $_REQUEST['search_max_time'];
Timber::render("customerList.html", $context); Timber::render("customerList.html", $context);
} }
function addCustomerTable() function addCustomerTable()
{ {
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$customerList = new customerList(); $customerList = new customerList();
$customerList->prepare_items(); $customerList->prepare_items();
$customerList->display(); $customerList->display();
......
...@@ -31,7 +31,7 @@ class customerTrackingList extends WP_List_Table ...@@ -31,7 +31,7 @@ class customerTrackingList extends WP_List_Table
function prepare_items() function prepare_items()
{ {
global $wpdb; global $wpdb;
$per_page = 1; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
...@@ -40,17 +40,17 @@ class customerTrackingList extends WP_List_Table ...@@ -40,17 +40,17 @@ class customerTrackingList extends WP_List_Table
$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 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 (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 where 1 = 1";
if (isset($_GET['status_type']) && $_GET['status_type'] != -1) { if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) {
$sql = $sql . " and tct.status_type = " . $_GET['status_type']; $sql = $sql . " and tct.status_type = " . $_REQUEST['status_type'];
} }
if (isset($_GET['search_consultant_name'])) { if (isset($_REQUEST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_GET['search_consultant_name'] . "%'"; $sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
} }
if (isset($_GET['search_min_time']) && $_GET['search_min_time'] != null) { if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
$sql = $sql . " and tct.time >= '" . $_GET['search_min_time'] . "'"; $sql = $sql . " and tct.time >= '" . $_REQUEST['search_min_time'] . "'";
} }
if (isset($_GET['search_max_time']) && $_GET['search_max_time'] != null) { if (isset($_REQUEST['search_max_time']) && $_REQUEST['search_max_time'] != null) {
$sql = $sql . " and tct.time <= '" . $_GET['search_max_time'] . "'"; $sql = $sql . " and tct.time <= '" . $_REQUEST['search_max_time'] . "'";
} }
$sql = $sql . " order by tct.time desc"; $sql = $sql . " order by tct.time desc";
$result = $wpdb->get_results($sql); $result = $wpdb->get_results($sql);
...@@ -68,11 +68,13 @@ class customerTrackingList extends WP_List_Table ...@@ -68,11 +68,13 @@ class customerTrackingList extends WP_List_Table
} }
$current_page = $this->get_pagenum(); $current_page = $this->get_pagenum();
if (isset($_GET['paged'])) {
$current_page = $_GET['paged'];
}
$total_items = count($data); $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); $data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
...@@ -90,16 +92,17 @@ function function_customerTrackingList() ...@@ -90,16 +92,17 @@ function function_customerTrackingList()
{ {
$context = array(); $context = array();
$context['status'] = SearchDao::searchStatusType(3); $context['status'] = SearchDao::searchStatusType(3);
$context['status_type'] = isset($_GET['status_type']) ? $_GET['status_type'] : -1; $context['status_type'] = isset($_REQUEST['status_type']) ? $_REQUEST['status_type'] : -1;
$context['search_consultant_name'] = $_GET['search_consultant_name']; $context['search_consultant_name'] = $_REQUEST['search_consultant_name'];
$context['search_min_time'] = $_GET['search_min_time']; $context['search_min_time'] = $_REQUEST['search_min_time'];
$context['search_max_time'] = $_GET['search_max_time']; $context['search_max_time'] = $_REQUEST['search_max_time'];
Timber::render("customerTrackingList.html", $context); Timber::render("customerTrackingList.html", $context);
} }
function addCustomerTrackingTable() function addCustomerTrackingTable()
{ {
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$customerTrackingList = new customerTrackingList(); $customerTrackingList = new customerTrackingList();
$customerTrackingList->prepare_items(); $customerTrackingList->prepare_items();
$customerTrackingList->display(); $customerTrackingList->display();
......
...@@ -5,33 +5,34 @@ class feature ...@@ -5,33 +5,34 @@ class feature
public static function ajax_add_feature() public static function ajax_add_feature()
{ {
$name = $_POST['name']; $name = $_POST['name'];
$type = $_POST['type'];
$array = array(); $array = array();
$result = feature::search_feature($name); $result = feature::search_feature($type, $name);
if ($result) { if ($result) {
$array['code'] = 2001; $array['code'] = 2001;
} else { } else {
feature::add_feature($name); feature::add_feature($type, $name);
$array['code'] = 2000; $array['code'] = 2000;
} }
wp_send_json($array); wp_send_json($array);
} }
public static function search_feature($name = null) public static function search_feature($type, $name = null)
{ {
global $wpdb; global $wpdb;
$sql = "select id,name from " . Config::TOSPUR_TAG_TABLE . " where type = 1"; $sql = "select id,name from " . Config::TOSPUR_TAG_TABLE . " where type = " . $type;
if ($name) { if ($name) {
$sql .= " and name = '" . $name . "'"; $sql .= " and name = '" . $name . "'";
} }
return $wpdb->get_results($sql); return $wpdb->get_results($sql);
} }
public static function add_feature($name) public static function add_feature($type, $name)
{ {
global $wpdb; global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_TAG_TABLE, array( $result = $wpdb->insert(Config::TOSPUR_TAG_TABLE, array(
'name' => $name, 'name' => $name,
'type' => 1 'type' => $type
)); ));
return $result; return $result;
} }
...@@ -40,9 +41,19 @@ class feature ...@@ -40,9 +41,19 @@ class feature
{ {
$context = array(); $context = array();
$context['view'] = plugins_url() . '/tospur/Admin/views'; $context['view'] = plugins_url() . '/tospur/Admin/views';
$context['result'] = feature::search_feature();
$context['url'] = home_url(); $context['url'] = home_url();
$context['admin_url'] = admin_url(); $context['request_url'] = $_SERVER['request_url'];
$type = null;
switch ($_GET['page']) {
case 'add_tag':
$type = 0;
break;
case 'add_feature':
$type = 1;
break;
}
$context['type'] = $type;
$context['result'] = feature::search_feature($type);
Timber::render('feature.html', $context); Timber::render('feature.html', $context);
} }
} }
......
...@@ -25,6 +25,7 @@ class RentHouse extends Tospur_House{ ...@@ -25,6 +25,7 @@ class RentHouse extends Tospur_House{
'city_id' => $_POST['baseCity'], 'city_id' => $_POST['baseCity'],
'district_id' => $_POST['baseAreaId'], 'district_id' => $_POST['baseAreaId'],
'plate_id' => $_POST["basePlateId"], 'plate_id' => $_POST["basePlateId"],
'room_id' => $_POST['baseRoom'],
'address' => $_POST['address'], 'address' => $_POST['address'],
'community_name'=>$_POST['community_name'], 'community_name'=>$_POST['community_name'],
'traffic' => $_POST['traffic'], 'traffic' => $_POST['traffic'],
...@@ -48,13 +49,14 @@ class RentHouse extends Tospur_House{ ...@@ -48,13 +49,14 @@ class RentHouse extends Tospur_House{
"garage"=>$_POST["garage"], "garage"=>$_POST["garage"],
"entrustDay"=>$_POST["entrustDay"], "entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"], "deadLine"=>$_POST["deadLine"],
"rent"=>$_POST["rent"] "rent"=>$_POST["rent"],
"status" => $_POST["status"]
); );
if($type==3){ if($type==3){
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){ if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0;
$result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array); $result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
if($result != 202){ if($result != 202){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result);; print_r($result);;
...@@ -65,7 +67,6 @@ class RentHouse extends Tospur_House{ ...@@ -65,7 +67,6 @@ class RentHouse extends Tospur_House{
} }
}else { }else {
$insert_tospur_house_array['status'] = $_POST['status'];
$result = RentHouse::rentHouseData_insert($insert_tospur_house_array); $result = RentHouse::rentHouseData_insert($insert_tospur_house_array);
if ($result != 200) { if ($result != 200) {
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
...@@ -83,8 +84,7 @@ class RentHouse extends Tospur_House{ ...@@ -83,8 +84,7 @@ class RentHouse extends Tospur_House{
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); $context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2); $context["status"] = searchDao::searchStatusType(2);
$context["rent"] = SearchDao::searchRent($_GET['id']);
} }
$context['role'] = RentHouse::getCurrentRole(); $context['role'] = RentHouse::getCurrentRole();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
...@@ -115,7 +115,9 @@ class RentHouse extends Tospur_House{ ...@@ -115,7 +115,9 @@ class RentHouse extends Tospur_House{
InsertDao::addRecConsultant($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
}else{ }else{
return 508; return 508;
} }
...@@ -153,7 +155,7 @@ class RentHouse extends Tospur_House{ ...@@ -153,7 +155,7 @@ class RentHouse extends Tospur_House{
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId)); $wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($houseId, $data['houseTag']);
return $result; return $result;
} }
} }
......
...@@ -24,6 +24,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -24,6 +24,7 @@ class SecHandHouse extends Tospur_House{
'city_id' => $_POST['baseCity'], 'city_id' => $_POST['baseCity'],
'district_id' => $_POST['baseAreaId'], 'district_id' => $_POST['baseAreaId'],
'plate_id' => $_POST["basePlateId"], 'plate_id' => $_POST["basePlateId"],
'room_id' => $_POST['baseRoom'],
'address' => $_POST['address'], 'address' => $_POST['address'],
'community_name'=>$_POST['community_name'], 'community_name'=>$_POST['community_name'],
'traffic' => $_POST['traffic'], 'traffic' => $_POST['traffic'],
...@@ -46,17 +47,17 @@ class SecHandHouse extends Tospur_House{ ...@@ -46,17 +47,17 @@ class SecHandHouse extends Tospur_House{
"matching_facilities"=>$_POST["matching_facilities"], "matching_facilities"=>$_POST["matching_facilities"],
"garage"=>$_POST["garage"], "garage"=>$_POST["garage"],
"entrustDay"=>$_POST["entrustDay"], "entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"] "deadLine"=>$_POST["deadLine"],
"status" => $_POST["status"]
); );
if($type==2){ if($type==2){
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){ if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0;
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array); $result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
if($result != 201){ if($result != 201){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r( $result);; print_r( $result);;
echo "二手房房源修改失败"; echo "二手房房源修改失败";
}else{ }else{
...@@ -65,7 +66,6 @@ class SecHandHouse extends Tospur_House{ ...@@ -65,7 +66,6 @@ class SecHandHouse extends Tospur_House{
} }
}else { }else {
$insert_tospur_house_array['status'] = $_POST['status'];
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array); $result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) { if ($result != 200) {
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
...@@ -82,10 +82,6 @@ class SecHandHouse extends Tospur_House{ ...@@ -82,10 +82,6 @@ class SecHandHouse extends Tospur_House{
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'])); $context = array_merge($context,SearchDao::getDetailInfo($_GET['id']));
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context['featureOld'] = json_encode(SearchDao::searchFeatureOld($_GET['id']));
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
} }
$context['role'] = SecHandHouse::getCurrentRole(); $context['role'] = SecHandHouse::getCurrentRole();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
...@@ -93,7 +89,6 @@ class SecHandHouse extends Tospur_House{ ...@@ -93,7 +89,6 @@ class SecHandHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType(); $context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2); $context["status"] = searchDao::searchStatusType(2);
$context["feature"] = searchDao::searchFeature();
$context["house_type"] = 1; $context["house_type"] = 1;
Timber::render("secHandHouse.html",$context); Timber::render("secHandHouse.html",$context);
...@@ -115,15 +110,15 @@ class SecHandHouse extends Tospur_House{ ...@@ -115,15 +110,15 @@ class SecHandHouse extends Tospur_House{
InsertDao::addMainImage($houseId,$data); InsertDao::addMainImage($houseId,$data);
$recommendRes = InsertDao::addRecommend($houseId,$data); InsertDao::addRecommend($houseId,$data);
$recConsultant=InsertDao::addRecConsultant($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
if(isset($_POST['mark'])&&$_POST['mark']!=""){ InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
} InsertDao::addHouseFeature($houseId, $data['houseFeature']);
InsertDao::addHouseFeature($houseId,$data); CustomerTrackingDao::insert($houseId, $_REQUEST);
}else{ }else{
...@@ -170,11 +165,9 @@ class SecHandHouse extends Tospur_House{ ...@@ -170,11 +165,9 @@ class SecHandHouse extends Tospur_House{
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a left JOIN tospur_tag tt on aht.tag_id = tt.id) as a
where house_id = %d and a.type = 1);", $houseId) where house_id = %d and a.type = 1);", $houseId)
); );
InsertDao::addHouseFeature($houseId,$data); InsertDao::addHouseTag($houseId, $data['houseTag']);
if(isset($_POST['mark'])&&$_POST['mark']!="") { InsertDao::addHouseFeature($houseId, $data['houseFeature']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
}
return $result; return $result;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<td> <td>
<div id="feature" class="row"> <div id="feature" class="row">
</div><br/> </div><br/>
<button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt"> <button type="button" class="button action" id="addFeatureBtn">
添加特色 添加特色
</button> </button>
</td> </td>
...@@ -14,27 +14,35 @@ ...@@ -14,27 +14,35 @@
</table> </table>
<script> <script>
(function($){ $(document).ready(function () {
{% set featureOld = function('SearchDao::searchFeatureOld', houseId, 1)|json_encode() %}
{% if featureOld %} {% if featureOld %}
var data = {{ featureOld }}; var data = {{ featureOld }};
$.each(data,function(i,item){ $.each(data, function (i, item) {
addFeature(item.tag_id,item.name); addFeature(item.tag_id, item.name);
}); });
{% endif %} {% endif %}
$(document).ready(function(){
//显示选中的特色 var featureArray = [];
$("#featureList").find("tr > td").click(function(){ $('#addFeatureBtn').click(function(){
addFeature($(this).attr("id"),$(this).text()); init_modal_addTag(1, function (id, value) {
featureArray = [];
$('input[name="data[houseFeature][]"]').each(function (index, item) {
featureArray.push(Number($(item).val()));
});
if(featureArray.indexOf(Number(id)) == -1){
addFeature(id, value);
}else{
alert('不能重复选择特色');
}
}); });
existsCancel();
}); });
function addFeature(id,name){ });
var houseFeature = $("<input>").attr({"type":"hidden","name":"data[houseFeature][]","value":id}); function addFeature(id, value) {
var cancel = $("<span>").attr("aria-hidden","true").addClass("glyphicon glyphicon-remove featureCancel "); var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
var span = $("<span>").attr("style","margin-right:5px").append(name); var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel ");
var divCol =$("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style","margin-bottom:10px"); 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); $("#feature").append(divCol);
} }
})(jQuery);
</script> </script>
\ No newline at end of file
{% block addTag %} {% block addTag %}
{% if feature %}
<style> <style>
.table td { .table td {
text-align: center; text-align: center;
...@@ -11,21 +10,46 @@ ...@@ -11,21 +10,46 @@
<div class="modal-content"> <div class="modal-content">
<div class="row" id="featureTable"> <div class="row" id="featureTable">
<div class="col-md-12"> <div class="col-md-12">
<table class="table" id="featureList"> <table class="table" id="tagList">
{% for item in feature %}
{% if loop.index0%4 == 0%}
<tr>
{% endif %}
<td id="{{item.id}}">{{ item.value }}</td>
{% if loop.index0%4 == 3%}
</tr>
{% endif %}
{% endfor %}
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endif %} <script>
var search_type;
var search_callback;
var tagList;
$(document).ready(function () {
tagList = $('#tagList');
$("#houseFeature").on("show.bs.modal", function () {
tagList.html('');
$.ajax({
type: "POST",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTagOrFeature&type=" + search_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.on("click", "tr > td", function () {
search_callback($(this).attr('id'), $(this).text());
});
existsCancel();
});
function init_modal_addTag(type, callback) {
search_type = type;
search_callback = callback;
$('#houseFeature').modal('show');
}
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
<br /> <br />
<div class="row"> <div class="row">
{% if house_type == 1%} {% if house_type == 1%}
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="total_price">总价:</label> <label for="total_price" class="col-sm-5 control-label">总价:</label>
<input name="total_price" id="total_price" type="text" value="{{result.total_price}}" class="form-control"> 万元 <div class="col-sm-7">
<input name="total_price" id="total_price" type="text" value="{{result.total_price}}" class="form-control" style="width: 70%"> 万元
</div>
</div>
<div class="col-md-8 form-group">
<label for="average_price" class="col-sm-4 control-label">单价:</label>
<div class="col-sm-8">
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control" style="width: 30%">
</div> </div>
<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> </div>
{% elseif house_type== 2 %} {% elseif house_type== 2 %}
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="rent">租金:</label> <label for="rent" class="col-sm-5 control-label">租金:</label>
<input name="rent" id="rent" type="text" value="{{rent.value}}" class="form-control"> 元/月 <div class="col-sm-7">
<input name="rent" id="rent" type="text" value="{{result.rent}}" class="form-control"> 元/月
</div>
</div> </div>
{% else %} {% else %}
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="average_price">均价:</label> <label for="average_price" class="col-sm-5 control-label">均价:</label>
<div class="col-sm-7">
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control"> <input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control">
</div> </div>
</div>
{% endif %} {% endif %}
</div> </div>
\ No newline at end of file
<div class="wrap"> <div class="wrap">
<h2>客户列表</h2> <h2>客户列表</h2>
<form id="" method="post"> <form method="get">
<div> <input type="hidden" name="page" value="customerList">
<div id="search_form">
<label for="status" class="hidden"></label> <label for="status" class="hidden"></label>
<select name="status" id="status"> <select name="status" id="status">
<option value="-1">状态</option> <option value="-1">状态</option>
...@@ -37,13 +38,11 @@ ...@@ -37,13 +38,11 @@
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
{{ function("addCustomerTable") }} {{ function("addCustomerTable") }}
<input type="hidden" name="paged" value="1">
</form> </form>
</div> </div>
<script> <script>
(function ($) { $(document).ready(function () {
$(document).ready(function(){
$('#demand_type').val('{{ demand_type }}'); $('#demand_type').val('{{ demand_type }}');
search_form_set_page();
}); });
})(jQuery);
</script> </script>
\ No newline at end of file
<div class="wrap"> <div class="wrap">
<h2>签约-房客跟进</h2> <h2>签约-房客跟进</h2>
<form action="" method="get"> <form method="get">
<input type="hidden" name="page" value="customerTrackingList"> <input type="hidden" name="page" value="customerTrackingList">
<div> <div id="search_form">
<label for="status_type" class="hidden"></label> <label for="status_type" class="hidden"></label>
<select name="status_type" id="status_type"> <select name="status_type" id="status_type">
<option value="-1">跟进类型</option> <option value="-1">跟进类型</option>
{% for item in status %} {% for item in status %}
<option {{ item.id == status_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option
{{ item.id == status_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}"> <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> <span>日期</span>
<label for="search_min_time" class="hidden"></label> <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="{{ search_min_time }}">
...@@ -20,6 +23,10 @@ ...@@ -20,6 +23,10 @@
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
{{ function("addCustomerTrackingTable") }} {{ function("addCustomerTrackingTable") }}
<input type="hidden" name="paged" value="1">
</form> </form>
</div> </div>
<script>
$(document).ready(function () {
search_form_set_page();
});
</script>
\ No newline at end of file
<h2>添加特色</h2> {% if type == 0 %}
<label for="feature">特色:</label> {% set text = '标签' %}
{% else %}
{% set text = '特色' %}
{% endif %}
<h2>添加{{ text }}</h2>
<label for="feature">{{ text }}:</label>
<input id="feature" type="text"> <input id="feature" type="text">
<input type="submit" id="submit" class="button"> <input type="submit" id="submit" class="button">
<h2>特色列表</h2> <h2>{{ text }}列表</h2>
<table class="table"> <table class="table">
<thead> <thead>
</thead> </thead>
...@@ -19,7 +24,6 @@ ...@@ -19,7 +24,6 @@
</tbody> </tbody>
</table> </table>
<script> <script>
var admin_url = '{{ admin_url }}';
(function ($) { (function ($) {
$(document).ready(function () { $(document).ready(function () {
$('#submit').click(function () { $('#submit').click(function () {
...@@ -28,14 +32,14 @@ ...@@ -28,14 +32,14 @@
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/', url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name, data: 'action=add_feature&name=' + name + '&type={{ type }}',
success: function (data) { success: function (data) {
switch (data.code) { switch (data.code) {
case 2000: case 2000:
window.location.href = admin_url + 'admin.php?page=add_feature'; window.location.href = '{{ request_url }}';
break; break;
case 2001: case 2001:
alert('不能重复添加特色'); alert('不能重复添加{{ text }}');
break; break;
default: default:
break; break;
...@@ -43,7 +47,7 @@ ...@@ -43,7 +47,7 @@
} }
}); });
} else { } else {
alert('请输入特色'); alert('请输入{{ text }}');
} }
}); });
}); });
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
} }
function existsCancel(){ function existsCancel(){
$("#preview,#houseImg,#feature").on("click",".existsCancel,.featureCancel",function(){ $("#preview,#houseImg,#feature,#mark").on("click",".existsCancel,.featureCancel",function(){
$(this).parent().remove(); $(this).parent().remove();
}); });
} }
...@@ -198,6 +198,29 @@ ...@@ -198,6 +198,29 @@
}); });
} }
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');
}
});
}
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12 form-group" >
<label for="housename">城市:</label> <label for="baseCity" class=" control-label" style="width: 11.11%">城市:</label>
<select id="baseCity" name="baseCity" class="form-control"> <select id="baseCity" name="baseCity" class="form-control" style="margin-left: 27px">
<option value="-1"> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
...@@ -28,45 +28,56 @@ ...@@ -28,45 +28,56 @@
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12 form-group">
<label for="address">地址:</label> <label for="address" class=" control-label" style="width: 11.11%">地址:</label>
<input name="address" type="text" value="{{result.address}}" class="form-control" style="width:80%;"> <input name="address" type="text" value="{{result.address}}" class="form-control" style="width:80%;margin-left: 27px;">
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="address">小区名称:</label> <label for="address" class="col-sm-5 control-label">小区名称:</label>
<input name="community_name" type="text" value="{{result.community_name}}" class="form-control"> <div class="col-sm-7">
<input name="community_name" type="text" value="{{result.community_name}}" class="form-control ">
</div> </div>
<div class="col-md-6"> </div>
<label for="developers">开发商:</label> <div class="col-md-8 form-group">
<label for="developers" class="col-sm-4 control-label">开发商:</label>
<div class="col-sm-8">
<input name="developers" type="text" value="{{result.developer}}" class="form-control" > <input name="developers" type="text" value="{{result.developer}}" class="form-control" >
</div> </div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="check_in_time">入住时间:</label> <label for="check_in_time" class="col-sm-5 control-label">入住时间:</label>
<div class="col-sm-7">
<input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" > <input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" >
</div> </div>
<div class="col-md-6"> </div>
<label for="property_age">产权年限:</label> <div class="col-md-8 form-group">
<label for="property_age" class="col-sm-4 control-label">产权年限:</label>
<div class="col-sm-8">
<input name="property_age" type="text" value="{{result.property_age}}" class="form-control" > <input name="property_age" type="text" value="{{result.property_age}}" class="form-control" >
</div> </div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="developers">建筑类型:</label> <label for="developers" class="col-sm-5 control-label">建筑类型:</label>
<div class="col-sm-7">
<select id="baseRoom" name="baseRoom" class="form-control"> <select id="baseRoom" name="baseRoom" class="form-control">
{% for item in room %} {% for item in room %}
<option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div class="col-md-6"> </div>
<label for="decoration">装修程度:</label> <div class="col-md-8 form-group">
<label for="decoration" class="col-sm-4 control-label">装修程度:</label>
<div class="col-sm-8">
<select name="decoration" class="form-control"> <select name="decoration" class="form-control">
<option value="毛坯">毛坯</option> <option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option> <option value="简单装修">简单装修</option>
...@@ -75,76 +86,97 @@ ...@@ -75,76 +86,97 @@
<option value="豪华装修">豪华装修</option> <option value="豪华装修">豪华装修</option>
</select> </select>
</div> </div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="covered_area">建筑面积:</label> <label for="households" class="col-sm-5 control-label">规划户数:</label>
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" >平方米 <div class="col-sm-7">
</div>
<div class="col-md-6">
<label for="households">规划户数:</label>
<input name="households" type="text" value="{{result.households}}" class="form-control" > <input name="households" type="text" value="{{result.households}}" class="form-control" >
</div> </div>
</div>
<div class="col-md-8 form-group">
<label for="covered_area" class="col-sm-4 control-label">建筑面积:</label>
<div class="col-sm-8">
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" > m<sup>2</sup>
</div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="volume_rate">容积率:</label> <label for="volume_rate" class="col-sm-5 control-label">容积率:</label>
<div class="col-sm-7">
<input name="volume_rate" type="text" value="{{result.volume_rate}}" class="form-control"> <input name="volume_rate" type="text" value="{{result.volume_rate}}" class="form-control">
</div> </div>
<div class="col-md-6"> </div>
<label for="greening_rate">绿化率:</label> <div class="col-md-8 form-group">
<label for="greening_rate" class="col-sm-4 control-label">绿化率:</label>
<div class="col-sm-8">
<input name="greening_rate" type="text" value="{{result.greening_rate}}" class="form-control" > <input name="greening_rate" type="text" value="{{result.greening_rate}}" class="form-control" >
</div> </div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="property_management">物业公司:</label></th> <label for="property_management" class="col-sm-5 control-label">物业公司:</label>
<div class="col-sm-7">
<input name="property_management" type="text" value="{{result.property_management}}" class="form-control" > <input name="property_management" type="text" value="{{result.property_management}}" class="form-control" >
</div> </div>
<div class="col-md-6"> </div>
<label for="property_money">物业费:</label> <div class="col-md-8 form-group">
<input name="property_money" type="text" value="{{result.property_money}}" class="form-control"> <label for="property_money" class="col-sm-4 control-label">物业费:</label>
<div class="col-sm-8">
<input name="property_money" type="text" value="{{result.property_money}}" class="form-control">&nbsp元
</div>
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="parking_spaces">车位数:</label> <label for="parking_spaces" class="col-sm-5 control-label">车位数:</label>
<div class="col-sm-7">
<input name="parking_spaces" type="text" value="{{result.parking_spaces}}" class="form-control" > <input name="parking_spaces" type="text" value="{{result.parking_spaces}}" class="form-control" >
</div> </div>
<div class="col-md-6"> </div>
<label for="periphery">周边配套:</label> <div class="col-md-8 form-group">
<label for="periphery" class="col-sm-4 control-label">周边配套:</label>
<div class="col-sm-8">
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control"> <input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div> </div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="traffic">交通线路:</label> <label for="traffic" class="col-sm-5 control-label">交通线路:</label>
<div class="col-sm-7">
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control"> <input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</div> </div>
<div class="col-md-6"> </div>
<label for="location">地域坐标:</label> <div class="col-md-8 form-group">
<label for="location" class="col-sm-4 control-label">地域坐标:</label>
<div class="col-sm-8">
<input name="location" id="location" type="text" value="{{result.location}}" class="form-control"> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
</div> </div>
</div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12 form-group">
<label for="overview">最新动态:</label> <label for="overview" class=" control-label" style="width:11.11%">最新动态:</label>
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea> <textarea name="overview" rows="4" cols="60" class="form-control" style="margin-left: 27px">{{result.overview}}</textarea>
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12 form-group">
<label for="overview">楼盘概述:</label> <label for="overview" class=" control-label" style="width:11.11%">楼盘概述:</label>
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea> <textarea name="overview" rows="4" cols="60" class="form-control" style="margin-left: 27px">{{result.overview}}</textarea>
</div> </div>
</div> </div>
......
...@@ -13,18 +13,35 @@ ...@@ -13,18 +13,35 @@
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;"> <div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div> </div>
<form action="" method="POST" enctype="multipart/form-data" id="newHouse" class="form-inline"> <form action="" method="POST" enctype="multipart/form-data" id="newHouse" class="form-inline form-horizontal">
<div class="row"> <div class="row">
<div class="col-md-11"> <div class="col-xs-10">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a></li> <li role="presentation" class="active">
<li role="presentation"><a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a></li> <a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a>
<li role="presentation"><a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a></li> </li>
<li role="presentation"><a href="#mainHouse" aria-controls="mainHouse" role="tab" data-toggle="tab">主力户型</a></li> <li role="presentation">
<li role="presentation"><a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a></li> <a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a>
<li role="presentation"><a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a></li> </li>
<li role="presentation"><a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a></li> <li role="presentation">
<a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a>
</li>
<li role="presentation">
<a href="#mainHouse" aria-controls="mainHouse" role="tab" data-toggle="tab">主力户型</a>
</li>
<li role="presentation">
<a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a>
</li>
<li role="presentation">
<a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a>
</li>
<li role="presentation">
<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>
</li>
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
...@@ -56,24 +73,32 @@ ...@@ -56,24 +73,32 @@
<div role="tabpanel" class="tab-pane" id="addConsultant"> <div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %} {% include 'addConsultant.html' %}
</div> </div>
<div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %}
{% import "macro.html" as macro %}
{{ macro.customer_tracking_list(houseId, 1) }}
</div>
</div> </div>
<input type="text" name="type" value="1" hidden="hidden"> <input type="text" name="type" value="1" hidden="hidden">
{% if houseId %} {% if houseId %}
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %} {% endif %}
</div> </div>
<div class="col-md-1"> <div class="col-xs-2">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:200px;"> <div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status"> <select id="status" name="status">
{% for item in status %} {% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option> <option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> {% else %}
<input type="hidden" name="status" value="0">
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px"> <input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div> </div>
</div>
</div> </div>
</form> </form>
...@@ -84,7 +109,9 @@ ...@@ -84,7 +109,9 @@
<!-- 置业顾问弹出层 --> <!-- 置业顾问弹出层 -->
{% include 'recConsultant.html' %} {% include 'recConsultant.html' %}
{{ block('recConsultant') }} {{ block('recConsultant') }}
<!-- 特色房源弹出层 -->
{% include 'addTag.html' %}
{{ block('addTag') }}
<script> <script>
(function($){ (function($){
......
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-4 form-group">
<label for="owner_name">业主姓名:</label> <label for="owner_name" class="col-sm-5 control-label">业主姓名:</label>
<div class="col-sm-7">
<input name="owner_name" id="owner_name" type="text" value="" class="form-control"> <input name="owner_name" id="owner_name" type="text" value="" class="form-control">
</div> </div>
<div class="col-md-6"> </div>
<label for="owner_phone">业主电话:</label> <div class="col-md-8 form-group">
<label for="owner_phone" class="col-sm-4 control-label">业主电话:</label>
<div class="col-sm-8">
<input name="owner_phone" id="owner_phone" type="text" value="" class="form-control"> <input name="owner_phone" id="owner_phone" type="text" value="" class="form-control">
</div> </div>
</div>
</div> </div>
\ No newline at end of file
...@@ -13,20 +13,35 @@ ...@@ -13,20 +13,35 @@
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;"> <div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div> </div>
<form action="" method="POST" enctype="multipart/form-data" id="rentHouse" class="form-inline"> <form action="" method="POST" enctype="multipart/form-data" id="rentHouse" class="form-inline form-horizontal">
<div class="row"> <div class="row">
<div class="col-md-11"> <div class="col-xs-10">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a></li> <li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a></li>
<li role="presentation"><a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a></li> <li role="presentation">
<li role="presentation"><a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a></li> <a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a>
</li>
<li role="presentation">
<a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a>
</li>
{% if not houseId %} {% if not houseId %}
<li role="presentation"><a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a></li> <li role="presentation">
<a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a>
</li>
{% endif %} {% endif %}
<li role="presentation"><a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a></li> <li role="presentation">
<li role="presentation"><a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a></li> <a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a>
<li role="presentation"><a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a></li> </li>
<li role="presentation">
<a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a>
</li>
<li role="presentation">
<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>
</li>
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
...@@ -51,25 +66,30 @@ ...@@ -51,25 +66,30 @@
<div role="tabpanel" class="tab-pane" id="addConsultant"> <div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %} {% include 'addConsultant.html' %}
</div> </div>
<div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %}
{% import "macro.html" as macro %}
{{ macro.customer_tracking_list(houseId, 1) }}
</div>
</div> </div>
<input type="text" name="type" value="3" hidden="hidden"> <input type="text" name="type" value="3" hidden="hidden">
{% if houseId %} {% if houseId %}
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %} {% endif %}
</div> </div>
<div class="col-md-1"> <div class="col-xs-2">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:200px;"> <div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status"> <select id="status" name="status">
{% for item in status %} {% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option> <option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %} {% endfor %}
</select> </select>
</div>
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px"> <input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div> </div>
</div> </div>
</div>
</form> </form>
<!-- Modal --> <!-- Modal -->
......
...@@ -16,67 +16,100 @@ ...@@ -16,67 +16,100 @@
</div> </div>
<form action="" method="POST" enctype="multipart/form-data" id="secHouse" class="form-inline"> <form action="" method="POST" enctype="multipart/form-data" id="secHouse" class="form-inline form-horizontal">
<div class="row"> <div class="row">
<div class="col-md-11"> <div class="col-xs-10">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a></li> <li role="presentation" class="active">
<li role="presentation"><a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a></li> <a href="#info" aria-controls="info" role="tab" data-toggle="tab">基本信息</a>
<li role="presentation"><a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a></li> </li>
{% if not houseId %} <!--<li role="presentation">-->
<li role="presentation"><a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a></li> <!--<a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a>-->
{% endif %} <!--</li>-->
<li role="presentation"><a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a></li> <!--<li role="presentation">-->
<li role="presentation"><a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a></li> <!--<a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a>-->
<li role="presentation"><a href="#addFeature" aria-controls="addFeature" role="tab" data-toggle="tab">房源特色</a></li> <!--</li>-->
<li role="presentation"><a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a></li> <!--{% if not houseId %}-->
<!--<li role="presentation">-->
<!--<a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a>-->
<!--</li>-->
<!--{% endif %}-->
<li role="presentation">
<a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">图片</a>
</li>
<!--<li role="presentation">-->
<!--<a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a>-->
<!--</li>-->
<!--<li role="presentation">-->
<!--<a href="#addFeature" aria-controls="addFeature" role="tab" data-toggle="tab">房源特色</a>-->
<!--</li>-->
<!--<li role="presentation">-->
<!--<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>-->
<!--</li>-->
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="info"> <div role="tabpanel" class="tab-pane active" id="info">
{% include 'houseInfo.html' %} {% include 'houseInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %} {% include 'weixin.html' %}
</div> {% if not houseId %}
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="owner">
{% include 'owner.html' %} {% include 'owner.html' %}
{% endif %}
{% include 'business.html' %}
</div> </div>
<!--<div role="tabpanel" class="tab-pane" id="weixin">-->
<!--{% include 'weixin.html' %}-->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="business">-->
<!---->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="owner">-->
<!---->
<!--</div>-->
<div role="tabpanel" class="tab-pane" id="photos"> <div role="tabpanel" class="tab-pane" id="photos">
{% include 'photos.html' %} {% include 'photos.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addRecHouse">
{% include 'addRecHouse.html' %} {% include 'addRecHouse.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addFeature">
{% include 'addFeature.html' %} {% include 'addFeature.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %} {% include 'addConsultant.html' %}
</div> </div>
<!--<div role="tabpanel" class="tab-pane" id="addRecHouse">-->
<!---->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="addFeature">-->
<!---->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="addConsultant">-->
<!---->
<!--</div>-->
<div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %}
{% import "macro.html" as macro %}
{{ macro.customer_tracking_list(houseId, 1) }}
</div>
</div> </div>
<input type="text" name="type" value="2" hidden="hidden"> <input type="text" name="type" value="2" hidden="hidden">
{% if houseId %} {% if houseId %}
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %} {% endif %}
</div> </div>
<div class="col-md-1"> <div class="col-xs-2">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:200px;"> <div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status"> <select id="status" name="status">
{% for item in status %} {% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option> <option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> {% else %}
{% endif %} <input type="hidden" name="status" value="0"> {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px"> <input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div> </div>
</div> </div>
</div>
</form> </form>
<!-- Modal --> <!-- Modal -->
......
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-4 form-group">
<label for="housename">标题:</label> <label for="housename" class="col-sm-5 control-label">标题:</label>
<input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" > <input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <table class="form-table">
<div class="col-md-12"> <tbody>
<label for="mark">标签:</label> <tr>
<input name="mark" id="mark" type="text" value="{{mark}}" class="form-control"> <th><label for="mark">标签</label></th>
</div> <td>
</div> <div id="mark" class="row">
\ No newline at end of file </div><br/>
<button type="button" class="button action" id="addTagBtn">
标签
</button>
</td>
</tr>
</tbody>
</table>
<script>
$(document).ready(function () {
{% set markOld = function('SearchDao::searchFeatureOld', houseId, 0)|json_encode() %}
{% if markOld %}
var data = {{ markOld }};
$.each(data, function (i, item) {
addTag(item.tag_id, item.name);
});
{% endif %}
var tagArray = [];
$('#addTagBtn').click(function(){
init_modal_addTag(0, function (id, value) {
tagArray = [];
$('input[name="data[houseTag][]"]').each(function (index, item) {
tagArray.push(Number($(item).val()));
});
if(tagArray.indexOf(Number(id)) == -1){
addTag(id, value);
}else{
alert('不能重复选择标签');
}
});
});
});
function addTag(id, value) {
var houseTag = $("<input>").attr({"type": "hidden", "name": "data[houseTag][]", "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(houseTag).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#mark").append(divCol);
}
</script>
\ No newline at end of file
...@@ -28,6 +28,8 @@ class Config { ...@@ -28,6 +28,8 @@ class Config {
const TOSPUR_CUSTOMER_TRACKING_TABLE = 'tospur_customer_tracking'; const TOSPUR_CUSTOMER_TRACKING_TABLE = 'tospur_customer_tracking';
const TOSPUR_CUSTOMER_TABLE = 'tospur_customer'; const TOSPUR_CUSTOMER_TABLE = 'tospur_customer';
const TOSPUR_CONTRACT = 'tospur_contract'; const TOSPUR_CONTRACT = 'tospur_contract';
const TOSPUR_COMMISSION = 'tospur_commission';
const TOSPUR_COMMISSION_LOG = 'tospur_commission_log';
//sync url //sync url
......
<?php
class CommissionDao{
public static function insert_touspur_commission($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_COMMISSION,$params);
if($wpdb->insert_id){
return $wpdb->insert_id;
}else{
return $wpdb->last_error;
}
}
public static function insert_commission_log($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_COMMISSION_LOG,$params);
if($wpdb->insert_id){
return $wpdb->insert_id;
}else{
return $wpdb->last_error;
}
}
public static function search_commission_consultant($contractId){
global $wpdb;
$sql = "select consultantId,imageUrl,name from ".Config::TOSPUR_COMMISSION." tcom
left join (select id,imageUrl,name from ".Config::TOSPUR_CONSULTANT.") tct
on tcom.consultantId = tct.id where tcom.contractId = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$contractId));
return $result;
}
public static function search_commission_log($commissionId){
global $wpdb;
$sql = "select id,time,paid from ".Config::TOSPUR_COMMISSION_LOG."
where commissionId = %d";
$result = $wpdb->get_results($wpdb->prepare($sql,$commissionId));
return $result;
}
public static function search_tospur_commission($contractId){
global $wpdb;
$sql = "select id,intent,accounts,type from ".Config::TOSPUR_COMMISSION."
where contractId = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$contractId));
return $result;
}
}
...@@ -42,7 +42,8 @@ class CustomerTrackingDao ...@@ -42,7 +42,8 @@ class CustomerTrackingDao
' left join (SELECT * FROM ' . Config::TOSPUR_STATUS_TABLE . ' where status_type = 3) as ts on tct.status_type = ts.status_id' . ' 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' . ' left join ' . Config::TOSPUR_CONSULTANT . ' tc on tct.consultant_id = tc.id' .
' where tct.house_id = ' . $house_id . ' and tct.origin = ' . $origin; ' where tct.house_id = ' . $house_id . ' and tct.origin = ' . $origin;
return $wpdb->get_results($sql); $result = $wpdb->get_results($sql);
return $result;
} }
public static function search_status() public static function search_status()
......
...@@ -204,10 +204,10 @@ class InsertDao{ ...@@ -204,10 +204,10 @@ class InsertDao{
} }
} }
} }
public static function addHouseFeature($houseId,$data){ public static function addHouseFeature($houseId,$houseFeature){
global $wpdb; global $wpdb;
if($data["houseFeature"]){ if($houseFeature){
foreach($data["houseFeature"] as $val){ foreach($houseFeature as $val){
$a_house_feature = array( $a_house_feature = array(
"house_id" => $houseId, "house_id" => $houseId,
"tag_id" =>$val "tag_id" =>$val
...@@ -222,53 +222,23 @@ class InsertDao{ ...@@ -222,53 +222,23 @@ class InsertDao{
} }
public static function addHouseTag($tags, $house_id) public static function addHouseTag($house_id, $houseTag)
{ {
global $wpdb; global $wpdb;
$arr = array(',' => ',');
$in = explode(',', strtr($tags, $arr));
//string
$tags_string = InsertDao::arrayToString($in);
//房源的标签id数组
$tags_ids = array();
//查询存在的标签
$sql = "select * from ".Config::TOSPUR_TAG_TABLE." where name in " . $tags_string." and type=0";
$has_tags_result = $wpdb->get_results($sql);
//排除存在的标签,剩下未有的标签和存在标签id数组
foreach ($has_tags_result as $key => $value) {
if (($key = array_search($value->name, $in)) !== false) {
unset($in[$key]);
}
$tags_ids[] = $value->id;
}
//添加未有的标签
foreach ($in as $value) {
$insert = $wpdb->insert(
'tospur_tag',
array(
'name' => $value
)
);
if($insert){
$tags_ids[] = $wpdb->insert_id;
}
}
//删除该房源的标签关联后,添加新的标签关联
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare("DELETE FROM " . Config::A_HOUSE_TAG_TABLE .
"DELETE FROM a_house_tag " WHERE tag_id in(select tag_id from (select tag_id,tt.type from " . Config::A_HOUSE_TAG_TABLE . " as aht" .
WHERE tag_id in(select tag_id from (select tag_id,tt.type from a_house_tag as aht " left JOIN " . Config::TOSPUR_TAG_TABLE . " tt on aht.tag_id = tt.id) as a" .
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a " where house_id = %d and a.type = 0);", $house_id)
where house_id = %d and a.type = 0);", $house_id)
); );
foreach ($tags_ids as $value) { if ($houseTag) {
$wpdb->insert( foreach ($houseTag as $val) {
'a_house_tag', $a_house_tag = array(
array( "house_id" => $house_id,
'house_id' => $house_id, "tag_id" => $val
'tag_id' => $value
)
); );
$wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
}
} }
} }
......
...@@ -344,6 +344,18 @@ class SearchDao ...@@ -344,6 +344,18 @@ class SearchDao
return $wpdb->get_results($sql); 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){ public static function getDetailInfo($hid,$type = NULL){
global $wpdb; global $wpdb;
$sql = "select *,dr.literal as room,db.literal as buildproperty from ".Config::TOSPUR_HOUSE_TABLE." th $sql = "select *,dr.literal as room,db.literal as buildproperty from ".Config::TOSPUR_HOUSE_TABLE." th
...@@ -440,26 +452,13 @@ class SearchDao ...@@ -440,26 +452,13 @@ class SearchDao
} }
public static function searchFeatureOld($hid){ public static function searchFeatureOld($hid, $type){
global $wpdb; global $wpdb;
$params[] = $hid;
$params[] = $type;
$featureSql ="select tag_id,name from a_house_tag aht $featureSql ="select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1"; LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and tt.type = %d";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$hid)); $feature = $wpdb->get_results($wpdb->prepare($featureSql,$params));
return $feature; return $feature;
} }
public static function searchStatus($hid,$statusType){
global $wpdb;
$statusSql = "select status_id as id from tospur_house th
left join(select status_type,status_id,status_name from ".Config::TOSPUR_STATUS_TABLE.") ts on th.status = ts.status_id where th.id=".$hid." and status_type=".$statusType;
$status = $wpdb->get_row($statusSql);
return $status;
}
public static function searchRent($hid){
global $wpdb;
$rentSql = "select rent as value from ".Config::TOSPUR_HOUSE_TABLE." where id = %d";
$results = $wpdb->get_row($wpdb->prepare($rentSql,$hid));
return $results;
}
} }
\ No newline at end of file
...@@ -137,6 +137,9 @@ function tospur_ajax_set() ...@@ -137,6 +137,9 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_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_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
add_action('wp_ajax_nopriv_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone'); add_action('wp_ajax_nopriv_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
//标签和特色
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'); add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
//后台处理 置业顾问 //后台处理 置业顾问
...@@ -180,7 +183,6 @@ function reset_menu() ...@@ -180,7 +183,6 @@ function reset_menu()
add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view'); add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view');
add_menu_page('二手房列表','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7); add_menu_page('二手房列表','二手房列表', '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', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html');
add_menu_page('租房列表','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8); add_menu_page('租房列表','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html'); add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9); add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
...@@ -190,6 +192,8 @@ function reset_menu() ...@@ -190,6 +192,8 @@ function reset_menu()
add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html'); add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html');
add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12); add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13); add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13);
add_menu_page('添加标签', '添加标签', 'edit_published_posts', 'add_tag', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page('添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page("同步数据", "同步数据", "manage_options", "sync", "TCSyncView::display", 'dashicons-menu'); add_menu_page("同步数据", "同步数据", "manage_options", "sync", "TCSyncView::display", 'dashicons-menu');
//移除更新信息 //移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 ); remove_action( 'admin_notices', 'update_nag', 3 );
......
...@@ -25,7 +25,7 @@ foreach ($context['select']['district'] as $item) { ...@@ -25,7 +25,7 @@ foreach ($context['select']['district'] as $item) {
$context['select']['plate'] = json_encode($plateArray); $context['select']['plate'] = json_encode($plateArray);
$context['select']['buildProperty'] = SearchDao::searchBuildProperty(); $context['select']['buildProperty'] = SearchDao::searchBuildProperty();
$context['select']['room'] = json_encode(SearchDao::searchRoom()); $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); $context['select']['unitPriceRange'] = SearchDao::searchUnitPriceRange($cityId);
if ($houseType == 2) { if ($houseType == 2) {
$context['select']['rentalPrice'] = SearchDao::searchRentalPrice($cityId); $context['select']['rentalPrice'] = SearchDao::searchRentalPrice($cityId);
......
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