Commit f65f4c8f by shz

plugins tospur

parent ba8dedff
...@@ -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(){
...@@ -11,11 +12,55 @@ class Contract { ...@@ -11,11 +12,55 @@ class Contract {
$context['siteUrl'] = get_site_url(); $context['siteUrl'] = get_site_url();
$context['adminUrl'] = admin_url(); $context['adminUrl'] = admin_url();
$context['city'] = SearchDao::searchCity(); $context['city'] = SearchDao::searchCity();
$context['managers'] = get_users( 'role=editor' ); $context['managers'] = get_users( 'role=jl' );
$context['status'] = SearchDao::searchStatusType(4); $context['status'] = SearchDao::searchStatusType(4);
$context['buildProperty'] = SearchDao::searchBuildProperty(); $context['buildProperty'] = SearchDao::searchBuildProperty();
$context['room'] = SearchDao::searchRoom(); $context['room'] = SearchDao::searchRoom();
if($type==1){
$wpdb->query("START TRANSACTION");
$prefix = "新增";
if(isset($_REQUEST["id"])) {
$prefix = "修改";
}
$result = Contract::doSqlAction();
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
$context["error"] = $result;
echo $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($id);
$context["commission"] = CommissionDao::search_tospur_commission($id);
$commissionIds = array();
foreach($context["commission"] as $item){
$commissionIds[] = $item->id;
}
$context["commissionLog"] = CommissionDao::search_commission_log(implode(",",$commissionIds));
}
Timber::render("contract.html",$context);
}
private static function formatCommissionParams($params,$contractId,$type){
$commissionParams = array(
"accounts" => $params["accounts"],
"type" => $_REQUEST["businessType"],
"contractId" => $contractId,
"consultantId" => $params["consultantId"],
"ioType" => $type,
"mtime" => $params["mtime"]
);
return $commissionParams;
}
private static function doSqlAction(){
$params = array( $params = array(
'signedDate' =>$_REQUEST['signedDate'], 'signedDate' =>$_REQUEST['signedDate'],
'status' =>$_REQUEST['status'], 'status' =>$_REQUEST['status'],
...@@ -37,22 +82,29 @@ class Contract { ...@@ -37,22 +82,29 @@ class Contract {
'cMoney' =>$_REQUEST['cMoney'], 'cMoney' =>$_REQUEST['cMoney'],
'cPayBack' =>$_REQUEST['cPayBack'] 'cPayBack' =>$_REQUEST['cPayBack']
); );
$commissionType = array();
$wpdb->query("START TRANSACTION");
if($type==1){
$prefix = "新增";
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;
}else if($params['status'] == 3){ }else if($params['status'] == 3){//成交
$status = 2; $status = 2;
$result = CustomerDao::updateCustomerStatue($_REQUEST['customerNumber'],1);
if(!is_numeric($result)){
return $result;
}
} }
$result = HouseDao::updateStatus($status,$_REQUEST['id']); $result = HouseDao::updateStatus($status,$_REQUEST['id']);
if(!is_numeric($result)){
return $result;
} }
$commissionType['buy'] = $_REQUEST['commissionId_buy'];
$commissionType['sell'] = $_REQUEST['commissionId_sell'];
}else{ }else{
$params['business'] = $_REQUEST['businessId']; $params['business'] = $_REQUEST['businessId'];
$params['houseNumber'] = $_REQUEST['houseNumber']; $params['houseNumber'] = $_REQUEST['houseNumber'];
...@@ -66,31 +118,56 @@ class Contract { ...@@ -66,31 +118,56 @@ 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); $contractNumber = $pre.str_pad($result,6,'0',STR_PAD_LEFT);
$result = ContractDao::setContractId($result,$contractId); $contractId = $result;
$result = ContractDao::setContractId($result,$contractNumber);
if(!is_numeric($result)){
return $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;
} }
} }
$buyCommissionParams = Contract::formatCommissionParams($_REQUEST['buy'],$contractId,0);
$result = CommissionDao::insert_touspur_commission($buyCommissionParams);
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; $commissionType['buy'] = $result;
}else if(isset($_GET['edit'])){
$id = $_REQUEST["id"]; $sellCommissionParams = Contract::formatCommissionParams($_REQUEST['sell'],$contractId,1);
$context['houseId'] = $id; $result = CommissionDao::insert_touspur_commission($sellCommissionParams);
$context['result'] = ContractDao::searchContract($id); if(!is_numeric($result)){
return $result;
} }
Timber::render("contract.html",$context); $commissionType['sell'] = $result;
}
if(isset( $_POST["log"])) {
foreach ($_POST["log"] as $key => $value) {
$commissionId = $commissionType[$key];
foreach($value as $item){
$logParams = array(
"commissionId" => $commissionId,
"time" => $item["time"],
"paid" => $item["paid"]
);
$result = CommissionDao::insert_commission_log($logParams);
if(!is_numeric($result)){
return $result;
}
}
};
}
return $result;
} }
} }
\ No newline at end of file
...@@ -93,9 +93,9 @@ class Contract_List extends WP_List_Table{ ...@@ -93,9 +93,9 @@ class Contract_List extends WP_List_Table{
left join tospur_status ts on ts.status_type = 4 and t.status = ts.status_id left join tospur_status ts on ts.status_type = 4 and t.status = ts.status_id
where 1=1 "; where 1=1 ";
//置业顾问显示自己的合同 //置业顾问显示自己的合同
if(current_user_can("author")){ if(current_user_can("zygw")){
$sql .= " and t.consultantId = ".get_current_user_id(); $sql .= " and t.consultantId = ".get_current_user_id();
}elseif(current_user_can("editor")){//经理显示提交给自己的合同,和自己的合同 }else if(current_user_can("htApproval")){//经理显示提交给自己的合同,和自己的合同
$sql .= " and (t.consultantId = ".get_current_user_id()." or t.managerId = ".get_current_user_id().")"; $sql .= " and (t.consultantId = ".get_current_user_id()." or t.managerId = ".get_current_user_id().")";
} }
$sql .= " order by t.signedDate desc"; $sql .= " order by t.signedDate desc";
......
...@@ -35,13 +35,40 @@ class House extends Tospur_House{ ...@@ -35,13 +35,40 @@ class House extends Tospur_House{
'room_id' => $_POST['baseRoom'], 'room_id' => $_POST['baseRoom'],
"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"]
); );
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){ if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0; //首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($_POST["userType"] == 0){
//经理
//通过
if($_POST["status"] != -2){
$insert_tospur_house_array["status"] =$_POST["status"];
$insert_tospur_house_array["approval"] = -2;
}else{
//退回
$insert_tospur_house_array["approval"] = $_POST["status"];
}
}else{
//置业顾问
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]);
//修改了状态
if($currentStatus["result"]->status != $_POST["status"]){
$insert_tospur_house_array["approval"] = $_POST["status"];
}else {
//没有修改状态
//没有申请审批
if($currentStatus["result"]->approval == -2){
$insert_tospur_house_array["approval"] = $currentStatus["result"]->status;
}else{
//申请了审批,没有修改状态,approval保持原来的
$insert_tospur_house_array["approval"] = $currentStatus["result"]->approval;
}
}
}
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array); $result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 203){ if(!is_numeric($result)){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result); print_r($result);
echo "新房房源修改失败"; echo "新房房源修改失败";
...@@ -50,11 +77,12 @@ class House extends Tospur_House{ ...@@ -50,11 +77,12 @@ class House extends Tospur_House{
echo "新房房源修改成功"; echo "新房房源修改成功";
} }
}else{ }else{
$insert_tospur_house_array['status'] = $_POST['status']; $insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1;
$result = House::data_insert($insert_tospur_house_array); $result = House::data_insert($insert_tospur_house_array);
if($result != 200){ if(!is_numeric($result)){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result);; print_r($result);
echo "新增房源失败"; echo "新增房源失败";
}else{ }else{
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
...@@ -68,9 +96,9 @@ class House extends Tospur_House{ ...@@ -68,9 +96,9 @@ class House 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'],1); $context["status"] = searchDao::searchStatusType(1);
} }
$context['role'] = House::getCurrentRole(); $context['canApproval'] = House::canApproval();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
...@@ -82,8 +110,7 @@ class House extends Tospur_House{ ...@@ -82,8 +110,7 @@ class House extends Tospur_House{
public static function data_update($houseId,$insert_tospur_house_array){ public static function data_update($houseId,$insert_tospur_house_array){
global $wpdb; global $wpdb;
$data = $_POST["data"]; $data = $_POST["data"];
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId)); $result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId));
$result = 203;
$exist_ids = array(); $exist_ids = array();
if(isset($_POST['exists'])){ if(isset($_POST['exists'])){
foreach($_POST['exists'] as $id => $item){ foreach($_POST['exists'] as $id => $item){
...@@ -122,19 +149,19 @@ class House extends Tospur_House{ ...@@ -122,19 +149,19 @@ class House extends Tospur_House{
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});"); $wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId)); $wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
$res = InsertDao::addRecommend($houseId,$data); $result = InsertDao::addRecommend($houseId,$data);
if($res == 504){ if(!is_numeric($result)){
$result = $res; return $result;
echo "推荐房源修改失败";
} }
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId)); $wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
$res = InsertDao::addRecConsultant($houseId, $data['recConsultant']); $result = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
if($res == 505){ if(!is_numeric($result)){
$result = $res; return $result;
echo "推荐置业顾问修改失败";
} }
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $result; return $result;
} }
...@@ -149,19 +176,31 @@ class House extends Tospur_House{ ...@@ -149,19 +176,31 @@ class House extends Tospur_House{
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT); $res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT);
if (!$res) { if (!$res) {
$houseId = InsertDao::insert_tospur_house($params); $houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
$mainImageRes = InsertDao::addMainImage($houseId,$data);
InsertDao::addMainImage($houseId,$data); $recommendRes = InsertDao::addRecommend($houseId,$data);
InsertDao::addRecommend($houseId,$data); $recConsultantRes = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addRecConsultant($houseId, $data['recConsultant']); InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseTag($_POST['mark'],$houseId); $customerTrackRes = CustomerTrackingDao::insert($houseId, $_REQUEST);
if(!is_numeric($mainImageRes)){
return $mainImageRes;
}else if(!is_numeric($recommendRes)){
return $recommendRes;
}else if(!is_numeric($recConsultantRes)){
return $recConsultantRes;
}else if(is_numeric($customerTrackRes)){
return $customerTrackRes;
}
}
return $houseId;
}else{ }else{
return 506; return "房源已存在";
} }
return 200;
} }
} }
\ No newline at end of file
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class QuotaMonthList extends WP_List_Table{
function column_default($item, $column_name)
{
switch($column_name){
case "quota":
return "<input type='text' name='".$item["id"]."' value='".$item["quota"]."'><button type='button' class='button action'>修改</button>";
break;
default:
return $item[$column_name];
}
}
function get_columns()
{
$columns['year'] = '年份';
$columns['month'] = '月份';
$columns['name'] = '姓名';
$columns['quota'] = '目标业绩';
return $columns;
}
function get_views(){
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(*) as totle,COUNT(NULLIF(quota is not null, false)) as isset,COUNT(NULLIF(quota is null, false)) as unset from ".Config::TOSPUR_CONSULTANT." tc
left join ".Config::TOSPUR_QUOTA_TABLE." tq on tq.consultantId = tc.id and tq.year = %d and tq.month = %d
where subsidiaryId = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$_REQUEST["year"],$_REQUEST["month"],$_REQUEST["oid"]));
return array(
"all" => '<a href="'.$current_url.'"'.(isset($_REQUEST["type"])?"":'class="current"').'>全部<span class="count">('.$result->totle.')</span></a>',
"isset" => '<a href="'.$current_url.'&type=2" '.($_REQUEST["type"]==2?'class="current"':"").'>已设置业绩<span class="count">('.$result->isset.')</span></a>',
"unset" => '<a href="'.$current_url.'&type=1" '.($_REQUEST["type"]==1?'class="current"':"").'>未设置业绩<span class="count">('.$result->unset.')</span></a>'
);
}
function prepare_items()
{
global $wpdb;
$per_page = 20;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$data = array();
if(isset($_REQUEST["year"]) && isset($_REQUEST["month"]) && isset($_REQUEST["oid"])){
$sql = "select tc.id,name,IFNULL(quota,0) as quota from ".Config::TOSPUR_CONSULTANT." tc
left join ".Config::TOSPUR_QUOTA_TABLE." tq on tq.consultantId = tc.id and tq.year = %d and tq.month = %d
where subsidiaryId = %d";
if(isset($_REQUEST['type'])){
$type = $_REQUEST['type'];
$sql .= " and quota is";
if($type == 2){
$sql .= " not";
}
$sql .=" null";
}
$result = $wpdb->get_results($wpdb->prepare($sql,$_REQUEST["year"],$_REQUEST["month"],$_REQUEST["oid"]));
foreach($result as $key => $value){
$data[$key] = array(
'id' => $value->id,
'year' => $_REQUEST["year"],
'month' => $_REQUEST["month"],
'name' => $value->name,
'quota' => $value->quota
);
}
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
public static function replaceQuota(){
$result = QuotaDao::replace($_REQUEST["year"],$_REQUEST["month"],$_REQUEST["id"],$_REQUEST["price"]);
$res = array(
"code"=>200,
"msg"=>$result
);
if(!is_numeric($result)){
$res["code"] = 500;
}
wp_send_json($res);
}
}
\ No newline at end of file
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class QuotaYearList extends WP_List_Table
{
function __construct()
{
}
function column_default($item, $column_name)
{
return '<a href="' . admin_url('admin.php?page=quotaList&edit=true&year='. $item['year'] .'&month=' . $item['month'] . '&oid='. $item['oid']) .'&name='. $item['name'] .'">' . $item[$column_name] . '</a>';
}
function get_columns()
{
$columns['year'] = '年份';
$columns['month'] = '月份';
$columns['name'] = '分店名';
$columns['totle'] = '分店总目标';
return $columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 12;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$data = array();
if(isset($_REQUEST["year"]) && isset($_REQUEST["organization"])){
$sql = "select *, month,sum(quota) as quota from ".Config::TOSPUR_QUOTA_TABLE." where consultantId in(select id from ".Config::TOSPUR_CONSULTANT."
where subsidiaryId = %d) and year = %d group by year,month;";
$result = $wpdb->get_results($wpdb->prepare($sql,$_REQUEST["organization"],$_REQUEST["year"]));
$name = $wpdb->get_var($wpdb->prepare("select Name from tospur_organization where id = %d;",$_REQUEST["organization"]));
$j = 0;
for($i = 1;$i<=12;$i++){
$item = $result[$j];
$totle = 0;
if($item->month==$i){
$totle = $item->quota;
$j++;
}
$data[$i] = array(
'oid' => $_REQUEST["organization"],
'year' => $_REQUEST["year"],
'month' => $i,
'name' => $name,
'totle' => $totle."元"
);
}
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => 1 //WE have to calculate the total number of pages
));
}
function showHtml(){
$context = array();
$context['req'] = $_REQUEST;
if(isset($_REQUEST['edit'])){
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged'), $current_url );
$context['current_url'] = $current_url;
Timber::render("quotaMonthList.html",$context);
}else{
Timber::render("quotaYearList.html",$context);
}
}
function displayMonthTable(){
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$quotaMonthList = new QuotaMonthList();
$quotaMonthList->prepare_items();
$quotaMonthList->views();
$quotaMonthList->display();
}
function displayYearTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$quotaYearList = new QuotaYearList();
$quotaYearList->prepare_items();
$quotaYearList->display();
}
}
\ No newline at end of file
<?php <?php
class Tospur_House{ class Tospur_House{
public static function canApproval(){
return current_user_can("houseApproval");
}
public static function getCurrentRole(){ public static function getCurrentRole(){
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) ) if ( !($current_user instanceof WP_User) )
......
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class commissionList extends WP_List_Table
{
function __construct()
{
}
public function print_column_headers()
{
echo '<th rowspan="2">部门</th>';
echo '<th rowspan="2">员工</th>';
echo '<th colspan="2">目标业绩</th>';
echo '<th colspan="3">应收业绩</th>';
echo '<th colspan="3">实收业绩</th>';
echo '<th colspan="3">前期未收</th>';
echo '<th rowspan="2">到职日期</th>';
echo '</tr>';
echo '<tr>';
echo '<th>金额(万)</th>';
echo '<th>达成率%</th>';
echo '<th>买卖</th>';
echo '<th>租赁</th>';
echo '<th>合计</th>';
echo '<th>买卖</th>';
echo '<th>租赁</th>';
echo '<th>合计</th>';
echo '<th>买卖</th>';
echo '<th>租赁</th>';
echo '<th>合计</th>';
}
function column_default($item, $column_name)
{
switch ($column_name) {
default:
return $item[$column_name];
}
}
function get_columns()
{
$columns['organization_name'] = '部门';
$columns['consultant_name'] = '员工';
$columns['target_amount'] = '金额(万)';
$columns['achieving_rate'] = '达成率%';
$columns['business'] = '应收业绩买卖';
$columns['lease'] = '应收业绩租赁';
$columns['accounts'] = '应收业绩合计';
$columns['businessPaid'] = '实收业绩买卖';
$columns['leasePaid'] = '实收业绩租赁';
$columns['paid'] = '实收业绩合计';
$columns['unBusinessPaid'] = '前期未收买卖';
$columns['unLeasePaid'] = '实收业绩租赁';
$columns['unPaid'] = '前期未收租赁';
$columns['entry_time'] = '到职日期';
return $columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$year = date('Y');
$month = null;
if (isset($_REQUEST['year']) && $_REQUEST['year'] != -1) {
$year = $_REQUEST['year'];
if (isset($_REQUEST['month']) && $_REQUEST['month'] != -1) {
$month = $_REQUEST['month'];
}
}
$commission_time_sql = " where time >= '" . $year . "-1-1' and time < DATE_SUB('" . $year . "-1-1', INTERVAL -1 YEAR)";
$quota_time_sql = " where year = " . $year;
if ($month != null) {
$quota_time_sql .= " and month = " . $month;
$commission_time_sql = " where time >= '" . $year . "-" . $month . "-1' and time < DATE_SUB('" . $year . "-" . $month . "-1', INTERVAL -1 MONTH)";
}
$sql = "select *,(accounts-paid) as unPaid," .
"(business-businessPaid) as unBusinessPaid," .
"(lease-leasePaid) as unLeasePaid" .
" from (select consultantId,sum(accounts) as accounts,sum(case when t1.type = 0 then accounts else 0 end) business," .
"sum(case when t1.type = 1 then accounts else 0 end) lease from (select consultantId,accounts,tcn.type from tospur_commission tcn" .
" left join tospur_commission_log tcl on tcl.commissionId = tcn.id" .
$commission_time_sql . " group by consultantId ) t1 group by consultantId) should" .
" left join (select consultantId,sum(paid) as paid,sum(case when tcn.type = 0 then paid else 0 end) businessPaid," .
"sum(case when tcn.type = 1 then paid else 0 end) leasePaid from tospur_commission tcn" .
" left join tospur_commission_log tcl on tcl.commissionId = tcn.id" .
$commission_time_sql .
" group by consultantId) actual on actual.consultantId = should.consultantId" .
" left join (select id as consultantId,name as consultant_name,time as entry_time,subsidiaryId from tospur_consultant) tc" .
" on tc.consultantId = should.consultantId" .
" left join (select id as organization_id,name as organization_name from tospur_organization) torg on torg.organization_id = tc.subsidiaryId";
$sql .= " left join (select consultantId,sum(quota) as target_amount from tospur_quota" .
$quota_time_sql .
" group by consultantId) tq on tq.consultantId = should.consultantId where 1 = 1";
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and torg.organization_id = " . $_REQUEST['organization'];
}
if (isset($_REQUEST['search_consultant_name']) && $_REQUEST['search_consultant_name'] != null) {
$sql = $sql . " and tc.consultant_name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$target_amount = 0;
$achieving_rate = 0;
if ($value->target_amount) {
$target_amount = $value->target_amount;
$achieving_rate = round((($value->paid) / $target_amount) * 100, 2);
}
$data[$key] = array(
'organization_name' => $value->organization_name,
'consultant_name' => $value->consultant_name,
'target_amount' => round($target_amount / 10000, 2),
'achieving_rate' => $achieving_rate . '%',
'business' => round($value->business / 10000, 2),
'lease' => round($value->lease / 10000, 2),
'accounts' => round($value->accounts / 10000, 2),
'businessPaid' => round($value->businessPaid / 10000, 2),
'leasePaid' => round($value->leasePaid / 10000, 2),
'paid' => round($value->paid / 10000, 2),
'unBusinessPaid' => round($value->unBusinessPaid / 10000, 2),
'unLeasePaid' => round($value->unLeasePaid / 10000, 2),
'unPaid' => round($value->unPaid / 10000, 2),
'entry_time' => $value->entry_time
);
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$total_pages = ceil($total_items / $per_page);
if ($_REQUEST['paged'] > $total_pages) {
$current_page = $total_pages;
}
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function function_commissionList()
{
$context = array();
$context['req'] = $_REQUEST;
$context['year'] = date('Y');
Timber::render("commissionList.html", $context);
}
function addCommissionTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', $_SERVER['REQUEST_URI']);
$commissionList = new commissionList();
$commissionList->prepare_items();
$commissionList->display();
}
?>
<?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
...@@ -173,13 +173,6 @@ class consultantScoreList extends WP_List_Table ...@@ -173,13 +173,6 @@ class consultantScoreList extends WP_List_Table
} }
} }
function add_consultant_score_menu()
{
add_menu_page('置业顾问评分', '置业顾问评分', 'moderate_comments', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26);
}
add_action('admin_menu', 'add_consultant_score_menu');
function consultant_score_page() function consultant_score_page()
{ {
$consultantScoreList = new consultantScoreList(); $consultantScoreList = new consultantScoreList();
......
...@@ -94,7 +94,7 @@ class customerList extends WP_List_Table ...@@ -94,7 +94,7 @@ class customerList extends WP_List_Table
" left join tospur_consultant tc on tcs.consultant_id = tc.id" . " left join tospur_consultant tc on tcs.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" . " left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1"; " where 1 = 1";
if (current_user_can('author')) { if (current_user_can('zygw')) {
$sql = $sql . " and tcs.consultant_id = " . get_current_user_id(); $sql = $sql . " and tcs.consultant_id = " . get_current_user_id();
} }
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) { if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
......
...@@ -42,7 +42,7 @@ class customerTrackingList extends WP_List_Table ...@@ -42,7 +42,7 @@ class customerTrackingList extends WP_List_Table
" left join tospur_consultant tc on tct.consultant_id = tc.id" . " left join tospur_consultant tc on tct.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" . " left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1"; " where 1 = 1";
if (current_user_can('author')) { if (current_user_can('zygw')) {
$sql = $sql . " and tc.id = " . get_current_user_id(); $sql = $sql . " and tc.id = " . get_current_user_id();
} }
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) { if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
......
...@@ -8,7 +8,37 @@ if (!class_exists('WP_List_Table')) { ...@@ -8,7 +8,37 @@ if (!class_exists('WP_List_Table')) {
class newHouseList extends WP_List_Table class newHouseList extends WP_List_Table
{ {
function __construct() function get_views(){
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(*) as allNum,
COUNT(NULLIF(approval != -2, false)) as needCheckNum,
COUNT(NULLIF(approval = 0, false)) as unCheckNum,
COUNT(NULLIF(approval = 1, false)) as checkNum,
COUNT(NULLIF(approval = -1, false)) as onSaleNum,
COUNT(NULLIF(approval = 2, false)) as notSaleNum
from ".Config::TOSPUR_HOUSE_TABLE." where house_type = 0";
$result = $wpdb->get_results($sql);
foreach($result as $value){
$approvalParam = array(
"allNum" =>$value->allNum,
"needCheckNum" => $value->needCheckNum,
"unCheckNum" => $value->unCheckNum,
"checkNum" => $value->checkNum,
"onSaleNum" => $value->onSaleNum,
"notSaleNum" => $value->notSaleNum
);
}
return array(
"allNum" => '<a href="'.$current_url.'&approval=" class="current">全部<span class="count">('.$approvalParam["allNum"].')</span></a>',
"needCheckNum" => '<a href="'.$current_url.'&approval=-2" class="current">需审批<span class="count">('.$approvalParam["needCheckNum"].')</span></a>',
"unCheckNum" => '<a href="'.$current_url.'&approval=0">未审核<span class="count">('.$approvalParam["unCheckNum"].')</span></a>',
"checkNum" => '<a href="'.$current_url.'&approval=1">审核<span class="count">('.$approvalParam["checkNum"].')</span></a>',
"onSaleNum" => '<a href="'.$current_url.'&approval=-1">交易中<span class="count">('.$approvalParam["onSaleNum"].')</span></a>',
"notSaleNum" => '<a href="'.$current_url.'&approval=-1">下架<span class="count">('.$approvalParam["notSaleNum"].')</span></a>'
);
} function __construct()
{ {
global $status, $page; global $status, $page;
//Set parent defaults //Set parent defaults
...@@ -57,11 +87,9 @@ class newHouseList extends WP_List_Table ...@@ -57,11 +87,9 @@ class newHouseList extends WP_List_Table
function get_columns() function get_columns()
{ {
if( current_user_can('moderate_comments') ) {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />' 'cb' => '<input type="checkbox" />'
); );
}
$columns['id']= 'ID'; $columns['id']= 'ID';
$columns['name']= '楼盘名'; $columns['name']= '楼盘名';
$columns['address']= '地址'; $columns['address']= '地址';
...@@ -108,45 +136,127 @@ class newHouseList extends WP_List_Table ...@@ -108,45 +136,127 @@ class newHouseList extends WP_List_Table
function get_bulk_actions() function get_bulk_actions()
{ {
if( current_user_can('houseApproval') ) {
$actions = array(
"agree" =>"通过",
"goBack" =>"退回"
);
}else{
$actions = array( $actions = array(
'noCheck' => '未审核', 'unCheck'=>'未审核',
'check' => '审核', 'check' =>'审核',
'stopSale' =>'下架' 'onSale'=>'交易中',
'notSale' =>'下架'
); );
}
return $actions; return $actions;
} }
function process_bulk_action() function manage_bulk_action(){
global $wpdb;
$flag = 0;
$action = $this->current_action();
if($action){
$string = null;
$approval = null;
switch ($action) {
case"agree":
$id = $_REQUEST['newhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$approvalRes = $wpdb ->get_results('select approval from tospur_house where id in '.$string);
foreach($approvalRes as $value){
if($value->approval == -2){
print_r("您审批的房源中含有未申请审批的房源,请重新选择");
exit;
}
}
$result = $wpdb->query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$flag = 1;
}
break;
case"goBack":
$id = $_REQUEST['newhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$flag = 1;
}
break;
}
if($flag == 1){
$wpdb->query('update tospur_house th SET th.approval= -2 where id in ' . $string);
}
}
}
function getCurrentStatus($houseId,$changeStatus = null){
global $wpdb;
$sql = "select status from tospur_house where id in".$houseId;
$res = $wpdb->get_results($sql);
if($changeStatus != null|| $changeStatus == 0 ){
foreach($res as $value){
if($value->status == $changeStatus){
print_r("您申请的状态含有与原状态相同的房源,请重新选择");
return false;
}
else{
return $changeStatus;
}
}
}
return $res;
} function process_bulk_action()
{ {
$action = $this->current_action(); $action = $this->current_action();
if ($action) { if ($action) {
$string = null; $string = null;
$status = null; $status = null;
$id = $_REQUEST['newhouselist'];
switch ($action) { switch ($action) {
case 'noCheck': case 'unCheck':
$id = $_POST['newhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 0; $res = $this->getCurrentStatus($string,0);
if($res === false){
exit;
}
$status = $res;
} }
break; break;
case 'check': case 'check':
$id = $_POST['newhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 1; $res = $this->getCurrentStatus($string,1);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'stopSale': case 'onSale':
$id = $_POST['newhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 2; $res = $this->getCurrentStatus($string,-1);
if(!$res){
exit;
}
$status = $res;
}
break;
case 'notSale':
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,2);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
} }
global $wpdb; global $wpdb;
$result = $wpdb->query('update tospur_house SET status='.$status .' where id in ' . $string); $result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string,$status));
} }
} }
...@@ -163,61 +273,96 @@ class newHouseList extends WP_List_Table ...@@ -163,61 +273,96 @@ class newHouseList extends WP_List_Table
$this->_column_headers = array($columns, $hidden, $sortable); $this->_column_headers = array($columns, $hidden, $sortable);
if( current_user_can('houseApproval') ) {
$this->manage_bulk_action();
}else{
$this->process_bulk_action(); $this->process_bulk_action();
}
//$data = $this->example_data; //$data = $this->example_data;
$sql = "select * from tospur_house th $sql = "select * from tospur_house th
left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id
left join (select value as did,literal as room_type from dic_room) dr on dr.did = th.room_id left join (select value as did,literal as room_type from dic_room) dr on dr.did = th.room_id
where 1=1 and house_type=0"; left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id and ahu.user_type=1
left join(select id as consul_id,name as consul_name,subsidiaryId from tospur_consultant) tc on ahu.aus_id = tc.consul_id
left join(select status_name,status_type,status_id from tospur_status)ts on th.status = ts.status_id and ts.status_type=1
left join(select status_name as approvalName,status_type,status_id from tospur_status)tss on th.approval = tss.status_id and tss.status_type=1
where 1=1 and house_type=0 ";
if($_POST["listCity"]!=0 ){ if( isset( $_REQUEST["listCity"]) && $_REQUEST["listCity"] != -1 ){
$params[] = $_POST["listCity"]; $params[] = $_REQUEST["listCity"];
$sql = $sql." and city_id=%d"; $sql = $sql." and city_id=%d";
} }
if($_POST["listDistrict"] != 0 ){ if( isset( $_REQUEST["listDistrict"]) && $_REQUEST["listDistrict"] != -1 ){
$params[] = $_POST["listDistrict"]; $params[] = $_REQUEST["listDistrict"];
$sql = $sql." and district_id=%d"; $sql = $sql." and district_id=%d";
} }
if($_POST["listPlate"] != 0){ if( isset( $_REQUEST["listPlate"]) && $_REQUEST["listPlate"] != -1){
$params[] = $_POST["listPlate"]; $params[] = $_REQUEST["listPlate"];
$sql = $sql." and plate_id=%d"; $sql = $sql." and plate_id=%d";
} }
if($_POST["buildProperty"]!=0){ if( isset( $_REQUEST["buildProperty"]) && $_REQUEST["buildProperty"]!=-1){
$params[] = $_POST["buildProperty"]; $params[] = $_REQUEST["buildProperty"];
$sql = $sql." and buildproperty_id=%d"; $sql = $sql." and buildproperty_id=%d";
} }
if($_POST["room"]!=0){ if( isset( $_REQUEST["room"]) && $_REQUEST["room"]!= -1){
$params[] = $_POST["room"]; $params[] = $_REQUEST["room"];
$sql = $sql." and room_id=%d"; $sql = $sql." and room_id=%d";
} }
if(isset($_POST["status"]) && $_POST["status"]!=-1){ if(isset($_REQUEST["status"]) && $_REQUEST["status"]!=-1){
$params[] = $_POST["status"]; $params[] = $_REQUEST["status"];
$sql = $sql." and status=%d"; $sql = $sql." and status=%d";
} }
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']); if( isset( $_REQUEST["organization"]) && $_REQUEST["organization"] != -1 ){
$params[] = $_REQUEST["organization"];
$sql = $sql." and subsidiaryId=%d ";
}
if($_REQUEST["totalPrice"]!=NULL){
$priceArray = explode("-", $_REQUEST['totalPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
$params[] = $priceArray[1]; $params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d"; $sql = $sql . " and average_price between %d and %d";
} }
if($_POST["acreage"]!= NULL){ if($_REQUEST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']); $areaArray = explode("-", $_REQUEST['acreage']);
$params[] = $areaArray[0]; $params[] = $areaArray[0];
$params[] = $areaArray[1]; $params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d"; $sql = $sql . " and covered_area between %d and %d";
} }
if($_POST["searchText"]!=NULL){ if($_REQUEST["searchText"]!=NULL){
$params[] = '%'.$_POST['searchText'].'%'; $params[] = '%'.$_REQUEST['searchText'].'%';
$sql = $sql . " and name like %s"; $sql = $sql . " and name like %s";
} }
if(isset($_REQUEST["approval"]) && $_REQUEST["approval"]!=""){
if($_REQUEST["approval"] == -2){
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval != %d";
}else{
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval = %d";
}
}
if($_REQUEST["beginDate"]!=NULL && $_REQUEST["endDate"]!= NULL){
$time = array($_REQUEST["beginDate"],$_REQUEST["endDate"]);
$params[] = $time[0];
$params[] = $time[1];
$sql = $sql." and creattime between %s and %s";
}
if($_REQUEST["stuff"]!= NULL){
$params[] = '%'.$_REQUEST['stuff'].'%';
$sql = $sql . " and consul_name like %s";
}
$sql = $sql . " group by id"; $sql = $sql . " group by id";
if(isset($_GET["orderby"])){ if(isset($_REQUEST["orderby"])){
$orderby = $_GET["orderby"]; $orderby = $_REQUEST["orderby"];
$order = $_GET["order"]; $order = $_REQUEST["order"];
$sql = $sql ." order by ".$orderby." ".$order; $sql = $sql ." order by ".$orderby." ".$order;
} }
...@@ -242,12 +387,10 @@ class newHouseList extends WP_List_Table ...@@ -242,12 +387,10 @@ class newHouseList extends WP_List_Table
'property_management' => $value->property_management, 'property_management' => $value->property_management,
'property_money' => $value->property_money 'property_money' => $value->property_money
); );
if($value->status == 0){ if($value->approval == -2){
$data[$key]['status'] ="未审核"; $data[$key]['status'] = $value->status_name;
}else if($value->status == 1){ }else{
$data[$key]['status'] ="审核"; $data[$key]['status'] = $value->status_name."(".$value->approvalName.")";
}else if($value->status == 2){
$data[$key]['status'] ="下架";
} }
} }
...@@ -279,19 +422,21 @@ function function_newHouseList() ...@@ -279,19 +422,21 @@ function function_newHouseList()
$contest['status'] = SearchDao::searchStatusType(1); $contest['status'] = SearchDao::searchStatusType(1);
$contest['buildProperty'] = SearchDao::searchBuildProperty(); $contest['buildProperty'] = SearchDao::searchBuildProperty();
$contest['room'] = searchDao::searchRoom(); $contest['room'] = searchDao::searchRoom();
if(isset($_POST['hasSearch'])){ if(isset($_REQUEST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_POST['listCity']); $contest['district'] = SearchDao::searchCity($_REQUEST['listCity']);
$contest['plate'] = SearchDao::searchCity($_POST['listCity'],$_POST['listDistrict']); $contest['plate'] = SearchDao::searchCity($_REQUEST['listCity'],$_REQUEST['listDistrict']);
$contest['dicTotalPrice'] = searchDao::searchTotalPrice($_POST['listCity']); $contest['dicTotalPrice'] = searchDao::searchTotalPrice($_REQUEST['listCity']);
$contest['dicArea'] = searchDao::searchArea($_POST['listCity']); $contest['dicArea'] = searchDao::searchArea($_REQUEST['listCity']);
$contest['cityId'] = $_POST['listCity']; $contest['cityId'] = $_REQUEST['listCity'];
$contest['districtId'] = $_POST['listDistrict']; $contest['districtId'] = $_REQUEST['listDistrict'];
$contest['plateId' ]= $_POST['listPlate']; $contest['plateId' ]= $_REQUEST['listPlate'];
$contest['roomId']= $_POST['room']; $contest['roomId']= $_REQUEST['room'];
$contest['buildPropertyId']= $_POST['buildProperty']; $contest['buildPropertyId']= $_REQUEST['buildProperty'];
$contest['totalPrice'] = $_POST['totalPrice']; $contest['averagePrice'] = $_REQUEST['averagePrice'];
$contest['acreage'] = $_POST['acreage']; $contest['acreage'] = $_REQUEST['acreage'];
$contest['statusId'] = $_POST['status']; $contest['statusId'] = $_REQUEST['status'];
$contest['req']['organization'] = $_REQUEST['organization'];
$contest['req'] = $_REQUEST;
} }
$contest["house_type"] = 0; $contest["house_type"] = 0;
Timber::render("houseList.html",$contest); Timber::render("houseList.html",$contest);
...@@ -300,6 +445,6 @@ function function_newHouseList() ...@@ -300,6 +445,6 @@ function function_newHouseList()
function addNewHouseTable(){ function addNewHouseTable(){
$newHouseList = new newHouseList(); $newHouseList = new newHouseList();
$newHouseList->prepare_items(); $newHouseList->prepare_items();
$newHouseList->display(); $newHouseList->views(); $newHouseList->display();
} }
?> ?>
...@@ -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,14 +49,43 @@ class RentHouse extends Tospur_House{ ...@@ -48,14 +49,43 @@ 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"],
"property_money"=>$_POST["property_money"],
"parking_spaces"=>$_POST["parking_spaces"]
); );
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; //首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($_POST["userType"] == 0){
//经理
//通过
if($_POST["status"] != -2){
$insert_tospur_house_array["status"] =$_POST["status"];
$insert_tospur_house_array["approval"] = -2;
}else{
//退回
$insert_tospur_house_array["approval"] = $_POST["status"];
}
}else{
//置业顾问
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]);
//修改了状态
if($currentStatus["result"]->status != $_POST["status"]){
$insert_tospur_house_array["approval"] = $_POST["status"];
}else {
//没有修改状态
//没有申请审批
if($currentStatus["result"]->approval == -2){
$insert_tospur_house_array["approval"] = $currentStatus["result"]->status;
}else{
//申请了审批,没有修改状态,approval保持原来的
$insert_tospur_house_array["approval"] = $currentStatus["result"]->approval;
}
}
}
$result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array); $result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 202){ if(!is_numeric($result)){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result);; print_r($result);;
echo "租房房源修改失败"; echo "租房房源修改失败";
...@@ -65,9 +95,10 @@ class RentHouse extends Tospur_House{ ...@@ -65,9 +95,10 @@ class RentHouse extends Tospur_House{
} }
}else { }else {
$insert_tospur_house_array['status'] = $_POST['status']; $insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1;
$result = RentHouse::rentHouseData_insert($insert_tospur_house_array); $result = RentHouse::rentHouseData_insert($insert_tospur_house_array);
if ($result != 200) { if (is_numeric($result)) {
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result); print_r($result);
echo "租房房源新增失败"; echo "租房房源新增失败";
...@@ -83,10 +114,9 @@ class RentHouse extends Tospur_House{ ...@@ -83,10 +114,9 @@ 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['canApproval'] = House::canApproval();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
...@@ -108,27 +138,42 @@ class RentHouse extends Tospur_House{ ...@@ -108,27 +138,42 @@ class RentHouse extends Tospur_House{
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT); $res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT);
if(!$res){ if(!$res){
$houseId = InsertDao::insert_tospur_house($params); $houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
$mainImageRes = InsertDao::addMainImage($houseId,$data);
InsertDao::addMainImage($houseId,$data); $recommendRes = InsertDao::addRecommend($houseId,$data);
InsertDao::addRecommend($houseId,$data); $recConsultantRes = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addRecConsultant($houseId, $data['recConsultant']); InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseTag($_POST['mark'],$houseId); $houseFeatureRes = InsertDao::addHouseFeature($houseId, $data['houseFeature']);
$customerTrackRes = CustomerTrackingDao::insert($houseId, $_REQUEST);
if(!is_numeric($mainImageRes)){
return $mainImageRes;
}else if(!is_numeric($recommendRes)){
return $recommendRes;
}else if(!is_numeric($recConsultantRes)){
return $recConsultantRes;
}else if(is_numeric($customerTrackRes)){
return $customerTrackRes;
}else if(is_numeric($houseFeatureRes)){
return $houseFeatureRes;
}
}
return $houseId;
}else{ }else{
return 508; return "房源已存在";
} }
return 200;
} }
public static function data_update($houseId,$params){ public static function data_update($houseId,$params){
global $wpdb; global $wpdb;
$data = $_POST["data"]; $data = $_POST["data"];
$res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId)); $result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$result = 202;
InsertDao::addMainImage($houseId,$data); InsertDao::addMainImage($houseId,$data);
$exists_photo_ids = array(); $exists_photo_ids = array();
if(isset($_POST['exists_photo'])){ if(isset($_POST['exists_photo'])){
...@@ -148,12 +193,18 @@ class RentHouse extends Tospur_House{ ...@@ -148,12 +193,18 @@ class RentHouse extends Tospur_House{
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});"); $wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId)); $wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
InsertDao::addRecommend($houseId,$data); $result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
}
$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['recConsultant']); $result = InsertDao::addRecConsultant($houseId,$data['recConsultant']);
if(!is_numeric($result)){
InsertDao::addHouseTag($_POST['mark'],$houseId); return $result;
}
InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
return $result; return $result;
} }
} }
......
...@@ -6,6 +6,46 @@ if (!class_exists('WP_List_Table')) { ...@@ -6,6 +6,46 @@ if (!class_exists('WP_List_Table')) {
class rentHouseList extends WP_List_Table class rentHouseList extends WP_List_Table
{ {
function get_views(){
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(*) as allNum,
COUNT(NULLIF(approval != -2, false)) as needCheckNum,
COUNT(NULLIF(approval = 0, false)) as unCheckNum,
COUNT(NULLIF(approval = 1, false)) as checkNum,
COUNT(NULLIF(approval = -1, false)) as onSaleNum,
COUNT(NULLIF(approval = 2, false)) as selfSaleNum,
COUNT(NULLIF(approval = 3, false)) as otherSaleNum,
COUNT(NULLIF(approval = 4, false)) as invalidNum,
COUNT(NULLIF(approval = 5, false)) as reactivationNum
from ".Config::TOSPUR_HOUSE_TABLE." where house_type = 2";
$result = $wpdb->get_results($sql);
foreach($result as $value){
$approvalParam = array(
"allNum" =>$value->allNum,
"needCheckNum" => $value->needCheckNum,
"unCheckNum" => $value->unCheckNum,
"checkNum" => $value->checkNum,
"onSaleNum" => $value->onSaleNum,
"selfSaleNum"=>$value->selfSaleNum,
"otherSaleNum"=>$value->otherSaleNum,
"invalidNum"=>$value->invalidNum,
"reactivationNum"=>$value->reactivationNum
);
}
return array(
"allNum" => '<a href="'.$current_url.'&approval" class="current">全部<span class="count">('.$approvalParam["allNum"].')</span></a>',
"needCheckNum" => '<a href="'.$current_url.'&approval=-2" class="current">需审批<span class="count">('.$approvalParam["needCheckNum"].')</span></a>',
"unCheckNum" => '<a href="'.$current_url.'&approval=0">未审核<span class="count">('.$approvalParam["unCheckNum"].')</span></a>',
"checkNum" => '<a href="'.$current_url.'&approval=1">审核<span class="count">('.$approvalParam["checkNum"].')</span></a>',
"onSaleNum" => '<a href="'.$current_url.'&approval=-1">交易中<span class="count">('.$approvalParam["onSaleNum"].')</span></a>',
"selfSaleNum" => '<a href="'.$current_url.'&approval=2">自售<span class="count">('.$approvalParam["selfSaleNum"].')</span></a>',
"otherSaleNum" => '<a href="'.$current_url.'&approval=3">他售<span class="count">('.$approvalParam["otherSaleNum"].')</span></a>',
"invalidNum" => '<a href="'.$current_url.'&approval=4">无效<span class="count">('.$approvalParam["invalidNum"].')</span></a>',
"reactivationNum" => '<a href="'.$current_url.'&approval=5">重激活<span class="count">('.$approvalParam["reactivationNum"].')</span></a>',
);
}
function __construct() function __construct()
{ {
global $status, $page; global $status, $page;
...@@ -41,20 +81,19 @@ class rentHouseList extends WP_List_Table ...@@ -41,20 +81,19 @@ class rentHouseList extends WP_List_Table
function column_cb($item) function column_cb($item)
{ {
return sprintf( return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" data-consultant="%3$s"/>', '<input type="checkbox" name="%1$s[]" value="%2$s" />',
$this->_args['singular'], /*$1%s*/
$item['id'], $this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
$item['consultant_id'] /*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
); );
} }
function get_columns() function get_columns()
{ {
if( current_user_can('moderate_comments') ) {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />' 'cb' => '<input type="checkbox" />'
); );
}
$columns['id']= 'ID'; $columns['id']= 'ID';
$columns['name']= '租房标题'; $columns['name']= '租房标题';
$columns['community_name']= '小区名称'; $columns['community_name']= '小区名称';
...@@ -93,20 +132,85 @@ class rentHouseList extends WP_List_Table ...@@ -93,20 +132,85 @@ class rentHouseList extends WP_List_Table
function get_bulk_actions() function get_bulk_actions()
{ {
if( current_user_can('houseApproval') ) {
$actions = array(
"agree" =>"通过",
"goBack" =>"退回"
);
}else{
$actions = array( $actions = array(
'noCheck' => '未审核', 'unCheck'=>'未审核',
'check' => '审核', 'check' =>'审核',
'onSale'=>'交易中',
'selfSale'=>'自售', 'selfSale'=>'自售',
'otherSale'=>'他售', 'otherSale'=>'他售',
'invalid'=>'无效', 'invalid'=>'无效',
'reactivation'=>'重激活' 'reactivation'=>'重激活'
); );
}
return $actions; return $actions;
} }
function manage_bulk_action(){
global $wpdb;
$flag = 0;
$action = $this->current_action();
if($action){
$string = null;
$approval = null;
switch ($action) {
case"agree":
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$approvalRes = $wpdb ->get_results('select approval from tospur_house where id in '.$string);
foreach($approvalRes as $value){
if($value->approval == -2){
print_r("您审批的房源中含有未申请审批的房源,请重新选择");
exit;
}
}
$result = $wpdb->query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$flag = 1;
}
break;
case"goBack":
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$flag = 1;
}
break;
}
if($flag == 1){
$wpdb->query('update tospur_house th SET th.approval= -2 where id in ' . $string);
}
}
}
function getCurrentStatus($houseId,$changeStatus = null){
global $wpdb;
$sql = "select status from tospur_house where id in".$houseId;
$res = $wpdb->get_results($sql);
if($changeStatus != null|| $changeStatus == 0 ){
foreach($res as $value){
if($value->status == $changeStatus){
print_r("您申请的状态含有与原状态相同的房源,请重新选择");
return false;
}
else{
return $changeStatus;
}
}
}
return $res;
}
function process_bulk_action() function process_bulk_action()
{ {
$action = $this->current_action(); $action = $this->current_action();
global $wpdb;
$id = $_REQUEST['renthouselist'];
if ($action) { if ($action) {
$string = null; $string = null;
$status = null; $status = null;
...@@ -114,52 +218,82 @@ class rentHouseList extends WP_List_Table ...@@ -114,52 +218,82 @@ class rentHouseList extends WP_List_Table
HouseDao::houseAllotConsultant($_POST['allot_consultant_id'], $_POST['sechandhouselist']); HouseDao::houseAllotConsultant($_POST['allot_consultant_id'], $_POST['sechandhouselist']);
}else{ }else{
switch ($action) { switch ($action) {
case 'noCheck': case 'unCheck':
$id = $_POST['renthouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 0; $res = $this->getCurrentStatus($string,0);
if($res === false){
exit;
}
$status = $res;
} }
break; break;
case 'check': case 'check':
$id = $_POST['renthouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 1; $res = $this->getCurrentStatus($string,1);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'selfSale': case 'selfSale':
$id = $_POST['renthouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,2);
if(!$res){
exit;
}
$status = 2; $status = 2;
} }
break; break;
case 'otherSale': case 'otherSale':
$id = $_POST['renthouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 3; $res = $this->getCurrentStatus($string,3);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'invalid': case 'invalid':
$id = $_POST['renthouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 4; $res = $this->getCurrentStatus($string,4);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'reactivation': case 'reactivation':
$id = $_POST['renthouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string);
foreach($res as $value){
if($value->status == 4){
$status = 5; $status = 5;
}else{
print_r("只有无效房源可重激活,请重新选择");
exit;
}
}
} }
break; break;
case 'onSale':
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,-1);
if(!$res){
exit;
} }
global $wpdb; $status = $res;
$result = $wpdb->query('update tospur_house SET status='.$status .' where id in ' . $string); }
break;
}
$result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string,$status));
} }
} }
} }
...@@ -177,32 +311,38 @@ class rentHouseList extends WP_List_Table ...@@ -177,32 +311,38 @@ class rentHouseList extends WP_List_Table
$this->_column_headers = array($columns, $hidden, $sortable); $this->_column_headers = array($columns, $hidden, $sortable);
if( current_user_can('houseApproval') ) {
$this->manage_bulk_action();
}else{
$this->process_bulk_action(); $this->process_bulk_action();
}
//$data = $this->example_data; //$data = $this->example_data;
$sql = "select * from tospur_house th $sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id and ahu.user_type=1 left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id and ahu.user_type=1
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 id as consul_id,name as consul_name,subsidiaryId 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 left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
left join(select status_name,status_type,status_id from tospur_status)ts on th.status = ts.status_id and ts.status_type=2
left join(select status_name as approvalName,status_type,status_id from tospur_status)tss on th.approval = tss.status_id and tss.status_type=2
where 1=1 and house_type=2 "; where 1=1 and house_type=2 ";
if($_REQUEST["listCity"]!=0 ){ if( isset( $_REQUEST["listCity"]) && $_REQUEST["listCity"] != -1 ){
$params[] = $_REQUEST["listCity"]; $params[] = $_REQUEST["listCity"];
$sql = $sql." and city_id=%d"; $sql = $sql." and city_id=%d";
} }
if($_REQUEST["listDistrict"] != 0 ){ if( isset( $_REQUEST["listDistrict"]) && $_REQUEST["listDistrict"] != -1 ){
$params[] = $_REQUEST["listDistrict"]; $params[] = $_REQUEST["listDistrict"];
$sql = $sql." and district_id=%d"; $sql = $sql." and district_id=%d";
} }
if($_REQUEST["listPlate"] != 0){ if( isset( $_REQUEST["listPlate"]) && $_REQUEST["listPlate"] != -1){
$params[] = $_REQUEST["listPlate"]; $params[] = $_REQUEST["listPlate"];
$sql = $sql." and plate_id=%d"; $sql = $sql." and plate_id=%d";
} }
if($_REQUEST["buildProperty"]!=0){ if( isset( $_REQUEST["buildProperty"]) && $_REQUEST["buildProperty"]!=-1){
$params[] = $_REQUEST["buildProperty"]; $params[] = $_REQUEST["buildProperty"];
$sql = $sql." and buildproperty_id=%d"; $sql = $sql." and buildproperty_id=%d";
} }
if($_REQUEST["room"]!=0){ if( isset( $_REQUEST["room"]) && $_REQUEST["room"]!= -1){
$params[] = $_REQUEST["room"]; $params[] = $_REQUEST["room"];
$sql = $sql." and room_id=%d"; $sql = $sql." and room_id=%d";
} }
...@@ -210,6 +350,12 @@ class rentHouseList extends WP_List_Table ...@@ -210,6 +350,12 @@ class rentHouseList extends WP_List_Table
$params[] = $_REQUEST["status"]; $params[] = $_REQUEST["status"];
$sql = $sql." and status=%d"; $sql = $sql." and status=%d";
} }
if( isset( $_REQUEST["organization"]) && $_REQUEST["organization"] != -1 ){
$params[] = $_REQUEST["organization"];
$sql = $sql." and subsidiaryId=%d ";
}
if($_REQUEST["rentalPrice"]!=NULL){ if($_REQUEST["rentalPrice"]!=NULL){
$priceArray = explode("-", $_REQUEST['rentalPrice']); $priceArray = explode("-", $_REQUEST['rentalPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
...@@ -226,6 +372,29 @@ class rentHouseList extends WP_List_Table ...@@ -226,6 +372,29 @@ class rentHouseList extends WP_List_Table
$params[] = '%'.$_REQUEST['searchText'].'%'; $params[] = '%'.$_REQUEST['searchText'].'%';
$sql = $sql . " and name like %s"; $sql = $sql . " and name like %s";
} }
if(isset($_REQUEST["approval"]) && $_REQUEST["approval"]!=""){
if($_REQUEST["approval"] == -2){
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval != %d";
}else{
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval = %d";
}
}
if($_REQUEST["beginDate"]!=NULL && $_REQUEST["endDate"]!= NULL){
$time = array($_REQUEST["beginDate"],$_REQUEST["endDate"]);
$params[] = $time[0];
$params[] = $time[1];
$sql = $sql." and creattime between %s and %s";
}
if($_REQUEST["stuff"]!= NULL){
$params[] = '%'.$_REQUEST['stuff'].'%';
$sql = $sql . " and consul_name like %s";
}
if(isset($_GET["orderby"])){ if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"]; $orderby = $_GET["orderby"];
$order = $_GET["order"]; $order = $_GET["order"];
...@@ -247,21 +416,11 @@ class rentHouseList extends WP_List_Table ...@@ -247,21 +416,11 @@ class rentHouseList extends WP_List_Table
'age' => $value->age, 'age' => $value->age,
'matching_facilities'=> $value->matching_facilities, 'matching_facilities'=> $value->matching_facilities,
'user_id' => $value->consul_name, 'user_id' => $value->consul_name,
'consultant_id' => $value->consul_id
); );
if($value->approval == -2){
if($value->status == 0){ $data[$key]['status'] = $value->status_name;
$data[$key]['status'] ="未审核"; }else{
}else if($value->status == 1){ $data[$key]['status'] = $value->status_name."(".$value->approvalName.")";
$data[$key]['status'] ="审核";
}else if($value->status == 2){
$data[$key]['status'] ="自售";
}else if($value->status == 3){
$data[$key]['status'] ="他售";
}else if($value->status == 4){
$data[$key]['status'] ="无效";
}else if($value->status == 5){
$data[$key]['status'] ="重激活";
} }
} }
...@@ -305,6 +464,8 @@ function function_rentHouseList() ...@@ -305,6 +464,8 @@ function function_rentHouseList()
$contest['rentalPrice'] = $_REQUEST['rentalPrice']; $contest['rentalPrice'] = $_REQUEST['rentalPrice'];
$contest['acreage'] = $_REQUEST['acreage']; $contest['acreage'] = $_REQUEST['acreage'];
$contest['statusId'] = $_REQUEST['status']; $contest['statusId'] = $_REQUEST['status'];
$contest['req']['organization'] = $_REQUEST['organization'];
$contest['req'] = $_REQUEST;
} }
$contest["house_type"] = 2; $contest["house_type"] = 2;
Timber::render("houseList.html",$contest); Timber::render("houseList.html",$contest);
...@@ -313,6 +474,7 @@ function function_rentHouseList() ...@@ -313,6 +474,7 @@ function function_rentHouseList()
function addRentTable(){ function addRentTable(){
$rentHouseList = new rentHouseList(); $rentHouseList = new rentHouseList();
$rentHouseList->prepare_items(); $rentHouseList->prepare_items();
$rentHouseList->views();
$rentHouseList->display(); $rentHouseList->display();
} }
?> ?>
......
...@@ -13,7 +13,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -13,7 +13,7 @@ class SecHandHouse extends Tospur_House{
'name' => $_POST['housename'], 'name' => $_POST['housename'],
'total_price' =>$_POST['total_price'], 'total_price' =>$_POST['total_price'],
'average_price' => $_POST['average_price'], 'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'], 'buildproperty_id'=>$_POST['roomNum'],
'covered_area' =>$_POST['covered_area'], 'covered_area' =>$_POST['covered_area'],
'floor' =>$_POST['floor'], 'floor' =>$_POST['floor'],
'faceto'=>$_POST['faceto'], 'faceto'=>$_POST['faceto'],
...@@ -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,47 @@ class SecHandHouse extends Tospur_House{ ...@@ -46,17 +47,47 @@ 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"],
"property_money"=>$_POST["property_money"],
"mortgage" =>$_POST["mortgage"],
"parking_spaces"=>$_POST["parking_spaces"]
); );
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; //首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($_POST["userType"] == 0){
//经理
//通过
if($_POST["status"] != -2){
$insert_tospur_house_array["status"] =$_POST["status"];
$insert_tospur_house_array["approval"] = -2;
}else{
//退回
$insert_tospur_house_array["approval"] = $_POST["status"];
}
}else{
//置业顾问
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]);
//修改了状态
if($currentStatus["result"]->status != $_POST["status"]){
$insert_tospur_house_array["approval"] = $_POST["status"];
}else {
//没有修改状态
//没有申请审批
if($currentStatus["result"]->approval == -2){
$insert_tospur_house_array["approval"] = $currentStatus["result"]->status;
}else{
//申请了审批,没有修改状态,approval保持原来的
$insert_tospur_house_array["approval"] = $currentStatus["result"]->approval;
}
}
}
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array); $result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 201){ if(!is_numeric($result)){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result); print_r( $result);;
echo "二手房房源修改失败"; echo "二手房房源修改失败";
}else{ }else{
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
...@@ -64,11 +95,12 @@ class SecHandHouse extends Tospur_House{ ...@@ -64,11 +95,12 @@ class SecHandHouse extends Tospur_House{
} }
}else { }else {
$insert_tospur_house_array['status'] = $_POST['status']; $insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1;
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array); $result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) { if (!is_numeric($result)) {
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result); print_r( $result);;
echo "二手房房源新增失败"; echo "二手房房源新增失败";
} else { } else {
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
...@@ -81,20 +113,13 @@ class SecHandHouse extends Tospur_House{ ...@@ -81,20 +113,13 @@ 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["markOld"] = json_encode(SearchDao::searchFeatureOld($_GET['id'], 0));
//$context['featureOld'] = json_encode(SearchDao::searchFeatureOld($_GET['id'], 1));
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
} }
$context['role'] = SecHandHouse::getCurrentRole(); $context['canApproval'] = House::canApproval();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty(); $context["buildProperty"] = SearchDao::searchBuildProperty();
$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["mark"] = searchDao::searchTagOrFeature(0);
$context["feature"] = searchDao::searchTagOrFeature(1);*/
$context["house_type"] = 1; $context["house_type"] = 1;
Timber::render("secHandHouse.html",$context); Timber::render("secHandHouse.html",$context);
...@@ -111,23 +136,36 @@ class SecHandHouse extends Tospur_House{ ...@@ -111,23 +136,36 @@ class SecHandHouse extends Tospur_House{
//获取新房信息,存入tospur_house表 //获取新房信息,存入tospur_house表
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT); $res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT);
if(!$res){ if(!$res){
$houseId = InsertDao::insert_tospur_house($params); $houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
InsertDao::addMainImage($houseId,$data); $mainImageRes = InsertDao::addMainImage($houseId,$data);
$recommendRes = InsertDao::addRecommend($houseId,$data); $recommendRes = InsertDao::addRecommend($houseId,$data);
$recConsultant=InsertDao::addRecConsultant($houseId, $data['recConsultant']); $recConsultantRes = InsertDao::addRecConsultant($houseId,$data['recConsultant']);
InsertDao::addHouseTag($houseId, $data['houseTag']); InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseFeature($houseId, $data['houseFeature']); $houseFeatureRes = InsertDao::addHouseFeature($houseId, $data['houseFeature']);
$customerTrackRes = CustomerTrackingDao::insert($houseId, $_REQUEST);
if(!is_numeric($mainImageRes)){
return $mainImageRes;
}else if(!is_numeric($recommendRes)){
return $recommendRes;
}else if(!is_numeric($recConsultantRes)){
return $recConsultantRes;
}else if(is_numeric($customerTrackRes)){
return $customerTrackRes;
}else if(is_numeric($houseFeatureRes)){
return $houseFeatureRes;
}
}
return $houseId;
}else{ }else{
return 507; return "房源已存在";
} }
return 200;
} }
public static function data_update($houseId,$params){ public static function data_update($houseId,$params){
...@@ -156,10 +194,15 @@ class SecHandHouse extends Tospur_House{ ...@@ -156,10 +194,15 @@ class SecHandHouse extends Tospur_House{
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});"); $wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId)); $wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
InsertDao::addRecommend($houseId,$data); $result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
}
$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['recConsultant']); $result = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
if(!is_numeric($result)){
return $result;
}
$wpdb->query( $wpdb->query(
$wpdb->prepare( $wpdb->prepare(
...@@ -170,7 +213,11 @@ class SecHandHouse extends Tospur_House{ ...@@ -170,7 +213,11 @@ class SecHandHouse extends Tospur_House{
); );
InsertDao::addHouseTag($houseId, $data['houseTag']); InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseFeature($houseId, $data['houseFeature']); $result = InsertDao::addHouseFeature($houseId, $data['houseFeature']);
if(!is_numeric($result)){
return $result;
}
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
return $result; return $result;
} }
......
...@@ -5,6 +5,46 @@ if (!class_exists('WP_List_Table')) { ...@@ -5,6 +5,46 @@ if (!class_exists('WP_List_Table')) {
class secHandHouseList extends WP_List_Table class secHandHouseList extends WP_List_Table
{ {
function get_views(){
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(*) as allNum,
COUNT(NULLIF(approval != -2, false)) as needCheckNum,
COUNT(NULLIF(approval = 0, false)) as unCheckNum,
COUNT(NULLIF(approval = 1, false)) as checkNum,
COUNT(NULLIF(approval = -1, false)) as onSaleNum,
COUNT(NULLIF(approval = 2, false)) as selfSaleNum,
COUNT(NULLIF(approval = 3, false)) as otherSaleNum,
COUNT(NULLIF(approval = 4, false)) as invalidNum,
COUNT(NULLIF(approval = 5, false)) as reactivationNum
from ".Config::TOSPUR_HOUSE_TABLE." where house_type = 1";
$result = $wpdb->get_results($sql);
foreach($result as $value){
$approvalParam = array(
"allNum" =>$value->allNum,
"needCheckNum" => $value->needCheckNum,
"unCheckNum" => $value->unCheckNum,
"checkNum" => $value->checkNum,
"onSaleNum" => $value->onSaleNum,
"selfSaleNum"=>$value->selfSaleNum,
"otherSaleNum"=>$value->otherSaleNum,
"invalidNum"=>$value->invalidNum,
"reactivationNum"=>$value->reactivationNum
);
}
return array(
"allNum" => '<a href="'.$current_url.'&approval" class="current">全部<span class="count">('.$approvalParam["allNum"].')</span></a>',
"needCheckNum" => '<a href="'.$current_url.'&approval=-2" class="current">需审批<span class="count">('.$approvalParam["needCheckNum"].')</span></a>',
"unCheckNum" => '<a href="'.$current_url.'&approval=0">未审核<span class="count">('.$approvalParam["unCheckNum"].')</span></a>',
"checkNum" => '<a href="'.$current_url.'&approval=1">审核<span class="count">('.$approvalParam["checkNum"].')</span></a>',
"onSaleNum" => '<a href="'.$current_url.'&approval=-1">交易中<span class="count">('.$approvalParam["onSaleNum"].')</span></a>',
"selfSaleNum" => '<a href="'.$current_url.'&approval=2">自售<span class="count">('.$approvalParam["selfSaleNum"].')</span></a>',
"otherSaleNum" => '<a href="'.$current_url.'&approval=3">他售<span class="count">('.$approvalParam["otherSaleNum"].')</span></a>',
"invalidNum" => '<a href="'.$current_url.'&approval=4">无效<span class="count">('.$approvalParam["invalidNum"].')</span></a>',
"reactivationNum" => '<a href="'.$current_url.'&approval=5">重激活<span class="count">('.$approvalParam["reactivationNum"].')</span></a>',
);
}
function __construct() function __construct()
{ {
global $status, $page; global $status, $page;
...@@ -40,20 +80,19 @@ class secHandHouseList extends WP_List_Table ...@@ -40,20 +80,19 @@ class secHandHouseList extends WP_List_Table
function column_cb($item) function column_cb($item)
{ {
return sprintf( return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" data-consultant="%3$s"/>', '<input type="checkbox" name="%1$s[]" value="%2$s" />',
$this->_args['singular'], /*$1%s*/
$item['id'], $this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
$item['consultant_id'] /*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
); );
} }
function get_columns() function get_columns()
{ {
if( current_user_can('moderate_comments') ) {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />' 'cb' => '<input type="checkbox" />'
); );
}
$columns['id']= 'ID'; $columns['id']= 'ID';
$columns['name']= '二手房标题'; $columns['name']= '二手房标题';
$columns['community_name']= '小区名称'; $columns['community_name']= '小区名称';
...@@ -92,74 +131,167 @@ class secHandHouseList extends WP_List_Table ...@@ -92,74 +131,167 @@ class secHandHouseList extends WP_List_Table
function get_bulk_actions() function get_bulk_actions()
{ {
if( current_user_can('houseApproval') ) {
$actions = array(
"agree" =>"通过",
"goBack" =>"退回"
);
}else{
$actions = array( $actions = array(
'noCheck' => '未审核', 'unCheck'=>'未审核',
'check' => '审核', 'check' =>'审核',
'onSale'=>'交易中',
'selfSale'=>'自售', 'selfSale'=>'自售',
'otherSale'=>'他售', 'otherSale'=>'他售',
'invalid'=>'无效', 'invalid'=>'无效',
'reactivation'=>'重激活', 'reactivation'=>'重激活'
'allot' => '分配置业顾问'
); );
}
return $actions; return $actions;
} }
function manage_bulk_action(){
global $wpdb;
$flag = 0;
$action = $this->current_action();
if($action){
$string = null;
$approval = null;
switch ($action) {
case"agree":
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$approvalRes = $wpdb ->get_results('select approval from tospur_house where id in '.$string);
foreach($approvalRes as $value){
if($value->approval == -2){
print_r("您审批的房源中含有未申请审批的房源,请重新选择");
exit;
}
}
$result = $wpdb->query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$flag = 1;
}
break;
case"goBack":
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$flag = 1;
}
break;
}
if($flag == 1){
$wpdb->query('update tospur_house th SET th.approval= -2 where id in ' . $string);
}
}
}
function getCurrentStatus($houseId,$changeStatus = null){
global $wpdb;
$sql = "select status from tospur_house where id in".$houseId;
$res = $wpdb->get_results($sql);
if($changeStatus != null|| $changeStatus == 0 ){
foreach($res as $value){
if($value->status == $changeStatus){
print_r("您申请的状态含有与原状态相同的房源,请重新选择");
return false;
}
else{
return $changeStatus;
}
}
}
return $res;
}
function process_bulk_action() function process_bulk_action()
{ {
$action = $this->current_action(); $action = $this->current_action();
if ($action) { if ($action) {
global $wpdb;
$id = $_REQUEST['sechandhouselist'];
$string = null; $string = null;
$status = null; $status = null;
if($action == 'allot'){ if($action == 'allot'){
HouseDao::houseAllotConsultant($_POST['allot_consultant_id'], $_POST['sechandhouselist']); HouseDao::houseAllotConsultant($_POST['allot_consultant_id'], $_POST['sechandhouselist']);
}else{ }else{
switch ($action) { switch ($action) {
case 'noCheck': case 'unCheck':
$id = $_POST['sechandhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 0; $res = $this->getCurrentStatus($string,0);
if($res === false){
exit;
}
$status = $res;
} }
break; break;
case 'check': case 'check':
$id = $_POST['sechandhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 1; $res = $this->getCurrentStatus($string,1);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'selfSale': case 'selfSale':
$id = $_POST['sechandhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 2; $res = $this->getCurrentStatus($string,2);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'otherSale': case 'otherSale':
$id = $_POST['sechandhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 3; $res = $this->getCurrentStatus($string,3);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'invalid': case 'invalid':
$id = $_POST['sechandhouselist'];
print_r($id);
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = 4; $res = $this->getCurrentStatus($string,4);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
case 'reactivation': case 'reactivation':
$id = $_POST['sechandhouselist'];
if ($id) { if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')'; $string = '(' . implode(',', array_map('intval', $id)) . ')';
$sql = "select status from tospur_house where id in".$string;
$res = $wpdb->get_results($sql);
foreach($res as $value){
if($value->status == 4){
$status = 5; $status = 5;
}else{
print_r("只有无效房源可重激活,请重新选择");
exit;
}
}
}
break;
case 'onSale':
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,-1);
if(!$res){
exit;
}
$status = $res;
} }
break; break;
} }
global $wpdb; $result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string,$status));
$result = $wpdb->query('update tospur_house SET status='.$status .' where id in ' . $string);
} }
} }
} }
...@@ -176,40 +308,52 @@ class secHandHouseList extends WP_List_Table ...@@ -176,40 +308,52 @@ class secHandHouseList extends WP_List_Table
$sortable = $this->get_sortable_columns(); $sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable); $this->_column_headers = array($columns, $hidden, $sortable);
if( current_user_can('houseApproval') ) {
$this->manage_bulk_action();
}else{
$this->process_bulk_action(); $this->process_bulk_action();
}
//$data = $this->example_data; //$data = $this->example_data;
$sql = "select * from tospur_house th $sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id and ahu.user_type=1 left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id and ahu.user_type=1
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 id as consul_id,name as consul_name,subsidiaryId 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 left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
left join(select status_name,status_type,status_id from tospur_status)ts on th.status = ts.status_id and ts.status_type=2
left join(select status_name as approvalName,status_type,status_id from tospur_status)tss on th.approval = tss.status_id and tss.status_type=2
where 1=1 and house_type=1 "; where 1=1 and house_type=1 ";
if($_REQUEST["listCity"]!=0 ){ if( isset( $_REQUEST["listCity"]) && $_REQUEST["listCity"] != -1 ){
$params[] = $_REQUEST["listCity"]; $params[] = $_REQUEST["listCity"];
$sql = $sql." and city_id=%d"; $sql = $sql." and city_id=%d";
} }
if($_REQUEST["listDistrict"] != 0 ){ if( isset( $_REQUEST["listDistrict"]) && $_REQUEST["listDistrict"] != -1 ){
$params[] = $_REQUEST["listDistrict"]; $params[] = $_REQUEST["listDistrict"];
$sql = $sql." and district_id=%d"; $sql = $sql." and district_id=%d";
} }
if($_REQUEST["listPlate"] != 0){ if( isset( $_REQUEST["listPlate"]) && $_REQUEST["listPlate"] != -1){
$params[] = $_REQUEST["listPlate"]; $params[] = $_REQUEST["listPlate"];
$sql = $sql." and plate_id=%d"; $sql = $sql." and plate_id=%d";
} }
if($_REQUEST["buildProperty"]!=0){ if( isset( $_REQUEST["buildProperty"]) && $_REQUEST["buildProperty"]!=-1){
$params[] = $_REQUEST["buildProperty"]; $params[] = $_REQUEST["buildProperty"];
$sql = $sql." and buildproperty_id=%d"; $sql = $sql." and buildproperty_id=%d";
} }
if($_REQUEST["room"]!=0){ if( isset( $_REQUEST["room"]) && $_REQUEST["room"]!= -1){
$params[] = $_REQUEST["room"]; $params[] = $_REQUEST["room"];
$sql = $sql." and room_id=%d"; $sql = $sql." and room_id=%d";
} }
if(isset($_REQUEST["status"]) && $_REQUEST["status"]!=-1){ if(isset($_REQUEST["status"]) && $_REQUEST["status"]!=-1){
$params[] = $_REQUEST["status"]; $params[] = $_REQUEST["status"];
$sql = $sql." and status=%d"; $sql = $sql." and status=%d";
} }
if( isset( $_REQUEST["organization"]) && $_REQUEST["organization"] != -1 ){
$params[] = $_REQUEST["organization"];
$sql = $sql." and subsidiaryId=%d ";
}
if($_REQUEST["totalPrice"]!=NULL){ if($_REQUEST["totalPrice"]!=NULL){
$priceArray = explode("-", $_REQUEST['totalPrice']); $priceArray = explode("-", $_REQUEST['totalPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
...@@ -227,6 +371,29 @@ class secHandHouseList extends WP_List_Table ...@@ -227,6 +371,29 @@ class secHandHouseList extends WP_List_Table
$sql = $sql . " and name like %s"; $sql = $sql . " and name like %s";
} }
if(isset($_REQUEST["approval"]) && $_REQUEST["approval"]!=""){
if($_REQUEST["approval"] == -2){
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval != %d";
}else{
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval = %d";
}
}
if($_REQUEST["beginDate"]!=NULL && $_REQUEST["endDate"]!= NULL){
$time = array($_REQUEST["beginDate"],$_REQUEST["endDate"]);
$params[] = $time[0];
$params[] = $time[1];
$sql = $sql." and creattime between %s and %s";
}
if($_REQUEST["stuff"]!= NULL){
$params[] = '%'.$_REQUEST['stuff'].'%';
$sql = $sql . " and consul_name like %s";
}
if(isset($_GET["orderby"])){ if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"]; $orderby = $_GET["orderby"];
$order = $_GET["order"]; $order = $_GET["order"];
...@@ -240,7 +407,7 @@ class secHandHouseList extends WP_List_Table ...@@ -240,7 +407,7 @@ class secHandHouseList extends WP_List_Table
'name' => $value->name, 'name' => $value->name,
'community_name' => $value->community_name, 'community_name' => $value->community_name,
'total_price' => $value->total_price, 'total_price' => $value->total_price,
'average_price'=> $value->average_price, 'average_price' => $value->average_price,
'buildproperty_id' => $value->literal, 'buildproperty_id' => $value->literal,
'covered_area' => $value->covered_area, 'covered_area' => $value->covered_area,
'floor' => $value->floor, 'floor' => $value->floor,
...@@ -248,20 +415,11 @@ class secHandHouseList extends WP_List_Table ...@@ -248,20 +415,11 @@ class secHandHouseList extends WP_List_Table
'decoration' => $value->decoration, 'decoration' => $value->decoration,
'age' => $value->age, 'age' => $value->age,
'user_id' => $value->consul_name, 'user_id' => $value->consul_name,
'consultant_id' => $value->consul_id
); );
if($value->status == 0){ if ($value->approval == -2) {
$data[$key]['status'] ="未审核"; $data[$key]['status'] = $value->status_name;
}else if($value->status == 1){ } else {
$data[$key]['status'] ="审核"; $data[$key]['status'] = $value->status_name . "(" . $value->approvalName . ")";
}else if($value->status == 2){
$data[$key]['status'] ="自售";
}else if($value->status == 3){
$data[$key]['status'] ="他售";
}else if($value->status == 4){
$data[$key]['status'] ="无效";
}else if($value->status == 5){
$data[$key]['status'] ="重激活";
} }
} }
...@@ -302,6 +460,8 @@ function function_secHandHouseList() ...@@ -302,6 +460,8 @@ function function_secHandHouseList()
$contest['totalPrice'] = $_REQUEST['totalPrice']; $contest['totalPrice'] = $_REQUEST['totalPrice'];
$contest['acreage'] = $_REQUEST['acreage']; $contest['acreage'] = $_REQUEST['acreage'];
$contest['statusId'] = $_REQUEST['status']; $contest['statusId'] = $_REQUEST['status'];
$contest['req']['organization'] = $_REQUEST['organization'];
$contest['req'] = $_REQUEST;
} }
$contest["house_type"] = 1; $contest["house_type"] = 1;
Timber::render("houseList.html",$contest); Timber::render("houseList.html",$contest);
...@@ -309,6 +469,7 @@ function function_secHandHouseList() ...@@ -309,6 +469,7 @@ function function_secHandHouseList()
function addSecTable(){ function addSecTable(){
$secHandHouseList = new secHandHouseList(); $secHandHouseList = new secHandHouseList();
$secHandHouseList->prepare_items(); $secHandHouseList->prepare_items();
$secHandHouseList->views();
$secHandHouseList->display(); $secHandHouseList->display();
} }
?> ?>
......
...@@ -21,7 +21,7 @@ class tospurSaleList extends WP_List_Table ...@@ -21,7 +21,7 @@ class tospurSaleList extends WP_List_Table
{ {
switch ($column_name) { switch ($column_name) {
case 'community_name': case 'community_name':
return '<a href="' . admin_url('admin.php?page=' . $_GET['page'] . '&id=' . $item['id']) . '">' . $item[$column_name] . '</a>'; return '<a href="' . admin_url('admin.php?page=' . $_GET['page'] . '&id=' . $item['id'] . '&cityId=' . $item['cityId']) . '">' . $item[$column_name] . '</a>';
case 'consultant': case 'consultant':
$consultant = $item[$column_name] ? $item[$column_name] : '未分配'; $consultant = $item[$column_name] ? $item[$column_name] : '未分配';
return $consultant; return $consultant;
...@@ -113,10 +113,13 @@ class tospurSaleList extends WP_List_Table ...@@ -113,10 +113,13 @@ class tospurSaleList extends WP_List_Table
} else if ($house_type == 'tospur_sale_rent') { } else if ($house_type == 'tospur_sale_rent') {
$house_type = 2; $house_type = 2;
} }
$sql = "SELECT ts.*,dc.cityName,u.display_name FROM tospur_sale ts" . $sql = "SELECT ts.*,dc.cityName,tc.name as consultant_name FROM tospur_sale ts" .
" left join (SELECT cityId,cityName FROM dic_city group by cityId) dc on ts.cityId = dc.cityId" . " left join (SELECT cityId,cityName FROM dic_city group by cityId) dc on ts.cityId = dc.cityId" .
" left join wp_users u on u.ID = ts.consultant_id" . " left join tospur_consultant tc on tc.id = ts.consultant_id" .
" where ts.house_type = " . $house_type; " where ts.house_type = " . $house_type;
if (!current_user_can('fdfw_allot')) {
$sql .= " and tc.id = " . get_current_user_id();
}
$cityId = (int)$_GET['cityId']; $cityId = (int)$_GET['cityId'];
if ($cityId > 0) { if ($cityId > 0) {
$sql .= " and ts.cityId = " . $cityId; $sql .= " and ts.cityId = " . $cityId;
...@@ -131,6 +134,7 @@ class tospurSaleList extends WP_List_Table ...@@ -131,6 +134,7 @@ class tospurSaleList extends WP_List_Table
$unit = ($value->house_type == 1) ? '万元' : '元/月'; $unit = ($value->house_type == 1) ? '万元' : '元/月';
$data[$key] = array( $data[$key] = array(
'id' => $value->id, 'id' => $value->id,
'cityId' => $value->cityId,
'cityName' => $value->cityName, 'cityName' => $value->cityName,
'community_name' => $value->community_name, 'community_name' => $value->community_name,
'apartment' => $value->bedroom . '室' . $value->hall . '厅' . $value->kitchen . '厨' . $value->bathroom . '卫', 'apartment' => $value->bedroom . '室' . $value->hall . '厅' . $value->kitchen . '厨' . $value->bathroom . '卫',
...@@ -141,7 +145,7 @@ class tospurSaleList extends WP_List_Table ...@@ -141,7 +145,7 @@ class tospurSaleList extends WP_List_Table
'description' => $value->description, 'description' => $value->description,
'phone' => $value->phone, 'phone' => $value->phone,
'submission_date' => $value->submission_date, 'submission_date' => $value->submission_date,
'consultant' => $value->display_name, 'consultant' => $value->consultant_name,
'handle' => $value->handle, 'handle' => $value->handle,
'handle_date' => $value->handle_date 'handle_date' => $value->handle_date
); );
...@@ -173,15 +177,6 @@ class tospurSaleList extends WP_List_Table ...@@ -173,15 +177,6 @@ class tospurSaleList extends WP_List_Table
} }
} }
function add_tospur_sale_menu()
{
add_menu_page('房东服务', '房东服务', 'activate_plugins', 'tospur_sale_secondhand', 'tospur_sale_page', 'dashicons-menu', 28);
add_submenu_page('tospur_sale_secondhand', '出售', '出售', 'activate_plugins', 'tospur_sale_secondhand', 'tospur_sale_page');
add_submenu_page('tospur_sale_secondhand', '出租', '出租', 'activate_plugins', 'tospur_sale_rent', 'tospur_sale_page');
}
add_action('admin_menu', 'add_tospur_sale_menu');
function tospur_sale_page() function tospur_sale_page()
{ {
if ($_GET['id']) { if ($_GET['id']) {
......
...@@ -8,22 +8,53 @@ if ($page == 'tospur_sale_secondhand') { ...@@ -8,22 +8,53 @@ if ($page == 'tospur_sale_secondhand') {
} else if ($page == 'tospur_sale_rent') { } else if ($page == 'tospur_sale_rent') {
$house_type = 2; $house_type = 2;
} }
$detail_sql = "SELECT ts.*,dc.cityName,u.display_name FROM tospur_sale ts" .
$role_flag = current_user_can('fdfw_allot');
global $wpdb;
if (isset($_POST['submit']) && $role_flag) {
$consultant_id = $_POST['data']['recConsultant'][0];
if (isset($consultant_id) && $consultant_id != null) {
$wpdb->update('tospur_sale',
array('consultant_id' => $consultant_id),
array('id' => $house_id)
);
} else {
echo '<script>alert("请选择置业顾问")</script>';
}
} else if (isset($_POST['handle']) && !$role_flag) {
$wpdb->update('tospur_sale',
array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s'),
),
array('id' => $house_id)
);
}
$detail_sql = "SELECT ts.*,dc.cityName,tc.id as consultant_id,tc.imageUrl,tc.name as consultant_name FROM tospur_sale ts" .
" left join (SELECT cityId,cityName FROM dic_city group by cityId) dc on ts.cityId = dc.cityId" . " left join (SELECT cityId,cityName FROM dic_city group by cityId) dc on ts.cityId = dc.cityId" .
" left join wp_users u on u.ID = ts.consultant_id" . " left join tospur_consultant tc on tc.id = ts.consultant_id" .
" where ts.house_type = " . $house_type . " and ts.id = " . $house_id; " where ts.house_type = " . $house_type . " and ts.id = " . $house_id;
$consultant_sql = 'SELECT u.id,u.display_name FROM wp_users u ' $result = $wpdb->get_row($detail_sql);
. 'left join wp_usermeta m on u.id=m.user_id where meta_key="wp_user_level" and meta_value=7;';
global $wpdb; if ($result->consultant_id && $role_flag) {
$context['consultant'][0] = array(
$context['detail_result'] = $wpdb->get_row($detail_sql); 'id' => $result->consultant_id,
$context['consultant_result'] = $wpdb->get_results($consultant_sql); 'imageUrl' => $result->imageUrl,
'name' => $result->consultant_name
);
}
$context['detail_result'] = $result;
$context['url'] = home_url(); $context['url'] = home_url();
$context['id'] = $house_id; $context['id'] = $house_id;
$context['cityId'] = $_GET['cityId'];
$context['house_type'] = $house_type; $context['house_type'] = $house_type;
$context['city'] = SearchDao::searchCity();
$context['role_flag'] = $role_flag;
if (!$role_flag) {
$context['handle'] = (integer)$result->handle;
}
Timber::render('sale_detail.html', $context); Timber::render('sale_detail.html', $context);
......
...@@ -127,13 +127,6 @@ class viewHouseList extends WP_List_Table ...@@ -127,13 +127,6 @@ class viewHouseList extends WP_List_Table
} }
} }
function add_view_house_menu()
{
add_menu_page('预约列表', '预约列表', 'moderate_comments', 'view_house', 'view_house_page', 'dashicons-menu', 27);
}
add_action('admin_menu', 'add_view_house_menu');
function view_house_page() function view_house_page()
{ {
if ($_GET['id']) { if ($_GET['id']) {
......
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<tr> <tr>
<th><label for="periphery">置业顾问</label></th> <th style="width:11.7%"><label for="periphery" style="margin-left: 30px">置业顾问:</label></th>
<td> <td>
<div id="consultantImg"> <div id="consultantImg">
</div><br /> </div>
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt"> <button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择置业顾问 选择置业顾问
</button> </button>
......
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<tr> <tr>
<th><label for="feature">房源特色</label></th> <th style="width:11.7%"><label for="feature" style="margin-left: 30px">特色筛选:</label></th>
<td> <td>
<div id="feature" class="row"> <div id="feature" class="row">
</div><br/> </div>
<button type="button" class="button action" id="addFeatureBtn"> <button type="button" class="button action" id="addFeatureBtn">
添加特色 添加特色
</button> </button>
......
<table class="form-table"> <table class="form-table" id="recHouseTable">
<tbody> <tbody>
<tr> <tr>
<th><label for="traffic">推荐房源</label></th> <th style="width:11.7%"><label for="traffic" style="margin-left: 30px">推荐房源:</label></th>
<td> <td>
<div id="houseImg"> <div id="houseImg">
</div><br /> </div>
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt"> <button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
添加房源 添加房源
</button> </button>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
function addRecHouse(data){ function addRecHouse(data){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id}); var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id});
var url = url; var url = url;
var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px"}); var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px;margin-bottom:10px;"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel"); var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse); var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseImg").append(p); $("#houseImg").append(p);
......
<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">
<h2>收佣进度表</h2>
<form method="get">
<input type="hidden" name="page" value="commissionList">
{% include 'selectOrganization.html' %}
<div id="search_form">
<label for="year" class="hidden"></label>
<select name="year" id="year">
<option value="2015">2015</option>
<option value="2016">2016</option>
</select>
<label for="month" class="hidden"></label>
<select name="month" id="month">
<option value="-1">请选择月份</option>
<option value="1">一月</option>
<option value="2">二月</option>
<option value="3">三月</option>
<option value="4">四月</option>
<option value="5">五月</option>
<option value="6">六月</option>
<option value="7">七月</option>
<option value="8">八月</option>
<option value="9">九月</option>
<option value="10">十月</option>
<option value="11">十一月</option>
<option value="12">十二月</option>
</select>
<label for="search_consultant_name" class="hidden"></label>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
value="{{ req.search_consultant_name }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
{{ function("addCommissionTable") }}
</div>
<script>
$(document).ready(function () {
$('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 + '">');
}
});
{% if req %}
$("#year").val('{{ req.year|default(year) }}');
$("#month").val('{{ req.month|default(-1) }}');
{% endif %}
});
</script>
\ No newline at end of file
<!DOCTYPE html> {% block commission %}
<html>
<head lang="en">
<meta charset="UTF-8">
<title>收佣管理</title>
</head>
<body>
<h2 class="title">收佣管理</h2>
<br/>
<form action="" method="POST" enctype="multipart/form-data" id="commissionManage" class="form-inline"> <form action="" method="POST" enctype="multipart/form-data" id="commissionManage" class="form-inline">
<div class="row" > <div class="row" >
<div class="col-md-10"> <div class="col-xs-10">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<div id="staffImg"> <div id="staffImg">
</div><br /> {% if consultant %}
<div style = "display: inline-block;">
<div class="row" style="margin-bottom:10px">
<div class="col-md-3">
<label>员工:</label>
</div>
<div class="col-md-5">
<img height="100" width="100" src="{{ consultant.imageUrl }}" style="margin-right: 50px">
</div>
<div class="col-md-4">
<label>{{ consultant.name }}</label>
</div>
</div>
<div class="row" style="margin-top: 10px;">
<div class="col-md-12">
<label>部门:</label><input type="text">
</div>
</div>
<input type="hidden" name="data[recConsultant]" value="{{ consultant.consultanId }}">
</div>
{% endif %}
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt"> <button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择员工 选择员工
</button> </button>
</div> </div>
</div> </div>
</div>
<br/> <br/>
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<label for="intent">目标业绩:</label> <label for="intent">目标业绩:</label>
<input name="intent" id="intent" type="text" class="form-control" disabled="true"> <input name="intent" id="intent" type="text" class="form-control"{% if commission %}value="{{commission.intent}}" readonly {% endif %}>
</div> </div>
</div> </div>
<br/> <br/>
...@@ -36,8 +49,18 @@ ...@@ -36,8 +49,18 @@
<br/> <br/>
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<label for="businessType">应佣类型:</label>
<select name="businessType">
<option value="0">买卖</option>
<option value="1">租赁</option>
</select>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="accounts">应收佣金:</label> <label for="accounts">应收佣金:</label>
<input name="accounts" id="accounts" type="text" class="form-control"> <input name="accounts" id="accounts" type="text" class="form-control" {% if commission %}value = "{{commission.accounts}}" readonly {% endif %}>
</div> </div>
</div> </div>
<br/> <br/>
...@@ -48,99 +71,161 @@ ...@@ -48,99 +71,161 @@
</button> </button>
</div> </div>
</div> </div>
<input type="text" name="type" value="4" hidden="hidden">
<table class="form-table"> <table class="form-table">
<tbody id="paidTbody"> <tbody id="paidTbody">
</tbody> </tbody>
</table> </table>
{% if commissionLog %}
<div class="panel panel-default">
<div class="panel-heading">实收佣金列表</div>
<table class="table">
<tbody id="commissionList">
<tr>
<th>实收时间:</th>
<th>实收佣金:</th>
</tr>
{% for item in commissionLog %}
<tr>
<td>
{{item.time}}
</td>
<td class="paidList">
{{item.paid}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> </div>
<div class="col-md-2"> {% endif %}
<div class="row" style="position: fixed;top:100px;">
<select name="businessType">
<option value="0">买卖</option>
<option value="1">租赁</option>
</select>
</div>
<div class="row">
<input type="submit" id="submit" class="button action" style="position: fixed;top:150px">
</div>
</div> </div>
</div> </div>
{% if id %}
<input type="hidden" name="contractId" value="{{ id }}">
{% endif %}
</form> </form>
{% include 'recConsultant.html' %} {% include 'recConsultant.html' %}
{{ block('recConsultant') }} {{ block('recConsultant') }}
<script> <script>
(function($){ (function($){
$(document).ready(function(){ $(document).ready(function(){
var d = new Date(); var j = 0 ;
var month = d.getMonth()+1; var urlParams = getUrlParmas();
var day = d.getDate(); var sum = 0;
var output = d.getFullYear() + '/' +
(month<10 ? '0' : '') + month + '/' +
(day<10 ? '0' : '') + day;
init_modal_myConsultantList(addStaff); init_modal_myConsultantList(addStaff);
$("form").on('click','#paid',function(){ $("form").on('click','#paid',function(){
var tr = $("<tr>"); var tr = $("<tr>");
var th = $("<th>"); var th = $("<th>");
var td = $("<td>"); var td = $("<td>");
var paidTime = $("<input>").attr({"type":"text","value":output}).addClass("form-control"); var paidTime = $("<input>").attr({"type":"date","name":'log['+j+'][time]'}).addClass("form-control datePicker paidTime");
var paid = $("<input>").attr({"type":"text"}).addClass("form-control"); var paid = $("<input>").attr({"type":"text","name":'log['+j+'][paid]'}).addClass("form-control paidMoney");
var paiiDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action paiiDelet form-control"); var paidDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action paidDelet form-control");
var th1 = th.clone().append("实收时间:"); var th1 = th.clone().append("实收时间:");
var td1 = td.clone().append(paidTime); var td1 = td.clone().append(paidTime);
var th2 = th.clone().append("实收佣金:"); var th2 = th.clone().append("实收佣金:");
var td2 = td.clone().append(paid); var td2 = td.clone().append(paid);
var td3 = td.clone().append(paiiDelet); var td3 = td.clone().append(paidDelet);
tr.append(th1).append(td1).append(th2).append(td2).append(td3); tr.append(th1).append(td1).append(th2).append(td2).append(td3);
$("#paidTbody").append(tr); $("#paidTbody").append(tr);
//实收时间默认为当天时间
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
$('.datePicker').val(today);
j++;
}); });
if(urlParams.id){
$("form").find("select[name='businessType']").val("{{ commission.type }}");
}
$("#staffImg").on("click",".consultantCancel",function(){ if($("#commissionList > tr").length > 1){
$(this).parents("p").remove(); //计算实收佣金的总和
}); $(".paidList").each(function() {
var value = $(this).text();
$("#accounts").change(function(){ if(!isNaN(value) && value.length != 0) {
if($("#accounts").val().length > 0){ sum += parseFloat(value);
$("#intent").removeAttr("disabled");
}else{
$("#intent").attr("disabled","true");
} }
}); });
var rate = parseInt(sum * 100/ $("#accounts").val())+"%";
$("#completeRate").val(rate);
}
// $("#accounts").change(function(){
// var accounts = $("#accounts").val();
// $("#intent").val(accounts);
// });
$("#paidTbody").on("click",".paiiDelet",function(){ $("#paidTbody").on("click",".paidDelet",function(){
$(this).parents("tr").remove(); $(this).parents("tr").remove();
}) })
$('#commissionManage').validate({
onkeyup: false,
onfocusout: false,
ignore: [],
errorClass: "my-error-class",
rules: {
accounts:'required',
intent:'required'
},
messages: {
accounts:'请输入应收佣金',
intent:'请输入目标业绩'
},
errorContainer: "#commissionMessage",
errorLabelContainer: "#commissionMessage",
submitHandler: function (form) {
if($("#paidTbody > tr").length == 0){
$("#commissionMessage").removeAttr("style");
var label = $("<label>").append("请添加实收佣金").addClass("my-error-class");
$("#commissionMessage").append(label);
return false;
}
if($("#staffImg > div").length == 0){
$("#commissionMessage").removeAttr("style");
var label = $("<label>").append("请选择员工").addClass("my-error-class");
$("#commissionMessage").append(label);
return false;
}
form.submit();
}
});
}); });
function addStaff(data){ function addStaff(data){
if($("#staffImg > div").length >0 ){
$("#staffImg > div").remove();
}
var row = $("<div>").addClass("row").css("margin-bottom","10px"); var row = $("<div>").addClass("row").css("margin-bottom","10px");
var left = $("<div>").addClass("col-md-2"); var row2 = $("<div>").addClass("row").css("margin-top","10px");
var left = $("<div>").addClass("col-md-3");
var label3 = $("<label>").append("员工:");
left.append(label3);
var mid = $("<div>").addClass("col-md-5");
var img = $("<img>").attr({"src":data.imageUrl,"height":100,"width":100,"style":"margin-right:50px"}); var img = $("<img>").attr({"src":data.imageUrl,"height":100,"width":100,"style":"margin-right:50px"});
left.append(img); mid.append(img);
var mid = $("<div>").addClass("col-md-2"); var mid2 =$("<div>").addClass("col-md-4");
var label = $("<label>").append(data.name); var label = $("<label>").append(data.name);
mid.append(label); mid2.append(label);
var mid2 =$("<div>").addClass("col-md-6");
var div = $("<div>").addClass("col-md-12");
var input = $("<input>").attr({"type":"text"}); var input = $("<input>").attr({"type":"text"});
var label2 = $("<label>").append("部门:").append(input); var label2 = $("<label>").append("部门:").append(input);
mid2.append(label2); div.append(label2);
var right = $("<div>").addClass("col-md-2"); var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant]","value":data.id});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel"); row.append(left).append(mid).append(mid2);
right.append(cancel); row2.append(div);
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value":data.id}); var div2 = $("<div>").append(row).append(row2).append(recommendConsultant).css("display","inline-block");
row.append(left).append(mid).append(mid2).append(right); $("#recConsultantBt").before(div2);
var p = $("<p>").append(row).append(recommendConsultant);
$("#consultantImg").append(p);
$("#staffImg").append(p);
controlCommand("staffImg",1,1); controlCommand("staffImg",1,1);
} }
})(jQuery); })(jQuery);
</script> </script>
</body> {% endblock %}
</html> \ No newline at end of file
\ No newline at end of file
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
<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="#soInfo" aria-controls="soInfo" role="tab" data-toggle="tab">业主/买方信息</a></li> <li role="presentation"><a href="#soInfo" aria-controls="soInfo" role="tab" data-toggle="tab">业主/买方信息</a></li>
<li role="presentation"><a href="#buyCommissionManage" aria-controls="buyCommissionManage" role="tab" data-toggle="tab">买方佣金管理</a></li>
<li role="presentation"><a href="#sellCommissionManage" aria-controls="sellCommissionManage" role="tab" data-toggle="tab">卖方佣金管理</a></li>
<li role="presentation" style="display: none;"><a id="houseInfo" data-toggle="tab">房源信息</a></li> <li role="presentation" style="display: none;"><a id="houseInfo" data-toggle="tab">房源信息</a></li>
<li role="presentation" style="display: none;"><a id="customerInfo" data-toggle="tab">客源信息</a></li> <li role="presentation" style="display: none;"><a id="customerInfo" data-toggle="tab">客源信息</a></li>
</ul> </ul>
...@@ -170,26 +172,215 @@ ...@@ -170,26 +172,215 @@
<label for="cAddress">地址:</label> <label for="cAddress">地址:</label>
<input name="cAddress" id="cAddress" type="text" value="{{result.cAddress}}" class="form-control"> <input name="cAddress" id="cAddress" type="text" value="{{result.cAddress}}" class="form-control">
</p> </p>
<h4>贷款</h4>
<p>
<label for="cPayBack">偿还形式:</label>
<input name="cPayBack" id="cPayBack" type="text" value="{{result.cPayBack}}" class="form-control">
</p>
<p>
<label for="cMoney">偿还金额:</label>
<input name="cMoney" id="cMoney" type="text" value="{{result.cMoney}}" class="form-control">
</p>
</div> </div>
</div> </div>
</div> </div>
<div role="tabpanel" class="tab-pane" id="buyCommissionManage">
<br />
<div class="row">
<div class="col-md-8">
<div id="staffImg_buy">
{% if consultant[0] %}
<div style = "display: inline-block;">
<div class="row" style="margin-bottom:10px">
<div class="col-md-3">
<label>员工:</label>
</div>
<div class="col-md-5">
<img height="100" width="100" src="{{ consultant[0].imageUrl }}" style="margin-right: 50px">
</div>
<div class="col-md-4">
<label>{{ consultant[0].name }}</label>
</div>
</div>
<div class="row" style="margin-top: 10px;">
<div class="col-md-12">
<label>部门:</label><label>{{ consultant[0].branchName }}</label>
</div>
</div>
<input type="hidden" name="buy[consultantId]" value="{{ consultant[0].consultantId }}">
</div>
{% endif %}
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt_buy" {{disabled}}>
选择员工
</button>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="businessType">应佣类型:</label>
<select name="businessType" {{disabled}}>
<option value="0">买卖</option>
<option value="1">租赁</option>
</select>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="buy[accounts]">应收佣金:</label>
<input name="buy[accounts]" id="accounts_buy" type="text" class="form-control" {% if commission[0] %}value = "{{commission[0].accounts}}" readonly {% endif %}>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="buy[mtime]">应收时间:</label>
<input name="buy[mtime]" type="text" class="form-control" {% if commission[0] %}value = "{{commission[0].mtime}}" readonly {% endif %}>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<button type="button" class="button action" id="paid_buy">
添加实收佣金
</button>
</div>
</div>
<table class="form-table">
<tbody id="paidTbody_buy">
</tbody>
</table>
{% if commissionLog %}
<div class="panel panel-default">
<div class="panel-heading">实收佣金列表</div>
<table class="table">
<tbody id="commissionList">
<tr>
<th>实收时间:</th>
<th>实收佣金:</th>
</tr>
{% for item in commissionLog %}
{% if item.ioType == 0 %}
<tr>
<td>
{{item.time}}
</td>
<td class="paidList">
{{item.paid}}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
<div role="tabpanel" class="tab-pane" id="sellCommissionManage">
<br />
<div class="row">
<div class="col-md-8">
<div id="staffImg_sell">
{% if consultant[1] %}
<div style = "display: inline-block;">
<div class="row" style="margin-bottom:10px">
<div class="col-md-3">
<label>员工:</label>
</div>
<div class="col-md-5">
<img height="100" width="100" src="{{ consultant[1].imageUrl }}" style="margin-right: 50px">
</div>
<div class="col-md-4">
<label>{{ consultant[1].name }}</label>
</div>
</div>
<div class="row" style="margin-top: 10px;">
<div class="col-md-12">
<label>部门:</label><label>{{ consultant[1].branchName }}</label>
</div>
</div>
<input type="hidden" name="sell[consultantId]" value="{{ consultant[1].consultantId }}">
</div>
{% endif %}
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt_sell" {{disabled}}>
选择员工
</button>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="businessType">应佣类型:</label>
<select name="businessType" {{disabled}}>
<option value="0">买卖</option>
<option value="1">租赁</option>
</select>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="sell[accounts]">应收佣金:</label>
<input name="sell[accounts]" id="accounts_sell" type="text" class="form-control" {% if commission[1] %}value = "{{commission[1].accounts}}" readonly {% endif %}>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="sell[mtime]">应收时间:</label>
<input name="sell[mtime]" type="text" class="form-control" {% if commission[1] %}value = "{{commission[1].mtime}}" readonly {% endif %}>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<button type="button" class="button action" id="paid_sell">
添加实收佣金
</button>
</div>
</div>
<table class="form-table">
<tbody id="paidTbody_sell">
</tbody>
</table>
{% if commissionLog %}
<div class="panel panel-default">
<div class="panel-heading">实收佣金列表</div>
<table class="table">
<tbody id="commissionList">
<tr>
<th>实收时间:</th>
<th>实收佣金:</th>
</tr>
{% for item in commissionLog %}
{% if item.ioType == 1 %}
<tr>
<td>
{{item.time}}
</td>
<td class="paidList">
{{item.paid}}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div> </div>
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2">
<input type="hidden" name="type" value="1"> <input type="hidden" name="type" value="1">
<input type="hidden" name="businessId" id="businessId"> <input type="hidden" name="businessId" id="businessId">
<input type="hidden" name="houseId" id="houseId"> <input type="hidden" name="houseId" id="houseId">
<input type="hidden" name="houseNumber" id="houseNumber"> <input type="hidden" name="houseNumber" id="houseNumber" value="{{result.houseNumber}}">
<input type="hidden" name="customerNumber" id="customerNumber"> <input type="hidden" name="customerNumber" id="customerNumber" value="{{result.customerNumber}}">
{% if commission %}
<input type="hidden" name="commissionId_buy" value="{{commission[0].id}}">
<input type="hidden" name="commissionId_sell" value="{{commission[1].id}}">
{% endif %}
<input type="hidden" name="address" id="address"> <input type="hidden" name="address" id="address">
<div class="row" style="position: fixed;"> <div class="row" style="position: fixed;">
<select name="status" id="status"> <select name="status" id="status">
...@@ -203,6 +394,8 @@ ...@@ -203,6 +394,8 @@
</div> </div>
</form> </form>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script> <script>
(function($){ (function($){
$(document).ready(function(){ $(document).ready(function(){
...@@ -228,6 +421,14 @@ ...@@ -228,6 +421,14 @@
} }
}); });
$("button[id^='recConsultantBt']").click(function(){
$("#myConsultant").data("id",$(this).attr("id"));
});
init_modal_myConsultantList(addStaff);
var rulesJson = { var rulesJson = {
houseNumber:'required', houseNumber:'required',
customerNumber:'required', customerNumber:'required',
...@@ -235,7 +436,13 @@ ...@@ -235,7 +436,13 @@
permitNumber:'required', permitNumber:'required',
area:'required', area:'required',
price:'required', price:'required',
signedDate:'required' signedDate:'required',
'buy[accounts]':'required',
'sell[accounts]':'required',
oCommission:'required',
oPhone:'required',
cCommission:'required',
cPhone:'required'
}; };
$('#contract').validate({ $('#contract').validate({
...@@ -252,13 +459,77 @@ ...@@ -252,13 +459,77 @@
area:'请选输入面积', area:'请选输入面积',
price:'请选输入金额', price:'请选输入金额',
signedDate:'请选输入签约日期', signedDate:'请选输入签约日期',
'buy[accounts]':'请输入买方应收佣金',
'sell[accounts]':'请输入卖方应收佣金',
oCommission:'请选业主佣金',
oPhone:'请选业主手机',
cCommission:'请选买方佣金',
cPhone:'请选买方手机'
}, },
errorContainer: "#messageBox1", errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1", errorLabelContainer: "#messageBox1",
submitHandler: function (form) { submitHandler: function (form) {
console.log($("input[name='sell[consultantId]']").val() == undefined);
console.log($("input[name='buy[consultantId]']").val() == undefined);
if($("input[name='sell[consultantId]']").val() == undefined && $("input[name='buy[consultantId]']").val() == undefined){
$("#messageBox1").removeAttr("style");
var label = $("<label>").append("请选择员工").addClass("my-error-class");
$("#messageBox1").append(label);
return false;
}
form.submit(); form.submit();
} }
}); });
var j = 0 ;
var urlParams = getUrlParmas();
var sum = 0;
$("form").on('click','button[id^="paid"]',function(){
var type = $(this).attr("id").split("_")[1];
var tr = $("<tr>");
var th = $("<th>");
var td = $("<td>");
var paidTime = $("<input>").attr({"type":"date","name":'log['+type+']['+j+'][time]'}).addClass("form-control datePicker paidTime");
//实收时间默认为当天时间
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
paidTime.val(today);
var paid = $("<input>").attr({"type":"text","name":'log['+type+']['+j+'][paid]'}).addClass("form-control paidMoney");
var paidDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action paidDelet form-control");
var th1 = th.clone().append("实收时间:");
var td1 = td.clone().append(paidTime);
var th2 = th.clone().append("实收佣金:");
var td2 = td.clone().append(paid);
var td3 = td.clone().append(paidDelet);
tr.append(th1).append(td1).append(th2).append(td2).append(td3);
$("#paidTbody_"+type).append(tr);
j++;
});
if(urlParams.id){
$("form").find("select[name='businessType']").val("{{ commission[0].type }}");
}
$("select[name='businessType']").change(function(){
$("select[name='businessType']").val($(this).val());
});
if($("#commissionList > tr").length > 1){
//计算实收佣金的总和
$(".paidList").each(function() {
var value = $(this).text();
if(!isNaN(value) && value.length != 0) {
sum += parseFloat(value);
}
});
}
$("#contract").on("click",".paidDelet",function(){
$(this).parents("tr").remove();
});
}); });
function checkBusinessSelected(){ function checkBusinessSelected(){
...@@ -277,14 +548,19 @@ ...@@ -277,14 +548,19 @@
function selectCustomer(data){ function selectCustomer(data){
$("input[name='customerNumberText']").val(data.id); $("input[name='customerNumberText']").val(data.id);
$("#customerNumber").val(data.id); $("#customerNumber").val(data.id);
$("#cName").val(data.name);
$("#cPhone").val(data.phone);
showCustomerTag(data.id); showCustomerTag(data.id);
close_modal_addCustomer(); close_modal_addCustomer();
setBusinessDisabled(); setBusinessDisabled();
} }
function selectHouse(data){ function selectHouse(data){
console.log(JSON.stringify(data));
$("input[name='addressText']").val(data.address); $("input[name='addressText']").val(data.address);
$("input[name='houseNumberText']").val(data.house_number); $("input[name='houseNumberText']").val(data.house_number);
$("#oName").val(data.owner_name);
$("#oPhone").val(data.owner_phone);
$("#address").val(data.address); $("#address").val(data.address);
$("#houseNumber").val(data.house_number); $("#houseNumber").val(data.house_number);
$("#houseId").val(data.id); $("#houseId").val(data.id);
...@@ -321,6 +597,37 @@ ...@@ -321,6 +597,37 @@
window.open("{{adminUrl}}admin.php?page="+houseType+"&edit=true&id="+id); window.open("{{adminUrl}}admin.php?page="+houseType+"&edit=true&id="+id);
}); });
} }
function addStaff(data){
var clickButtonId = $("#myConsultant").data("id");
var type = clickButtonId.split("_")[1];
var clickButton = $("#"+clickButtonId);
if($("#staffImg_"+type+" > div").length >0 ){
$("#staffImg_"+type+" > div").remove();
}
var row = $("<div>").addClass("row").css("margin-bottom","10px");
var row2 = $("<div>").addClass("row").css("margin-top","10px");
var left = $("<div>").addClass("col-md-3");
var label3 = $("<label>").append("员工:");
left.append(label3);
var mid = $("<div>").addClass("col-md-5");
var img = $("<img>").attr({"src":data.imageUrl,"height":100,"width":100,"style":"margin-right:50px"});
mid.append(img);
var mid2 =$("<div>").addClass("col-md-4");
var label = $("<label>").append(data.name);
mid2.append(label);
var div = $("<div>").addClass("col-md-12");
var branchName = $("<label>").html(data.branchName);
var label2 = $("<label>").append("部门:");
div.append(label2).append(branchName);
var recommendConsultant = $("<input>").attr({"type":"hidden","name":type+"[consultantId]","value":data.id});
row.append(left).append(mid).append(mid2);
row2.append(div);
var div2 = $("<div>").append(row).append(row2).append(recommendConsultant).css("display","inline-block");
clickButton.before(div2);
}
})(jQuery); })(jQuery);
</script> </script>
{% include 'recommendHouse.html' %} {% include 'recommendHouse.html' %}
......
...@@ -8,3 +8,11 @@ label.my-error-class { ...@@ -8,3 +8,11 @@ label.my-error-class {
color: #EA5200; color: #EA5200;
} }
p[class^=col-]{
padding: 0;
}
#preview,#addPhotos,#recHouseTable{
border-bottom: 1px solid;
border-bottom: 1px solid #ddd;
}
\ No newline at end of file
<div class="wrap"> <div class="wrap">
<h2>客户列表</h2> <h2>客户列表</h2>
<form method="get" id="search_form"> <form method="get">
<input type="hidden" name="page" value="customerList"> <input type="hidden" name="page" value="customerList">
<div> <div id="search_form">
<input type="hidden" name="hasSearch" value="1"/> <input type="hidden" name="hasSearch" value="1"/>
{% include 'selectOrganization.html' %}
<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>
{% set customer_status_array = function('SearchDao::searchStatusType', 5) %} {% for item in status %}
{% for item in customer_status_array %} <option {{ item.id == status_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == req.status ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="customer_type" class="hidden"></label> <label for="customer_type" class="hidden"></label>
<select name="customer_type" id="customer_type"> <select name="customer_type" id="customer_type">
<option value="-1">客户类型</option> <option value="-1">客户类型</option>
{% set customer_type_array = function('SearchDao::searchStatusType', 6) %} {% for item in customer_type %}
{% for item in customer_type_array %} <option {{ item.id == customer_type_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == req.customer_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="demand_type" class="hidden"></label> <label for="demand_type" class="hidden"></label>
...@@ -32,80 +29,74 @@ ...@@ -32,80 +29,74 @@
<select id="listCity" name="listCity"> <select id="listCity" name="listCity">
<option value="-1"> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == req.listCity ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="listDistrict" class="hidden"></label> <label for="listDistrict" class="hidden"></label>
<select id="listDistrict" name="listDistrict"> <select id="listDistrict" name="listDistrict">
<option value="-1">区域</option> <option value="-1">区域</option>
{% set district = function('SearchDao::searchCity', req.listCity) %}
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
<option {{ item.id == req.listDistrict ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="listPlate" class="hidden"></label> <label for="listPlate" class="hidden"></label>
<select id="listPlate" name="listPlate"> <select id="listPlate" name="listPlate">
<option value="-1">板块</option> <option value="-1">板块</option>
{% set plate = function('SearchDao::searchCity', req.listCity, req.listDistrict) %}
{% if plate %} {% if plate %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == req.listPlate ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="totalPrice" class="hidden"></label> <label for="totalPrice" class="hidden"></label>
<select id="totalPrice" name="totalPrice" class="hidden"> <select id="totalPrice" name="totalPrice" class="hidden">
<option value="-1">总价</option> <option value="">总价</option>
{% set dicTotalPrice = function('SearchDao::searchTotalPrice', req.listCity) %}
{% if dicTotalPrice %} {% if dicTotalPrice %}
{% for item in dicTotalPrice %} {% for item in dicTotalPrice %}
<option {{ item.value == req.totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> <option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="rentalPrice" class="hidden"></label> <label for="rentalPrice" class="hidden"></label>
<select id="rentalPrice" name="rentalPrice" class="hidden"> <select id="rentalPrice" name="rentalPrice" class="hidden">
<option value ="-1">月租</option> <option value ="">月租</option>
{% set dicRentalPrice = function('SearchDao::searchRentalPrice', req.listCity) %}
{% if dicRentalPrice %} {% if dicRentalPrice %}
{% for item in dicRentalPrice %} {% for item in dicRentalPrice %}
<option {{ item.value == req.rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> <option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="buildProperty" class="hidden"></label> <label for="buildProperty" class="hidden"></label>
<select id="buildProperty" name="buildProperty"> <select id="buildProperty" name="buildProperty">
<option value="-1">房型</option> <option value="-1">房型</option>
{% set buildProperty_array = function('SearchDao::searchBuildProperty') %} {% for item in buildProperty %}
{% for item in buildProperty_array %} <option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == req.buildProperty ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="acreage" class="hidden"></label> <label for="acreage" class="hidden"></label>
<select id="acreage" name="acreage"> <select id="acreage" name="acreage">
<option value="-1">面积</option> <option value="">面积</option>
{% set dicArea = function('SearchDao::searchArea', req.listCity) %} {% if acreage %}
{% if dicArea %}
{% for item in dicArea %} {% for item in dicArea %}
<option {{ item.value == req.acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> <option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px;">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ req.search_name }}"> <input type="text" placeholder="请输入姓名" name="search_name" value="{{ search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ req.search_consultant_name }}"> <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ req.search_phone }}"> <input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}">
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px;">
<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="{{ req.search_min_time }}"> <input type="date" name="search_min_time" id="search_min_time" value="{{ search_min_time }}">
<label for="search_max_time" class="hidden"></label> <label for="search_max_time" class="hidden"></label>
<input type="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}"> <input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
</form> </form>
...@@ -119,7 +110,7 @@ ...@@ -119,7 +110,7 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var demand_type_select = $('#demand_type'); var demand_type_select = $('#demand_type');
demand_type_select.val('{{ req.demand_type|default(-1) }}'); demand_type_select.val('{{ demand_type }}');
search_form_set_page(); search_form_set_page();
var acreage = $("#acreage"); var acreage = $("#acreage");
...@@ -166,16 +157,5 @@ ...@@ -166,16 +157,5 @@
} }
allot_consultant('customerlist'); allot_consultant('customerlist');
$('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> </script>
\ No newline at end of file
<div class="wrap"> <div class="wrap">
<h2>签约-房客跟进</h2> <h2>签约-房客跟进</h2>
<form method="get">
<form method="get" id="search_form">
<input type="hidden" name="page" value="customerTrackingList"> <input type="hidden" name="page" value="customerTrackingList">
<div id="search_form">
<div>
{% include 'selectOrganization.html' %}
<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 <option
{{ item.id == (req.status_type) ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {{ item.id == status_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="search_consultant_name" class="hidden"></label> <label for="search_consultant_name" class="hidden"></label>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name" <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
value="{{ req.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="{{ req.search_min_time }}"> <input type="date" name="search_min_time" id="search_min_time" value="{{ search_min_time }}">
<label for="search_max_time" class="hidden"></label> <label for="search_max_time" class="hidden"></label>
<input type="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}"> <input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
</form>
<form method="post">
{{ function("addCustomerTrackingTable") }} {{ function("addCustomerTrackingTable") }}
</form> </form>
</div> </div>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
search_form_set_page(); 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> </script>
\ No newline at end of file
<br /> <br />
<div class="row"> {% include 'weixin.html' %}
<div class="col-md-12"> {% if house_type == 1%}
<label for="housename">城市:</label> {% include 'addFeature.html' %}
<select id="baseCity" name="baseCity" class="form-control"> {% endif %}
<div class="row form-group">
<div class="col-xs-4">
<label for="baseCity" class=" control-label col-xs-3" >城市:</label>
<p class="col-xs-3">
<select id="baseCity" name="baseCity" class="form-control" style="width:75px;">
<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>
{% endfor %} {% endfor %}
</select> </select>
<select id="baseAreaId" name="baseAreaId" class="form-control"> </p>
<p class="col-xs-3">
<select id="baseAreaId" name="baseAreaId" class="form-control" style="width:90px; margin-left:5px">
<option value = "-1">区域</option> <option value = "-1">区域</option>
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
...@@ -16,7 +23,9 @@ ...@@ -16,7 +23,9 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<select id="basePlateId" name="basePlateId" class="form-control"> </p>
<p class="col-xs-3">
<select id="basePlateId" name="basePlateId" class="form-control" style="width:90px; margin-left: 25px">
<option value = "-1">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
...@@ -24,41 +33,47 @@ ...@@ -24,41 +33,47 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
</p>
</div> </div>
</div> <div class="col-xs-4 ">
<br /> <label for="address" class="control-label col-xs-5">小区名称:</label>
<div class="row"> <p class="col-xs-7">
<div class="col-md-12">
<label for="address">地址:</label>
<input name="address" type="text" value="{{result.address}}" class="form-control" style="width:80%;">
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="address">小区名称:</label>
<input name="community_name" type="text" value="{{result.community_name}}" class="form-control"> <input name="community_name" type="text" value="{{result.community_name}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="suite">门牌号码:</label></th> <label for="address" class="control-label col-xs-5" >地址:</label>
<input name="suite" type="text" value="{{result.suite}}" class="form-control"> <p class="col-xs-7">
<input name="address" type="text" value="{{result.address}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br /> <div class="row form-group">
<div class="row"> <div class="col-xs-4">
<div class="col-md-6"> <label for="suite" class="col-xs-5 control-label">门牌号码:</label>
<label for="floor">楼层:</label> <p class="col-xs-7">
<input name="suite" type="text" value="{{result.suite}}" class="form-control">
</p>
</div>
<div class="col-xs-4">
<label for="floor" class="col-xs-5 control-label">楼层:</label>
<p class="col-xs-7">
<input name="floor" type="text" value="{{result.floor}}" class="form-control"> <input name="floor" type="text" value="{{result.floor}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="totalFloor">总层:</label> <label for="totalFloor" class="col-xs-5 control-label">总层:</label>
<p class="col-xs-7">
<input type="text" name="totalFloor"value="{{result.totalFloor}}" class="form-control"> <input type="text" name="totalFloor"value="{{result.totalFloor}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4">
<label for="faceto">朝向:</label> <label for="faceto" class="col-xs-5 control-label">朝向:</label>
<p class="col-xs-7">
<select name="faceto" class="form-control"> <select name="faceto" class="form-control">
<option value="其他">其他</option> <option value="其他">其他</option>
<option value="东"></option> <option value="东"></option>
...@@ -72,18 +87,33 @@ ...@@ -72,18 +87,33 @@
<option value="西南">西南</option> <option value="西南">西南</option>
<option value="西北">西北</option> <option value="西北">西北</option>
</select> </select>
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="age">建筑年代:</label> <label for="age" class="col-xs-5 control-label">建筑年代:</label>
<p class="col-xs-7">
<select name="age" id="pageAge" class="form-control"> <select name="age" id="pageAge" class="form-control">
<option value="未知">未知</option> <option value="未知">未知</option>
</select> </select>
</p>
</div>
<div class="col-xs-4 ">
<label for="decoration" class="col-xs-5 control-label">装修程度:</label>
<p class="col-xs-7">
<select name="decoration" class="form-control">
<option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option>
<option value="中等装修">中等装修</option>
<option value="精装修">精装修</option>
<option value="豪华装修">豪华装修</option>
</select>
</p>
</div> </div>
</div> </div>
<br /> <div class="row form-group">
<div class="row"> <div class="col-xs-8">
<div class="col-md-6"> <label for="from" class="col-xs-2 control-label">户型:</label>
<label for="from">户型:</label> <p class="col-xs-1">
<select name="roomNum" class="form-control"> <select name="roomNum" class="form-control">
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
...@@ -95,7 +125,9 @@ ...@@ -95,7 +125,9 @@
<option value="7">7</option> <option value="7">7</option>
<option value="8">8</option> <option value="8">8</option>
</select> </select>
<label for="roomNum"></label> </p>
<p class="col-xs-1" style="margin-top: 5px;margin-left: 5px"></p>
<p class="col-xs-1">
<select name="livingRoom" class="form-control"> <select name="livingRoom" class="form-control">
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
...@@ -103,7 +135,9 @@ ...@@ -103,7 +135,9 @@
<option value="3">3</option> <option value="3">3</option>
<option value="4">4</option> <option value="4">4</option>
</select> </select>
<label for="livingRoom"></label> </p>
<p class="col-xs-1" style="margin-top: 5px;margin-left: 5px"></p>
<p class="col-xs-1">
<select name="bathRoom" class="form-control"> <select name="bathRoom" class="form-control">
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
...@@ -111,45 +145,78 @@ ...@@ -111,45 +145,78 @@
<option value="3">3</option> <option value="3">3</option>
<option value="4">4</option> <option value="4">4</option>
</select> </select>
<label for="bathRoom"></label> </p>
<p class="col-xs-1 " style="margin-top: 5px;margin-left: 5px"></p>
<p class="col-xs-1">
<select name="kitchen" class="form-control"> <select name="kitchen" class="form-control">
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="3">3</option> <option value="3">3</option>
</select> </select>
<label for="kitchen"></label> </p>
<p class="col-xs-1" style="margin-top: 5px;margin-left: 5px"></p>
<p class="col-xs-1">
<select name="balcony" class="form-control"> <select name="balcony" class="form-control">
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="3">3</option> <option value="3">3</option>
</select> </select>
<label for="balcony">阳台</label> </p>
<p class="col-xs-1=2" style="margin-top: 5px;margin-left:5px">阳台</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="decoration">装修程度:</label> <label for="baseRoom" class="col-xs-5 control-label">建筑类型:</label>
<select name="decoration" class="form-control"> <p class="col-xs-7">
<option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option>
<option value="中等装修">中等装修</option>
<option value="精装修">精装修</option>
<option value="豪华装修">豪华装修</option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="baseRoom">建筑类型:</label>
<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>
</p>
</div>
</div>
<div class="row form-group">
<div class="col-xs-4">
<label for="covered_area" class="col-xs-5 control-label">建筑面积:</label>
<p class="col-xs-6">
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control">
</p>
<p class="col-xs-1" style="margin-top: 10px">
&nbsp;m<sup>2</sup>
</p>
</div>
<div class="col-xs-4 ">
<label for="useArea" class="col-xs-5 control-label">使用面积:</label>
<p class="col-xs-6">
<input type="text" name="useArea" value="{{result.useArea}}" class="form-control">
</p>
<p class="col-xs-1" style="margin-top: 10px">
&nbsp;m<sup>2</sup>
</p>
</div>
<div class="col-xs-4 ">
<label for="structure" class="col-xs-5 control-label">结构:</label>
<p class="col-xs-7">
<select name="structure" class="form-control">
<option value="其他">其他</option>
<option value="框架">框架</option>
<option value="砖混">砖混</option>
<option value="剪力">剪力</option>
<option value="钢混">钢混</option>
<option value="木混">木混</option>
<option value="砖木">砖木</option>
</select>
</p>
</div> </div>
<div class="col-md-6"> </div>
<label for="propertyRight">产权:</label>
<div class="row form-group">
<div class="col-xs-4 ">
<label for="propertyRight" class="col-xs-5 control-label">产权:</label>
<p class="col-xs-7">
<select name="propertyRight" class="form-control"> <select name="propertyRight" class="form-control">
<option value="个人产权">个人产权</option> <option value="个人产权">个人产权</option>
<option value="单位产权">单位产权</option> <option value="单位产权">单位产权</option>
...@@ -164,97 +231,168 @@ ...@@ -164,97 +231,168 @@
<option value="三联单">三联单</option> <option value="三联单">三联单</option>
<option value="其他">其他</option> <option value="其他">其他</option>
</select> </select>
</p>
</div> </div>
</div> <div class="col-xs-4">
<br /> <label for="propertyProof" class="col-xs-5 control-label">产证:</label>
<div class="row"> <p class="col-xs-7">
<div class="col-md-6"> <input type="text" name="propertyProof" value="{{result.propertyProof}}" class="form-control">
<label for="covered_area">建筑面积:</label> </p>
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control">平方米
</div> </div>
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="useArea">使用面积:</label> <label class="control-label col-xs-5">
<input type="text" name="useArea" value="{{result.useArea}}" class="form-control">平方米 <input type="checkbox" id="keyCheck" {{ result.key?"checked":"" }} class="form-control"> 钥匙:
</label>
<p class="col-xs-7">
<input type="text" {% if not result.key %} disabled="true" {% endif %} id="key" name="key" value="{{result.key}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="propertyProof">产证:</label> <label class="control-label col-xs-5">
<input type="text" name="propertyProof" value="{{result.propertyProof}}" class="form-control"> <input type="checkbox" id="garageCheck" {{ result.garage?"checked":"" }} class="form-control"> 车库:
</label>
<p class="col-xs-7">
<input type="text" {% if not result.garage %}disabled="true"{% endif %} id="garage" name="garage" value="{{result.garage}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6">
<label for="structure">结构:</label> {% if house_type == 1 %}
<select name="structure" class="form-control"> <div class="col-xs-4">
<option value="其他">其他</option> <label for="total_price" class="col-xs-5 control-label">总价:</label>
<option value="框架">框架</option> <p class="col-xs-5">
<option value="砖混">砖混</option> <input name="total_price" id="total_price" type="text" value="{{result.total_price}}" class="form-control">
<option value="剪力">剪力</option> </p>
<option value="钢混">钢混</option> <p class="col-xs-2" style="margin-top: 10px">
<option value="木混">木混</option> &nbsp;万元
<option value="砖木">砖木</option> </p>
</select> </div>
<div class="col-xs-4 ">
<label for="average_price" class="col-xs-5 control-label">单价:</label>
<p class="col-xs-6">
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control">
</p>
<p class="col-xs-1" style="margin-top: 10px">
&nbsp;
</p>
</div>
{% elseif house_type== 2 %}
<div class="col-xs-4 ">
<label for="rent" class="col-xs-5 control-label" >租金:</label>
<div class="col-xs-5">
<input name="rent" id="rent" type="text" value="{{result.rent}}" class="form-control">
</div>
<p class="col-xs-2" style="margin-top: 10px">
&nbsp;元/月
</p>
</div> </div>
{% endif %}
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4">
<input type="checkbox" id="keyCheck" {{ result.key?"checked":"" }} class="form-control"> <label for="entrustDay" class="col-xs-5 control-label">委托日:</label>
<label for="key">钥匙:</label> <p class="col-xs-7">
<input type="text" {% if not result.key %} disabled="true" {% endif %} id="key" name="key" value="{{result.key}}" style="width: 10%" class="form-control"> <input type="date" name="entrustDay" id="entrustDay" value="{{result.entrustDay}}" class="form-control">
</div> </p>
<div class="col-md-6"> </div>
<input type="checkbox" id="garageCheck" {{ result.garage?"checked":"" }} class="form-control"> <div class="col-xs-4">
<label for="garage">车库:</label> <label for="deadLine" class="col-xs-5 control-label">到期日:</label>
<input type="text" {% if not result.garage %}disabled="true"{% endif %} id="garage" name="garage" value="{{result.garage}}" class="form-control"> <p class="col-xs-7">
<input name="deadLine" type="date" id="deadLine" value="{{result.deadLine}}" class="form-control">
</p>
</div>
<div class="col-xs-4 ">
<label for="street" class="col-xs-5 control-label">街道:</label>
<p class="col-xs-7">
<input type="text" name="street" value="{{result.street}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="entrustDay">委托日:</label> <label for="traffic" class="col-xs-5 control-label">交通线路:</label>
<input type="text" name="entrustDay" id="entrustDay" value="{{result.entrustDay}}" class="form-control"> <p class="col-xs-7">
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</p>
</div>
<div class="col-xs-4 ">
<label for="periphery" class="col-xs-5 control-label">周边配套:</label>
<p class="col-xs-7">
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> {% if house_type == 1%}
<label for="deadLine">到期日:</label> <div class="col-xs-4 ">
<input name="deadLine" type="text" id="deadLine" value="{{result.deadLine}}" class="form-control"> <label for="property_money" class="col-xs-5 control-label">物业费:</label>
<p class="col-xs-6">
<input name="property_money" type="text" value="{{result.property_money}}" class="form-control" >
</p>
<p style="margin-top: 10px">
&nbsp;
</p>
</div> </div>
{% endif %}
</div> </div>
<br /> {% if house_type == 1 %}
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4">
<label for="street">街道:</label> <label for="parking_spaces" class="col-xs-5 control-label">车位:</label>
<input type="text" name="street" value="{{result.street}}" class="form-control"> <p class="col-xs-7">
<input type="text" name="parking_spaces" value="{{result.parking_spaces}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="traffic">交通线路:</label> <label for="mortgage" class="col-xs-5 control-label">抵押:</label>
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control" style="width:80%;"> <p class="col-xs-7">
<input type="text" name="mortgage" value="{{result.mortgage}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br /> {% endif %}
<div class="row">
<div class="col-md-6"> <div class="row form-group">
<label for="periphery">周边配套:</label> <div class="col-xs-8">
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control"> <label for="matching_facilities" class="col-xs-2 control-label">设施:</label>
<p class="col-xs-10">
<input type="text" name="matching_facilities" value="{{result.matching_facilities}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="location">地域坐标:</label> <label for="location" class="col-xs-5 control-label">地域坐标:</label>
<p class="col-xs-7">
<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">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-12"> <div class="col-xs-8">
<label for="matching_facilities">设施:</label> <label for="overview" class="col-xs-2 control-label">房源点评:</label>
<input type="text" name="matching_facilities" value="{{result.matching_facilities}}" class="form-control" style="width:80%;"> <p class="col-xs-10">
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea>
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> {% if not houseId %}
<div class="col-md-12"> <div class="row form-group">
<label for="overview">房源点评:</label> <div class="col-xs-4 ">
<textarea name="overview" rows="4" cols="60" class="form-control" >{{result.overview}}</textarea> <label for="owner_name" class="col-xs-5 control-label">业主姓名:</label>
<p class="col-xs-7">
<input name="owner_name" id="owner_name" type="text" value="" class="form-control">
</p>
</div>
<div class="col-xs-4">
<label for="owner_phone" class="col-xs-5 control-label">业主电话:</label>
<p class="col-xs-7">
<input name="owner_phone" id="owner_phone" type="text" value="" class="form-control">
</p>
</div> </div>
</div> </div>
{% endif %}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
margin: 20px 0; margin: 20px 0;
} }
</style> </style>
<h2>诚信宣言</h2> <h2>我的设置</h2>
<p> <p>
<label for="time">入职时间:</label> <label for="time">入职时间:</label>
<input type="date" id="time" value="{{ time }}"> <input type="date" id="time" value="{{ time }}">
......
//城市区域联动
function setCity(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var baseArea = $("#"+areaSelector);
var basePlate = $("#"+plateSelector);
baseArea.find('option:not(:first-child)').remove();
basePlate.find('option:not(:first-child)').remove();
//城市联动区域
searchCity(cityId,baseArea)
}
//区域联动板块
function setArea(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var areaId = $("#"+areaSelector).val();
var basePlate = $("#"+plateSelector);
basePlate.find('option:not(:first-child)').remove();
searchArea(cityId,areaId,basePlate);
}
//搜索城市的方法
function searchCity(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//搜索区域的方法
function searchArea(cityId,areaId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,optionId);
}
});
}
function existsCancel(){
$("#preview,#houseImg,#feature,#mark").on("click",".existsCancel,.featureCancel",function(){
$(this).parent().remove();
});
}
//租房与二手房中钥匙与车库的选项
function setCheckBox(){
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
}
//控制当二手房租房中钥匙与车库被勾选时,后面的文本域可使用
function textDisable(checkId,textId){
if($('input[id="'+checkId+'"]:checked').length > 0){
$("#"+textId).removeAttr("disabled");
}else{
$("#"+textId).attr("disabled","true");
}
}
//搜索置业顾问的方法
//function searchConsultant(consulCityId,consultantName){
// $.ajax({
// type: "GET",
// url: "/tospur/wp-admin/admin-ajax.php",
// data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
// success:function(json){
// for(var i = 0; i <=json.length-1; i++){
// var name = json[i]["consultantName"];
// var imgUrl = json[i]["imageUrl"];
// var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
// var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
// $("#consultantList").append(li);
// }
// }
// });
//}
//往给定id的select中添加option
function addOption(json,select){
var selectId = select.attr("id");
//select.find('option:not(:first-child)').remove();
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId.indexOf("creage") > -1|| selectId.indexOf("rice") > -1){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
//控制推荐房源与置业顾问的个数
function controlCommand(id,number,type){
var num = $("#"+id+" > p").length;
if(num>number){
if(type==0){
alert("最多只能推荐3个房源");
}else if(type==1){
alert("您只能推荐一位置业顾问");
}
$("#"+id).find("p:last-child").remove();
}
}
function getUrlParmas(){
var href = location.search.substr(1,location.search.length-1);
var params = href.split("&");
var map = {};
for(item in params){
var key = params[item].split("=")[0] || "";
var value = params[item].split("=")[1] || "";
map[key] = value;
}
return map;
}
function setDate(id){
$("#"+id).datepicker({
dateFormat: "yy-mm-dd"
});
}
//建筑年代的下拉框
function setAge(){
for(var i = 1981; i<= 2020; i++){
var option = $("<option>").append(i);
$("#pageAge").append(option);
}
}
//租房二手房中,修改界面下拉框的信息还原
function revertOption(data){
$.each(data,function(i,item){
$("form").find("select[name='"+i+"']").val(item);
});
}
//搜索面积的方法
function searchAcreage(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//搜索单价的方法
function searchPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchUnitPriceRange&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchTotalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTotalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchRentalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchRentalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function search_form_set_page(){
var search_flag = false;
var search_form = $('#search_form');
$('form').submit(function () {
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) {
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');
}
});
}
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');
}
});
}
{% block listBlock %} {% block listBlock %}
<div class="wrap"> <div class="wrap">
<h2> {% if house_type == 0%}新房列表{% elseif house_type == 1 %}二手房列表{% else %}租房房列表{% endif %}</h2> <h2> {% if house_type == 0%}新房列表{% elseif house_type == 1 %}二手房列表{% else %}租房房列表{% endif %}</h2>
<form id="scores-filter" method="GET"> <form id="scores-filter" method="GET" class="form-inline">
<br />
{% include 'selectOrganization.html' %}
<!-- For plugins, we also need to ensure that the form posts back to our current page --> <!-- For plugins, we also need to ensure that the form posts back to our current page -->
<div style="margin-bottom: 10px;">
<input type="hidden" name="page" value="{{page}}"/> <input type="hidden" name="page" value="{{page}}"/>
<select id="listCity" name="listCity"> <select id="listCity" name="listCity" class="form-control">
<option value="0"> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="listDistrict" name="listDistrict"> <select id="listDistrict" name="listDistrict" class="form-control">
<option value="0">区域</option> <option value="-1">区域</option>
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<select id="listPlate" name="listPlate"> <select id="listPlate" name="listPlate" class="form-control">
<option value="0">板块</option> <option value="-1">板块</option>
{% if plate %} {% if plate %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
...@@ -27,7 +30,7 @@ ...@@ -27,7 +30,7 @@
{% endif %} {% endif %}
</select> </select>
{% if house_type == 2%} {% if house_type == 2%}
<select id="rentalPrice" name="rentalPrice"> <select id="rentalPrice" name="rentalPrice" class="form-control">
<option value ="">租金</option> <option value ="">租金</option>
{% if dicRentalPrice %} {% if dicRentalPrice %}
{% for item in dicRentalPrice %} {% for item in dicRentalPrice %}
...@@ -35,8 +38,13 @@ ...@@ -35,8 +38,13 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
{% elseif house_type == 0 %}
<select id="averagePrice" name="averagePrice" class="form-control">
<option value ="">单价</option>
<!--<option {{ item.value == average_price ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>-->
</select>
{% else%} {% else%}
<select id="totalPrice" name="totalPrice"> <select id="totalPrice" name="totalPrice" class="form-control">
<option value ="">价格</option> <option value ="">价格</option>
{% if dicTotalPrice %} {% if dicTotalPrice %}
{% for item in dicTotalPrice %} {% for item in dicTotalPrice %}
...@@ -46,20 +54,20 @@ ...@@ -46,20 +54,20 @@
</select> </select>
{% endif %} {% endif %}
{% if house_type == 0%} {% if house_type == 0%}
<select id="room" name="room"> <select id="room" name="room" class="form-control">
<option value="0">类型</option> <option value="-1">类型</option>
{% for item in room %} {% for item in room %}
<option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
{% endif %} {% endif %}
<select id="buildProperty" name="buildProperty"> <select id="buildProperty" name="buildProperty" class="form-control">
<option value="0"> 房型</option> <option value="-1"> 房型</option>
{% for item in buildProperty %} {% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="acreage" name="acreage"> <select id="acreage" name="acreage" class="form-control">
<option value ="">面积</option> <option value ="">面积</option>
{% if acreage %} {% if acreage %}
{% for item in dicArea %} {% for item in dicArea %}
...@@ -67,19 +75,29 @@ ...@@ -67,19 +75,29 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<select name="status" name="status"> <select name="status" name="status" class="form-control">
<option value="-1">状态</option> <option value="-1">状态</option>
{% for item in status%} {% for item in status%}
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<input type="text" placeholder="请出入楼盘名" name="searchText"> </div>
<div id="organization" style="margin-bottom: 10px;">
<label for="endDate">楼盘名:</label>
<input type="text" name="searchText" class="form-control">
<label for="beginDate" >开始日期:</label>
<input type="date" name="beginDate" class="form-control" {% if req %}value="{{req.beginDate}}"{% endif %}>
<label for="endDate">结束日期:</label>
<input type="date" name="endDate" class="form-control" {% if req %}value="{{req.endDate}}"{% endif %}>
<label for="stuff">员工:</label>
<input type="text" name="stuff" class="form-control" {% if req %}value="{{req.stuff}}"{% endif %}>
<input type="hidden" name="hasSearch" value="1"/> <input type="hidden" name="hasSearch" value="1"/>
<input type="hidden" id="house_type" value="{{house_type}}"/> <input type="hidden" id="house_type" value="{{house_type}}"/>
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
<!-- Now we can render the completed list table --> </div>
</form> </form>
<form method="post"> <form method="post">
<!-- Now we can render the completed list table -->
{% if house_type == 0 %} {% if house_type == 0 %}
{{function("addNewHouseTable")}} {{function("addNewHouseTable")}}
{% elseif house_type == 1%} {% elseif house_type == 1%}
...@@ -98,6 +116,7 @@ ...@@ -98,6 +116,7 @@
var acreage =$("#acreage"); var acreage =$("#acreage");
var totalPrice = $("#totalPrice"); var totalPrice = $("#totalPrice");
var rentalPrice = $("#rentalPrice"); var rentalPrice = $("#rentalPrice");
var averagePrice = $("#averagePrice");
$("#listCity").change(function() { $("#listCity").change(function() {
var cityId = $("#listCity").val(); var cityId = $("#listCity").val();
setCity("listCity", "listDistrict", "listPlate"); setCity("listCity", "listDistrict", "listPlate");
...@@ -109,7 +128,10 @@ ...@@ -109,7 +128,10 @@
//城市联动房子价格 //城市联动房子价格
if ($("#house_type").val() == 2) { if ($("#house_type").val() == 2) {
searchRentalPrice(cityId, rentalPrice); searchRentalPrice(cityId, rentalPrice);
}else{ }else if($("#house_type").val() == 0){
searchPrice(cityId,averagePrice);
}
else{
searchTotalPrice(cityId,totalPrice); searchTotalPrice(cityId,totalPrice);
} }
}); });
...@@ -123,6 +145,17 @@ ...@@ -123,6 +145,17 @@
{% elseif house_type == 2 %} {% elseif house_type == 2 %}
allot_consultant('renthouselist'); allot_consultant('renthouselist');
{% endif %} {% endif %}
$('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 + '">');
}
});
}); });
})(jQuery); })(jQuery);
</script> </script>
......
<div id="preview"> <div id="preview">
<table class="form-table">
<tbody>
<tr>
<th style="width:11.7%"><label for="traffic" style="margin-left: 30px">主力房源:</label></th>
<td>
<input type="file" name="files[0]" property="0" class = "files form-control"multiple style="width: 30%;">
</td>
</tr>
</tbody>
</table>
{% set exists_ids = "" %} {% set exists_ids = "" %}
{% for item in mainImage %} {% for item in mainImage %}
{% if exists_ids != "" %} {% if exists_ids != "" %}
...@@ -7,7 +17,7 @@ ...@@ -7,7 +17,7 @@
{% set exists_ids = exists_ids~item.id %} {% set exists_ids = exists_ids~item.id %}
<div> <div>
<img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px;margin-top:10px"> <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px;margin-top:10px">
<select name="exists[{{item.id}}][buildProperty]" style="margin-right: 50px"> <select name="exists[{{item.id}}][buildProperty]" style="margin-right: 50px;width: 10%;display: inline-block" class="form-control">
{% for i in buildProperty %} {% for i in buildProperty %}
<option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option> <option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option>
{% endfor %} {% endfor %}
...@@ -16,9 +26,11 @@ ...@@ -16,9 +26,11 @@
<input type="button" value="删除" class="button action cancel existsCancel" style="margin-top: 30px"> <input type="button" value="删除" class="button action cancel existsCancel" style="margin-top: 30px">
</div> </div>
{% endfor %} {% endfor %}
<p></p> <p></p>
<input type="hidden" name="exists_ids" value="{{exists_ids}}" > <input type="hidden" name="exists_ids" value="{{exists_ids}}" >
<input type="file" name="files[0]" property="0" class = "files"multiple class="browser button button-hero">
</div> </div>
<script> <script>
...@@ -38,12 +50,12 @@ ...@@ -38,12 +50,12 @@
function mainHouse(input,i){ function mainHouse(input,i){
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (e) { reader.onload = function (e) {
var img = $("<img>").attr({"id":"target","src":e.target.result,"height":90,"width":140,"style":"margin-right:50px;margin-top:10px"}); var img = $("<img>").attr({"id":"target","src":e.target.result,"height":90,"width":140,"style":"margin-right:50px;margin-top:10px;"});
var button = $("<input>").attr({"type":"button","value":"删除","property":+i,"id":+i}).addClass("button action cancel"); var button = $("<input>").attr({"type":"button","value":"删除","property":+i,"id":+i}).addClass("button action cancel");
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i}); var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i});
var mainHousePic = $("<input>").attr({"type":"hidden","name":"data["+i+"][mainHouse]","value":0,"property":+i}); var mainHousePic = $("<input>").attr({"type":"hidden","name":"data["+i+"][mainHouse]","value":0,"property":+i});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files"); var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files form-control").css("width","20%");
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px"}); var select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px;width:10%;display:inline-block"}).addClass("form-control");
{% for item in buildProperty %} {% for item in buildProperty %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%} {% endfor%}
......
<br /> <br />
<div class="row"> {% include 'weixin.html' %}
<div class="col-md-12"> <br/>
<label for="housename">城市:</label> <div class="row form-group">
<select id="baseCity" name="baseCity" class="form-control"> <div class="col-xs-4">
<label for="baseCity" class=" control-label col-xs-3" >城市:</label>
<p class="col-xs-3">
<select id="baseCity" name="baseCity" class="form-control" style="width:75px;">
<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>
{% endfor %} {% endfor %}
</select> </select>
<select id="baseAreaId" name="baseAreaId" class="form-control"> </p>
<p class="col-xs-3">
<select id="baseAreaId" name="baseAreaId" class="form-control" style="width:90px; margin-left:5px">
<option value = "-1">区域</option> <option value = "-1">区域</option>
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
...@@ -16,7 +21,9 @@ ...@@ -16,7 +21,9 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<select id="basePlateId" name="basePlateId" class="form-control"> </p>
<p class="col-xs-3">
<select id="basePlateId" name="basePlateId" class="form-control" style="width:90px; margin-left: 25px">
<option value = "-1">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
...@@ -24,49 +31,58 @@ ...@@ -24,49 +31,58 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
</p>
</div> </div>
</div> <div class="col-xs-4 ">
<br /> <label for="address" class="control-label col-xs-5">小区名称:</label>
<div class="row"> <p class="col-xs-7">
<div class="col-md-12">
<label for="address">地址:</label>
<input name="address" type="text" value="{{result.address}}" class="form-control" style="width:80%;">
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="address">小区名称:</label>
<input name="community_name" type="text" value="{{result.community_name}}" class="form-control"> <input name="community_name" type="text" value="{{result.community_name}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="developers">开发商:</label> <label for="address" class="control-label col-xs-5" >地址:</label>
<input name="developers" type="text" value="{{result.developer}}" class="form-control" > <p class="col-xs-7">
<input name="address" type="text" value="{{result.address}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4">
<label for="check_in_time">入住时间:</label> <label for="developers" class="col-xs-5 control-label">开发商:</label>
<input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" > <p class="col-xs-7">
</div> <input name="developers" type="text" value="{{result.developer}}" class="form-control">
<div class="col-md-6"> </p>
<label for="property_age">产权年限:</label> </div>
<input name="property_age" type="text" value="{{result.property_age}}" class="form-control" > <div class="col-xs-4 ">
<label for="check_in_time" class="col-xs-5 control-label">入住时间:</label>
<p class="col-xs-7">
<input name="check_in_time" id="checkin" type="date" value="{{result.check_in_time}}" class="form-control" >
</p>
</div>
<div class="col-xs-4 ">
<label for="property_age" class="col-xs-5 control-label">产权年限:</label>
<p class="col-xs-7">
<input name="property_age" type="text" value="{{result.property_age}}" class="form-control">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="developers">建筑类型:</label> <label for="developers" class="col-xs-5 control-label">建筑类型:</label>
<p class="col-xs-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>
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="decoration">装修程度:</label> <label for="decoration" class="col-xs-5 control-label">装修程度:</label>
<p class="col-xs-7">
<select name="decoration" class="form-control"> <select name="decoration" class="form-control">
<option value="毛坯">毛坯</option> <option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option> <option value="简单装修">简单装修</option>
...@@ -74,78 +90,99 @@ ...@@ -74,78 +90,99 @@
<option value="精装修">精装修</option> <option value="精装修">精装修</option>
<option value="豪华装修">豪华装修</option> <option value="豪华装修">豪华装修</option>
</select> </select>
</p>
</div> </div>
</div> <div class="col-xs-4">
<br /> <label for="households" class="col-xs-5 control-label">规划户数:</label>
<div class="row"> <p class="col-xs-7">
<div class="col-md-6">
<label for="covered_area">建筑面积:</label>
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" >平方米
</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" >
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4">
<label for="volume_rate">容积率:</label> <label for="covered_area" class="col-xs-5 control-label">建筑面积:</label>
<p class="col-xs-6">
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control">
</p>
<p class="col-xs-1" style="margin-top: 10px">
&nbsp;m<sup>2</sup>
</p>
</div>
<div class="col-xs-4">
<label for="volume_rate" class="col-xs-5 control-label">容积率:</label>
<p class="col-xs-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">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4">
<label for="greening_rate">绿化率:</label> <label for="greening_rate" class="col-xs-5 control-label">绿化率:</label>
<p class="col-xs-7">
<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" >
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="property_management">物业公司:</label></th> <label for="property_management" class="col-xs-5 control-label">物业公司:</label>
<p class="col-xs-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> </p>
<div class="col-md-6"> </div>
<label for="property_money">物业费:</label> <div class="col-xs-4 ">
<input name="property_money" type="text" value="{{result.property_money}}" class="form-control"> <label for="property_money" class="col-xs-5 control-label">物业费:</label>
</div> <p class="col-xs-6">
</div> <input name="property_money" type="text" value="{{result.property_money}}" class="form-control" >
<br /> </p>
<div class="row"> <p style="margin-top: 10px">
<div class="col-md-6"> &nbsp;
<label for="parking_spaces">车位数:</label> </p>
</div>
<div class="col-xs-4">
<label for="parking_spaces" class="col-xs-5 control-label">车位数:</label>
<p class="col-xs-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> </p>
<div class="col-md-6">
<label for="periphery">周边配套:</label>
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="traffic">交通线路:</label> <label for="periphery" class="col-xs-5 control-label">周边配套:</label>
<p class="col-xs-7">
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control" >
</p>
</div>
<div class="col-xs-4 ">
<label for="traffic" class="col-xs-5 control-label">交通线路:</label>
<p class="col-xs-7">
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control"> <input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</p>
</div> </div>
<div class="col-md-6"> <div class="col-xs-4 ">
<label for="location">地域坐标:</label> <label for="location" class="col-xs-5 control-label">地域坐标:</label>
<p class="col-xs-7">
<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">
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-12"> <div class="col-xs-8">
<label for="overview">最新动态:</label> <label for="latest_news" class="col-xs-2 control-label">最新动态:</label>
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea> <p class="col-xs-10">
<textarea name="latest_news" rows="4" cols="60" class="form-control">{{result.latest_news}}</textarea>
</p>
</div> </div>
</div> </div>
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-12"> <div class="col-xs-8">
<label for="overview">楼盘概述:</label> <label for="overview" class="col-xs-2 control-label" >楼盘概述:</label>
<p class="col-xs-10">
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea> <textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea>
</p>
</div> </div>
</div> </div>
...@@ -13,18 +13,20 @@ ...@@ -13,18 +13,20 @@
<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-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="#mainHouse" aria-controls="mainHouse" 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="#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">
...@@ -35,44 +37,52 @@ ...@@ -35,44 +37,52 @@
{% else %} {% else %}
{% include 'newHouseInfo.html' %} {% include 'newHouseInfo.html' %}
{% endif %} {% endif %}
</div>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div> </div>
<div role="tabpanel" class="tab-pane" id="mainHouse"> <div role="tabpanel" class="tab-pane" id="mainHouse">
<br/>
{% include 'mainHouse.html' %} {% include 'mainHouse.html' %}
</div> <br/>
<div role="tabpanel" class="tab-pane" id="photos">
{% include 'photos.html' %} {% include 'photos.html' %}
</div> <br/>
<div role="tabpanel" class="tab-pane" id="addRecHouse">
{% include 'addRecHouse.html' %} {% include 'addRecHouse.html' %}
</div> <br/>
<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;">
<select id="status" name="status"> {% if houseId %}
{% if canApproval %}
{% if result.approval != -2 %}
<select name="status" class="form-control">
<option value="{{result.approval}}">通过</option>
<option value="-2">退回</option>
</select>
<input type="hidden" name="userType" value="0">
{% endif %}
{% else %}
<select name="status" class="form-control">
{% 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> <input type="hidden" name="userType" value="{{houseId}}">
{% endif %}
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px"> <input type="submit" id="submit" class="button action" style="float:left">
</div>
</div> </div>
</div> </div>
</form> </form>
...@@ -84,7 +94,9 @@ ...@@ -84,7 +94,9 @@
<!-- 置业顾问弹出层 --> <!-- 置业顾问弹出层 -->
{% include 'recConsultant.html' %} {% include 'recConsultant.html' %}
{{ block('recConsultant') }} {{ block('recConsultant') }}
<!-- 特色房源弹出层 -->
{% include 'addTag.html' %}
{{ block('addTag') }}
<script> <script>
(function($){ (function($){
...@@ -95,7 +107,6 @@ ...@@ -95,7 +107,6 @@
$("#baseAreaId").change(function(){ $("#baseAreaId").change(function(){
setArea("baseCity","baseAreaId","basePlateId"); setArea("baseCity","baseAreaId","basePlateId");
}); });
setDate("checkin");
var json = {"decoration":"{{result.decoration}}"}; var json = {"decoration":"{{result.decoration}}"};
revertOption(json); revertOption(json);
$('#newHouse').validate({ $('#newHouse').validate({
...@@ -109,7 +120,7 @@ ...@@ -109,7 +120,7 @@
community_name:'required', community_name:'required',
address:'required', address:'required',
average_price:'required', average_price:'required',
latest_news:'required', description:'required',
baseCity:{ baseCity:{
citySelectcheck: true citySelectcheck: true
}, },
...@@ -126,7 +137,8 @@ ...@@ -126,7 +137,8 @@
community_name:'请输入小区名称', community_name:'请输入小区名称',
address:'请输入地址', address:'请输入地址',
average_price:'请输入均价', average_price:'请输入均价',
latest_news:'请输入最新动态'
description:'请输入跟进说明'
}, },
errorContainer: "#messageBox1", errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1", errorLabelContainer: "#messageBox1",
...@@ -135,8 +147,12 @@ ...@@ -135,8 +147,12 @@
alert("请选择房源相册"); alert("请选择房源相册");
return false; return false;
} }
if($("#houseImg > p").length == 0){ if($("#consultantImg > p").length == 0){
alert("请选择推荐房源"); alert("请选择置业顾问");
return false;
}
if($("#photosTbody > tr").length == 0){
alert("请选择房源相册");
return false; return false;
} }
form.submit(); form.submit();
......
<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
<table class="form-table"> <div class="row" id="addPhotos">
<thead> <div class="col-md-12">
<tr> <table class="form-table" style="margin-left: 30px">
<th>类型</th> <thead >
<tr >
<th >类型</th>
<th>相册</th> <th>相册</th>
<th>设为封面</th> <th>设为封面</th>
<th></th> <th></th>
...@@ -31,15 +33,16 @@ ...@@ -31,15 +33,16 @@
<td> <td>
<input type="button" value="删除" class="button action cancel existsCancel"> <input type="button" value="删除" class="button action cancel existsCancel">
</td> </td>
</div>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" > <input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
<button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px"> <button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px;margin-left: 30px">
新增 新增
</button> </button>
</div>
</div>
<script> <script>
(function($){ (function($){
...@@ -48,7 +51,7 @@ ...@@ -48,7 +51,7 @@
$("#housePicture").click(function(){ $("#housePicture").click(function(){
var tr = $("<tr>"); var tr = $("<tr>");
var td = $("<td>"); var td = $("<td>");
var select = $("<select>").attr({"name":"data["+i+"][type]"}).addClass("form-control"); var select = $("<select>").attr({"name":"data["+i+"][type]"}).addClass("form-control").css("width","30%");
{% for item in photoType %} {% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%} {% endfor%}
...@@ -60,7 +63,7 @@ ...@@ -60,7 +63,7 @@
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i}).addClass("form-control"); var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i}).addClass("form-control");
var td3 = td.clone().append(radio); var td3 = td.clone().append(radio);
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel form-control"); var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
var td4 = td.clone().append(picDelet); var td4 = td.clone().append(picDelet);
tr.append(td1).append(td2).append(td3).append(td4); tr.append(td1).append(td2).append(td3).append(td4);
......
<div class="wrap">
<h2>{{req.name}}{{req.year}}年{{req.month}}月业绩列表</h2>
{{function("QuotaYearList::displayMonthTable")}}
</div>
<script>
$(document).ready(function () {
$("#the-list").on("click","td > .button.action",function(){
var price = $(this).prev().val();
var id = $(this).prev().attr("name");
var params = {
action:"replaceQuota",
year:{{req.year}},
month:{{req.month}},
id:id,
price:price
};
$.ajax({
type: "post",
url: "admin-ajax.php",
data: params,
success:function(json){
if(json.code == 200)
alert("设置业绩目标成功");
else
alert(json.msg);
}
});
});
});
</script>
\ No newline at end of file
<div class="wrap">
<h2>业绩列表</h2>
<form method="get">
<input type="hidden" name="page" value="quotaList">
{% include 'selectOrganization.html' %}
<div id="search_form">
<select name="year" id="year">
<option value="2015">2015</option>
<option value="2016">2016</option>
</select>
<input type="submit" id="submit" class="button action" value="搜索">
<!--
<select name="month" id="month">
<option value="1">一月</option>
<option value="2">二月</option>
<option value="3">三月</option>
<option value="4">四月</option>
<option value="5">五月</option>
<option value="6">六月</option>
<option value="7">七月</option>
<option value="8">八月</option>
<option value="9">九月</option>
<option value="10">十月</option>
<option value="11">十一月</option>
<option value="12">十二月</option>
</select>
-->
</div>
</form>
{{function("QuotaYearList::displayYearTable")}}
</div>
<script>
$(document).ready(function () {
{% if req %}
$("#year").val({{req.year}});
{% endif %}
$('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
...@@ -13,61 +13,64 @@ ...@@ -13,61 +13,64 @@
<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-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="#photos" aria-controls="photos" 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="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
<li role="presentation"><a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a></li> </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>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="owner">
{% include 'owner.html' %}
</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="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;">
<div class="row" style="position: fixed;top:200px;"> {% if houseId %}
<select id="status" name="status"> {% if canApproval %}
{% if result.approval != -2 %}
<select name="status" class="form-control">
<option value="{{result.approval}}">通过</option>
<option value="-2">退回</option>
</select>
<input type="hidden" name="userType" value="0">
{% endif %}
{% else %}
<select name="status" class="form-control">
{% 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> <input type="hidden" name="userType" value="{{houseId}}">
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px"> {% endif %}
<input type="submit" id="submit" class="button action" style="float:left">
</div>
</div> </div>
</div> </div>
</form> </form>
...@@ -94,9 +97,6 @@ ...@@ -94,9 +97,6 @@
}); });
setCheckBox(); setCheckBox();
setAge(); setAge();
setDate("entrustDay");
setDate("deadLine");
var json = { var json = {
"faceto":"{{result.faceto}}", "faceto":"{{result.faceto}}",
"age":"{{result.age}}", "age":"{{result.age}}",
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
mark:'required', mark:'required',
rent:'required', rent:'required',
community_name:'required', community_name:'required',
description:'required',
baseCity:{ baseCity:{
citySelectcheck: true citySelectcheck: true
}, },
...@@ -144,7 +145,8 @@ ...@@ -144,7 +145,8 @@
owner_name:'请输入业主姓名', owner_name:'请输入业主姓名',
owner_phone:'请输入业主电话', owner_phone:'请输入业主电话',
rent:'请输入租金', rent:'请输入租金',
community_name:'请输入小区名称' community_name:'请输入小区名称',
description:'请输入跟进说明'
}, },
errorContainer: "#messageBox1", errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1", errorLabelContainer: "#messageBox1",
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
{% set unit = '元/月' %} {% set unit = '元/月' %}
{% set price = '租金' %} {% set price = '租金' %}
{% endif %} {% endif %}
<div class="sale_detail"> <form method="post">
<div class="sale_detail">
<h2>房东服务详细</h2> <h2>房东服务详细</h2>
<ul> <ul>
<li> <li>
...@@ -65,17 +66,18 @@ ...@@ -65,17 +66,18 @@
<span>房源描述:</span> <span>房源描述:</span>
<span>{{ detail_result.description }}</span> <span>{{ detail_result.description }}</span>
</li> </li>
<li>
<span>置业顾问:</span>
<span>
<select id="consultant">
{% for consultant in consultant_result %}
<option value="{{ consultant.id }}"{% if(house_result.consultant_id == consultant.id) %} selected="selected"{% endif %}>{{ consultant.display_name }}</option>
{% endfor %}
</select>
<label for="consultant"></label>
</span>
</li>
</ul> </ul>
</div> {% if role_flag %}
<button id="handle">提交处理</button> {% include 'addConsultant.html' %}
\ No newline at end of file <input type="hidden" name="submit" value="1">
<input type="hidden" id="baseCity" value="{{ cityId }}">
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
{% else %}
<input type="hidden" name="handle" value="1">
{% endif %}
{% if handle == 0 %}
<input type="submit" id="submit" class="button action" value="提交处理">
{% endif %}
</div>
</form>
\ No newline at end of file
...@@ -16,65 +16,65 @@ ...@@ -16,65 +16,65 @@
</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-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="#photos" aria-controls="photos" 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="#customer_tracking" aria-controls="customer_tracking" 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>
</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>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="owner">
{% include 'owner.html' %}
</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' %}
</div>
<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="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;">
<select id="status" name="status"> {% if houseId %}
{% if canApproval %}
{% if result.approval != -2 %}
<select name="status" class="form-control">
<option value="{{result.approval}}">通过</option>
<option value="-2">退回</option>
</select>
<input type="hidden" name="userType" value="0">
{% endif %}
{% else %}
<select name="status" class="form-control">
{% 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> <input type="hidden" name="userType" value="{{houseId}}">
{% endif %} {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px"> {% endif %}
<input type="submit" id="submit" class="button action" style="float:left">
</div>
</div> </div>
</div> </div>
</form> </form>
...@@ -101,8 +101,6 @@ ...@@ -101,8 +101,6 @@
}); });
setCheckBox(); setCheckBox();
setAge(); setAge();
setDate("entrustDay");
setDate("deadLine");
var json = { var json = {
"faceto":"{{result.faceto}}", "faceto":"{{result.faceto}}",
"age":"{{result.age}}", "age":"{{result.age}}",
...@@ -125,6 +123,7 @@ ...@@ -125,6 +123,7 @@
community_name:'required', community_name:'required',
average_price:'required', average_price:'required',
latest_news:'required', latest_news:'required',
description:'required',
baseCity:{ baseCity:{
citySelectcheck: true citySelectcheck: true
}, },
...@@ -152,7 +151,8 @@ ...@@ -152,7 +151,8 @@
owner_phone:'请输入业主电话', owner_phone:'请输入业主电话',
total_price:'请输入售价', total_price:'请输入售价',
community_name:'请输入小区名称', community_name:'请输入小区名称',
average_price:'请输入单价' average_price:'请输入单价',
description:'请输入跟进说明'
}, },
errorContainer: "#messageBox1", errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1", errorLabelContainer: "#messageBox1",
......
{% set organization = function('SearchDao::searchOrganization')|json_encode() %} {% set organization = function('SearchDao::searchOrganization')|json_encode() %}
<div id="organization" style="margin-bottom: 10px;"> <div id="organization" style="margin-bottom: 10px;">
<span>门店</span> <label>部门:</label>
<label for="depth_1" class="hidden"></label> <label for="depth_1" class="hidden"></label>
<select data-depth="1" id="depth_1"> <select data-depth="1" id="depth_1">
<option value="-1">请选择</option> <option value="-1">请选择</option>
......
<br />
<div class="row"> <div class="row form-group">
<div class="col-md-12"> <div class="col-xs-4">
<label for="housename">标题:</label> <label for="housename" class="col-xs-5 control-label" >微信标题:</label>
<p class="col-xs-7">
<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" >
</p>
</div>
{% if house_type == 0 %}
<div class="col-xs-4">
<label for="average_price" class="col-xs-5 control-label">均价:</label>
<p class="col-xs-6">
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control">
</p>
<p class="col-xs-1" style="margin-top: 10px">
&nbsp;
</p>
</div> </div>
{% endif %}
</div> </div>
<br />
<table class="form-table"> <table class="form-table">
<tbody> <tbody >
<tr> <tr>
<th><label for="mark">标签</label></th> <th style="width:11.9%"><label for="mark" style="margin-left: 42px">标签:</label></th>
<td> <td>
<div id="mark" class="row"> <div id="mark" class="row">
</div><br/> </div>
<button type="button" class="button action" id="addTagBtn"> <button type="button" class="button action" id="addTagBtn">
标签 标签
</button> </button>
...@@ -30,7 +42,6 @@ ...@@ -30,7 +42,6 @@
addTag(item.tag_id, item.name); addTag(item.tag_id, item.name);
}); });
{% endif %} {% endif %}
var tagArray = []; var tagArray = [];
$('#addTagBtn').click(function(){ $('#addTagBtn').click(function(){
init_modal_addTag(0, function (id, value) { init_modal_addTag(0, function (id, value) {
......
...@@ -28,6 +28,9 @@ class Config { ...@@ -28,6 +28,9 @@ 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';
const TOSPUR_QUOTA_TABLE = 'tospur_quota';
//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,branchName,ioType from ".Config::TOSPUR_COMMISSION." tcom
left join (SELECT tct.id,imageUrl,tct.name,ton.name as branchName from ".Config::TOSPUR_CONSULTANT." tct
left JOIN ".Config::TOSPUR_ORGANIZATION_TABLE." ton on ton.id = tct.subsidiaryId) tc
on tcom.consultantId = tc.id where tcom.contractId = %d order by ioType;";
$result = $wpdb->get_results($wpdb->prepare($sql,$contractId));
return $result;
}
public static function search_commission_log($commissionIds){
global $wpdb;
$sql = " SELECT tcl.id,time,paid,ioType from tospur_commission_log tcl
left join tospur_commission tc on tc.id = tcl.commissionId
where tcl.commissionId in (".$commissionIds.");";
$result = $wpdb->get_results($sql);
return $result;
}
public static function search_tospur_commission($contractId){
global $wpdb;
$sql = "select id,accounts,type from ".Config::TOSPUR_COMMISSION."
where contractId = %d";
$result = $wpdb->get_results($wpdb->prepare($sql,$contractId));
return $result;
}
}
...@@ -4,11 +4,12 @@ class ContractDao { ...@@ -4,11 +4,12 @@ class ContractDao {
public static function insert($params){ public static function insert($params){
global $wpdb; global $wpdb;
$wpdb->insert(Config::TOSPUR_CONTRACT,$params); $wpdb->insert(Config::TOSPUR_CONTRACT,$params);
if($wpdb->insert_id){ if($wpdb->last_error){
return $wpdb->insert_id;
}
return $wpdb->last_error; return $wpdb->last_error;
} }
print_r($wpdb->last_error);
return $wpdb->insert_id;
}
public static function setContractId($id,$contractId){ public static function setContractId($id,$contractId){
global $wpdb; global $wpdb;
......
...@@ -46,6 +46,18 @@ class CustomerDao ...@@ -46,6 +46,18 @@ class CustomerDao
$result = $wpdb->get_results($wpdb->prepare($sql, $search,$search)); $result = $wpdb->get_results($wpdb->prepare($sql, $search,$search));
wp_send_json($result); wp_send_json($result);
} }
public static function updateCustomerStatue($id,$status){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CUSTOMER_TABLE,array(
'status' => $status,
),array(
'id' => $id
));
if($wpdb->last_error)
return $wpdb->last_error;
return $result;
}
} }
?> ?>
\ No newline at end of file
...@@ -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()
......
...@@ -3,16 +3,15 @@ ...@@ -3,16 +3,15 @@
class InsertDao{ class InsertDao{
public static function insert_tospur_house($params){ public static function insert_tospur_house($params){
global $wpdb; global $wpdb;
$houseRes = $wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params); $wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
$houseId = $wpdb->insert_id; $houseId = $wpdb->insert_id;
if(!InsertDao::setHouseNumber($houseId,$params['house_type'],$params['city_id'])){ if(!InsertDao::setHouseNumber($houseId,$params['house_type'],$params['city_id'])){
return 510; return "房源代码生成失败";
} }
if($houseRes){
return $houseId; return $houseId;
}else{
return 500;
}
} }
public static function setHouseNumber($houseId,$houseType,$cityId){ public static function setHouseNumber($houseId,$houseType,$cityId){
...@@ -41,52 +40,47 @@ class InsertDao{ ...@@ -41,52 +40,47 @@ class InsertDao{
public static function insert_tospur_image($params){ public static function insert_tospur_image($params){
global $wpdb; global $wpdb;
$imgRes = $wpdb->insert(Config::TOSPUR_IMAGE_TABLE, $params); $wpdb->insert(Config::TOSPUR_IMAGE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
$imgId = $wpdb->insert_id; $imgId = $wpdb->insert_id;
if($imgRes){
return $imgId; return $imgId;
}else{
return 501;
}
} }
public static function insert_a_district_area($params){ public static function insert_a_district_area($params){
global $wpdb; global $wpdb;
$districtAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $params); $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $params);
if($districtAreaRes){ if($wpdb->last_error){
return $districtAreaRes; return $wpdb->last_error;
}else{
return 502;
} }
return $wpdb->insert_id;
} }
public static function insert_a_house_image($params){ public static function insert_a_house_image($params){
global $wpdb; global $wpdb;
$houseImageRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $params); $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $params);
if($houseImageRes){ if($wpdb->last_error){
return $houseImageRes; return $wpdb->last_error;
}else{
return 503;
} }
return $wpdb->insert_id;
} }
public static function insert_a_house_recommend($params){ public static function insert_a_house_recommend($params){
global $wpdb; global $wpdb;
$houseImageRes = $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $params); $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $params);
if($houseImageRes){ if($wpdb->last_error){
return $houseImageRes; return $wpdb->last_error;
}else{
return 504;
} }
return $wpdb->insert_id;
} }
public static function insert_a_house_user($params){ public static function insert_a_house_user($params){
global $wpdb; global $wpdb;
$houseUserRes = $wpdb->insert(Config::A_HOUSE_USER_TABLE, $params); $wpdb->insert(Config::A_HOUSE_USER_TABLE, $params);
if($houseUserRes){ if($wpdb->last_error){
return $houseUserRes; return $wpdb->last_error;
}else{
return 505;
} }
return $wpdb->insert_id;
} }
public static function addMainImage($houseId,$data){ public static function addMainImage($houseId,$data){
...@@ -94,6 +88,7 @@ class InsertDao{ ...@@ -94,6 +88,7 @@ class InsertDao{
//图片信息 //图片信息
$uploadedfile = $_FILES['files']; $uploadedfile = $_FILES['files'];
$frontCover = $_POST["frontCover"]; $frontCover = $_POST["frontCover"];
$result = 1;
//主力房源的图片与房子信息关联插入数据库 //主力房源的图片与房子信息关联插入数据库
if(isset($uploadedfile["name"])){ if(isset($uploadedfile["name"])){
foreach($uploadedfile["name"] as $key=> $value) { foreach($uploadedfile["name"] as $key=> $value) {
...@@ -128,9 +123,9 @@ class InsertDao{ ...@@ -128,9 +123,9 @@ class InsertDao{
$imagePath = get_home_path().$url; $imagePath = get_home_path().$url;
Image::makeImage($uploadFileName,$imagePath); Image::makeImage($uploadFileName,$imagePath);
//插入图片表 //插入图片表
$imgRes = $wpdb->insert('tospur_image', $insert_image_array); $wpdb->insert('tospur_image', $insert_image_array);
if (!$imgRes) { if ($wpdb->last_error) {
return 501; return $wpdb->last_error;
} }
//获取插入图片的id //获取插入图片的id
...@@ -147,9 +142,9 @@ class InsertDao{ ...@@ -147,9 +142,9 @@ class InsertDao{
"house_area" => $data["$key"]["housearea"], "house_area" => $data["$key"]["housearea"],
"image_id" => $imgid "image_id" => $imgid
); );
$houseTypeAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea); $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if (!$houseTypeAreaRes) { if ($wpdb->last_error) {
return 502; return $wpdb->last_error;
} }
} }
//将房源id与图片id储存到关联表中 //将房源id与图片id储存到关联表中
...@@ -157,9 +152,9 @@ class InsertDao{ ...@@ -157,9 +152,9 @@ class InsertDao{
'house_id' => $houseId, 'house_id' => $houseId,
'image_id' => $imgid, 'image_id' => $imgid,
); );
$houseImgRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array); $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
if (!$houseImgRes) { if ($wpdb->last_error) {
return 503; return $wpdb->last_error;
} }
} else { } else {
return $movefile['error']; return $movefile['error'];
...@@ -168,6 +163,10 @@ class InsertDao{ ...@@ -168,6 +163,10 @@ class InsertDao{
} }
} }
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,array("frontCover_id"=>$frontCover),array("id"=>$houseId)); $wpdb->update(Config::TOSPUR_HOUSE_TABLE,array("frontCover_id"=>$frontCover),array("id"=>$houseId));
if ($wpdb->last_error) {
return $wpdb->last_error;
}
return $result;
} }
public static function addRecommend($houseId,$data){ public static function addRecommend($houseId,$data){
...@@ -179,12 +178,13 @@ class InsertDao{ ...@@ -179,12 +178,13 @@ class InsertDao{
"house_id" => $houseId, "house_id" => $houseId,
"recommend_id" =>$value "recommend_id" =>$value
); );
$a_house_recommendRes = $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray); $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray);
if(!$a_house_recommendRes){ if( $wpdb->last_error){
return 504; return $wpdb->last_error;
} }
} }
} }
return 1;
} }
public static function addRecConsultant($houseId, $consultant){ public static function addRecConsultant($houseId, $consultant){
...@@ -197,14 +197,13 @@ class InsertDao{ ...@@ -197,14 +197,13 @@ class InsertDao{
"house_id" => $houseId, "house_id" => $houseId,
"user_type" => 1 "user_type" => 1
); );
$a_house_userRes = $wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray); $wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
if($a_house_userRes){ if( $wpdb->last_error){
return $a_house_userRes;
}else{
return $wpdb->last_error; return $wpdb->last_error;
} }
} }
} }
return 1;
} }
public static function addHouseFeature($houseId,$houseFeature){ public static function addHouseFeature($houseId,$houseFeature){
...@@ -215,13 +214,13 @@ class InsertDao{ ...@@ -215,13 +214,13 @@ class InsertDao{
"house_id" => $houseId, "house_id" => $houseId,
"tag_id" =>$val "tag_id" =>$val
); );
$wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
$a_house_featureRes = $wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature); if( $wpdb->last_error){
if(!$a_house_featureRes){ return $wpdb->last_error;
return 506;
} }
} }
} }
return 1;
} }
...@@ -234,6 +233,9 @@ class InsertDao{ ...@@ -234,6 +233,9 @@ class InsertDao{
" left JOIN " . Config::TOSPUR_TAG_TABLE . " tt on aht.tag_id = tt.id) as a" . " left JOIN " . Config::TOSPUR_TAG_TABLE . " 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)
); );
if( $wpdb->last_error){
return $wpdb->last_error;
}
if ($houseTag) { if ($houseTag) {
foreach ($houseTag as $val) { foreach ($houseTag as $val) {
$a_house_tag = array( $a_house_tag = array(
...@@ -241,9 +243,13 @@ class InsertDao{ ...@@ -241,9 +243,13 @@ class InsertDao{
"tag_id" => $val "tag_id" => $val
); );
$wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag); $wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
if( $wpdb->last_error){
return $wpdb->last_error;
} }
} }
} }
return 1;
}
public static function arrayToString($array) public static function arrayToString($array)
{ {
...@@ -263,6 +269,4 @@ class InsertDao{ ...@@ -263,6 +269,4 @@ class InsertDao{
} }
?> ?>
\ No newline at end of file
<?php
class QuotaDao {
public static function replace($year,$month,$consultantId,$quota){
global $wpdb;
$result = $wpdb->replace(Config::TOSPUR_QUOTA_TABLE,array(
"year" => $year,
"month" => $month,
"consultantId" => $consultantId,
"quota" => $quota
),array(
"%d",
"%d",
"%d",
"%d"
));
if($wpdb->last_error)
return $wpdb->last_error;
return $result;
}
}
\ No newline at end of file
...@@ -131,7 +131,7 @@ class SearchDao ...@@ -131,7 +131,7 @@ class SearchDao
global $wpdb; global $wpdb;
$where = " where 1=1 "; $where = " where 1=1 ";
if ($parentId != NULL) { if ($parentId != NULL) {
$where .= " and ParentId =" . $parentId; $where .= " and ParentId = %d";
} }
$result = $wpdb->get_results($wpdb->prepare('select * from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId)); $result = $wpdb->get_results($wpdb->prepare('select * from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
return $result; return $result;
...@@ -195,7 +195,7 @@ class SearchDao ...@@ -195,7 +195,7 @@ class SearchDao
$orderbySql = " order by th.creattime DESC"; $orderbySql = " order by th.creattime DESC";
} }
$sql = "select th.id,th.house_type,th.name,th.latest_news,th.address,th.average_price,th.community_name,th.covered_area,th.total_price,th.decoration,th.rent,". $sql = "select th.id,th.house_type,th.name,th.latest_news,th.address,th.average_price,th.community_name,th.covered_area,th.total_price,th.decoration,th.rent,".
"ti.path,dr.literal,th.house_number,dbp.bp_literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht". "ti.path,dr.literal,th.house_number,dbp.bp_literal,th.owner_name,th.owner_phone,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht".
" LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id". " LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id".
" where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th". " where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th".
$addSql. $addSql.
...@@ -295,7 +295,9 @@ class SearchDao ...@@ -295,7 +295,9 @@ class SearchDao
public static function searchConsultant($consulCityId = NULL,$consultantName = NULL){ public static function searchConsultant($consulCityId = NULL,$consultantName = NULL){
global $wpdb; global $wpdb;
$sql = "select id,name,imageUrl from ".Config::TOSPUR_CONSULTANT." where 1=1"; $sql = "select tc.id,tc.name,imageUrl,tor.Name as branchName from ".Config::TOSPUR_CONSULTANT." tc
LEFT JOIN ".Config::TOSPUR_ORGANIZATION_TABLE." tor on tc.subsidiaryId = tor.Id
where 1=1";
$params = array(); $params = array();
if($consulCityId != NULL){ if($consulCityId != NULL){
$params[] = $consulCityId; $params[] = $consulCityId;
...@@ -303,7 +305,7 @@ class SearchDao ...@@ -303,7 +305,7 @@ class SearchDao
} }
if($consultantName != NULL){ if($consultantName != NULL){
$params[] = '%'.$consultantName.'%'; $params[] = '%'.$consultantName.'%';
$sql = $sql." and name like %s"; $sql = $sql." and tc.name like %s";
} }
$result = $wpdb->get_results($wpdb->prepare($sql,$params)); $result = $wpdb->get_results($wpdb->prepare($sql,$params));
return $result; return $result;
...@@ -337,12 +339,12 @@ class SearchDao ...@@ -337,12 +339,12 @@ class SearchDao
return $feature; return $feature;
} }
/*public static function searchFeature() public static function searchFeature()
{ {
global $wpdb; global $wpdb;
$sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;'; $sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;';
return $wpdb->get_results($sql); return $wpdb->get_results($sql);
}*/ }
public static function ajax_searchTagOrFeature() public static function ajax_searchTagOrFeature()
{ {
...@@ -459,35 +461,6 @@ class SearchDao ...@@ -459,35 +461,6 @@ class SearchDao
$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 tt.type = %d"; 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,$params)); $feature = $wpdb->get_results($wpdb->prepare($featureSql,$params));
//print_r($wpdb->last_query);
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;
}
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
<?php <?php
require_once(PLUGIN_DIR . 'Config.php'); require_once(PLUGIN_DIR . 'Config.php');
class TospurDao class TospurDao
......
...@@ -3,4 +3,29 @@ ...@@ -3,4 +3,29 @@
require_once(PLUGIN_DIR . 'Config.php'); require_once(PLUGIN_DIR . 'Config.php');
class Core { class Core {
function get_week($year) {
$year_start = $year . "-01-01";
$year_end = $year . "-12-31";
$startday = strtotime($year_start);
if (intval(date('N', $startday)) != '1') {
$startday = strtotime("next monday", strtotime($year_start)); //获取年第一周的日期
}
$year_mondy = date("Y-m-d", $startday); //获取年第一周的日期
$endday = strtotime($year_end);
if (intval(date('W', $endday)) == '7') {
$endday = strtotime("last sunday", strtotime($year_end));
}
$num = intval(date('W', $endday));
for ($i = 1; $i <= $num; $i++) {
$j = $i -1;
$start_date = date("Y-m-d", strtotime("$year_mondy $j week "));
$end_day = date("Y-m-d", strtotime("$start_date +6 day"));
$week_array[$i] = array ( $start_date, $end_day );
}
return $week_array;
}
} }
\ No newline at end of file
...@@ -22,7 +22,7 @@ class TCSync { ...@@ -22,7 +22,7 @@ class TCSync {
$user = get_user_by( "login", $item['WorkNum'] ); $user = get_user_by( "login", $item['WorkNum'] );
$userdata = array( $userdata = array(
'ID' => $user->data->ID, 'ID' => $user->data->ID,
'role' => 'author', 'role' => 'zygw',
'display_name' => $item['Name'] 'display_name' => $item['Name']
); );
$user_id = wp_update_user( $userdata ) ; $user_id = wp_update_user( $userdata ) ;
...@@ -30,7 +30,7 @@ class TCSync { ...@@ -30,7 +30,7 @@ class TCSync {
$userdata = array( $userdata = array(
'user_login' => $item['WorkNum'], 'user_login' => $item['WorkNum'],
'user_pass' => $item['WorkNumAndID'], // When creating an user, `user_pass` is expected. 'user_pass' => $item['WorkNumAndID'], // When creating an user, `user_pass` is expected.
'role' => 'author', 'role' => 'zygw',
'display_name' => $item['Name'] 'display_name' => $item['Name']
); );
$user_id = wp_insert_user( $userdata ) ; $user_id = wp_insert_user( $userdata ) ;
...@@ -70,6 +70,7 @@ class TCSync { ...@@ -70,6 +70,7 @@ class TCSync {
$result = wp_remote_retrieve_body( $response ); $result = wp_remote_retrieve_body( $response );
$result = json_decode($result,true); $result = json_decode($result,true);
//print_r($result['data']['CityList']); //print_r($result['data']['CityList']);
$wpdb->query("delete from ".Config::DIC_CITY_TABLE." where cityId > -1;");
foreach($result['data']['CityList'] as $item){ foreach($result['data']['CityList'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(Config::DIC_CITY_TABLE,$item,array('plateId'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_CITY_TABLE,$item,array('plateId')));
//print_r(TCSync::create_insert_update_sql(Config::CITY_TABLE,$item,array('plateId')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::CITY_TABLE,$item,array('plateId')));print_r("<br />");
......
...@@ -11,7 +11,7 @@ define('PLUGIN_DIR', dirname(__FILE__) . '/'); ...@@ -11,7 +11,7 @@ define('PLUGIN_DIR', dirname(__FILE__) . '/');
add_action('init', 'tospur_init'); add_action('init', 'tospur_init');
function tospur_init() function tospur_init()
{ {my_plugin_activate();
require_once(PLUGIN_DIR . 'Config.php'); require_once(PLUGIN_DIR . 'Config.php');
require_once(PLUGIN_DIR . 'Tools/TCSync.php'); require_once(PLUGIN_DIR . 'Tools/TCSync.php');
require_once(PLUGIN_DIR . 'Tools/Image.php'); require_once(PLUGIN_DIR . 'Tools/Image.php');
...@@ -19,6 +19,8 @@ function tospur_init() ...@@ -19,6 +19,8 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Dao/TospurDao.php'); require_once(PLUGIN_DIR . 'Dao/TospurDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php'); require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerDao.php'); require_once(PLUGIN_DIR . 'Dao/CustomerDao.php');
require_once(PLUGIN_DIR . 'Dao/QuotaDao.php');
require_once(PLUGIN_DIR . 'Dao/DBManager.php');
require_once(PLUGIN_DIR . 'Admin/House.php'); require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/customer.php'); require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php'); require_once(PLUGIN_DIR . 'Admin/customerList.php');
...@@ -29,7 +31,10 @@ function tospur_init() ...@@ -29,7 +31,10 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Admin/rentHouseList.php'); require_once(PLUGIN_DIR . 'Admin/rentHouseList.php');
require_once(PLUGIN_DIR . 'Admin/customer.php'); require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php'); require_once(PLUGIN_DIR . 'Admin/customerList.php');
require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php'); require_once(PLUGIN_DIR . 'Admin/feature.php'); require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php');
require_once(PLUGIN_DIR . 'Admin/QuotaYearList.php');
require_once(PLUGIN_DIR . 'Admin/QuotaMonthList.php');
require_once(PLUGIN_DIR . 'Admin/feature.php');
require_once(PLUGIN_DIR . 'Admin/introduction.php'); require_once(PLUGIN_DIR . 'Admin/introduction.php');
require_once(PLUGIN_DIR . 'Admin/Contract.php'); require_once(PLUGIN_DIR . 'Admin/Contract.php');
require_once(PLUGIN_DIR . 'Admin/consultant_score.php'); require_once(PLUGIN_DIR . 'Admin/consultant_score.php');
...@@ -38,7 +43,7 @@ function tospur_init() ...@@ -38,7 +43,7 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Admin/TCSyncView.php'); require_once(PLUGIN_DIR . 'Admin/TCSyncView.php');
require_once(PLUGIN_DIR . 'Admin/Contract_List.php'); require_once(PLUGIN_DIR . 'Admin/Contract_List.php');
require_once(PLUGIN_DIR . 'Admin/commissionManage.php'); require_once(PLUGIN_DIR . 'Admin/commissionManage.php');
require_once(PLUGIN_DIR . 'Admin/commissionList.php');
add_action('admin_menu', 'reset_menu'); add_action('admin_menu', 'reset_menu');
tospur_register_script_style(); tospur_register_script_style();
tospur_ajax_set(); tospur_ajax_set();
...@@ -137,6 +142,8 @@ function tospur_ajax_set() ...@@ -137,6 +142,8 @@ 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_replaceQuota', 'QuotaMonthList::replaceQuota');
//标签和特色 //标签和特色
add_action('wp_ajax_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature'); add_action('wp_ajax_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
add_action('wp_ajax_nopriv_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature'); add_action('wp_ajax_nopriv_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
...@@ -177,24 +184,141 @@ function update_consultant() ...@@ -177,24 +184,141 @@ function update_consultant()
} }
} }
function my_plugin_activate() {
remove_role("zygw");
remove_role("qzzy");
remove_role("xzzl");
remove_role("jl");
$cRole = array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"sygl"=>true,
"zygwpf"=>true,
"zygwyj"=>true,
"syjdb"=>true,
"addTag"=>true,
"addFeature"=>true,
"dataSync"=>true,
"houseApproval"=>true,
"ht"=>true,
"htEdit"=>true,
"htApproval"=>true,
"mySet" => true,
"fdfw_allot" => true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"yyList"=>true
);
add_role("zygw","置业顾问",array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"ht"=>true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"mySet" => true,
"yyList"=>true
));
add_role("qzzy","权证专员",array(
"ht"=>true,
"htEdit"=>true
));
add_role("xzzl","行政助理",array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"sygl"=>true,
"zygwpf"=>true,
"zygwyj"=>true,
"syjdb"=>true,
"addTag"=>true,
"addFeature"=>true,
"dataSync"=>true,
"houseApproval"=>true,
"ht"=>true,
"htEdit"=>true,
"htApproval"=>true,
"fdfw_allot"=>true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"yyList"=>true
));
add_role("jl","经理",array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"sygl"=>true,
"zygwpf"=>true,
"zygwyj"=>true,
"syjdb"=>true,
"addTag"=>true,
"addFeature"=>true,
"dataSync"=>true,
"houseApproval"=>true,
"ht"=>true,
"htEdit"=>true,
"htApproval"=>true,
"fdfw_allot"=>true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"yyList"=>true
));
}
register_activation_hook( __FILE__, 'my_plugin_activate' );
function reset_menu() function reset_menu()
{ {
add_menu_page('新房列表','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6); add_menu_page('新房列表','新房列表', 'xfList', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view'); add_submenu_page('newHouseList', '添加新房', '添加新房', 'xf', 'newHouse', 'House::init_view');
add_menu_page('二手房列表','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7); add_menu_page('二手房列表','二手房列表', 'esfList', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'edit_published_posts', 'secHandHouse', 'SecHandHouse::secHandHouse_html'); add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'esf', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_menu_page('租房列表','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8); add_menu_page('租房列表','租房列表', 'zfList', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html'); add_submenu_page('rentHouseList', '添加租房', '添加租房', 'zf', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9); add_menu_page("我的设置", "我的设置", "mySet", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('合同列表','合同列表', 'edit_published_posts', 'contractList', 'Contract_List::showTableView', 'dashicons-menu', 10); add_menu_page('合同列表','合同列表', 'ht', 'contractList', 'Contract_List::showTableView', 'dashicons-menu', 10);
add_submenu_page('contractList', '添加合同', '添加合同', 'edit_published_posts', 'contract', 'Contract::init_view'); add_submenu_page('contractList', '添加合同', '添加合同', 'htEdit', 'contract', 'Contract::init_view');
add_menu_page('客户列表','客户列表', 'edit_published_posts', 'customerList', 'function_customerList', 'dashicons-menu', 11); add_menu_page('客户列表','客户列表', 'khList', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html'); add_submenu_page('customerList', '新增客户', '新增客户', 'kh', 'customer', 'customer::customer_html');
add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12); add_menu_page('房客跟进', '房客跟进', 'fygj', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13); add_menu_page('置业顾问评分', '置业顾问评分', 'zygwpf', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 14);
add_menu_page('添加标签', '添加标签', 'edit_published_posts', 'add_tag', 'feature::add_feature_html', 'dashicons-menu'); add_submenu_page('consultant_score', '置业顾问业绩', '置业顾问业绩', 'zygwyj', 'quotaList', 'QuotaYearList::showHtml');
add_menu_page('添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html', 'dashicons-menu'); add_menu_page('收佣进度表', '收佣进度表', 'syjdb', 'commissionList', 'function_commissionList', 'dashicons-menu', 15);
add_menu_page("同步数据", "同步数据", "manage_options", "sync", "TCSyncView::display", 'dashicons-menu'); add_menu_page('房东服务', '房东服务', 'fdfw_cs', 'tospur_sale_secondhand', 'tospur_sale_page', 'dashicons-menu', 16);
add_submenu_page('tospur_sale_secondhand', '出售', '出售', 'fdfw_cs', 'tospur_sale_secondhand', 'tospur_sale_page');
add_submenu_page('tospur_sale_secondhand', '出租', '出租', 'fdfw_cz', 'tospur_sale_rent', 'tospur_sale_page');
add_menu_page('预约列表', '预约列表', 'yyList', 'view_house', 'view_house_page', 'dashicons-menu', 17);
add_menu_page('添加标签', '添加标签', 'addTag', 'add_tag', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page('添加特色', '添加特色', 'addFeature', 'add_feature', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page("同步数据", "同步数据", "dataSync", "sync", "TCSyncView::display", 'dashicons-menu');
//移除更新信息 //移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 ); remove_action( 'admin_notices', 'update_nag', 3 );
global $menu; global $menu;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment