Commit 6527ff71 by shz

tospur

parent fa8bb9d2
<?php
require_once(PLUGIN_DIR . 'Dao/ContractDao.php');
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/HouseDao.php');
class Contract {
public static function init_view(){
......@@ -6,47 +9,88 @@ class Contract {
$type = $_POST["type"];
$context = array();
$context['siteUrl'] = get_site_url();
$context['adminUrl'] = admin_url();
$context['city'] = SearchDao::searchCity();
$context['managers'] = get_users( 'role=editor' );
$context['status'] = SearchDao::searchStatusType(4);
$context['buildProperty'] = SearchDao::searchBuildProperty();
$context['room'] = SearchDao::searchRoom();
$params = array(
'business' => $_REQUEST['business'],
'houseNumber' =>$_REQUEST['houseNumber'],
'customerNumber' =>$_REQUEST['customerNumber'],
'signedDate' =>$_REQUEST['signedDate'],
'permitNumber' =>$_REQUEST['permitNumber'],
'status' =>$_REQUEST['status'],
'area' =>$_REQUEST['area'],
'house_number' =>$_REQUEST['house_number'],
'price' =>$_REQUEST['price'],
'permitNumber' =>$_REQUEST['permitNumber'],
'managerId' =>$_REQUEST['managerId'],
'paymentMethod' =>$_REQUEST['paymentMethod'],
'codicil' =>$_REQUEST['codicil'],
'oName' =>$_REQUEST['oName'],
'oPhone' =>$_REQUEST['oPhone'],
'oID' =>$_REQUEST['oID'],
'oCommission' =>$_REQUEST['oCommission'],
'oBroker' =>$_REQUEST['oBroker'],
'oAddress' =>$_REQUEST['oAddress'],
'oPayBack' =>$_REQUEST['oPayBack'],
'oMoney' =>$_REQUEST['oMoney'],
'oPayBack' =>$_REQUEST['oPayBack'],
'cName' =>$_REQUEST['cName'],
'cPhone' =>$_REQUEST['cPhone'],
'cID' =>$_REQUEST['cID'],
'cCommission' =>$_REQUEST['cCommission'],
'cBroker' =>$_REQUEST['cBroker'],
'cAddress' =>$_REQUEST['cAddress'],
'cPayBack' =>$_REQUEST['cPayBack'],
'cMoney' =>$_REQUEST['cMoney']
'cMoney' =>$_REQUEST['cMoney'],
'cPayBack' =>$_REQUEST['cPayBack']
);
if($type==1){
}else if(isset($_GET['edit'])){
$wpdb->query("START TRANSACTION");
if($type==1){
$prefix = "新增";
if(isset($_REQUEST["id"])){
$result = ContractDao::update($_REQUEST["id"],$params);
$prefix = "修改";
if(is_numeric($result)){
$status = 0;
if($params['status'] == 4) {
$status = 0;
}else if($params['status'] == 3){
$status = 2;
}
Timber::render("contract.html",$context);
$result = HouseDao::updateStatus($status,$_REQUEST['id']);
}
}else{
$params['business'] = $_REQUEST['businessId'];
$params['houseNumber'] = $_REQUEST['houseNumber'];
$params['price'] = $_REQUEST['price'];
$params['houseId'] = $_REQUEST['houseId'];
$params['customerNumber'] = $_REQUEST['customerNumber'];
$params['oPhone'] = $_REQUEST['oPhone'];
$params['oCommission'] = $_REQUEST['oCommission'];
$params['cPhone'] = $_REQUEST['cPhone'];
$params['cCommission'] = $_REQUEST['cCommission'];
$params['consultantId'] = get_current_user_id();
public static function insert($params){
global $wpdb;
//$wpdb->insert(Config::);
$result = ContractDao::insert($params);
$pre = "CJCS";
if($_REQUEST['type'] > 1){
$pre = "CJCZ";
}
public static function update($params){
$contractId = $pre.str_pad($result,6,'0',STR_PAD_LEFT);
$result = ContractDao::setContractId($result,$contractId);
//二手房、租房创建合同时修改房源的状态
if(intval($_REQUEST['businessId']) >=1 ){
$result = HouseDao::updateStatus(-1,$params['houseId']);
}
}
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
$context["error"] = $result;
echo $prefix."合同失败";
}else{
$wpdb->query("COMMIT");
echo $prefix."合同成功";
}
exit;
}else if(isset($_GET['edit'])){
$id = $_REQUEST["id"];
$context['houseId'] = $id;
$context['result'] = ContractDao::searchContract($id);
}
Timber::render("contract.html",$context);
}
}
\ No newline at end of file
<?php
class Contract_List extends WP_List_Table{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'contractLists', //singular name of the listed records
'plural' => 'contractLists', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
$name = $item[$column_name];
switch ($column_name) {
case'business':
switch($item[$column_name]){
case 0:
$name = "新房";
break;
case 1:
$name = "二手房";
break;
case 2:
$name = "租房";
break;
}
break;
}
return '<a href="' . admin_url() . 'admin.php?page=contract&edit=true&id='. $item['id'].'">' .$name . '</a>';
}
function get_columns()
{
$columns['contractId']= '合同编号';
$columns['signedDate']= '签约日期';
$columns['business']= '业务类型';
$columns['address']='房源地址';
$columns['price']= '成交金额';
$columns['commission']= '佣金总额';
$columns['manager']= '签约人员';
$columns['status']= '状态';
$columns['oName']= '业主姓名';
$columns['oBroker']= '卖方经纪人';
$columns['oCommission']= '佣金';
$columns['cName']= '客户姓名';
$columns['cBroker']= '买方经纪人';
$columns['cCommission']= '佣金';
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array(
/*'contractId' => array('contractId', false),
'signedDate' => array('signedDate', false),
'business' => array('business', false),
'address' => array('address', false),
'price' => array('price', false),
'commission' => array('commission', false),
'status' => array('status', false),
'oName' => array('oName', false),
'oBroker' => array('oBroker', false),
'oCommission' => array('oCommission', false),
'cName' => array('cName', false),
'cBroker' => array('cBroker', false),
'cCommission' => array('cCommission', false)*/
);
return $sortable_columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->process_bulk_action();
//$data = $this->example_data;
$sql = "select t.id,t.contractId,t.signedDate,t.business,th.address,t.price,(t.oCommission+t.cCommission) as commission,
tc.name as manager,ts.status_name as status,oName,oBroker,oCommission,cName,cBroker,cCommission
from tospur_contract t
left join tospur_consultant tc on tc.id = t.consultantId
left join tospur_house th on th.id = t.houseId
left join tospur_status ts on ts.status_type = 4 and t.status = ts.status_id
where 1=1 ";
//置业顾问显示自己的合同
if(current_user_can("author")){
$sql .= " and t.consultantId = ".get_current_user_id();
}elseif(current_user_can("editor")){//经理显示提交给自己的合同,和自己的合同
$sql .= " and (t.consultantId = ".get_current_user_id()." or t.managerId = ".get_current_user_id().")";
}
$sql .= " order by t.signedDate desc";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'contractId' => $value->contractId,
'signedDate' => $value->signedDate,
'business' => $value->business,
'address' => $value->address,
'price' => $value->price,
'commission' => $value->commission,
'manager' => $value->manager,
'status' => $value->status,
'oName' => $value->oName,
'oBroker' => $value->oBroker,
'oCommission' => $value->oCommission,
'cName' => $value->cName,
'cBroker' => $value->cBroker,
'cCommission' => $value->cCommission
);
}
$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 showTableView()
{
Timber::render("contractList.html");
}
public static function displayTable(){
$contractList = new Contract_List();
$contractList->prepare_items();
$contractList->display();
}
}
\ No newline at end of file
<?php
require_once(PLUGIN_DIR . 'Tools/TCSync.php');
class TCSyncView {
public static function display(){
if(isset($_REQUEST["type"])){
switch($_REQUEST["type"]){
case 0:
TCSync::user_sync();
break;
case 1:
TCSync::organization_sync();
break;
case 2:
TCSync::other_sync();
break;
}
}
Timber::render("TCSyncView.html");
}
}
\ No newline at end of file
<?php
class commissionManage{
function commissionManage_html(){
$context = array();
$context["city"] = SearchDao::searchCity();
Timber::render("commissionManage.html",$context);
}
}
\ No newline at end of file
......@@ -8,6 +8,11 @@ class customerList extends WP_List_Table
{
function __construct()
{
parent::__construct(array(
'singular' => 'customerList',
'plural' => 'customerList',
'ajax' => false
));
}
function column_default($item, $column_name)
......@@ -20,15 +25,58 @@ class customerList extends WP_List_Table
}
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" data-consultant="%3$s"/>',
$this->_args['singular'],
$item['id'],
$item['consultant_id']
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox"/>'
);
$columns['name'] = '姓名';
$columns['demand_type'] = '需求类型';
$columns['customer_remark'] = '客户备注';
$columns['consultant_name'] = '置业顾问';
$columns['status_name'] = '状态';
$columns['customer_remark'] = '客户备注';
return $columns;
}
function get_bulk_actions()
{
$actions = array(
'allot' => '分配置业顾问'
);
return $actions;
}
function process_bulk_action()
{
$action = $this->current_action();
if ($action) {
$string = null;
switch ($action) {
case 'allot':
$consultant_id = $_POST['allot_consultant_id'];
if ($consultant_id) {
$string = '(' . implode(',', array_map('intval', $_POST['customerlist'])) . ')';
global $wpdb;
$result = $wpdb->query('update ' . Config::TOSPUR_CUSTOMER_TABLE
. ' SET consultant_id = ' . $consultant_id
. ' where id in ' . $string);
if($result){
echo '<script>alert("分配置业顾问成功");</script>';
}
}
break;
}
}
}
function prepare_items()
{
......@@ -39,9 +87,15 @@ class customerList extends WP_List_Table
$this->_column_headers = array($columns, $hidden);
$this->process_bulk_action();
$sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name FROM tospur_customer tcs" .
" left join (SELECT * FROM tospur_status where status_type = 5) as ts on tcs.status = ts.status_id" .
" left join tospur_consultant tc on tcs.consultant_id = tc.id where 1 = 1";
$current_user = wp_get_current_user();
if($current_user->roles[0] == 'author'){
$sql = $sql . " and tcs.consultant_id = " . $current_user->ID;
}
if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_REQUEST['status'];
}
......@@ -65,6 +119,34 @@ class customerList extends WP_List_Table
$sql = $sql . " and " . $demand_type . " = 1";
}
}
if (isset($_REQUEST['listCity']) && $_REQUEST["listCity"] != -1) {
$sql = $sql . " and tcs.city_id = " . $_REQUEST["listCity"];
}
if (isset($_REQUEST['listDistrict']) && $_REQUEST["listDistrict"] != -1) {
$sql = $sql . " and tcs.district_id = " . $_REQUEST["listDistrict"];
}
if (isset($_REQUEST['listPlate']) && $_REQUEST["listPlate"] != -1) {
$sql = $sql . " and tcs.plate_id = " . $_REQUEST["listPlate"];
}
if ($_REQUEST["totalPrice"] != null) {
$priceArray = explode("-", $_REQUEST['totalPrice']);
$sql = $sql . " and (tcs.min_totalPrice >= " . $priceArray[0] . " and tcs.max_totalPrice <= " . $priceArray[1] . ")";
}
if ($_REQUEST["rentalPrice"] != null) {
$priceArray = explode("-", $_REQUEST['rentalPrice']);
$sql = $sql . " and (tcs.min_rent >= " . $priceArray[0] . " and tcs.max_rent <= " . $priceArray[1] . ")";
}
if (isset($_REQUEST['buildProperty']) && $_REQUEST["buildProperty"] != -1) {
if ($_REQUEST["buildProperty"] == 5) {
$sql = $sql . " and (tcs.bedroom >= " . $_REQUEST["buildProperty"] . " or tcs.bedroom = -1)";
} else {
$sql = $sql . " and (tcs.bedroom = " . $_REQUEST["buildProperty"] . " or tcs.bedroom = -1)";
}
}
if ($_REQUEST["acreage"] != null) {
$areaArray = explode("-", $_REQUEST['acreage']);
$sql = $sql . " and (tcs.min_coveredArea >= " . $areaArray[0] . " and tcs.max_coveredArea <= " . $areaArray[1] . ")";
}
if (isset($_REQUEST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_REQUEST['search_name'] . "%'";
}
......@@ -96,6 +178,7 @@ class customerList extends WP_List_Table
'name' => $value->name,
'demand_type' => implode("、", $demand_type_array),
'customer_remark' => $value->customer_remark,
'consultant_id' => $value->consultant_id,
'consultant_name' => $value->consultant_name,
'status_name' => $value->status_name
);
......@@ -125,9 +208,28 @@ class customerList extends WP_List_Table
function function_customerList()
{
$context = array();
//
$context['city'] = SearchDao::searchCity();
$context['buildProperty'] = SearchDao::searchBuildProperty();
//
$context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6);
if (isset($_REQUEST['hasSearch'])) {
$context['district'] = SearchDao::searchCity($_REQUEST['listCity']);
$context['plate'] = SearchDao::searchCity($_REQUEST['listCity'], $_REQUEST['listDistrict']);
$context['dicTotalPrice'] = searchDao::searchTotalPrice($_REQUEST['listCity']);
$context['dicRentalPrice'] = searchDao::searchRentalPrice($_REQUEST['listCity']);
$context['dicArea'] = searchDao::searchArea($_REQUEST['listCity']);
$context['cityId'] = $_REQUEST['listCity'];
$context['districtId'] = $_REQUEST['listDistrict'];
$context['plateId'] = $_REQUEST['listPlate'];
$context['buildPropertyId'] = $_REQUEST['buildProperty'];
$context['totalPrice'] = $_REQUEST['totalPrice'];
$context['rentalPrice'] = $_REQUEST['rentalPrice'];
$context['acreage'] = $_REQUEST['acreage'];
}
$context['status_id'] = $_REQUEST['status'];
$context['demand_type'] = isset($_REQUEST['demand_type']) ? $_REQUEST['demand_type'] : -1;
$context['customer_type_id'] = isset($_REQUEST['customer_type']) ? $_REQUEST['customer_type'] : -1;
......
......@@ -5,45 +5,55 @@ class feature
public static function ajax_add_feature()
{
$name = $_POST['name'];
$type = $_POST['type'];
$array = array();
$result = feature::search_feature($name);
$result = feature::search_feature($type, $name);
if ($result) {
$array['code'] = 2001;
} else {
feature::add_feature($name);
feature::add_feature($type, $name);
$array['code'] = 2000;
}
wp_send_json($array);
}
public static function search_feature($name = null)
public static function search_feature($type, $name = null)
{
global $wpdb;
$sql = "select id,name from " . Config::TOSPUR_TAG_TABLE . " where type = 1";
$sql = "select id,name from " . Config::TOSPUR_TAG_TABLE . " where type = " . $type;
if ($name) {
$sql .= " and name = '" . $name . "'";
}
return $wpdb->get_results($sql);
}
public static function add_feature($name)
public static function add_feature($type, $name)
{
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_TAG_TABLE, array(
'name' => $name,
'type' => 1
'type' => $type
));
return $result;
}
public static function add_feature_html()
{
wp_enqueue_style('bootstrapMinCss');
$context = array();
$context['view'] = plugins_url() . '/tospur/Admin/views';
$context['result'] = feature::search_feature();
$context['url'] = home_url();
$context['admin_url'] = admin_url();
$context['request_url'] = $_SERVER['request_url'];
$type = null;
switch ($_GET['page']) {
case 'add_tag':
$type = 0;
break;
case 'add_feature':
$type = 1;
break;
}
$context['type'] = $type;
$context['result'] = feature::search_feature($type);
Timber::render('feature.html', $context);
}
}
......
......@@ -4,17 +4,19 @@ class introduction
{
public static function ajax_submit_introduction()
{
$time = $_POST['time'];
$introduction = $_POST['introduction'];
$user_id = $_POST['user_id'];
wp_send_json(introduction::submit_introduction($introduction, $user_id));
wp_send_json(introduction::submit_introduction($time, $introduction, $user_id));
}
public static function submit_introduction($introduction, $user_id)
public static function submit_introduction($time, $introduction, $user_id)
{
global $wpdb;
$result = $wpdb->update(
Config::TOSPUR_CONSULTANT,
array(
'time' => $time,
'introduction' => $introduction
),
array('id' => $user_id)
......@@ -22,12 +24,12 @@ class introduction
return $result;
}
public static function search_introduction()
public static function search_time_and_introduction()
{
global $wpdb;
$user_id = introduction::get_user_id();
$sql = "select introduction from " . Config::TOSPUR_CONSULTANT . " where id = " . $user_id;
$result = $wpdb->get_var($sql);
$sql = "select time,introduction from " . Config::TOSPUR_CONSULTANT . " where id = " . $user_id;
$result = $wpdb->get_row($sql);
return $result;
}
......@@ -35,7 +37,9 @@ class introduction
{
$context = array();
$context['url'] = home_url();
$context['introduction'] = introduction::search_introduction();
$result = introduction::search_time_and_introduction();
$context['time'] = $result->time;
$context['introduction'] = $result->introduction;
$user_id = introduction::get_user_id();
$context['user_id'] = $user_id;
Timber::render('introduction.html', $context);
......
......@@ -57,7 +57,7 @@ class newHouseList extends WP_List_Table
function get_columns()
{
if( current_user_can('administrator') ) {
if( current_user_can('moderate_comments') ) {
$columns = array(
'cb' => '<input type="checkbox" />'
);
......@@ -155,6 +155,7 @@ class newHouseList extends WP_List_Table
function prepare_items()
{
global $wpdb;
$params = array();
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
......@@ -170,37 +171,57 @@ class newHouseList extends WP_List_Table
left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id
left join (select value as did,literal as room_type from dic_room) dr on dr.did = th.room_id
where 1=1 and house_type=0";
if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"];
$params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"];
$params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"];
$params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"];
$params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$sql = $sql." and room_id=".$_POST["room"];
$params[] = $_POST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$sql = $sql." and status=".$_POST["status"];
$params[] = $_POST["status"];
$sql = $sql." and status=%d";
}
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']);
$sql = $sql . " and average_price between ".$priceArray[0]." and ".$priceArray[1];
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
$sql = $sql . " and covered_area between ".$areaArray[0]." and ".$areaArray[1];
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$sql = $sql . " and name like '%".$_POST['searchText']."%'";
$params[] = '%'.$_POST['searchText'].'%';
$sql = $sql . " and name like %s";
}
$sql = $sql . " group by id";
$result = $wpdb->get_results($sql);
if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"];
$order = $_GET["order"];
$sql = $sql ." order by ".$orderby." ".$order;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......@@ -230,16 +251,6 @@ class newHouseList extends WP_List_Table
}
}
function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'valid'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
$total_items = count($data);
......@@ -282,7 +293,8 @@ function function_newHouseList()
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
}
Timber::render("newHouseList.html",$contest);
$contest["house_type"] = 0;
Timber::render("houseList.html",$contest);
}
function addNewHouseTable(){
......
......@@ -12,16 +12,14 @@ class RentHouse extends Tospur_House{
//获取新房信息,存入tospur_house表
$insert_tospur_house_array = array(
'name' => $_POST['housename'],
'house_number' =>$_POST['house_number'],
'rent'=>$_POST['rent'],
'total_price' =>$_POST['total_price'],
'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'],
'covered_area' =>$_POST['covered_area'],
'floor' =>$_POST['floor'],
'faceto'=>$_POST['faceto'],
'decoration' => $_POST['decoration'],
'age'=>$_POST['age'],
'matching_facilities'=>$_POST['matching_facilities'],
'flat'=>$_POST['flat'],
'suite'=>$_POST["suite"],
'overview' => $_POST['overview'],
'city_id' => $_POST['baseCity'],
......@@ -46,7 +44,11 @@ class RentHouse extends Tospur_House{
"propertyRight"=>$_POST["propertyRight"],
"structure"=>$_POST["structure"],
"key"=>$_POST["key"],
"garage"=>$_POST["garage"]
"matching_facilities"=>$_POST["matching_facilities"],
"garage"=>$_POST["garage"],
"entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"],
"rent"=>$_POST["rent"]
);
if($type==3){
$wpdb->query("START TRANSACTION");
......@@ -90,9 +92,7 @@ class RentHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2);
for($i = 1981; $i<= 2020; $i++){
$context["age"][]=$i;
}
$context["house_type"] = 2;
Timber::render("rentHouse.html",$context);
}
......
......@@ -51,7 +51,7 @@ class rentHouseList extends WP_List_Table
function get_columns()
{
if( current_user_can('administrator') ) {
if( current_user_can('moderate_comments') ) {
$columns = array(
'cb' => '<input type="checkbox" />'
);
......@@ -166,6 +166,7 @@ class rentHouseList extends WP_List_Table
function prepare_items()
{
global $wpdb;
$params = array();
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
......@@ -176,44 +177,58 @@ class rentHouseList extends WP_List_Table
$this->process_bulk_action();
//$data = $this->example_data;
$params = array(
"city_id" => $_POST["listCity"],
"district_id" => $_POST["listDistrict"],
"plate_id" =>$_POST["listPlate"],
"buildproperty_id"=>$_POST["buildProperty"],
"status" => $_POST["status"],
);
$sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id
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 value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=2 and ahu.user_type=1";
where 1=1 and house_type=2 ";
if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"];
$params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"];
$params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"];
$params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"];
$params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$params[] = $_POST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$sql = $sql." and status=".$_POST["status"];
$params[] = $_POST["status"];
$sql = $sql." and status=%d";
}
if($_POST["rentalPrice"]!=NULL){
$priceArray = explode("-", $_POST['rentalPrice']);
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and rent between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
$sql = $sql . " and covered_area between ".$areaArray[0]." and ".$areaArray[1];
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$sql = $sql . " and name like '%".$_POST['searchText']."%'";
$params[] = '%'.$_POST['searchText'].'%';
$sql = $sql . " and name like %s";
}
$result = $wpdb->get_results($sql);
if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"];
$order = $_GET["order"];
$sql = $sql ." order by ".$orderby." ".$order;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......@@ -246,15 +261,6 @@ class rentHouseList extends WP_List_Table
}
}
function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'valid'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
......@@ -286,17 +292,18 @@ function function_rentHouseList()
if(isset($_POST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_POST['listCity']);
$contest['plate'] = SearchDao::searchCity($_POST['listCity'],$_POST['listDistrict']);
$contest['dicTotalPrice'] = searchDao::searchTotalPrice($_POST['listCity']);
$contest['dicRentalPrice'] = searchDao::searchRentalPrice($_POST['listCity']);
$contest['dicArea'] = searchDao::searchArea($_POST['listCity']);
$contest['cityId'] = $_POST['listCity'];
$contest['districtId'] = $_POST['listDistrict'];
$contest['plateId' ]= $_POST['listPlate'];
$contest['buildPropertyId']= $_POST['buildProperty'];
$contest['totalPrice'] = $_POST['totalPrice'];
$contest['rentalPrice'] = $_POST['rentalPrice'];
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
}
Timber::render("rentHouseList.html",$contest);
$contest["house_type"] = 2;
Timber::render("houseList.html",$contest);
}
function addRentTable(){
......
......@@ -56,8 +56,7 @@ class SecHandHouse extends Tospur_House{
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 201){
$wpdb->query("ROLLBACK");
print_r( $result);;
print_r($result);
echo "二手房房源修改失败";
}else{
$wpdb->query("COMMIT");
......@@ -69,7 +68,7 @@ class SecHandHouse extends Tospur_House{
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) {
$wpdb->query("ROLLBACK");
print_r( $result);;
print_r($result);
echo "二手房房源新增失败";
} else {
$wpdb->query("COMMIT");
......@@ -82,8 +81,9 @@ class SecHandHouse extends Tospur_House{
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id']));
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context['featureOld'] = json_encode(SearchDao::searchFeatureOld($_GET['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);
}
......@@ -93,7 +93,8 @@ class SecHandHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2);
$context["feature"] = searchDao::searchTagOrFeature(1);
/*$context["mark"] = searchDao::searchTagOrFeature(0);
$context["feature"] = searchDao::searchTagOrFeature(1);*/
$context["house_type"] = 1;
Timber::render("secHandHouse.html",$context);
......@@ -119,12 +120,9 @@ class SecHandHouse extends Tospur_House{
$recConsultant=InsertDao::addRecConsultant($houseId,$data);
if(isset($_POST['mark'])&&$_POST['mark']!=""){
InsertDao::addHouseTag($_POST['mark'],$houseId);
}
InsertDao::addHouseFeature($houseId,$data);
InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseFeature($houseId, $data['houseFeature']);
}else{
return 507;
......@@ -170,11 +168,9 @@ class SecHandHouse extends Tospur_House{
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a
where house_id = %d and a.type = 1);", $houseId)
);
InsertDao::addHouseFeature($houseId,$data);
InsertDao::addHouseTag($houseId, $data['houseTag']);
if(isset($_POST['mark'])&&$_POST['mark']!="") {
InsertDao::addHouseTag($_POST['mark'],$houseId);
}
InsertDao::addHouseFeature($houseId, $data['houseFeature']);
return $result;
}
......
......@@ -50,7 +50,7 @@ class secHandHouseList extends WP_List_Table
function get_columns()
{
if( current_user_can('administrator') ) {
if( current_user_can('moderate_comments') ) {
$columns = array(
'cb' => '<input type="checkbox" />'
);
......@@ -165,6 +165,7 @@ class secHandHouseList extends WP_List_Table
function prepare_items()
{
global $wpdb;
$params = array();
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
......@@ -177,38 +178,57 @@ class secHandHouseList extends WP_List_Table
//$data = $this->example_data;
$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
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 value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=1 and ahu.user_type=1";
where 1=1 and house_type=1 ";
if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"];
$params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
}
if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"];
$params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
}
if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"];
$params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
}
if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"];
$params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
}
if($_POST["room"]!=0){
$params[] = $_POST["room"];
$sql = $sql." and room_id=%d";
}
if(isset($_POST["status"]) && $_POST["status"]!=-1){
$sql = $sql." and status=".$_POST["status"];
$params[] = $_POST["status"];
$sql = $sql." and status=%d";
}
if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']);
$sql = $sql . " and average_price between ".$priceArray[0]." and ".$priceArray[1];
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql . " and average_price between %d and %d";
}
if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']);
$sql = $sql . " and covered_area between ".$areaArray[0]." and ".$areaArray[1];
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql . " and covered_area between %d and %d";
}
if($_POST["searchText"]!=NULL){
$sql = $sql . " and name like '%".$_POST['searchText']."%'";
$params[] = '%'.$_POST['searchText'].'%';
$sql = $sql . " and name like %s";
}
if(isset($_GET["orderby"])){
$orderby = $_GET["orderby"];
$order = $_GET["order"];
$sql = $sql ." order by ".$orderby." ".$order;
}
$result = $wpdb->get_results($sql);
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......@@ -240,16 +260,6 @@ class secHandHouseList extends WP_List_Table
}
}
function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'valid'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
$total_items = count($data);
......@@ -288,7 +298,8 @@ function function_secHandHouseList()
$contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status'];
}
Timber::render("secHandHouseList.html",$contest);
$contest["house_type"] = 1;
Timber::render("houseList.html",$contest);
}
function addSecTable(){
$secHandHouseList = new secHandHouseList();
......
<body>
<h2 class="title">数据同步</h2><br/>
<form action="" method="POST" class="form-inline">
<div class="form-group">
<label>请选择要同步内容:</label>
<select name="type" class="form-control">
<option value="0">同步置业顾问</option>
<option value="1">同步组织机构</option>
<option value="2">同步字典表</option>
</select>
</div><br/><br/>
<div class="form-group">
<input type="submit" value="同步" class="form-control">
</div>
</form>
</body>
\ No newline at end of file
{% block addCustomer %}
<div class="modal fade" id="addCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-6">
<input type="text" placeholder="请输入姓名/手机号搜索" id="addCustomer_searchtext" class="form-control">
</div>
<div class="col-md-2">
<button type="button" class="button action" id="addCustomer_search">搜索</button>
</div>
</div>
</div>
<div class="modal-body " style="height: 500px;overflow: auto;">
<ul id="addCustomer_list">
</ul>
</div>
</div>
</div>
</div>
<script>
function close_modal_addCustomer(){
$("#addCustomer").modal('hide');
}
function init_modal_addCustomer(callback,customerDemand){
$("#addCustomer").on("shown.bs.modal",function(){
});
$("#addCustomer_search").click(function(){
searchCustomer(customerDemand);
});
$("#addCustomer_list").on("click",".row",function(){
callback($(this).data());
});
searchCustomer(customerDemand);
}
function searchCustomer(customerDemand){
var params = {
action:"searchCustomerByNameOrPhone",
search:$("#addCustomer_searchtext").val(),
customerDemand:customerDemand
};
$.ajax({
type: "post",
url: "admin-ajax.php",
data: params,
success:function(json){
console.log($("#addCustomer_list").find(".row").length);
$("#addCustomer_list").find(".row").remove();
if(json){
for(var i = 0; i <json.length; i++){
var item = json[i];
var name = item["name"];
var id = item['id'];
var phone = item['phone'];
var row = $("<div>").addClass("row").css("margin-bottom","10px");
var left = $("<div>").addClass("col-md-3");
var phoneDiv = $("<label>").append(phone);
var right = $("<div>").addClass("col-md-3");
var nameDiv = $("<label>").append(name);
right.append(phoneDiv);
left.append(nameDiv);
row.append(left).append(right).data(item);
$("#addCustomer_list").append(row);
}
}
}
});
}
</script>
{% endblock %}
\ No newline at end of file
......@@ -5,7 +5,7 @@
<td>
<div id="feature" class="row">
</div><br/>
<button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt">
<button type="button" class="button action" id="addFeatureBtn">
添加特色
</button>
</td>
......@@ -15,17 +15,28 @@
<script>
$(document).ready(function () {
{% set featureOld = function('SearchDao::searchFeatureOld', houseId, 1)|json_encode() %}
{% if featureOld %}
var data = {{ featureOld }};
$.each(data, function (i, item) {
addFeature(item.tag_id, item.name);
});
{% endif %}
//显示选中的特色
var featureArray = [];
$('#addFeatureBtn').click(function(){
init_modal_addTag(1, function (id, value) {
featureArray = [];
$('input[name="data[houseFeature][]"]').each(function (index, item) {
featureArray.push(Number($(item).val()));
});
if(featureArray.indexOf(Number(id)) == -1){
addFeature(id, value);
}else{
alert('不能重复选择特色');
}
});
});
existsCancel();
});
function addFeature(id, value) {
var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
......@@ -34,5 +45,4 @@
var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#feature").append(divCol);
}
</script>
\ No newline at end of file
......@@ -34,6 +34,7 @@
function addRecHouse(data){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id});
var url = url;
var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse);
......
{% block addTag %}
{% if feature %}
<style>
.table td {
text-align: center;
......@@ -18,16 +17,18 @@
</div>
</div>
</div>
{% endif %}
<script>
function init_modal_addTag(type, callback) {
var tagList = $('#tagList');
var search_type;
var search_callback;
var tagList;
$(document).ready(function () {
tagList = $('#tagList');
$("#houseFeature").on("show.bs.modal", function () {
tagList.html('');
$.ajax({
type: "POST",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTagOrFeature&type=" + type,
data: "action=searchTagOrFeature&type=" + search_type,
success: function (data) {
var tr;
$.each(data, function (index, item) {
......@@ -37,13 +38,18 @@
tr.append('<td id="' + item.id + '">' + item.value + '</td>');
tagList.append(tr);
});
tagList.find("tr > td").on("click", function () {
callback($(this).attr('id'), $(this).text());
});
}
});
});
tagList.on("click", "tr > td", function () {
search_callback($(this).attr('id'), $(this).text());
});
existsCancel();
});
function init_modal_addTag(type, callback) {
search_type = type;
search_callback = callback;
$('#houseFeature').modal('show');
}
</script>
{% endblock %}
\ No newline at end of file
<!DOCTYPE html>
<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">
<div class="row" >
<div class="col-md-10">
<div class="row">
<div class="col-md-8">
<div id="staffImg">
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择员工
</button>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="intent">目标业绩:</label>
<input name="intent" id="intent" type="text" class="form-control" disabled="true">
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="completeRate">达成率:</label>
<input id="completeRate" type="text" class="form-control" readonly>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<label for="accounts">应收佣金:</label>
<input name="accounts" id="accounts" type="text" class="form-control">
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<button type="button" class="button action" id="paid">
添加实收佣金
</button>
</div>
</div>
<table class="form-table">
<tbody id="paidTbody">
</tbody>
</table>
</div>
<div class="col-md-2">
<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>
</form>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
(function($){
$(document).ready(function(){
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var output = d.getFullYear() + '/' +
(month<10 ? '0' : '') + month + '/' +
(day<10 ? '0' : '') + day;
init_modal_myConsultantList(addStaff);
$("form").on('click','#paid',function(){
var tr = $("<tr>");
var th = $("<th>");
var td = $("<td>");
var paidTime = $("<input>").attr({"type":"text","value":output}).addClass("form-control");
var paid = $("<input>").attr({"type":"text"}).addClass("form-control");
var paiiDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action paiiDelet 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(paiiDelet);
tr.append(th1).append(td1).append(th2).append(td2).append(td3);
$("#paidTbody").append(tr);
});
$("#staffImg").on("click",".consultantCancel",function(){
$(this).parents("p").remove();
});
$("#accounts").change(function(){
if($("#accounts").val().length > 0){
$("#intent").removeAttr("disabled");
}else{
$("#intent").attr("disabled","true");
}
});
$("#paidTbody").on("click",".paiiDelet",function(){
$(this).parents("tr").remove();
})
});
function addStaff(data){
var row = $("<div>").addClass("row").css("margin-bottom","10px");
var left = $("<div>").addClass("col-md-2");
var img = $("<img>").attr({"src":data.imageUrl,"height":100,"width":100,"style":"margin-right:50px"});
left.append(img);
var mid = $("<div>").addClass("col-md-2");
var label = $("<label>").append(data.name);
mid.append(label);
var mid2 =$("<div>").addClass("col-md-6");
var input = $("<input>").attr({"type":"text"});
var label2 = $("<label>").append("部门:").append(input);
mid2.append(label2);
var right = $("<div>").addClass("col-md-2");
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
right.append(cancel);
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value":data.id});
row.append(left).append(mid).append(mid2).append(right);
var p = $("<p>").append(row).append(recommendConsultant);
$("#consultantImg").append(p);
$("#staffImg").append(p);
controlCommand("staffImg",1,1);
}
})(jQuery);
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
{% set title = contractId?"修改合同":"添加合同" %}
{% set title = result?"修改合同":"添加合同" %}
{% set disabled = result?"disabled":"" %}
<meta charset="utf-8">
<title>{{title}}</title>
</head>
<body>
<h2 class="title">{{title}}</h2>
<form action="" method="POST" enctype="multipart/form-data" class="form-inline">
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div>
<form id="contract" action="" method="POST" enctype="multipart/form-data" class="form-inline">
<div class="row">
<div class="col-md-10">
<div class="col-xs-10">
<!-- Nav tabs -->
<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"><a href="#soInfo" aria-controls="soInfo" role="tab" data-toggle="tab">业主/买方信息</a></li>
<li role="presentation"><a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a></li>
<li role="presentation"><a href="#recommend" aria-controls="recommend" role="tab" data-toggle="tab">推荐房源</a></li>
<li role="presentation" style="display: none;"><a id="houseInfo" data-toggle="tab">房源信息</a></li>
<li role="presentation" style="display: none;"><a id="customerInfo" data-toggle="tab">客源信息</a></li>
</ul>
<!-- Tab panes -->
......@@ -25,40 +29,42 @@
<div class="row">
<div class="col-md-6" class="form-control">
<label for="business">业务:</label>
<select name="business" id="business">
<select name="business" id="business" {{disabled}}>
<option value="-1">请选择</option>
<option value="0">新房</option>
<option value="1">二手房</option>
<option value="2">租房</option>
</select>
</div>
{% if result.contractId %}
<div class="col-md-6" class="form-control">
<label>合同编号:</label>
<label></label>
<label>{{result.contractId}}</label>
</div>
{% endif %}
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="houseNumber">房源编号:</label>
<input name="houseNumber" id="houseNumber" type="text" value="{{result.houseNumber}}" class="form-control" disabled>
<label for="houseNumberText">房源编号:</label>
<input name="houseNumberText" type="text" value="{{result.houseNumber}}" class="form-control" disabled>
</div>
<div class="col-md-6">
<label for="address">房源地址:</label>
<input id="address" type="text" value="{{result.address}}" class="form-control" disabled style="width:60%;">
<input type="button" id="select_house" value="选择" class="form-control">
<label for="addressText">房源地址:</label>
<input name="addressText" type="text" value="{{result.address}}" class="form-control" style="width:60%;" disabled>
<input type="button" id="select_house" value="选择" data-toggle="modal" data-target="#myModal" class="form-control" {{disabled}}>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="customerNumber">客源编号:</label>
<input id="customerNumber" name="customerNumber" type="text" value="{{result.customerNumber}}" class="form-control" disabled style="width:60%;">
<input type="button" id="customerNumber" value="选择" class="form-control">
<label for="customerNumberText">客源编号:</label>
<input name="customerNumberText" type="text" value="{{result.customerNumber}}" class="form-control" style="width:60%;" disabled>
<input type="button" id="select_customer" value="选择" data-toggle="modal" data-target="#addCustomer" class="form-control" {{disabled}}>
</div>
<div class="col-md-6">
<label for="signedDate">签约日:</label>
<input name="signedDate" id="signedDate" type="date" value="{{result.signedDate}}" class="form-control">
<input name="signedDate" type="date" value="{{result.signedDate}}" class="form-control">
</div>
</div>
<br />
......@@ -69,19 +75,21 @@
</div>
<div class="col-md-6">
<label for="area">面积:</label>
<input id="area" type="text" value="{{result.area}}" class="form-control">平方米
<input name="area" id="area" type="text" value="{{result.area}}" class="form-control">平方米
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="price">合同金额:</label>
<input name="price" id="price" type="text" value="{{result.price}}" class="form-control">
<input name="price" id="price" type="text" value="{{result.price}}" class="form-control" {{disabled}}>
</div>
<div class="col-md-6">
<label for="managerId">主管:</label>
<select name="managerId" id="managerId" class="form-control">
{% for item in managers %}
<option value="{{item.ID}}">{{item.display_name}}</option>
{% endfor%}
</select>
</div>
</div>
......@@ -108,15 +116,19 @@
</p>
<p>
<label for="oPhone">手机:</label>
<input name="oPhone" id="oPhone" type="text" value="{{result.oPhone}}" class="form-control">
<input name="oPhone" id="oPhone" type="text" value="{{result.oPhone}}" class="form-control" {{disabled}}>
</p>
<p>
<label for="oID">身份证:</label>
<input name="oID" id="oID" type="text" value="{{result.oID}}" class="form-control">
</p>
<p>
<label for="oBroker">经纪人:</label>
<input name="oBroker" id="oBroker" type="text" value="{{result.oBroker}}" class="form-control">
</p>
<p>
<label for="oCommission">佣金:</label>
<input name="oCommission" id="oCommission" type="text" value="{{result.oCommission}}" class="form-control">
<input name="oCommission" id="oCommission" type="text" value="{{result.oCommission}}" class="form-control" {{disabled}}>
</p>
<p>
<label for="oAddress">地址:</label>
......@@ -140,15 +152,19 @@
</p>
<p>
<label for="cPhone">手机:</label>
<input name="cPhone" id="cPhone" type="text" value="{{result.cPhone}}" class="form-control">
<input name="cPhone" id="cPhone" type="text" value="{{result.cPhone}}" class="form-control" {{disabled}}>
</p>
<p>
<label for="cID">身份证:</label>
<input name="cID" id="cID" type="text" value="{{result.cID}}" class="form-control">
</p>
<p>
<label for="cBroker">经纪人:</label>
<input name="cBroker" id="cBroker" type="text" value="{{result.oBroker}}" class="form-control">
</p>
<p>
<label for="cCommission">佣金:</label>
<input name="cCommission" id="cCommission" type="text" value="{{result.cCommission}}" class="form-control">
<input name="cCommission" id="cCommission" type="text" value="{{result.cCommission}}" class="form-control" {{disabled}}>
</p>
<p>
<label for="cAddress">地址:</label>
......@@ -166,29 +182,150 @@
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="business">
</div>
<div role="tabpanel" class="tab-pane" id="owner">
</div>
<div role="tabpanel" class="tab-pane" id="photos">
</div>
<div role="tabpanel" class="tab-pane" id="recommend">
</div>
</div>
<div class="col-xs-2">
<input type="hidden" name="type" value="1">
<input type="hidden" name="businessId" id="businessId">
<input type="hidden" name="houseId" id="houseId">
<input type="hidden" name="houseNumber" id="houseNumber">
<input type="hidden" name="customerNumber" id="customerNumber">
<input type="hidden" name="address" id="address">
<div class="row" style="position: fixed;">
<select name="status" id="status">
{% for item in status %}
<option value="{{item.id}}">{{item.value}}</option>
{% endfor %}
</select>
<input type="submit" id="submit" class="button action">
</div>
<div class="col-md-2">
<input type="text" name="type" value="1" hidden="hidden">
<input type="submit" id="submit" class="button action" style="position: fixed;">
</div>
</div>
</form>
<script>
(function($){
$(document).ready(function(){
{% if result %}
$("#business,#businessId").val({{result.business}});
$("#status").val({{result.status}});
$("#managerId").val({{result.managerId}});
showHouseTag({{result.business}},{{result.houseId}});
showCustomerTag({{result.customerNumber}});
{% endif %}
$("#select_house").click(function(){
if(checkBusinessSelected()){
init_modal_houseList(selectHouse,$("#business").val());
}else{
return false;
}
});
$("#select_customer").click(function(){
if(checkBusinessSelected()){
init_modal_addCustomer(selectCustomer,$("#business").val());
}else{
return false;
}
});
var rulesJson = {
houseNumber:'required',
customerNumber:'required',
businessId:'required',
permitNumber:'required',
area:'required',
price:'required',
signedDate:'required'
};
$('#contract').validate({
onkeyup: false,
onfocusout: false,
ignore: [],
errorClass: "my-error-class",
rules:rulesJson ,
messages: {
houseNumber:'请选择房源',
customerNumber:'请选择客源',
businessId:'请选择业务类型',
permitNumber:'请选输入产证编号',
area:'请选输入面积',
price:'请选输入金额',
signedDate:'请选输入签约日期',
},
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1",
submitHandler: function (form) {
form.submit();
}
});
});
function checkBusinessSelected(){
if($("#business").val() == -1){
alert("请先选择业务");
return false;
}
return true;
}
function setBusinessDisabled(){
$("#businessId").val($("#business").val());
$("#business").attr("disabled", true);
}
function selectCustomer(data){
$("input[name='customerNumberText']").val(data.id);
$("#customerNumber").val(data.id);
showCustomerTag(data.id);
close_modal_addCustomer();
setBusinessDisabled();
}
function selectHouse(data){
$("input[name='addressText']").val(data.address);
$("input[name='houseNumberText']").val(data.house_number);
$("#address").val(data.address);
$("#houseNumber").val(data.house_number);
$("#houseId").val(data.id);
var houseType = $("#business").val();
if(houseType != -1){
showHouseTag(houseType,data.id);
}
close_modal_houseList();
setBusinessDisabled();
}
function showCustomerTag(id){
$("#customerInfo").parent().show();
$("#customerInfo").unbind().click(function(){
window.open("{{adminUrl}}admin.php?page=customer&edit=true&id="+id);
});
}
function showHouseTag(houseType,id){
houseType = houseType+"";
$("#houseInfo").parent().show();
switch(houseType){
case "0":
houseType = "newHouse";
break;
case "1":
houseType = "secHandHouse";
break;
case "2":
houseType = "rentHouse";
break;
}
$("#houseInfo").unbind().click(function(){
window.open("{{adminUrl}}admin.php?page="+houseType+"&edit=true&id="+id);
});
}
})(jQuery);
</script>
{% include 'recommendHouse.html' %}
{{ block('recommendHouse') }}
{% include 'addCustomer.html' %}
{{ block('addCustomer') }}
</body>
</html>
\ No newline at end of file
<div class="wrap">
{{function("Contract_List::displayTable")}}
</div>
label.my-error-class {
padding-left: 16px;
padding-bottom: 2px;
font-weight: bold;
color: #EA5200;
}
\ No newline at end of file
......@@ -20,12 +20,6 @@
<a href="#customer" aria-controls="customer" role="tab" data-toggle="tab">客户信息</a>
</li>
<li role="presentation">
<a href="#demand" aria-controls="demand" role="tab" data-toggle="tab">需求信息</a>
</li>
<li role="presentation">
<a href="#house" aria-controls="house" 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>
{% if role == 'administrator' or role == 'editor' %}
......@@ -36,13 +30,11 @@
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="customer">
{% include 'customerInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="demand">
{% include 'customerDemand.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="house">
{% include 'customerDetail.html' %}
<hr>
{% include 'customerDemand.html' %}
<hr>
{% include 'customerInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %}
......
......@@ -141,7 +141,7 @@
<div class="col-md-6">
<label>户型:</label>
<select name="bedroom" id="bedroom" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="-1" selected="selected">不限</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
......@@ -154,7 +154,7 @@
</select>
<label for="bedroom"></label>
<select name="hall" id="hall" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="-1" selected="selected">不限</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
......@@ -163,7 +163,7 @@
</select>
<label for="hall"></label>
<select name="bathroom" id="bathroom" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="-1" selected="selected">不限</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
......
<div class="wrap">
<h2>客户列表</h2>
<form action="http://192.168.3.79/tospur/wp-admin/admin.php/" method="get">
<form method="get">
<input type="hidden" name="page" value="customerList">
<div id="search_form">
<input type="hidden" name="hasSearch" value="1"/>
<label for="status" class="hidden"></label>
<select name="status" id="status">
<option value="-1">状态</option>
......@@ -24,6 +25,67 @@
<option value="1">二手房</option>
<option value="2">租房</option>
</select>
<label for="listCity" class="hidden"></label>
<select id="listCity" name="listCity">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="listDistrict" class="hidden"></label>
<select id="listDistrict" name="listDistrict">
<option value="-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="listPlate" class="hidden"></label>
<select id="listPlate" name="listPlate">
<option value="-1">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="totalPrice" class="hidden"></label>
<select id="totalPrice" name="totalPrice" class="hidden">
<option value="">总价</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="rentalPrice" class="hidden"></label>
<select id="rentalPrice" name="rentalPrice" class="hidden">
<option value ="">月租</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="buildProperty" class="hidden"></label>
<select id="buildProperty" name="buildProperty">
<option value="-1">房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="acreage" class="hidden"></label>
<select id="acreage" name="acreage">
<option value="">面积</option>
{% if acreage %}
{% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
<div style="margin-top: 10px;">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}">
......@@ -37,12 +99,102 @@
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
<form method="post">
{{ function("addCustomerTable") }}
<input type="hidden" name="allot_consultant_id" id="allot_consultant_id">
</form>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
$(document).ready(function () {
$('#demand_type').val('{{ demand_type }}');
var demand_type_select = $('#demand_type');
demand_type_select.val('{{ demand_type }}');
search_form_set_page();
var acreage = $("#acreage");
var totalPrice = $("#totalPrice");
var rentalPrice = $("#rentalPrice");
var listCity = $('#listCity');
listCity.change(function () {
var cityId = $('#listCity').val();
setCity('listCity', 'listDistrict', 'listPlate');
acreage.find('option:not(:first-child)').remove();
totalPrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove();
//面积
searchAcreage(cityId, acreage);
setTotalOrRentalPrice(demand_type_select, cityId);
});
//设置区域
$('#listDistrict').change(function () {
setArea('listCity', 'listDistrict', 'listPlate');
});
demand_type_select.change(function () {
totalPrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove();
setTotalOrRentalPrice($(this), listCity.val());
});
setTotalOrRentalPrice(demand_type_select, listCity.val());
function setTotalOrRentalPrice(self, cityId) {
var demand_type = self.val();
if (demand_type == 0 || demand_type == 1) {
totalPrice.removeClass('hidden');
rentalPrice.addClass('hidden');
searchTotalPrice(cityId, totalPrice);
} else if (demand_type == 2) {
rentalPrice.removeClass('hidden');
totalPrice.addClass('hidden');
searchRentalPrice(cityId, rentalPrice);
}else{
rentalPrice.addClass('hidden');
totalPrice.addClass('hidden');
}
}
//批量操作
$('select[name=action]').change(function(){
//分配置业顾问
if ($(this).find('option:selected').val() == 'allot') {
//选择房/客源
var checkbox = $('input[name="customerlist[]"]');
if(checkbox.is(':checked')){
var array = [];
$('input[name="customerlist[]"]:checked').map(function() {
var consultant_id = Number($(this).data('consultant'));
if (array.indexOf(consultant_id) == -1) {
array.push(consultant_id);
}
});
var confirmFlag = true;
if(array.length>1){
confirmFlag = confirm('当前选择的房/客源置业顾问不同,是否继续');
}
if(confirmFlag){
$('#myConsultant').modal('show');
}
//未选择房/客源,下拉框显示批量操作
}else{
$(this).find('option:first').attr('selected', 'selected');
alert('请选择房/客源');
return false;
}
}
});
init_modal_myConsultantList(function (data) {
var consultant_id = Number(data.id);
$('#allot_consultant_id').val(consultant_id);
});
$("#myConsultant").on("hide.bs.modal", function () {
var allot_consultant_id = Number($('#allot_consultant_id').val());
if (!allot_consultant_id) {
$('select[name=action]').find('option:first').attr('selected', 'selected');
}
});
});
</script>
\ No newline at end of file
<h2>添加特色</h2>
<label for="feature">特色:</label>
{% if type == 0 %}
{% set text = '标签' %}
{% else %}
{% set text = '特色' %}
{% endif %}
<h2>添加{{ text }}</h2>
<label for="feature">{{ text }}:</label>
<input id="feature" type="text">
<input type="submit" id="submit" class="button">
<h2>特色列表</h2>
<h2>{{ text }}列表</h2>
<table class="table">
<thead>
</thead>
......@@ -19,7 +24,6 @@
</tbody>
</table>
<script>
var admin_url = '{{ admin_url }}';
(function ($) {
$(document).ready(function () {
$('#submit').click(function () {
......@@ -28,14 +32,14 @@
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name,
data: 'action=add_feature&name=' + name + '&type={{ type }}',
success: function (data) {
switch (data.code) {
case 2000:
window.location.href = admin_url + 'admin.php?page=add_feature';
window.location.href = '{{ request_url }}';
break;
case 2001:
alert('不能重复添加特色');
alert('不能重复添加{{ text }}');
break;
default:
break;
......@@ -43,7 +47,7 @@
}
});
} else {
alert('请输入特色');
alert('请输入{{ text }}');
}
});
});
......
{% include 'listBlock.html' %}
{{ block('listBlock') }}
\ No newline at end of file
<style>
p {
font-size: 15px;
margin: 20px 0;
}
</style>
<h2>诚信宣言</h2>
<label for="introduction">
<textarea id="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ introduction }}</textarea>
</label>
<p>
<label for="time">入职时间:</label>
<input type="date" id="time" value="{{ time }}">
</p>
<p>
<label for="introduction" style="vertical-align: top;">诚信宣言:</label>
<textarea id="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ introduction }}</textarea>
</p>
<p>
<input type="hidden" id="user_id" value="{{ user_id }}">
<input type="submit" id="submit" class="button">
</p>
<script>
(function ($) {
var oldIntroduction = '{{ introduction }}';
$(document).ready(function () {
$('#submit').click(function () {
var introduction = $('#introduction').val();
var time = $('#time').val();
var user_id = $('#user_id').val();
if (introduction.trim() != '' && oldIntroduction != introduction) {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=submit_introduction&introduction=' + introduction + '&user_id=' + user_id,
data: 'action=submit_introduction&time=' + time + '&introduction=' + introduction + '&user_id=' + user_id,
success: function (data) {
if (data) {
alert('提交成功');
}
}
});
}else{
alert('请修改诚信宣言');
}
});
});
})(jQuery);
......
......@@ -44,7 +44,7 @@
}
function existsCancel(){
$("#preview,#houseImg,#feature").on("click",".existsCancel,.featureCancel",function(){
$("#preview,#houseImg,#feature,#mark").on("click",".existsCancel,.featureCancel",function(){
$(this).parent().remove();
});
}
......
{% block listBlock %}
<div class="wrap">
<h2> {% if house_type == 0%}新房列表{% elseif house_type == 1 %}二手房列表{% else %}租房房列表{% endif %}</h2>
<form id="scores-filter" method="GET">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="{{page}}"/>
<select id="listCity" name="listCity">
<option value="0"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="listDistrict" name="listDistrict">
<option value="0">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="listPlate" name="listPlate">
<option value="0">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% if house_type == 2%}
<select id="rentalPrice" name="rentalPrice">
<option value ="">租金</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% else%}
<select id="totalPrice" name="totalPrice">
<option value ="">价格</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% endif %}
{% if house_type == 0%}
<select id="room" name="room">
<option value="0">类型</option>
{% for item in room %}
<option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
{% endif %}
<select id="buildProperty" name="buildProperty">
<option value="0"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage">
<option value ="">面积</option>
{% if acreage %}
{% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select name="status" name="status">
<option value="-1">状态</option>
{% for item in status%}
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入楼盘名" name="searchText">
<input type="hidden" name="hasSearch" value="1"/>
<input type="hidden" id="house_type" value="{{house_type}}"/>
<input type="submit" id="submit" class="button action" value="搜索">
<!-- Now we can render the completed list table -->
{% if house_type == 0 %}
{{function("addNewHouseTable")}}
{% elseif house_type == 1%}
{{function("addSecTable")}}
{% else %}
{{function("addRentTable")}}
{% endif %}
</form>
</div>
<script>
(function ($) {
$(document).ready(function(){
var acreage =$("#acreage");
var totalPrice = $("#totalPrice");
var rentalPrice = $("#rentalPrice");
$("#listCity").change(function() {
var cityId = $("#listCity").val();
setCity("listCity", "listDistrict", "listPlate");
acreage.find('option:not(:first-child)').remove();
totalPrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove();
//面积
searchAcreage(cityId, acreage);
//城市联动房子价格
if ($("#house_type").val() == 2) {
searchRentalPrice(cityId, rentalPrice);
}else{
searchTotalPrice(cityId,totalPrice);
}
});
//设置区域
$("#listDistrict").change(function(){
setArea("listCity","listDistrict","listPlate");
})
});
})(jQuery);
</script>
{% endblock %}
\ No newline at end of file
<div id="preview">
{% set exists_ids = "" %}
{% for item in mainImage %}
{% if exists_ids != "" %}
{% set exists_ids = exists_ids~"," %}
{% endif %}
{% set exists_ids = exists_ids~item.id %}
<div>
<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">
{% for i in buildProperty %}
<option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option>
{% endfor %}
</select>
<input type="text" placeholder="面积" name="exists[{{item.id}}][housearea]" class="form-control" value="{{item.area}}" style="width: 100px;display:inline-block; margin-right: 50px">
<input type="button" value="删除" class="button action cancel existsCancel" style="margin-top: 30px">
</div>
{% endfor %}
<p></p>
<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>
<script>
(function($){
$(document).ready(function(){
$("form").on("change",".files",function(){
mainHouse(this,i);
$(this).hide();
i++;
});
$("#preview").on("click",".cancel",function(){
$(this).parent("div").remove();
});
});
//显示主力户型
function mainHouse(input,i){
var reader = new FileReader();
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 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 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 select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px"});
{% for item in buildProperty %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]","style":"width: 100px;display:inline-block;margin-right:50px"}).addClass("form-control");
var div = $("<div>").attr({"property":+i}).append(img).append(select).append(areatext).append(button).append(type).append(mainHousePic);
$("form").find("#preview > p").after(file);
$("#preview > p").append(div);
}
reader.readAsDataURL(input.files[0]);
}
})(jQuery);
</script>
\ No newline at end of file
<br />
<div class="row">
<div class="col-md-12">
<label for="housename">城市:</label>
<select id="baseCity" name="baseCity" class="form-control">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="baseAreaId" name="baseAreaId" class="form-control">
<option value = "-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="basePlateId" name="basePlateId" class="form-control">
<option value = "-1">板块</option>
{% if district %}
{% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
</div>
<br />
<div class="row">
<div class="col-md-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">
</div>
<div class="col-md-6">
<label for="developers">开发商:</label>
<input name="developers" type="text" value="{{result.developer}}" class="form-control" >
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="check_in_time">入住时间:</label>
<input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" >
</div>
<div class="col-md-6">
<label for="property_age">产权年限:</label>
<input name="property_age" type="text" value="{{result.property_age}}" class="form-control" >
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="developers">建筑类型:</label>
<select id="baseRoom" name="baseRoom" class="form-control">
{% for item in room %}
<option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-6">
<label for="decoration">装修程度:</label>
<select name="decoration" class="form-control">
<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="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" >
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="volume_rate">容积率:</label>
<input name="volume_rate" type="text" value="{{result.volume_rate}}" class="form-control">
</div>
<div class="col-md-6">
<label for="greening_rate">绿化率:</label>
<input name="greening_rate" type="text" value="{{result.greening_rate}}" class="form-control" >
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="property_management">物业公司:</label></th>
<input name="property_management" type="text" value="{{result.property_management}}" class="form-control" >
</div>
<div class="col-md-6">
<label for="property_money">物业费:</label>
<input name="property_money" type="text" value="{{result.property_money}}" class="form-control">
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="parking_spaces">车位数:</label>
<input name="parking_spaces" type="text" value="{{result.parking_spaces}}" class="form-control" >
</div>
<div class="col-md-6">
<label for="periphery">周边配套:</label>
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div>
</div>
<br />
<div class="row">
<div class="col-md-6">
<label for="traffic">交通线路:</label>
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</div>
<div class="col-md-6">
<label for="location">地域坐标:</label>
<input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<label for="overview">最新动态:</label>
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<label for="overview">楼盘概述:</label>
<textarea name="overview" rows="4" cols="60" class="form-control">{{result.overview}}</textarea>
</div>
</div>
......@@ -6,299 +6,65 @@
<title>{{title}}</title>
</head>
<body>
<script>
var i = 0
</script>
<h2 class="title">{{title}}</h2>
<form action="" method="POST" enctype="multipart/form-data" id="newHouse">
<div class="row">
<div class="col-md-11">
<div class="row">
<div class="col-md-4">
<label for="housename">楼盘名:</label>
<input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="mark">标签:</label>
<input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</div>
<div class="col-md-4">
<label for="community_name">小区名:</label>
<input name="community_name" id="community_name" type="text" value="{{result.community_name}}" class="form-control" >
</div>
</div><br>
<div class="row">
<div class="col-md-8">
<label for="address">地址:</label>
<input name="address" type="text" value="{{result.address}}" class="form-control">
</div>
<div class="col-md-4">
<label for="average_price">均价:</label>
<p>
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control" style="width:80%;display: inline-block">
</p>
</div>
</div><br>
<div class="row">
<div class="col-md-8">
<label for="latest_news">最新动态:</label>
<textarea name="latest_news" rows="4" cols="40" class="form-control" >{{result.latest_news}}</textarea>
</div>
</div><br>
<h2 class="title">位置及周边</h2>
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div>
<form action="" method="POST" enctype="multipart/form-data" id="newHouse" class="form-inline">
<div class="row">
<div class="col-md-4">
<label for="from">所属地区:</label>
<div class="row">
<div class="col-md-3">
<select id="baseCity" name="baseCity" class="required">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<select id="baseAreaId" name="baseAreaId">
<option value = "-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
<div class="col-md-3">
<select id="basePlateId" name="basePlateId">
<option value = "-1">板块</option>
{% if district %}
{% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
<div class="col-md-11">
<!-- Nav tabs -->
<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"><a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a></li>
<li role="presentation"><a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a></li>
<li role="presentation"><a href="#mainHouse" aria-controls="mainHouse" role="tab" data-toggle="tab">主力户型</a></li>
<li role="presentation"><a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a></li>
<li role="presentation"><a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a></li>
<li role="presentation"><a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="info">
{% if (house_type==1 or house_type == 2)%}
{% include 'houseInfo.html' %}
{% else %}
{% include 'newHouseInfo.html' %}
{% endif %}
</select>
</div>
</div>
</div>
<div class="col-md-4">
<th><label for="location">地域坐标:</label>
<td> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
</div>
<div class="col-md-4">
<label for="traffic">交通线路:</label>
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</div>
</div><br>
<div class="row">
<div class="col-md-4">
<label for="periphery">周边配套:</label>
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div>
</div><br>
<h2 class="title">基本信息</h2>
<div class="row">
<div class="col-md-4">
<div class="row">
<div class="col-md-4">
<label for="developers">建筑类型:</label>
<select id="baseRoom" name="baseRoom">
{% for item in room %}
<option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="col-md-4">
<label for="developers">开发商:</label>
<input name="developers" type="text" value="{{result.developer}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="check_in_time">入住时间:</label>
<input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" >
</div>
</div><br>
<div class="row">
<div class="col-md-4">
<label for="property_age">产权年限:</label>
<input name="property_age" type="text" value="{{result.property_age}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="decoration">装修状况:</label></th>
<input name="decoration" type="text" value="{{result.decoration}}" class="form-control">
</div>
<div class="col-md-4">
<label for="covered_area">建筑面积:</label></th>
<div class="row">
<div class="col-md-9">
<input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" >
</div>
<div class="col-md-3">
<font>平方米</font>
</div>
</div>
</div>
</div><br>
<div class="row">
<div class="col-md-4">
<label for="volume_rate">容积率:</label>
<input name="volume_rate" type="text" value="{{result.volume_rate}}" class="form-control">
</div>
<div class="col-md-4">
<label for="greening_rate">绿化率:</label>
<input name="greening_rate" type="text" value="{{result.greening_rate}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="households">规划户数:</label>
<input name="households" type="text" value="{{result.households}}" class="form-control" >
</div>
</div><br>
<div class="row">
<div class="col-md-4">
<label for="parking_spaces">车位数:</label>
<input name="parking_spaces" type="text" value="{{result.parking_spaces}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="property_management">物业公司:</label></th>
<input name="property_management" type="text" value="{{result.property_management}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="property_money">物业费:</label>
<input name="property_money" type="text" value="{{result.property_money}}" class="form-control">
</div>
</div><br>
<div class="row">
<div class="col-md-6">
<label for="overview">楼盘概述:</label>
<textarea name="overview" rows="4" cols="40" class="form-control">{{result.overview}}</textarea>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
</div><br>
<h2 class="title">关联信息</h2>
<table class="form-table">
<tbody>
<tr>
<th><label for="mainHouse">主力户型</label></th>
<td>
<div id="preview">
{% set exists_ids = "" %}
{% for item in mainImage %}
{% if exists_ids != "" %}
{% set exists_ids = exists_ids~"," %}
{% endif %}
{% set exists_ids = exists_ids~item.id %}
<div>
<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">
{% for i in buildProperty %}
<option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option>
{% endfor %}
</select>
<input type="text" placeholder="面积" name="exists[{{item.id}}][housearea]" class="form-control" value="{{item.area}}" style="width: 100px;display:inline-block; margin-right: 50px">
<input type="button" value="取消" class="button action cancel existsCancel" style="margin-top: 30px">
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
{% endfor %}
<p></p>
<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>
</td>
</tr>
<tr>
<th><label>房源相册</label></th>
<td>
{% if houseId %}
<div class="row">
<div class="col-md-3">
<font>类型</font>
<div role="tabpanel" class="tab-pane" id="mainHouse">
{% include 'mainHouse.html' %}
</div>
<div class="col-md-3">
<font>相册</font>
<div role="tabpanel" class="tab-pane" id="photos">
{% include 'photos.html' %}
</div>
<div class="col-md-3">
<font>设为封面</font>
<div role="tabpanel" class="tab-pane" id="addRecHouse">
{% include 'addRecHouse.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %}
</div>
{% endif %}
<div id="picList">
{% set exists_photo_ids = "" %}
{% for item in images %}
{% if exists_photo_ids != "" %}
{% set exists_photo_ids = exists_photo_ids~"," %}
{% endif %}
{% set exists_photo_ids = exists_photo_ids~item.image_id %}
<div class="row">
<div class="col-md-3">
<select name="exists_photo[{{ item.image_id }}][type]" style="margin-right: 50px">
{% for i in photoType %}
<option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
</div>
<div class="col-md-3">
<input type="radio" name="frontCover" style="margin-right: 50px" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} />
</div>
<div class="col-md-2">
<input type="button" value="删除" class="button action cancel existsCancel">
</div>
</div>
{% endfor %}
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
</div>
<button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px">
新增
</button>
</td>
</tr>
<tr>
<th><label for="traffic">推荐房源</label></th>
<td>
<div id="houseImg">
{% for item in recommends %}
<p>
<img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
<input type="button" value="删除" class="button action imgCancel existsCancel">
<input type="hidden" name="data[recommend][]" value="{{item.id}}">
</p>
{% endfor %}
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
添加房源
</button>
</td>
</tr>
<tr>
<th><label for="periphery">置业顾问</label></th>
<td>
<div id="consultantImg">
{% for item in consultant %}
<p>
<img src="{{item.imageUrl}}" height="90" width="140" style="margin-right: 50px">
<span style="margin-right: 50px">{{item.name}}</span>
<input type="button" value="删除" class="button action consultantCancel existsCancel">
<input type="hidden" name="data[recConsultant][]" value="{{item.id}}">
</p>
{% endfor %}
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择置业顾问
</button>
</td>
</tr>
</tbody>
</table>
<input type="text" name="type" value="1" hidden="hidden">
{% if houseId %}
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %}
</div>
<div class = "col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;">
{% if role == 'administrator' %}
<div class="row" style="position: fixed;top:60px;">
<div class="col-md-1">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:200px;">
<select id="status" name="status">
{% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
......@@ -306,335 +72,36 @@
</select>
</div>
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div>
</div>
</form>
<!-- Modal -->
<!-- 新增房源弹出层 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="cityId">
</select>
<select id="areaId">
<option value = "-1">区域</option>
</select>
<select id="plateId">
<option value = "-1">板块</option>
</select>
<select id="price">
<option value = "-1">价格</option>
</select>
<select id="buildProperty">
<option value = "-1">房型</option>
{% for item in buildProperty %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="room">
<option value = "-1">类型</option>
{% for item in room %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage">
<option value = "-1">面积</option>
</select>
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext">
<button type="button" class="button action" id="search">搜索</button>
<ul id="houseList">
</ul>
</div>
</div>
</div>
</div>
<!-- 推荐房源弹出层 -->
{% include 'recommendHouse.html' %}
{{ block('recommendHouse') }}
<!-- 置业顾问弹出层 -->
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="consultCity">
</select>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control">
<button type="button" class="button action" id="searchConsult">搜索</button>
<ul id="consultantList">
</ul>
</div>
</div>
</div>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
(function($){
$(document).ready(function(){
var titleFlag = 0;
//主力房源中选择图片file的下标
var i = 0;
//入住时间选择
$("#checkin").datepicker({
dateFormat: "yy-mm-dd"
});
//主力房源选择文件
$("form").on("change",".files",function(){
readURL(this,1);
$(this).hide();
});
//主力房源中图片的删除功能
$("form").on("click",".cancel",function(){
$buttonid = $(this).attr("property");
$("[property = "+$buttonid+"]").remove();
$("form input[type='file']:last-child").show();
});
//基本信息的联动AJAX
$("#baseCity").change(function(){
var cityId = $("#baseCity").val();
var baserArea = $("#baseAreaId");
$('#baseAreaId').find('option:not(:first-child)').remove();
$('#basePlateId').find('option:not(:first-child)').remove();
//城市联动区域
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,baserArea);
}
setCity("baseCity","baseAreaId","basePlateId");
});
});
//区域联动板块
$("#baseAreaId").change(function(){
var basePlate = $("#basePlateId");
var areaId = $("#baseAreaId").val();
var cityId = $("#baseCity").val();
$('#basePlateId').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,basePlate);
}
});
});
//根据上方选择的城市,选择推荐房源的默认城市
$("#recHouseBt").click(function(){
$('#cityId').find('option').remove();
$('#areaId').find('option:not(:first-child)').remove();
$('#plateId').find('option:not(:first-child)').remove();
$('#price').find('option:not(:first-child)').remove();
$('#acreage').find('option:not(:first-child)').remove();
$("#houseList").find("li").remove();
var acreage =$("#acreage");
var price = $("#price");
var cityId = $("#baseCity").val();
var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",cityId).append(cityName);
$("#cityId").append(option);
if(cityId != -1){
var area = $("#areaId");
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,area);
}
});
//城市联动房子面积
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+cityId,
success:function(json){
addOption(json,acreage);
}
});
//城市联动房子价格
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchUnitPriceRange&cityId="+cityId,
success:function(json){
addOption(json,price);
}
});
addList(0);
}
});
//区域联动板块
$("#areaId").change(function(){
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plate = $("#plateId");
$("#houseList").find("li").remove();
$('#plateId').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,plate);
}
});
});
//推荐房源下显示图片信息以及房名
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
addList(0);
});
//添加房源中搜索框的搜索
$("#search").click(function(){
$searchtext = $("#searchtext").val();
$("#houseList").find("li").remove();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&searchText="+$searchtext,
success:function(json){
var result = json.result;
for(var i = 0; i < result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140});
var li = $("<li>").addClass("addImg").append(img).append(name);
$("#houseList").append(li);
}
}
});
})
//根据上方选择的城市,选择推荐置业顾问的默认城市
$("#recConsultantBt").click(function(){
$('#consultCity').find('option').remove();
$("#consultantList").find("li").remove();
var consulCityId = $("#baseCity").val();
var consultantName =$("#consultantName").val();
var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",consulCityId).append(cityName);
$("#consultCity").append(option);
$.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":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li);
}
}
});
});
//添加置业顾问弹出层中搜索框的搜索内容
$("#searchConsult").click(function(){
var consulCityId = $("#consultCity").val();
var consultantName =$("#consultantName").val();
$("#consultantList").find("li").remove();
$.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":90,"width":140});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li);
}
}
setArea("baseCity","baseAreaId","basePlateId");
});
})
//点击添加房源中显示的列表,在界面中显示
$("#houseList").on("click",".addImg",function(){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")});
var url = $(this).find("img").attr("src");
var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:50px"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseImg").append(p);
controlCommand();
});
//添加置业顾问
$("#consultantList").on("click",".consultantImg",function(){
var url = $(this).find("img").attr("src");
var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:55px"});
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
var font = $("<font>").attr("style","margin-right:50px").append( $(this).text());
var p = $("<p>").append(img).append(font).append(cancel).append(recommendConsultant);
$("#consultantImg").append(p);
});
//新增房源相册
$("#housePicture").click(function(){
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i,});
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var select = $("<select>").attr({"name":"data["+i+"][type]"});
var dicRadio = $("<div>").append(radio).addClass("col-md-3");
var dicPicDelet = $("<div>").append(picDelet).addClass("col-md-2");
var dicFile = $("<div>").append(file).addClass("col-md-3");
var dicSelect = $("<div>").append(select).addClass("col-md-3");
var div = $("<div>").append(dicSelect).append(dicFile).append(dicRadio).append(dicPicDelet).addClass("row");
{% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var fontA = $("<div>").append("<font>").append("设为封面").addClass("col-md-3");
var fontB = $("<div>").append("<font>").append("类型").addClass("col-md-3");
var fontC = $("<div>").append("<font>").append("相册").addClass("col-md-3");
var titleP = $("<div>").append(fontB).append(fontC).append(fontA).addClass("row");
$("#picList").append(div);
var url = getUrlParmas();
if(!url.id){
if( titleFlag== 0){
$("#picList").before(titleP);
titleFlag = 1
}
}
i++
});
//房源相册
$("#picList").on("change",".picFiles",function(){
readURL(this,2);
$(this).hide();
});
//删除房源相册、推荐房源、推荐置业顾问
$("#houseImg,#consultantImg").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
$(this).parents("p").remove();
});
$("#preview,#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#picList").on("click",".existsCancel",function(){
$(this).parent().parent().remove();
});
setDate("checkin");
var json = {"decoration":"{{result.decoration}}"};
revertOption(json);
$('#newHouse').validate({
onkeyup: false,
onfocusout: false,
ignore: [],
errorClass: "my-error-class",
rules: {
housename:'required',
......@@ -644,15 +111,14 @@
average_price:'required',
latest_news:'required',
baseCity:{
selectcheck: true
citySelectcheck: true
},
baseAreaId:{
selectcheck: true
areaSelectcheck: true
},
basePlateId:{
selectcheck: true
plateSelectcheck: true
}
},
messages: {
housename:'请输入楼盘名称',
......@@ -662,124 +128,29 @@
average_price:'请输入均价',
latest_news:'请输入最新动态'
},
errorLabelContainer: "#notice",
errorElement: 'div',
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1",
submitHandler: function (form) {
if($("#preview div").length == 0 ){
alert("请选择主力户型");
}else if($("#consultantImg > p").length == 0){
alert("请选择置业顾问");
} else{
form.submit();
}
}
});
jQuery.validator.addMethod('selectcheck', function (value) {
return (value != '-1');
},"请选择城市区域");
//file上传之前,显示图片的方法
function readURL(input,type) {
if(type == 1){
if (input.files && input.files[0]){
var reader = new FileReader();
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 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 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 select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px"});
{% for item in buildProperty %}{{item.id}}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]","style":"width: 100px;display:inline-block;margin-right:50px"}).addClass("form-control");
var div = $("<div>").attr({"property":+i}).append(img).append(select).append(areatext).append(button).append(type).append(mainHousePic);
$("form").find("#preview > p").after(file);
$("#preview > p").append(div);
i++;
}
}
}else{
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e){
var img = $("<img>").attr({"src":e.target.result,"height":90,"width":140});
$(input).before(img);
}
}
}
reader.readAsDataURL(input.files[0]);
}
function addOption(json,select){
var selectId = select.attr("id");
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId == "acreage" || selectId == "price"){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
function controlCommand(){
var num = $("#houseImg > p").length;
if(num>3){
alert("最多只能推荐3个房源");
$("#houseImg").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 addList($houseType){
$("#houseList").find("li").remove();
var cityId = $("#baseCity").val();
var buildPropertyId = $("#buildProperty").val();
var room = $("#room").val();
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plateId = $("#plateId").val();
var acreage = $("#acreage").val();
var price = $("#price").val();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+$houseType,
success:function(json){
var result = json.result;
var urlParams = getUrlParmas();
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = result[i]['path'];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
if(urlParams["id"]){
if(urlParams["id"]!=id){
$("#houseList").append(li);
}
}else{
$("#houseList").append(li);
if($("#photosTbody > tr").length == 0){
alert("请选择房源相册");
return false;
}
if($("#houseImg > p").length == 0){
alert("请选择推荐房源");
return false;
}
form.submit();
}
});
}
jQuery.validator.addMethod('citySelectcheck', function (value) {
return (value != '-1');
},"请选择城市");
jQuery.validator.addMethod('areaSelectcheck', function (value) {
return (value != '-1');
},"请选择区域");
jQuery.validator.addMethod('plateSelectcheck', function (value) {
return (value != '-1');
},"请选择板块");
});
})(jQuery);
......
......@@ -6,365 +6,60 @@
<title>{{title}}</title>
</head>
<body>
<script>
var i = 0
</script>
<h2 class="title">{{title}}</h2>
<form action="" method="POST" enctype="multipart/form-data" id="rentHouse">
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div>
<form action="" method="POST" enctype="multipart/form-data" id="rentHouse" class="form-inline">
<div class="row">
<div class="col-md-11">
<div class="row">
<div class="col-md-4">
<label for="housename">房源名:</label>
<input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
</div>
<div class="col-md-4">
<label for="community_name">小区名称:</label>
<input name="community_name" type="text" value="{{result.community_name}}" class="form-control">
</div>
<div class="col-md-4">
<label for="rent">租金:</label>
<div class="row">
<p>
<input name="rent" id="rent" type="text" value="{{rent.value}}" class="form-control" style="width:80%;display: inline-block"> 元/月
</p>
</div>
</div>
</div><br>
<div class="row">
<div class="col-md-6">
<label for="mark">标签:</label>
<input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</div>
</div><br>
<div class="row">
<!-- Nav tabs -->
<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"><a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a></li>
<li role="presentation"><a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a></li>
{% if not houseId %}
<div class="col-md-4">
<label for="owner_name">业主姓名:</label>
<input name="owner_name" id="owner_name" type="text" value="" class="form-control">
</div>
<div class="col-md-4">
<label for="owner_phone">业主电话:</label>
<input name="owner_phone" id="owner_phone" type="text" value="" class="form-control">
</div>
<li role="presentation"><a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a></li>
{% endif %}
</div><br>
<h2 class="title">基本信息</h2>
<div class="row">
<div class="col-md-12">
<label for="suite">门牌号码:</label></th>
<input name="suite" type="text" value="{{result.suite}}"style="width: 10%">
&nbsp;
<label for="floor">楼层:</label>
<input name="floor" type="text" value="{{result.floor}}" style="width: 5%">
&nbsp;
<label for="totalFloor">总层:</label>
<input type="text" name="totalFloor"value="{{result.totalFloor}}" style="width: 5%">
&nbsp;
<label for="faceto">朝向:</label>
<select name="faceto">
<option value="其他">其他</option>
<option value="东"></option>
<option value="南"></option>
<option value="西">西</option>
<option value="北"></option>
<option value="东西">东西</option>
<option value="南北">南北</option>
<option value="南南">南南</option>
<option value="东南">东南</option>
<option value="东北">东北</option>
<option value="西南">西南</option>
<option value="西北">西北</option>
</select>
&nbsp;
<label for="age">建筑年代:</label>
<!--<input name="age" type="text" value="{{result.age}}" class="form-control">-->
<select name="age">
<option>未知</option>
{% for item in age%}
<option {{ item == result.age?"selected":"" }}value="{{item}}">{{item}}</option>
{% endfor %}
</select>
&nbsp;
<label for="propertyRight">产权:</label>
<select name="propertyRight">
<option value="个人产权">个人产权</option>
<option value="单位产权">单位产权</option>
<option value="售后产权">售后产权</option>
<option value="家庭成员共有">家庭成员共有</option>
<option value="使用权">使用权</option>
<option value="小产权">小产权</option>
<option value="协议房">协议房</option>
<option value="私产">私产</option>
<option value="公产">公产</option>
<option value="合同发票">合同发票</option>
<option value="三联单">三联单</option>
<option value="其他">其他</option>
</select>
</div>
</div><br>
<div class="row">
<div class="col-md-12">
<label for="propertyProof">产证:</label>
<input type="text" name="propertyProof" value="{{result.propertyProof}}">
&nbsp;
<label for="decoration">装修状况:</label>
<select name="decoration">
<option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option>
<option value="中等装修">中等装修</option>
<option value="精装修">精装修</option>
<option value="豪华装修">豪华装修</option>
</select>
&nbsp;
<label for="useArea">使用面积:</label>
<input type="text" name="useArea" value="{{result.useArea}}" style="width: 10%;display: inline-block">平方米
&nbsp;
<label for="covered_area">建筑面积:</label>
<input name="covered_area" type="text" value="{{result.covered_area}}" style="width:10%;display: inline-block">平方米
&nbsp;
<input type="checkbox" id="keyCheck" {{ result.key?"checked":"" }}> <label for="key">钥匙:</label><input type="text" {% if not result.key %} disabled="true" {% endif %} id="key" name="key" value="{{result.key}}" style="width: 10%">
</div>
</div><br>
<div class="row">
<div class="col-md-12">
<input type="checkbox" id="garageCheck" {{ result.garage?"checked":"" }}> <label for="garage">车库:</label><input type="text" {% if not result.garage %}disabled="true"{% endif %} id="garage" name="garage" value="{{result.garage}}" style="width: 10%">
&nbsp;
<label for="street">街道:</label>
<input type="text" name="street" value="{{result.street}}">
&nbsp;
<label for="flat">楼号:</label>
<input name="flat" type="text" value="{{result.flat}}" style="width: 10%;">
&nbsp;
<label for="matching_facilities">设施:</label>
<input type="text" name="matching_facilities" value="{{result.matching_facilities}}">
&nbsp;
<label for="structure">结构:</label>
<select name="structure">
<option value="其他">其他</option>
<option value="框架">框架</option>
<option value="砖混">砖混</option>
<option value="剪力">剪力</option>
<option value="钢混">钢混</option>
<option value="木混">木混</option>
<option value="砖木">砖木</option>
</select>
</div>
</div><br>
<div class="row">
<div class="col-md-12">
<label for="from">户型:</label>
<select id="buildproperty_id" name="buildproperty_id">
{% for item in buildProperty %}
<option {{ item.id == result.buildproperty_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="roomNum">室:</label>
<select name="roomNum">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
<label for="livingRoom">厅:</label>
<select name="livingRoom">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<label for="bathRoom">卫:</label>
<select name="bathRoom">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<label for="kitchen">厨:</label>
<select name="kitchen">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<label for="balcony">阳台:</label>
<select name="balcony">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div><br>
<div class="row">
<div class="col-md-12">
<label for="overview">房源点评:</label>
<textarea name="overview" rows="4" cols="40" class="form-control" >{{result.overview}}</textarea>
</div>
</div><br>
<h2 class="title">位置及周边</h2>
<div class="row">
<div class="col-md-4">
<label for="from">所属地区:</label>
<div class="row">
<div class="col-md-3">
<select id="baseCity" name="baseCity" class="required">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<select id="baseAreaId" name="baseAreaId">
<option value = "-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
<div class="col-md-3">
<select id="basePlateId" name="basePlateId">
<option value = "-1">板块</option>
{% if district %}
{% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
</div>
</div>
<div class="col-md-4">
<label for="address">地址:</label>
<input name="address" type="text" value="{{result.address}}" class="form-control">
</div>
<div class="col-md-4">
<label for="traffic">交通线路:</label>
<input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</div>
</div><br>
<div class="row">
<div class="col-md-4">
<label for="periphery">周边配套:</label>
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div>
<div class="col-md-4">
<label for="location">地域坐标:</label>
<input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
</div>
</div><br>
<h2 class="title">关联信息</h2>
<table class="form-table">
<tbody>
<tr>
<th><label>房源相册:</label></th>
<td>
{% if houseId %}
<div class="row">
<div class="col-md-3">
<font>类型</font>
</div>
<div class="col-md-3">
<font>相册</font>
</div>
<div class="col-md-3">
<font>设为封面</font>
<li role="presentation"><a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a></li>
<li role="presentation"><a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a></li>
<li role="presentation"><a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="info">
{% include 'houseInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
{% endif %}
<div id="picList">
{% set exists_photo_ids = "" %}
{% for item in images %}
{% if exists_photo_ids != "" %}
{% set exists_photo_ids = exists_photo_ids~"," %}
{% endif %}
{% set exists_photo_ids = exists_photo_ids~item.image_id %}
<div class="row">
<div class="col-md-3">
<select name="exists_photo[{{ item.image_id }}][type]" style="margin-right: 50px">
{% for i in photoType %}
<option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option>
{% endfor %}
</select>
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
<div class="col-md-3">
<img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
<div role="tabpanel" class="tab-pane" id="owner">
{% include 'owner.html' %}
</div>
<div class="col-md-3">
<input type="radio" name="frontCover" style="margin-right: 50px" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} />
<div role="tabpanel" class="tab-pane" id="photos">
{% include 'photos.html' %}
</div>
<div class="col-md-2">
<input type="button" value="删除" class="button action cancel existsCancel">
<div role="tabpanel" class="tab-pane" id="addRecHouse">
{% include 'addRecHouse.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %}
</div>
{% endfor %}
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
</div>
<button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px">
新增
</button>
</td>
</tr>
<tr>
<th><label for="traffic">推荐房源</label></th>
<td>
<div id="houseImg">
{% for item in recommends %}
<p>
<img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
<input type="button" value="删除" class="button action imgCancel existsCancel">
<input type="hidden" name="data[recommend][]" value="{{item.id}}">
</p>
{% endfor %}
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
添加房源
</button>
</td>
</tr>
<tr>
<th><label for="periphery">置业顾问</label></th>
<td>
<div id="consultantImg">
{% for item in consultant %}
<p>
<img src="{{item.imageUrl}}" height="100" width="100" style="margin-right: 50px">
<span style="margin-right: 50px">{{item.name}}</span>
<input type="button" value="删除" class="button action consultantCancel existsCancel">
<input type="hidden" name="data[recConsultant][]" value="{{item.id}}">
</p>
{% endfor %}
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择置业顾问
</button>
</td>
</tr>
</tbody>
</table>
<input type="text" name="type" value="3" hidden="hidden">
{% if houseId %}
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %}
</div>
<div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;">
{% if role == 'administrator' %}
<div class="row" style="position: fixed;top:50px;">
{% if (role == 'administrator'or role =='eidtor') %}
<div class="row" style="position: fixed;top:200px;">
<select id="status" name="status">
{% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
......@@ -372,499 +67,112 @@
</select>
</div>
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
</div>
</div>
</form>
<!-- Modal -->
<!-- 新增房源弹出层 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="cityId">
</select>
<select id="areaId">
<option value = "-1">区域</option>
</select>
<select id="plateId">
<option value = "-1">板块</option>
</select>
<select id="price">
<option value = "-1">价格</option>
</select>
<select id="buildProperty">
<option value = "-1">房型</option>
{% for item in buildProperty %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="room">
<option value = "-1">类型</option>
{% for item in room %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage">
<option value = "-1">面积</option>
</select>
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext">
<button type="button" class="button action" id="search">搜索</button>
<ul id="houseList">
</ul>
</div>
</div>
</div>
</div>
<!-- 推荐房源弹出层 -->
{% include 'recommendHouse.html' %}
{{ block('recommendHouse') }}
<!-- 置业顾问弹出层 -->
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="consultCity">
<option value=""> 城市</option>
{% for item in city %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName">
<button type="button" class="button action" id="searchConsult">搜索</button>
<ul id="consultantList">
</ul>
</div>
</div>
</div>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<!-- 特色房源弹出层 -->
{% include 'addTag.html' %}
{{ block('addTag') }}
<script>
(function($){
$(document).ready(function(){
var titleFlag = 0;
//主力房源中选择图片file的下标
var i = 0;
//基本信息的联动AJAX
$("#baseCity").change(function(){
var cityId = $("#baseCity").val();
var baserArea = $("#baseAreaId");
$('#baseAreaId').find('option:not(:first-child)').remove();
$('#basePlateId').find('option:not(:first-child)').remove();
//城市联动区域
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,baserArea);
}
setCity("baseCity","baseAreaId","basePlateId");
});
});
//区域联动板块
$("#baseAreaId").change(function(){
var basePlate = $("#basePlateId");
var areaId = $("#baseAreaId").val();
var cityId = $("#baseCity").val();
$('#basePlateId').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,basePlate);
}
});
});
//根据上方选择的城市,选择推荐房源的默认城市
$("#recHouseBt").click(function(){
$('#cityId').find('option').remove();
$('#areaId').find('option:not(:first-child)').remove();
$('#plateId').find('option:not(:first-child)').remove();
$('#price').find('option:not(:first-child)').remove();
$('#acreage').find('option:not(:first-child)').remove();
$("#houseList").find("li").remove();
var acreage =$("#acreage");
var price = $("#price");
var cityId = $("#baseCity").val();
var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",cityId).append(cityName);
$("#cityId").append(option);
var area = $("#areaId");
if(cityId != -1){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,area);
}
});
//城市联动房子面积
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+cityId,
success:function(json){
addOption(json,acreage);
}
});
//城市联动房子价格
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchUnitPriceRange&cityId="+cityId,
success:function(json){
addOption(json,price);
}
});
addList(2);
}
});
//区域联动板块
$("#areaId").change(function(){
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plate = $("#plateId");
$("#houseList").find("li").remove();
$('#plateId').find('option:not(:first-child)').remove();
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,plate);
}
});
});
//推荐房源下显示图片信息以及房名
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
addList(2);
});
//添加房源中搜索框的搜索
$("#search").click(function(){
$searchtext = $("#searchtext").val();
$("#houseList").find("li").remove();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&searchText="+$searchtext,
success:function(json){
var result = json.result;
for(var i = 0; i < result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").addClass("addImg").append(img).append(name);
$("#houseList").append(li);
}
}
});
})
//根据上方选择的城市,选择推荐置业顾问的默认城市
$("#recConsultantBt").click(function(){
$('#consultCity').find('option').remove();
$("#consultantList").find("li").remove();
var consulCityId = $("#baseCity").val();
var consultantName =$("#consultantName").val();
var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",consulCityId).append(cityName);
$("#consultCity").append(option);
$.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":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li);
}
}
});
});
//添加置业顾问弹出层中搜索框的搜索内容
$("#searchConsult").click(function(){
var consulCityId = $("#consultCity").val();
var consultantName =$("#consultantName").val();
$("#consultantList").find("li").remove();
$.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);
}
}
});
})
//点击添加房源中显示的列表,在界面中显示
$("#houseList").on("click",".addImg",function(){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")});
var url = $(this).find("img").attr("src");
var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:50px"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseImg").append(p);
controlCommand("houseImg",3,0);
});
//添加置业顾问
$("#consultantList").on("click",".consultantImg",function(){
var url = $(this).find("img").attr("src");
var img = $("<img>").attr({"src":url,"height":100,"width":100,"style":"margin-right:50px"});
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
var font = $("<font>").attr("style","margin-right:50px").append( $(this).text());
var p = $("<p>").append(img).append(font).append(cancel).append(recommendConsultant);
$("#consultantImg").append(p);
controlCommand("consultantImg",1,1);
});
//新增房源相册
$("#housePicture").click(function(){
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i,});
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var select = $("<select>").attr({"name":"data["+i+"][type]"});
var dicRadio = $("<div>").append(radio).addClass("col-md-3");
var dicPicDelet = $("<div>").append(picDelet).addClass("col-md-2");
var dicFile = $("<div>").append(file).addClass("col-md-3");
var dicSelect = $("<div>").append(select).addClass("col-md-3");
var div = $("<div>").append(dicSelect).append(dicFile).append(dicRadio).append(dicPicDelet).addClass("row");
{% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var p = $("<p>").append(div);
var fontA = $("<div>").append("<font>").append("设为封面").addClass("col-md-3");
var fontB = $("<div>").append("<font>").append("类型").addClass("col-md-3");
var fontC = $("<div>").append("<font>").append("相册").addClass("col-md-3");
var titleP = $("<div>").append(fontB).append(fontC).append(fontA).addClass("row");
$("#picList").append(p);
var url = getUrlParmas();
if(!url.id){
if( titleFlag== 0){
$("#picList").before(titleP);
titleFlag = 1
}
}
i++
});
//房源相册
$("#picList").on("change",".picFiles",function(){
readURL(this,2);
$(this).hide();
});
//删除房源相册、推荐房源、推荐置业顾问
$("#houseImg,#consultantImg").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
$(this).parents("p").remove();
});
$("#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#picList").on("click",".existsCancel",function(){
$(this).parent().parent().remove();
});
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
$("form").find("select[name='faceto']").val("{{result.faceto}}");
$("form").find("select[name='age']").val("{{result.age}}");
$("form").find("select[name='propertyRight']").val("{{result.propertyRight}}");
$("form").find("select[name='decoration']").val("{{result.decoration}}");
$("form").find("select[name='source']").val("{{result.source}}");
$("form").find("select[name='structure']").val("{{result.structure}}");
$("form").find("select[name='roomNum']").val("{{result.roomNum}}");
$("form").find("select[name='livingRoom']").val("{{result.livingRoom}}");
$("form").find("select[name='bathRoom']").val("{{result.bathRoom}}");
$("form").find("select[name='kitchen']").val("{{result.kitchen}}");
$("form").find("select[name='balcony']").val("{{result.balcony}}");
$('#rentHouse').validate({
onkeyup: false,
onfocusout: false,
errorClass: "my-error-class",
rules: {
setArea("baseCity","baseAreaId","basePlateId");
});
setCheckBox();
setAge();
setDate("entrustDay");
setDate("deadLine");
var json = {
"faceto":"{{result.faceto}}",
"age":"{{result.age}}",
"propertyRight":"{{result.propertyRight}}",
"decoration":"{{result.decoration}}",
"source":"{{result.source}}",
"structure":"{{result.structure}}",
"roomNum":"{{result.roomNum}}",
"livingRoom":"{{result.livingRoom}}",
"bathRoom":"{{result.bathRoom}}",
"kitchen":"{{result.kitchen}}",
"balcony":"{{result.balcony}}"
};
revertOption(json);
var rulesJson = {
housename:'required',
mark:'required',
rent:'required',
owner_name:'required',
owner_phone:'required',
community_name:'required',
baseCity:{
selectcheck: true
citySelectcheck: true
},
baseAreaId:{
selectcheck: true
areaSelectcheck: true
},
basePlateId:{
selectcheck: true
plateSelectcheck: true
}
};
{% if not houseId %}
rulesJson.owner_name = 'required';
rulesJson.owner_phone = 'required';
{% endif %}
},
$('#rentHouse').validate({
onkeyup: false,
onfocusout: false,
ignore: [],
errorClass: "my-error-class",
rules:rulesJson ,
messages: {
housename:'请输入房源名称',
mark:'请输入标签',
owner_name:'请输入业主姓名',
owner_phone:'请输入业主电话',
rent:'请输入租金',
community_name:'请输入小区名称',
community_name:'请输入小区名称'
},
errorLabelContainer: "#notice",
errorElement: 'div',
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1",
submitHandler: function (form) {
if($("#consultantImg > p").length == 0 ){
if($("#consultantImg > p").length == 0){
alert("请选择置业顾问");
}else{
form.submit();
}
}
});
jQuery.validator.addMethod('selectcheck', function (value) {
return (value != '-1');
},"请选择城市区域");
function textDisable(checkId,textId){
if($('input[id="'+checkId+'"]:checked').length > 0){
$("#"+textId).removeAttr("disabled");
}else{
$("#"+textId).attr("disabled","true");
}
}
//file上传之前,显示图片的方法
function readURL(input,type) {
if(type == 1){
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e) {
var img = $("<img>").attr({"id":"target","src":e.target.result,"heghit":90,"width":140});
var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("cancel");
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":0,"property":+i});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files");
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"});
{% for item in buildProperty %}{{item.id}}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("regular-text");
var div = $("<div>").append(select).append(areatext).append(button).append(type);
var span = $("<span>").attr({"property":+i}).append(img).append(div);
$("form").find("#preview > p").before(file);
$("#preview > p").append(span);
i++;
}
}
}else{
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e){
var img = $("<img>").attr({"src":e.target.result,"heghit":90,"width":140});
$(input).before(img);
}
}
}
reader.readAsDataURL(input.files[0]);
}
function addOption(json,select){
var selectId = select.attr("id");
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId == "acreage" || selectId == "price"){
id = value;
return false;
}
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 addList($houseType){
$("#houseList").find("li").remove();
var cityId = $("#baseCity").val();
var buildPropertyId = $("#buildProperty").val();
var room = $("#room").val();
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plateId = $("#plateId").val();
var acreage = $("#acreage").val();
var price = $("#price").val();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+$houseType,
success:function(json){
var result = json.result;
var urlParams = getUrlParmas();
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = result[i]['path'];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
if(urlParams["id"]){
if(urlParams["id"]!=id){
$("#houseList").append(li);
}
}else{
$("#houseList").append(li);
if($("#photosTbody > tr").length == 0){
alert("请选择房源相册");
return false;
}
if($("#houseImg > p").length == 0){
alert("请选择推荐房源");
return false;
}
form.submit();
}
});
}
jQuery.validator.addMethod('citySelectcheck', function (value) {
return (value != '-1');
},"请选择城市");
jQuery.validator.addMethod('areaSelectcheck', function (value) {
return (value != '-1');
},"请选择区域");
jQuery.validator.addMethod('plateSelectcheck', function (value) {
return (value != '-1');
},"请选择板块");
});
})(jQuery);
......
......@@ -6,26 +6,51 @@
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<label for="mark">标签:</label>
<input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</div>
</div>
<table class="form-table">
<tbody>
<tr>
<th><label for="mark">标签</label></th>
<td>
<div id="mark" class="row">
</div><br/>
<button type="button" class="button action" id="addTagBtn">
标签
</button>
</td>
</tr>
</tbody>
</table>
<script>
$(document).ready(function () {
//显示选中的特色
init_modal_addTag(1, function (id, value) {
addFeature(id, value);
{% set markOld = function('SearchDao::searchFeatureOld', houseId, 0)|json_encode() %}
{% if markOld %}
var data = {{ markOld }};
$.each(data, function (i, item) {
addTag(item.tag_id, item.name);
});
existsCancel();
{% endif %}
var tagArray = [];
$('#addTagBtn').click(function(){
init_modal_addTag(0, function (id, value) {
tagArray = [];
$('input[name="data[houseTag][]"]').each(function (index, item) {
tagArray.push(Number($(item).val()));
});
function addFeature(id, value) {
var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
if(tagArray.indexOf(Number(id)) == -1){
addTag(id, value);
}else{
alert('不能重复选择标签');
}
});
});
});
function addTag(id, value) {
var houseTag = $("<input>").attr({"type": "hidden", "name": "data[houseTag][]", "value": id});
var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel ");
var span = $("<span>").attr("style", "margin-right:5px").append(value);
var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#feature").append(divCol);
var divCol = $("<div>").append(houseTag).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#mark").append(divCol);
}
</script>
\ No newline at end of file
<?php
class ContractDao {
public static function insert($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_CONTRACT,$params);
if($wpdb->insert_id){
return $wpdb->insert_id;
}
return $wpdb->last_error;
}
public static function setContractId($id,$contractId){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CONTRACT,array(
"contractId" => $contractId
),array(
"id" => $id
));
if($result){
return $result;
}else{
return $wpdb->last_error;
}
}
public static function update($id,$params){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CONTRACT,$params,array(
"id" => $id
));
if($wpdb->last_error)
return $wpdb->last_error;
return $result;
}
public static function searchContract($id){
global $wpdb;
$sql = "select tc.*,th.address from ".Config::TOSPUR_CONTRACT." tc
left join ".Config::TOSPUR_HOUSE_TABLE." th on tc.houseId = th.id
where tc.id = %d;";
$result = $wpdb->get_row($wpdb->prepare($sql,$id));
if($result){
return $result;
}else{
return $wpdb->last_error;
}
}
}
\ No newline at end of file
......@@ -27,6 +27,25 @@ class CustomerDao
}
return $context;
}
public static function searchCustomerByNameOrPhone(){
global $wpdb;
$search = "%".$_REQUEST['search']."%";
$sql = "SELECT tcs.id,tcs.name,tcs.phone FROM ".Config::TOSPUR_CUSTOMER_TABLE." tcs where (tcs.name like %s or tcs.phone like %s)";
switch($_REQUEST["customerDemand"]){
case "0":
$sql .= " and tcs.new_house = 1";
break;
case "1":
$sql .= " and tcs.secondHand_house = 1";
break;
case "2":
$sql .= " and tcs.rent_house = 1";
break;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $search,$search));
wp_send_json($result);
}
}
?>
\ No newline at end of file
<?php
class HouseDao {
public static function updateStatus($status,$houseId){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,array(
'status' => $status
),array(
'id' => $houseId
));
if($wpdb->last_error)
return $wpdb->last_error;
return $result;
}
public static function checkHouseStatus($houseId){
global $wpdb;
$result = $wpdb->get_row(Config::TOSPUR_HOUSE_TABLE,array(
'id' => $houseId
));
if($wpdb->last_error)
return $wpdb->last_error;
return $result;
}
}
\ No newline at end of file
......@@ -147,7 +147,7 @@ class InsertDao{
"house_area" => $data["$key"]["housearea"],
"image_id" => $imgid
);
$houseTypeAreaRes = $wpdb->insert('a_district_area', $houseTypeArea);
$houseTypeAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if (!$houseTypeAreaRes) {
return 502;
}
......@@ -157,7 +157,7 @@ class InsertDao{
'house_id' => $houseId,
'image_id' => $imgid,
);
$houseImgRes = $wpdb->insert('a_house_image', $house_img_array);
$houseImgRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
if (!$houseImgRes) {
return 503;
}
......@@ -204,10 +204,10 @@ class InsertDao{
}
}
}
public static function addHouseFeature($houseId,$data){
public static function addHouseFeature($houseId,$houseFeature){
global $wpdb;
if($data["houseFeature"]){
foreach($data["houseFeature"] as $val){
if($houseFeature){
foreach($houseFeature as $val){
$a_house_feature = array(
"house_id" => $houseId,
"tag_id" =>$val
......@@ -222,53 +222,23 @@ class InsertDao{
}
public static function addHouseTag($tags, $house_id)
public static function addHouseTag($house_id, $houseTag)
{
global $wpdb;
$arr = array(',' => ',');
$in = explode(',', strtr($tags, $arr));
//string
$tags_string = InsertDao::arrayToString($in);
//房源的标签id数组
$tags_ids = array();
//查询存在的标签
$sql = "select * from tospur_tag where name in " . $tags_string." and type=0";
$has_tags_result = $wpdb->get_results($sql);
//排除存在的标签,剩下未有的标签和存在标签id数组
foreach ($has_tags_result as $key => $value) {
if (($key = array_search($value->name, $in)) !== false) {
unset($in[$key]);
}
$tags_ids[] = $value->id;
}
//添加未有的标签
foreach ($in as $value) {
$insert = $wpdb->insert(
'tospur_tag',
array(
'name' => $value
)
);
if($insert){
$tags_ids[] = $wpdb->insert_id;
}
}
//删除该房源的标签关联后,添加新的标签关联
$wpdb->query(
$wpdb->prepare(
"DELETE FROM a_house_tag
WHERE tag_id in(select tag_id from (select tag_id,tt.type from a_house_tag as aht
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a
where house_id = %d and a.type = 0);", $house_id)
$wpdb->prepare("DELETE FROM " . Config::A_HOUSE_TAG_TABLE .
" WHERE tag_id in(select tag_id from (select tag_id,tt.type from " . Config::A_HOUSE_TAG_TABLE . " as aht" .
" 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)
);
foreach ($tags_ids as $value) {
$wpdb->insert(
'a_house_tag',
array(
'house_id' => $house_id,
'tag_id' => $value
)
if ($houseTag) {
foreach ($houseTag as $val) {
$a_house_tag = array(
"house_id" => $house_id,
"tag_id" => $val
);
$wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
}
}
}
......
......@@ -180,29 +180,29 @@ class SearchDao
$addWhereSql = null;
$orderbySql = null;
if ($array['houseType'] == 0) {
$addSql = " 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 bp_value,literal as bp_literal from dic_buildproperty) dbp on ada.buildproperty_id = dbp.bp_value";
$addSql = " left join (select buildproperty_id,house_area,image_id,house_id as bph_id from ".Config::A_DISTRICT_AREA_TABLE.") ada on th.id = ada.bph_id".
" left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on ada.buildproperty_id = dbp.bp_value";
$orderbySql = " group by th.id order by th.creattime DESC";
}else if ($array['houseType'] == 1) {
$addSql = " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value";
$addSql = " left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on th.buildproperty_id = dbp.bp_value";
if ($array['feature'] > -1) {
$addSql .= " left join (select house_id,tag_id from a_house_tag) aht on th.id = aht.house_id";
$addSql .= " left join (select house_id,tag_id from ".Config::A_HOUSE_TAG_TABLE.") aht on th.id = aht.house_id";
$addWhereSql = " and tag_id = ".$array['feature'];
}
$orderbySql = " order by th.creattime DESC";
}else if($array['houseType'] == 2){
$addSql = " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value";
$addSql = " left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on th.buildproperty_id = dbp.bp_value";
$orderbySql = " order by th.creattime DESC";
}
$sql = "select th.id,th.house_type,th.name,th.latest_news,th.address,th.average_price,th.community_name,th.covered_area,th.total_price,th.decoration,th.rent,".
"ti.path,dr.literal,dbp.bp_literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from a_house_tag aht".
" LEFT JOIN tospur_tag tt on tt.id = aht.tag_id".
" where aht.house_id = th.id) as tags from tospur_house th".
"ti.path,dr.literal,th.house_number,dbp.bp_literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht".
" LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id".
" where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th".
$addSql.
" left join dic_city dc on th.plate_id = dc.plateId".
" left join (select id as rid,value as r_value,literal from dic_room) dr on th.room_id = dr.r_value".
" left join (select id as image_id,path from tospur_image) ti on ti.image_id = th.frontCover_id".
" where 1=1";
" left join ".Config::DIC_CITY_TABLE." dc on th.plate_id = dc.plateId".
" left join (select id as rid,value as r_value,literal from ".Config::DIC_ROOM_TABLE.") dr on th.room_id = dr.r_value".
" left join (select id as image_id,path from ".Config::TOSPUR_IMAGE_TABLE.") ti on ti.image_id = th.frontCover_id".
" where 1=1 and th.status = 1 ";
if ($array['cityId'] > -1) {
$params[] = $array['cityId'];
$sql = $sql . " and cityId=%d";
......@@ -256,7 +256,7 @@ class SearchDao
if ($array['userType'] > -1 && $array['userId'] > -1) {
$params[] = $array['userType'];
$params[] = $array['userId'];
$sql = $sql . " and id in (select house_id from a_house_user where user_type = %d and user_id = %d)";
$sql = $sql . " and id in (select house_id from ".Config::A_HOUSE_USER_TABLE." where user_type = %d and user_id = %d)";
}
if ($array['searchText'] != null) {
$params[] = '%'.$array['searchText'].'%';
......@@ -331,8 +331,8 @@ class SearchDao
public static function searchFeatureByHouse($hid){
global $wpdb;
$featureSql ="select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from tospur_tag) tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
$featureSql ="select tag_id,name from ".Config::A_HOUSE_TAG_TABLE." aht
LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$hid));
return $feature;
}
......@@ -360,7 +360,7 @@ class SearchDao
global $wpdb;
$sql = "select *,dr.literal as room,db.literal as buildproperty from ".Config::TOSPUR_HOUSE_TABLE." th
left JOIN ".Config::DIC_ROOM_TABLE." dr on th.room_id = dr.id
left JOIN dic_buildproperty db on th.buildproperty_id = db.value
left JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on th.buildproperty_id = db.value
where th.id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$hid));
$context = array();
......@@ -381,19 +381,19 @@ class SearchDao
}
$context['mainImage'] = $mainImage;
$recommendSql = "select th.id,th.name,th.average_price,th.latest_news,th.address,ti.path,dr.literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from a_house_tag aht
LEFT JOIN tospur_tag tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from tospur_house th
LEFT JOIN tospur_image ti on th.frontCover_id = ti.id
LEFT JOIN dic_room dr on dr.value = th.room_id
where th.id in(select recommend_id from a_house_recommend where house_id = %d);";
$recommendSql = "select th.id,th.name,th.average_price,th.latest_news,th.address,ti.path,dr.literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on th.frontCover_id = ti.id
LEFT JOIN ".Config::DIC_ROOM_TABLE." dr on dr.value = th.room_id
where th.id in(select recommend_id from ".Config::A_HOUSE_RECOMMEND_TABLE." where house_id = %d);";
}else{
$recommendSql = "select th.id,th.name,th.community_name,ti.path,dr.value,th.rent,th.decoration,th.covered_area,th.total_price,(SELECT GROUP_CONCAT(left(tt.name,3)) from a_house_tag aht
LEFT JOIN tospur_tag tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from tospur_house th
LEFT JOIN dic_room dr on dr.id = th.room_id
LEFT JOIN tospur_image ti on th.frontCover_id = ti.id
where th.id in(select recommend_id from a_house_recommend where house_id = %d);";
$recommendSql = "select th.id,th.name,th.community_name,ti.path,dr.value,th.rent,th.decoration,th.covered_area,th.total_price,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th
LEFT JOIN ".Config::DIC_ROOM_TABLE." dr on dr.id = th.room_id
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on th.frontCover_id = ti.id
where th.id in(select recommend_id from ".Config::A_HOUSE_RECOMMEND_TABLE." where house_id = %d);";
}
$recommends = $wpdb->get_results($wpdb->prepare($recommendSql,$hid));
......@@ -402,21 +402,21 @@ class SearchDao
}
$context['recommends'] = $recommends;
$consultantSql = "select id,name,mobile,imageUrl,s.average_score from tospur_consultant c
$consultantSql = "select id,name,mobile,imageUrl,s.average_score from ".Config::TOSPUR_CONSULTANT." c
LEFT JOIN (select consultant_id,sum(score)/count(score) as average_score
from tospur_consultant_score
from ".Config::TOSPUR_CONSULTANT_SCORE_TABLE."
where valid=1 group by consultant_id) s on c.id = s.consultant_id
where id in(select user_id from a_house_user where user_type = 1 and house_id = %d) limit {$consultantLimit};";
where id in(select user_id from ".Config::A_HOUSE_USER_TABLE." where user_type = 1 and house_id = %d) limit {$consultantLimit};";
$consultant = $wpdb->get_results($wpdb->prepare($consultantSql,$hid));
$context['consultant'] = $consultant;
if($type == 'edit'){
$imagesSql = 'select * from a_house_image ahi
LEFT JOIN tospur_image ti on ti.id = ahi.image_id
where ahi.house_id = %d and ahi.image_id not in (select image_id from a_district_area where house_id = %d);';
where ahi.house_id = %d and ahi.image_id not in (select image_id from '.Config::A_DISTRICT_AREA_TABLE.' where house_id = %d);';
}else{
$imagesSql = 'select * from tospur_image ti
LEFT JOIN a_house_image ahi on ti.id = ahi.image_id
$imagesSql = 'select * from '.Config::TOSPUR_IMAGE_TABLE.' ti
LEFT JOIN '.Config::A_HOUSE_IMAGE_TABLE.' ahi on ti.id = ahi.image_id
WHERE ahi.house_id = %d order by image_type;';
}
......@@ -432,8 +432,8 @@ class SearchDao
public static function searchHouseTag($houseId){
global $wpdb;
$sql = "select tt.name from a_house_tag aht
LEFT JOIN tospur_tag tt on aht.tag_id = tt.id
$sql = "select tt.name from ".Config::A_HOUSE_TAG_TABLE." aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on aht.tag_id = tt.id
where aht.house_id = %d and type = 0;";
$results = $wpdb->get_results($wpdb->prepare($sql,$houseId));
$tags = array();
......@@ -445,32 +445,35 @@ class SearchDao
public static function searchStatusType($statusType){
global $wpdb;
$sql="select status_id as id,status_name as value from tospur_status where status_type = %d";
$sql="select status_id as id,status_name as value from ".Config::TOSPUR_STATUS_TABLE." where status_type = %d";
$results = $wpdb->get_results($wpdb->prepare($sql,$statusType));
return $results;
}
public static function searchFeatureOld($hid){
public static function searchFeatureOld($hid, $type){
global $wpdb;
$params[] = $hid;
$params[] = $type;
$featureSql ="select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from tospur_tag) tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$hid));
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));
//print_r($wpdb->last_query);
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 tospur_status) ts on th.status = ts.status_id where th.id=".$hid." and status_type=".$statusType;
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 tospur_house where id = %d";
$rentSql = "select rent as value from ".Config::TOSPUR_HOUSE_TABLE." where id = %d";
$results = $wpdb->get_row($wpdb->prepare($rentSql,$hid));
return $results;
}
......
......@@ -22,8 +22,8 @@ class TCSync {
$user = get_user_by( "login", $item['WorkNum'] );
$userdata = array(
'ID' => $user->data->ID,
'display_name' => $item['Name'],
'role' => 'author'
'role' => 'author',
'display_name' => $item['Name']
);
$user_id = wp_update_user( $userdata ) ;
}else{
......
......@@ -20,6 +20,8 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerDao.php');
require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php');
require_once(PLUGIN_DIR . 'Admin/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouseList.php');
......@@ -27,13 +29,16 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Admin/rentHouseList.php');
require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php');
require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php');
require_once(PLUGIN_DIR . 'Admin/feature.php');
require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php'); require_once(PLUGIN_DIR . 'Admin/feature.php');
require_once(PLUGIN_DIR . 'Admin/introduction.php');
require_once(PLUGIN_DIR . 'Admin/Contract.php');
require_once(PLUGIN_DIR . 'Admin/consultant_score.php');
require_once(PLUGIN_DIR . 'Admin/view_house.php');
require_once(PLUGIN_DIR . 'Admin/tospur_sale.php');
require_once(PLUGIN_DIR . 'Admin/TCSyncView.php');
require_once(PLUGIN_DIR . 'Admin/Contract_List.php');
require_once(PLUGIN_DIR . 'Admin/commissionManage.php');
add_action('admin_menu', 'reset_menu');
tospur_register_script_style();
tospur_ajax_set();
......@@ -86,8 +91,9 @@ function tospur_load_resources(){
wp_enqueue_script('validate');
wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('bootstrapMinCss');
wp_enqueue_style('publicCss');
wp_enqueue_style('bootstrapMinCss');
}
function tospur_register_script_style(){
......@@ -98,9 +104,9 @@ function tospur_register_script_style(){
wp_register_script('publicjs',plugins_url('Admin/views', __FILE__)."/js/public.js");
wp_register_style('jquery-ui_css', plugins_url('Admin/views', __FILE__)."/css/jquery-ui.css");
wp_register_style('publicCss', plugins_url('Admin/views', __FILE__)."/css/public.css");
wp_register_style('bootstrapcss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.css");
wp_register_style('bootstrapMinCss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.min.css");
wp_register_style('publicCss', plugins_url('Admin/views', __FILE__)."/css/public.css");
}
function tospur_ajax_set()
......@@ -117,6 +123,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_searchUnitPriceRange', 'SearchDao::ajax_searchUnitPriceRange');
add_action('wp_ajax_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice');
add_action('wp_ajax_nopriv_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice');
add_action('wp_ajax_searchRentalPrice', 'SearchDao::ajax_searchRentalPrice');
add_action('wp_ajax_nopriv_searchRentalPrice', 'SearchDao::ajax_searchRentalPrice');
add_action('wp_ajax_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' );
......@@ -127,6 +135,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_add_feature', 'feature::ajax_add_feature');
add_action('wp_ajax_submit_introduction', 'introduction::ajax_submit_introduction');
add_action('wp_ajax_nopriv_submit_introduction', 'introduction::ajax_submit_introduction');
add_action('wp_ajax_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
add_action('wp_ajax_nopriv_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
//标签和特色
add_action('wp_ajax_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
add_action('wp_ajax_nopriv_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
......@@ -169,20 +179,22 @@ function update_consultant()
function reset_menu()
{
add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync");
add_menu_page('nesHouseList','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_menu_page('新房列表','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view');
add_menu_page('secHandHouseList','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_menu_page('二手房列表','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'edit_published_posts', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html');
add_menu_page('rentHouseList','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_menu_page('租房列表','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("introduction", "诚信宣言", "editor", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('contract','合同管理', 'edit_published_posts', 'contract', 'Contract::init_view', 'dashicons-menu', 10);
add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('合同列表','合同列表', 'edit_published_posts', 'contractList', 'Contract_List::showTableView', 'dashicons-menu', 10);
add_submenu_page('contractList', '添加合同', '添加合同', 'edit_published_posts', 'contract', 'Contract::init_view');
add_menu_page('客户列表','客户列表', 'edit_published_posts', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html');
add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13);
add_menu_page('添加标签', '添加标签', 'edit_published_posts', 'add_tag', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page('添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page("同步数据", "同步数据", "manage_options", "sync", "TCSyncView::display", 'dashicons-menu');
//移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 );
global $menu;
......@@ -215,10 +227,3 @@ function reset_menu()
}
}
}
\ No newline at end of file
function do_sync()
{
TCSync::user_sync();
TCSync::organization_sync();
TCSync::other_sync();
}
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
Timber::render('ability_calculator.html', $context);
?>
\ No newline at end of file
......@@ -368,7 +368,7 @@ a:hover {
#tabWrapper #tabScroller {
padding-bottom: 15px;
}
#tabWrapper #tabScroller .tab-pane ul li {
.tab-content .tab-pane ul li {
width: 100%;
height: 60px;
line-height: 60px;
......@@ -376,10 +376,10 @@ a:hover {
color: #898989;
font-size: 18px;
}
#tabWrapper #tabScroller .tab-pane ul li:nth-child(odd) {
.tab-content .tab-pane ul li:nth-child(odd) {
background-color: #ffffff;
}
#tabWrapper #tabScroller .tab-pane ul li.arrow {
.tab-content .tab-pane ul li.arrow {
width: 100%;
height: 60px;
background: url("../img/gray_leftarrow_icon.png") no-repeat;
......@@ -387,17 +387,35 @@ a:hover {
-webkit-background-size: 30px 30px;
background-position: 95% center;
}
#tabWrapper #tabScroller .tab-pane ul li label {
.tab-content .tab-pane ul li label {
color: #000000;
margin-bottom: 0;
padding: 0 0 0 10px;
}
#tabWrapper #tabScroller .tab-pane ul li p {
.tab-content .tab-pane ul li label input[type="radio"] {
display: none;
}
.tab-content .tab-pane ul li label input[type="radio"]:checked + span {
background-position: -27px -1px;
}
.tab-content .tab-pane ul li label span {
width: 25px;
height: 25px;
background: url("../img/radio_icon.png") no-repeat;
background-size: 53px 27px;
-webkit-background-size: 53px 27px;
background-position: -1px -1px;
display: inline-block;
position: relative;
top: 8px;
margin-right: 5px;
}
.tab-content .tab-pane ul li p {
margin-bottom: 0;
padding: 0;
height: 100%;
}
#tabWrapper #tabScroller .tab-pane ul li p .form-control {
.tab-content .tab-pane ul li p .form-control {
color: #898989;
font-size: 18px;
background-color: transparent;
......@@ -407,16 +425,16 @@ a:hover {
-webkit-box-shadow: none;
-webkit-appearance: none;
}
#tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-outer-spin-button,
#tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-inner-spin-button {
.tab-content .tab-pane ul li p .form-control::-webkit-outer-spin-button,
.tab-content .tab-pane ul li p .form-control::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}
#tabWrapper #tabScroller .tab-pane > p {
.tab-content .tab-pane > p {
padding-right: 15px;
color: #898989;
}
#tabWrapper #tabScroller .tab-pane .btn {
.tab-content .tab-pane .btn {
width: 86%;
display: block;
color: #ffffff;
......@@ -435,12 +453,12 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
#tabWrapper #tabScroller .tab-pane .btn:active {
.tab-content .tab-pane .btn:active {
background-color: #117bb9;
}
#tabWrapper #tabScroller .tab-pane .btn:focus {
.tab-content .tab-pane .btn:focus {
outline: 0;
}
#tabWrapper #tabScroller .tab-pane:last-child .btn {
.tab-content .tab-pane:last-child .btn {
margin-top: 5%;
}
......@@ -415,7 +415,6 @@ a:hover {
}
.container-fluid {
width: 100%;
height: 100%;
background: url("../img/formBg.jpg") no-repeat;
background-size: 100% 100%;
......@@ -565,6 +564,7 @@ a:hover {
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
border: 0;
}
.container-fluid form .btn:active {
......
......@@ -51,6 +51,12 @@ function page_template($template)
case 'loan_calculator':
$page = $theme . '/loan_calculator.php';
break;
case 'tax_calculator':
$page = $theme . '/tax_calculator.php';
break;
case 'ability_calculator':
$page = $theme . '/ability_calculator.php';
break;
case 'manager':
$page = $theme . '/manager.php';
break;
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
Timber::render('tax_calculator.html', $context);
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<title>购房能力评估计算器</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_calculator.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_detail.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/modernizr.custom.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
</head>
<body>
<div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1">
<ul id="tab" class="list-unstyled btn-group-justified tab">
<li class="btn-group active">
<a href="#ability" data-toggle="tab" class="btn">购房能力评估</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="ability">
<ul class="list-unstyled">
<li>
<label class="col-xs-5">现持有资金:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="hold">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">现家庭月收入:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="income">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">家庭月固定支出:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="expense">
</p>
<p class="col-xs-2"></p>
</li>
<li class="arrow">
<label class="col-xs-5">还款年限:</label>
<p class="col-xs-7">
<select class="form-control" id="month">
<option value="12">1年(12期)</option>
<option value="24">2年(24期)</option>
<option value="36">3年(36期)</option>
<option value="48">4年(48期)</option>
<option value="60">5年(60期)</option>
<option value="72">6年(72期)</option>
<option value="84">7年(84期)</option>
<option value="96">8年(96期)</option>
<option value="108">9年(108期)</option>
<option value="120">10年(120期)</option>
<option value="132">11年(132期)</option>
<option value="144">12年(144期)</option>
<option value="156">13年(156期)</option>
<option value="168">14年(168期)</option>
<option value="180">15年(180期)</option>
<option value="192">16年(192期)</option>
<option value="204">17年(204期)</option>
<option value="216">18年(216期)</option>
<option value="228">19年(228期)</option>
<option value="240" selected="selected">20年(240期)</option>
<option value="300">25年(300期)</option>
<option value="360">30年(360期)</option>
</select>
</p>
</li>
<li>
<label class="col-xs-4">房屋面积:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="area">
</p>
<p class="col-xs-3">平方米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
</div>
</div>
<div class="pt-page pt-page-2">
<div id="wrapper" style="top: 0;">
<div id="scroller">
<ul class="list-unstyled" id="result">
</ul>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<script type="text/javascript" src="{{ theme }}/js/pagetransitions.js"></script>
<script>
var page = 0;
var resultList;
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('input[type=submit]').tap(function () {
var hold = Number($('#hold').val().trim());
var income = Number($('#income').val().trim());
var expense = Number($('#expense').val().trim());
var month = Number($('#month').val());
var area = Number($('#area').val().trim());
console.log(hold);
console.log(income);
console.log(expense);
console.log(month);
console.log(area);
if (hold == '') {
notice.html('请输入现持有资金');
myModal.modal('show');
} else if (income == '') {
notice.html('请输入现家庭月收入');
myModal.modal('show');
} else if (expense == '') {
notice.html('请输入家庭月固定支出');
myModal.modal('show');
} else if (month == '') {
notice.html('请输入还款年限');
myModal.modal('show');
} else if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else {
resultList = $('#result');
var abilityResult = abilityCalculator(month, hold, income, expense, area);
resultList.html('<li><span class="col-xs-4">房屋总价:</span><span>' + abilityResult.total + '元</span></li>' +
'<li><span class="col-xs-4">房屋单价:</span><span>' + abilityResult.avgPrice + '元/平方</span></li>');
page = 1;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
if (window.location.hash == '#result') {
window.history.back();
}
window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) {
page = 0;
PageTransitions.nextPage({
animation: 2,
showPage: page
});
resultList.html('');
}
});
});
function abilityCalculator(month, holdMoney, income, outcome, area) {
var year = parseInt(month / 12);
var lilu = 0.00576;
if (year > 5)
lilu = 0.00594;
var d1 = income - outcome;
var d2 = Math.pow(1 + lilu, month) - 1;
var d3 = lilu * Math.pow(1 + lilu, month);
//房屋总价
var total = Math.round(((d1 * d2) / d3) + holdMoney);
//房屋单价
var avgPrice = total / area;
var result = {
total: total,
avgPrice: avgPrice
};
return result;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -5,9 +5,33 @@
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="renderer" content="webkit">
<title>登录</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/manager.css">
<!--[if lte IE 8]>
<style type="text/css">
.container-fluid {
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/formBg.jpg',sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/formBg.jpg', sizingMethod='scale');
}
.container-fluid form .has-feedback.username .form-control-feedback {
background: none;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_username_icon.png',sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_username_icon.png', sizingMethod='scale');
}
.container-fluid form .has-feedback.password .form-control-feedback {
background: none;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_password_icon.png',sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_password_icon.png', sizingMethod='scale');
}
.container-fluid form .has-feedback .form-control {
width: 74%;
height: 40px;
line-height: 40px;
}
</style>
<![endif]-->
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
......@@ -53,7 +77,7 @@
</head>
<body>
<div class="container-fluid text-center">
<div class="container-fluid">
<form id="loginForm" method="post">
<h2></h2>
<p class="has-feedback username">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<title>税费计算器</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_calculator.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_detail.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/modernizr.custom.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
</head>
<body>
<div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1">
<ul id="tab" class="list-unstyled btn-group-justified tab">
<li class="btn-group active">
<a href="#new" data-toggle="tab" class="btn">新房</a>
</li>
<li class="btn-group">
<a href="#secondhand" data-toggle="tab" class="btn">二手房</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="new">
<ul class="list-unstyled">
<li>
<label class="col-xs-3">房屋面积:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="area">
</p>
<p class="col-xs-3">平米</p>
</li>
<li>
<label class="col-xs-3">房屋单价:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="average_price">
</p>
<p class="col-xs-3">元/平米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
<div class="tab-pane fade" id="secondhand">
<ul class="list-unstyled">
<li>
<label class="col-xs-3">房屋面积:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="area">
</p>
<p class="col-xs-3">平米</p>
</li>
<li>
<label class="col-xs-3">房屋单价:</label>
<p class="col-xs-6">
<input type="number" class="form-control" data-id="average_price">
</p>
<p class="col-xs-3">元/平米</p>
</li>
<li>
<label class="col-xs-3">购置年限:</label>
<p class="col-xs-6">
<select class="form-control" data-id="year">
<option selected="selected" value="0">2年以内</option>
<option value="1">2-5年</option>
<option value="2">5年以上</option>
</select>
</p>
<p class="col-xs-3"></p>
</li>
<li>
<label class="col-xs-3">首次购房:</label>
<label for="firstTrue" class="col-xs-4 text-center">
<input type="radio" name="first" id="firstTrue" value="1" checked>
<span></span>
</label>
<label for="firstFalse" class="col-xs-4 text-center">
<input type="radio" name="first" id="firstFalse" value="0">
<span></span>
</label>
</li>
<li>
<label class="col-xs-3">唯一住房:</label>
<label for="onlyTrue" class="col-xs-4 text-center">
<input type="radio" name="only" id="onlyTrue" value="1" checked>
<span></span>
</label>
<label for="onlyFalse" class="col-xs-4 text-center">
<input type="radio" name="only" id="onlyFalse" value="0">
<span></span>
</label>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
</div>
</div>
<div class="pt-page pt-page-2">
<div id="wrapper" style="top: 0;">
<div id="scroller">
<ul class="list-unstyled" id="result">
</ul>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<script type="text/javascript" src="{{ theme }}/js/pagetransitions.js"></script>
<script>
var page = 0;
var resultList;
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('input[type=submit]').tap(function () {
var tab = $(this).parents('.active');
var tabId = tab.attr('id');
var area = Number(tab.find('[data-id=area]').val().trim());
var average_price = Number(tab.find('[data-id=average_price]').val().trim());
var year = Number(tab.find('[data-id=year]').val());
if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else if (average_price == '') {
notice.html('请输入房屋单价');
myModal.modal('show');
} else {
resultList = $('#result');
var taxResult = null;
if (tabId == 'new') {
taxResult = newHouseTaxCalculator(area, average_price);
resultList.html('<li><span class="col-xs-4">印花税:</span><span>' + taxResult.stampDuty + '元</span></li>'+
'<li><span class="col-xs-4">契税:</span><span>' + taxResult.deed + '元</span></li>'+
'<li><span class="col-xs-4">公证费:</span><span>' + taxResult.notaryFees + '元</span></li>');
} else {
if (year >= 0) {
var first = (Number($('input[name=first]:checked').val()) == 1);
var only = (Number($('input[name=only]:checked').val()) == 1);
taxResult = secondhandHouseTaxCalculator(area, average_price, first, only, year);
resultList.html('<li><span class="col-xs-5">房屋总价:</span><span>' + taxResult.housePrice + '元</span></li>' +
'<li><span class="col-xs-5">契税:</span><span>' + taxResult.deed + '元</span></li>' +
'<li><span class="col-xs-5">营业税:</span><span>' + taxResult.bt + '元</span></li>' +
'<li><span class="col-xs-5">个人所得税:</span><span>' + taxResult.pit + '元</span></li>' +
'<li><span class="col-xs-5">工本印花税:</span><span>5元</span></li>' +
'<li><span class="col-xs-5">合计:</span><span>' + (taxResult.deed + taxResult.bt + taxResult.pit + 5) + '元</span></li>');
} else {
notice.html('请选择购置年限');
myModal.modal('show');
return false;
}
}
page = 1;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
if (window.location.hash == '#result') {
window.history.back();
}
window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) {
page = 0;
PageTransitions.nextPage({
animation: 2,
showPage: page
});
resultList.html('');
}
});
});
function newHouseTaxCalculator(area, avgPrice) {
var area = parseFloat(area);
var avgPrice = parseFloat(avgPrice);
var totle = area * avgPrice;
//契税
var deed = 0;
//印花税
var stampDuty = totle * 0.0005;
//公证费
var notaryFees = totle * 0.003;
if (avgPrice <= 9432)
deed = totle * 0.015;
else if (avgPrice > 9432)
deed = totle * 0.03;
var result = {
stampDuty: stampDuty,
deed: deed,
notaryFees: notaryFees
};
return result;
}
function secondhandHouseTaxCalculator(area, avgPrice, isFirst, onlyOne, year) {
var totle = area * avgPrice;
//契税
var deed = 0;
//个人所得税
var pit = 0;
//营业税
var bt = 0;
if (area > 144)
isFist = false;
if (isFirst) {
deed = totle * 0.01;
if (area >= 90 && area <= 144)
deed = totle * 0.015;
} else {
deed = totle * 0.03;
}
if (year == 2 && onlyOne) {
pit = 0;
} else {
pit = totle * 0.01;
}
if (year == 0) {
bt = totle * 0.056;
}
var result = {
housePrice: totle,
deed: deed,
pit: pit,
bt: bt
};
return result;
}
</script>
</body>
</html>
\ No newline at end of file
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