Commit 6527ff71 by shz

tospur

parent fa8bb9d2
<?php <?php
require_once(PLUGIN_DIR . 'Dao/ContractDao.php');
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/HouseDao.php');
class Contract { class Contract {
public static function init_view(){ public static function init_view(){
...@@ -6,47 +9,88 @@ class Contract { ...@@ -6,47 +9,88 @@ class Contract {
$type = $_POST["type"]; $type = $_POST["type"];
$context = array(); $context = array();
$context['siteUrl'] = get_site_url(); $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( $params = array(
'business' => $_REQUEST['business'],
'houseNumber' =>$_REQUEST['houseNumber'],
'customerNumber' =>$_REQUEST['customerNumber'],
'signedDate' =>$_REQUEST['signedDate'], 'signedDate' =>$_REQUEST['signedDate'],
'permitNumber' =>$_REQUEST['permitNumber'], 'status' =>$_REQUEST['status'],
'area' =>$_REQUEST['area'], 'area' =>$_REQUEST['area'],
'house_number' =>$_REQUEST['house_number'], 'permitNumber' =>$_REQUEST['permitNumber'],
'price' =>$_REQUEST['price'],
'managerId' =>$_REQUEST['managerId'], 'managerId' =>$_REQUEST['managerId'],
'paymentMethod' =>$_REQUEST['paymentMethod'], 'paymentMethod' =>$_REQUEST['paymentMethod'],
'codicil' =>$_REQUEST['codicil'], 'codicil' =>$_REQUEST['codicil'],
'oName' =>$_REQUEST['oName'], 'oName' =>$_REQUEST['oName'],
'oPhone' =>$_REQUEST['oPhone'],
'oID' =>$_REQUEST['oID'], 'oID' =>$_REQUEST['oID'],
'oCommission' =>$_REQUEST['oCommission'], 'oBroker' =>$_REQUEST['oBroker'],
'oAddress' =>$_REQUEST['oAddress'], 'oAddress' =>$_REQUEST['oAddress'],
'oPayBack' =>$_REQUEST['oPayBack'],
'oMoney' =>$_REQUEST['oMoney'], 'oMoney' =>$_REQUEST['oMoney'],
'oPayBack' =>$_REQUEST['oPayBack'],
'cName' =>$_REQUEST['cName'], 'cName' =>$_REQUEST['cName'],
'cPhone' =>$_REQUEST['cPhone'],
'cID' =>$_REQUEST['cID'], 'cID' =>$_REQUEST['cID'],
'cCommission' =>$_REQUEST['cCommission'], 'cBroker' =>$_REQUEST['cBroker'],
'cAddress' =>$_REQUEST['cAddress'], 'cAddress' =>$_REQUEST['cAddress'],
'cPayBack' =>$_REQUEST['cPayBack'], 'cMoney' =>$_REQUEST['cMoney'],
'cMoney' =>$_REQUEST['cMoney'] 'cPayBack' =>$_REQUEST['cPayBack']
); );
$wpdb->query("START TRANSACTION");
if($type==1){ 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;
}
$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();
$result = ContractDao::insert($params);
$pre = "CJCS";
if($_REQUEST['type'] > 1){
$pre = "CJCZ";
}
$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'])){ }else if(isset($_GET['edit'])){
$id = $_REQUEST["id"];
$context['houseId'] = $id;
$context['result'] = ContractDao::searchContract($id);
} }
Timber::render("contract.html",$context); Timber::render("contract.html",$context);
} }
public static function insert($params){
global $wpdb;
//$wpdb->insert(Config::);
}
public static function update($params){
}
} }
\ 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 ...@@ -8,6 +8,11 @@ class customerList extends WP_List_Table
{ {
function __construct() function __construct()
{ {
parent::__construct(array(
'singular' => 'customerList',
'plural' => 'customerList',
'ajax' => false
));
} }
function column_default($item, $column_name) function column_default($item, $column_name)
...@@ -20,15 +25,58 @@ class customerList extends WP_List_Table ...@@ -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() function get_columns()
{ {
$columns = array(
'cb' => '<input type="checkbox"/>'
);
$columns['name'] = '姓名'; $columns['name'] = '姓名';
$columns['demand_type'] = '需求类型'; $columns['demand_type'] = '需求类型';
$columns['customer_remark'] = '客户备注';
$columns['consultant_name'] = '置业顾问'; $columns['consultant_name'] = '置业顾问';
$columns['status_name'] = '状态'; $columns['status_name'] = '状态';
$columns['customer_remark'] = '客户备注';
return $columns; 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() function prepare_items()
{ {
...@@ -39,9 +87,15 @@ class customerList extends WP_List_Table ...@@ -39,9 +87,15 @@ class customerList extends WP_List_Table
$this->_column_headers = array($columns, $hidden); $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" . $sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name FROM tospur_customer tcs" .
" left join (SELECT * FROM tospur_status where status_type = 5) as ts on tcs.status = ts.status_id" . " left join (SELECT * FROM tospur_status where status_type = 5) as ts on tcs.status = ts.status_id" .
" left join tospur_consultant tc on tcs.consultant_id = tc.id where 1 = 1"; " left join tospur_consultant tc on tcs.consultant_id = tc.id where 1 = 1";
$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) { if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_REQUEST['status']; $sql = $sql . " and tcs.status = " . $_REQUEST['status'];
} }
...@@ -65,6 +119,34 @@ class customerList extends WP_List_Table ...@@ -65,6 +119,34 @@ class customerList extends WP_List_Table
$sql = $sql . " and " . $demand_type . " = 1"; $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'])) { if (isset($_REQUEST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_REQUEST['search_name'] . "%'"; $sql = $sql . " and tcs.name like '%" . $_REQUEST['search_name'] . "%'";
} }
...@@ -96,6 +178,7 @@ class customerList extends WP_List_Table ...@@ -96,6 +178,7 @@ class customerList extends WP_List_Table
'name' => $value->name, 'name' => $value->name,
'demand_type' => implode("、", $demand_type_array), 'demand_type' => implode("、", $demand_type_array),
'customer_remark' => $value->customer_remark, 'customer_remark' => $value->customer_remark,
'consultant_id' => $value->consultant_id,
'consultant_name' => $value->consultant_name, 'consultant_name' => $value->consultant_name,
'status_name' => $value->status_name 'status_name' => $value->status_name
); );
...@@ -125,9 +208,28 @@ class customerList extends WP_List_Table ...@@ -125,9 +208,28 @@ class customerList extends WP_List_Table
function function_customerList() function function_customerList()
{ {
$context = array(); $context = array();
//
$context['city'] = SearchDao::searchCity();
$context['buildProperty'] = SearchDao::searchBuildProperty();
//
$context['status'] = SearchDao::searchStatusType(5); $context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6); $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['status_id'] = $_REQUEST['status'];
$context['demand_type'] = isset($_REQUEST['demand_type']) ? $_REQUEST['demand_type'] : -1; $context['demand_type'] = isset($_REQUEST['demand_type']) ? $_REQUEST['demand_type'] : -1;
$context['customer_type_id'] = isset($_REQUEST['customer_type']) ? $_REQUEST['customer_type'] : -1; $context['customer_type_id'] = isset($_REQUEST['customer_type']) ? $_REQUEST['customer_type'] : -1;
......
...@@ -5,45 +5,55 @@ class feature ...@@ -5,45 +5,55 @@ class feature
public static function ajax_add_feature() public static function ajax_add_feature()
{ {
$name = $_POST['name']; $name = $_POST['name'];
$type = $_POST['type'];
$array = array(); $array = array();
$result = feature::search_feature($name); $result = feature::search_feature($type, $name);
if ($result) { if ($result) {
$array['code'] = 2001; $array['code'] = 2001;
} else { } else {
feature::add_feature($name); feature::add_feature($type, $name);
$array['code'] = 2000; $array['code'] = 2000;
} }
wp_send_json($array); wp_send_json($array);
} }
public static function search_feature($name = null) public static function search_feature($type, $name = null)
{ {
global $wpdb; global $wpdb;
$sql = "select id,name from " . Config::TOSPUR_TAG_TABLE . " where type = 1"; $sql = "select id,name from " . Config::TOSPUR_TAG_TABLE . " where type = " . $type;
if ($name) { if ($name) {
$sql .= " and name = '" . $name . "'"; $sql .= " and name = '" . $name . "'";
} }
return $wpdb->get_results($sql); return $wpdb->get_results($sql);
} }
public static function add_feature($name) public static function add_feature($type, $name)
{ {
global $wpdb; global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_TAG_TABLE, array( $result = $wpdb->insert(Config::TOSPUR_TAG_TABLE, array(
'name' => $name, 'name' => $name,
'type' => 1 'type' => $type
)); ));
return $result; return $result;
} }
public static function add_feature_html() public static function add_feature_html()
{ {
wp_enqueue_style('bootstrapMinCss');
$context = array(); $context = array();
$context['view'] = plugins_url() . '/tospur/Admin/views'; $context['view'] = plugins_url() . '/tospur/Admin/views';
$context['result'] = feature::search_feature();
$context['url'] = home_url(); $context['url'] = home_url();
$context['admin_url'] = admin_url(); $context['request_url'] = $_SERVER['request_url'];
$type = null;
switch ($_GET['page']) {
case 'add_tag':
$type = 0;
break;
case 'add_feature':
$type = 1;
break;
}
$context['type'] = $type;
$context['result'] = feature::search_feature($type);
Timber::render('feature.html', $context); Timber::render('feature.html', $context);
} }
} }
......
...@@ -4,17 +4,19 @@ class introduction ...@@ -4,17 +4,19 @@ class introduction
{ {
public static function ajax_submit_introduction() public static function ajax_submit_introduction()
{ {
$time = $_POST['time'];
$introduction = $_POST['introduction']; $introduction = $_POST['introduction'];
$user_id = $_POST['user_id']; $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; global $wpdb;
$result = $wpdb->update( $result = $wpdb->update(
Config::TOSPUR_CONSULTANT, Config::TOSPUR_CONSULTANT,
array( array(
'time' => $time,
'introduction' => $introduction 'introduction' => $introduction
), ),
array('id' => $user_id) array('id' => $user_id)
...@@ -22,12 +24,12 @@ class introduction ...@@ -22,12 +24,12 @@ class introduction
return $result; return $result;
} }
public static function search_introduction() public static function search_time_and_introduction()
{ {
global $wpdb; global $wpdb;
$user_id = introduction::get_user_id(); $user_id = introduction::get_user_id();
$sql = "select introduction from " . Config::TOSPUR_CONSULTANT . " where id = " . $user_id; $sql = "select time,introduction from " . Config::TOSPUR_CONSULTANT . " where id = " . $user_id;
$result = $wpdb->get_var($sql); $result = $wpdb->get_row($sql);
return $result; return $result;
} }
...@@ -35,7 +37,9 @@ class introduction ...@@ -35,7 +37,9 @@ class introduction
{ {
$context = array(); $context = array();
$context['url'] = home_url(); $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(); $user_id = introduction::get_user_id();
$context['user_id'] = $user_id; $context['user_id'] = $user_id;
Timber::render('introduction.html', $context); Timber::render('introduction.html', $context);
......
...@@ -57,7 +57,7 @@ class newHouseList extends WP_List_Table ...@@ -57,7 +57,7 @@ class newHouseList extends WP_List_Table
function get_columns() function get_columns()
{ {
if( current_user_can('administrator') ) { if( current_user_can('moderate_comments') ) {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />' 'cb' => '<input type="checkbox" />'
); );
...@@ -155,6 +155,7 @@ class newHouseList extends WP_List_Table ...@@ -155,6 +155,7 @@ class newHouseList extends WP_List_Table
function prepare_items() function prepare_items()
{ {
global $wpdb; global $wpdb;
$params = array();
$per_page = 10; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
...@@ -170,37 +171,57 @@ class newHouseList extends WP_List_Table ...@@ -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 buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id
left join (select value as did,literal as room_type from dic_room) dr on dr.did = th.room_id left join (select value as did,literal as room_type from dic_room) dr on dr.did = th.room_id
where 1=1 and house_type=0"; where 1=1 and house_type=0";
if($_POST["listCity"]!=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 ){ if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"]; $params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
} }
if($_POST["listPlate"] != 0){ if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"]; $params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
} }
if($_POST["buildProperty"]!=0){ if($_POST["buildProperty"]!=0){
$sql = $sql." and buildproperty_id=".$_POST["buildProperty"]; $params[] = $_POST["buildProperty"];
$sql = $sql." and buildproperty_id=%d";
} }
if($_POST["room"]!=0){ 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){ 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){ if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']); $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){ if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']); $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){ 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"; $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(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$data[$key] = array( $data[$key] = array(
...@@ -230,16 +251,6 @@ class newHouseList extends WP_List_Table ...@@ -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(); $current_page = $this->get_pagenum();
$total_items = count($data); $total_items = count($data);
...@@ -282,7 +293,8 @@ function function_newHouseList() ...@@ -282,7 +293,8 @@ function function_newHouseList()
$contest['acreage'] = $_POST['acreage']; $contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status']; $contest['statusId'] = $_POST['status'];
} }
Timber::render("newHouseList.html",$contest); $contest["house_type"] = 0;
Timber::render("houseList.html",$contest);
} }
function addNewHouseTable(){ function addNewHouseTable(){
......
...@@ -12,16 +12,14 @@ class RentHouse extends Tospur_House{ ...@@ -12,16 +12,14 @@ class RentHouse extends Tospur_House{
//获取新房信息,存入tospur_house表 //获取新房信息,存入tospur_house表
$insert_tospur_house_array = array( $insert_tospur_house_array = array(
'name' => $_POST['housename'], 'name' => $_POST['housename'],
'house_number' =>$_POST['house_number'], 'total_price' =>$_POST['total_price'],
'rent'=>$_POST['rent'], 'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'], 'buildproperty_id'=>$_POST['buildproperty_id'],
'covered_area' =>$_POST['covered_area'], 'covered_area' =>$_POST['covered_area'],
'floor' =>$_POST['floor'], 'floor' =>$_POST['floor'],
'faceto'=>$_POST['faceto'], 'faceto'=>$_POST['faceto'],
'decoration' => $_POST['decoration'], 'decoration' => $_POST['decoration'],
'age'=>$_POST['age'], 'age'=>$_POST['age'],
'matching_facilities'=>$_POST['matching_facilities'],
'flat'=>$_POST['flat'],
'suite'=>$_POST["suite"], 'suite'=>$_POST["suite"],
'overview' => $_POST['overview'], 'overview' => $_POST['overview'],
'city_id' => $_POST['baseCity'], 'city_id' => $_POST['baseCity'],
...@@ -46,7 +44,11 @@ class RentHouse extends Tospur_House{ ...@@ -46,7 +44,11 @@ class RentHouse extends Tospur_House{
"propertyRight"=>$_POST["propertyRight"], "propertyRight"=>$_POST["propertyRight"],
"structure"=>$_POST["structure"], "structure"=>$_POST["structure"],
"key"=>$_POST["key"], "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){ if($type==3){
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
...@@ -90,9 +92,7 @@ class RentHouse extends Tospur_House{ ...@@ -90,9 +92,7 @@ class RentHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType(); $context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2); $context["status"] = searchDao::searchStatusType(2);
for($i = 1981; $i<= 2020; $i++){ $context["house_type"] = 2;
$context["age"][]=$i;
}
Timber::render("rentHouse.html",$context); Timber::render("rentHouse.html",$context);
} }
......
...@@ -51,7 +51,7 @@ class rentHouseList extends WP_List_Table ...@@ -51,7 +51,7 @@ class rentHouseList extends WP_List_Table
function get_columns() function get_columns()
{ {
if( current_user_can('administrator') ) { if( current_user_can('moderate_comments') ) {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />' 'cb' => '<input type="checkbox" />'
); );
...@@ -166,6 +166,7 @@ class rentHouseList extends WP_List_Table ...@@ -166,6 +166,7 @@ class rentHouseList extends WP_List_Table
function prepare_items() function prepare_items()
{ {
global $wpdb; global $wpdb;
$params = array();
$per_page = 10; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
...@@ -176,44 +177,58 @@ class rentHouseList extends WP_List_Table ...@@ -176,44 +177,58 @@ class rentHouseList extends WP_List_Table
$this->process_bulk_action(); $this->process_bulk_action();
//$data = $this->example_data; //$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 $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 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 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 ){ if($_POST["listCity"]!=0 ){
$sql = $sql." and city_id=".$_POST["listCity"]; $params[] = $_POST["listCity"];
$sql = $sql." and city_id=%d";
} }
if($_POST["listDistrict"] != 0 ){ if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"]; $params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
} }
if($_POST["listPlate"] != 0){ if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"]; $params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
} }
if($_POST["buildProperty"]!=0){ 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){ 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){ if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']); $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){ 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(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$data[$key] = array( $data[$key] = array(
...@@ -246,15 +261,6 @@ class rentHouseList extends WP_List_Table ...@@ -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(); $current_page = $this->get_pagenum();
...@@ -286,17 +292,18 @@ function function_rentHouseList() ...@@ -286,17 +292,18 @@ function function_rentHouseList()
if(isset($_POST['hasSearch'])){ if(isset($_POST['hasSearch'])){
$contest['district'] = SearchDao::searchCity($_POST['listCity']); $contest['district'] = SearchDao::searchCity($_POST['listCity']);
$contest['plate'] = SearchDao::searchCity($_POST['listCity'],$_POST['listDistrict']); $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['dicArea'] = searchDao::searchArea($_POST['listCity']);
$contest['cityId'] = $_POST['listCity']; $contest['cityId'] = $_POST['listCity'];
$contest['districtId'] = $_POST['listDistrict']; $contest['districtId'] = $_POST['listDistrict'];
$contest['plateId' ]= $_POST['listPlate']; $contest['plateId' ]= $_POST['listPlate'];
$contest['buildPropertyId']= $_POST['buildProperty']; $contest['buildPropertyId']= $_POST['buildProperty'];
$contest['totalPrice'] = $_POST['totalPrice']; $contest['rentalPrice'] = $_POST['rentalPrice'];
$contest['acreage'] = $_POST['acreage']; $contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status']; $contest['statusId'] = $_POST['status'];
} }
Timber::render("rentHouseList.html",$contest); $contest["house_type"] = 2;
Timber::render("houseList.html",$contest);
} }
function addRentTable(){ function addRentTable(){
......
...@@ -56,8 +56,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -56,8 +56,7 @@ class SecHandHouse extends Tospur_House{
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array); $result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 201){ if($result != 201){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result);
print_r( $result);;
echo "二手房房源修改失败"; echo "二手房房源修改失败";
}else{ }else{
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
...@@ -69,7 +68,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -69,7 +68,7 @@ class SecHandHouse extends Tospur_House{
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array); $result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) { if ($result != 200) {
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r( $result);; print_r($result);
echo "二手房房源新增失败"; echo "二手房房源新增失败";
} else { } else {
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
...@@ -82,8 +81,9 @@ class SecHandHouse extends Tospur_House{ ...@@ -82,8 +81,9 @@ class SecHandHouse extends Tospur_House{
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'])); $context = array_merge($context,SearchDao::getDetailInfo($_GET['id']));
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); //$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context['featureOld'] = json_encode(SearchDao::searchFeatureOld($_GET['id'])); //$context["markOld"] = json_encode(SearchDao::searchFeatureOld($_GET['id'], 0));
//$context['featureOld'] = json_encode(SearchDao::searchFeatureOld($_GET['id'], 1));
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2); $context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
} }
...@@ -93,7 +93,8 @@ class SecHandHouse extends Tospur_House{ ...@@ -93,7 +93,8 @@ class SecHandHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType(); $context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2); $context["status"] = searchDao::searchStatusType(2);
$context["feature"] = searchDao::searchTagOrFeature(1); /*$context["mark"] = searchDao::searchTagOrFeature(0);
$context["feature"] = searchDao::searchTagOrFeature(1);*/
$context["house_type"] = 1; $context["house_type"] = 1;
Timber::render("secHandHouse.html",$context); Timber::render("secHandHouse.html",$context);
...@@ -119,12 +120,9 @@ class SecHandHouse extends Tospur_House{ ...@@ -119,12 +120,9 @@ class SecHandHouse extends Tospur_House{
$recConsultant=InsertDao::addRecConsultant($houseId,$data); $recConsultant=InsertDao::addRecConsultant($houseId,$data);
if(isset($_POST['mark'])&&$_POST['mark']!=""){ InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
}
InsertDao::addHouseFeature($houseId,$data);
InsertDao::addHouseFeature($houseId, $data['houseFeature']);
}else{ }else{
return 507; return 507;
...@@ -170,11 +168,9 @@ class SecHandHouse extends Tospur_House{ ...@@ -170,11 +168,9 @@ class SecHandHouse extends Tospur_House{
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a left JOIN tospur_tag tt on aht.tag_id = tt.id) as a
where house_id = %d and a.type = 1);", $houseId) where house_id = %d and a.type = 1);", $houseId)
); );
InsertDao::addHouseFeature($houseId,$data); InsertDao::addHouseTag($houseId, $data['houseTag']);
if(isset($_POST['mark'])&&$_POST['mark']!="") { InsertDao::addHouseFeature($houseId, $data['houseFeature']);
InsertDao::addHouseTag($_POST['mark'],$houseId);
}
return $result; return $result;
} }
......
...@@ -50,7 +50,7 @@ class secHandHouseList extends WP_List_Table ...@@ -50,7 +50,7 @@ class secHandHouseList extends WP_List_Table
function get_columns() function get_columns()
{ {
if( current_user_can('administrator') ) { if( current_user_can('moderate_comments') ) {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />' 'cb' => '<input type="checkbox" />'
); );
...@@ -165,6 +165,7 @@ class secHandHouseList extends WP_List_Table ...@@ -165,6 +165,7 @@ class secHandHouseList extends WP_List_Table
function prepare_items() function prepare_items()
{ {
global $wpdb; global $wpdb;
$params = array();
$per_page = 10; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
...@@ -177,38 +178,57 @@ class secHandHouseList extends WP_List_Table ...@@ -177,38 +178,57 @@ class secHandHouseList extends WP_List_Table
//$data = $this->example_data; //$data = $this->example_data;
$sql = "select * from tospur_house th $sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id left join(select user_id as aus_id,house_id,user_type from a_house_user) ahu on th.id = ahu.house_id and ahu.user_type=1
left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=1 and ahu.user_type=1"; where 1=1 and house_type=1 ";
if($_POST["listCity"]!=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 ){ if($_POST["listDistrict"] != 0 ){
$sql = $sql." and district_id=".$_POST["listDistrict"]; $params[] = $_POST["listDistrict"];
$sql = $sql." and district_id=%d";
} }
if($_POST["listPlate"] != 0){ if($_POST["listPlate"] != 0){
$sql = $sql." and plate_id=".$_POST["listPlate"]; $params[] = $_POST["listPlate"];
$sql = $sql." and plate_id=%d";
} }
if($_POST["buildProperty"]!=0){ 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){ 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){ if($_POST["totalPrice"]!=NULL){
$priceArray = explode("-", $_POST['totalPrice']); $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){ if($_POST["acreage"]!= NULL){
$areaArray = explode("-", $_POST['acreage']); $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){ 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(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$data[$key] = array( $data[$key] = array(
...@@ -240,16 +260,6 @@ class secHandHouseList extends WP_List_Table ...@@ -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(); $current_page = $this->get_pagenum();
$total_items = count($data); $total_items = count($data);
...@@ -288,7 +298,8 @@ function function_secHandHouseList() ...@@ -288,7 +298,8 @@ function function_secHandHouseList()
$contest['acreage'] = $_POST['acreage']; $contest['acreage'] = $_POST['acreage'];
$contest['statusId'] = $_POST['status']; $contest['statusId'] = $_POST['status'];
} }
Timber::render("secHandHouseList.html",$contest); $contest["house_type"] = 1;
Timber::render("houseList.html",$contest);
} }
function addSecTable(){ function addSecTable(){
$secHandHouseList = new secHandHouseList(); $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 @@ ...@@ -5,7 +5,7 @@
<td> <td>
<div id="feature" class="row"> <div id="feature" class="row">
</div><br/> </div><br/>
<button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt"> <button type="button" class="button action" id="addFeatureBtn">
添加特色 添加特色
</button> </button>
</td> </td>
...@@ -15,17 +15,28 @@ ...@@ -15,17 +15,28 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
{% set featureOld = function('SearchDao::searchFeatureOld', houseId, 1)|json_encode() %}
{% if featureOld %} {% if featureOld %}
var data = {{ featureOld }}; var data = {{ featureOld }};
$.each(data, function (i, item) { $.each(data, function (i, item) {
addFeature(item.tag_id, item.name); addFeature(item.tag_id, item.name);
}); });
{% endif %} {% endif %}
//显示选中的特色
init_modal_addTag(1, function (id, value) { var featureArray = [];
addFeature(id, value); $('#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) { function addFeature(id, value) {
var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id}); var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
...@@ -34,5 +45,4 @@ ...@@ -34,5 +45,4 @@
var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px"); var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#feature").append(divCol); $("#feature").append(divCol);
} }
</script> </script>
\ No newline at end of file
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
function addRecHouse(data){ function addRecHouse(data){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id}); var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id});
var url = url;
var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px"}); var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel"); var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse); var p = $("<p>").append(img).append(cancel).append(recommendHouse);
......
{% block addTag %} {% block addTag %}
{% if feature %} <style>
<style> .table td {
.table td { text-align: center;
text-align: center; }
} </style>
</style> <!-- 房源特色出层 -->
<!-- 房源特色出层 --> <div class="modal fade" id="houseFeature" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal fade" id="houseFeature" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document" style="position: absolute;top: 0;bottom: 0;left: 0;right: 0; margin: auto;height: 200px;overflow-y: auto;overflow-x: hidden;">
<div class="modal-dialog" role="document" style="position: absolute;top: 0;bottom: 0;left: 0;right: 0; margin: auto;height: 200px;overflow-y: auto;overflow-x: hidden;"> <div class="modal-content">
<div class="modal-content"> <div class="row" id="featureTable">
<div class="row" id="featureTable"> <div class="col-md-12">
<div class="col-md-12"> <table class="table" id="tagList">
<table class="table" id="tagList"> </table>
</table>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endif %} </div>
<script> <script>
function init_modal_addTag(type, callback) { var search_type;
var tagList = $('#tagList'); var search_callback;
var tagList;
$(document).ready(function () {
tagList = $('#tagList');
$("#houseFeature").on("show.bs.modal", function () { $("#houseFeature").on("show.bs.modal", function () {
tagList.html(''); tagList.html('');
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/tospur/wp-admin/admin-ajax.php", url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTagOrFeature&type=" + type, data: "action=searchTagOrFeature&type=" + search_type,
success: function (data) { success: function (data) {
var tr; var tr;
$.each(data, function (index, item) { $.each(data, function (index, item) {
...@@ -37,13 +38,18 @@ ...@@ -37,13 +38,18 @@
tr.append('<td id="' + item.id + '">' + item.value + '</td>'); tr.append('<td id="' + item.id + '">' + item.value + '</td>');
tagList.append(tr); 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> </script>
{% endblock %} {% 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
<div class="wrap">
{{function("Contract_List::displayTable")}}
</div>
label.my-error-class { label.my-error-class {
padding-left: 16px; padding-left: 16px;
padding-bottom: 2px; padding-bottom: 2px;
font-weight: bold; font-weight: bold;
color: #EA5200; color: #EA5200;
} }
\ No newline at end of file
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
<a href="#customer" aria-controls="customer" role="tab" data-toggle="tab">客户信息</a> <a href="#customer" aria-controls="customer" role="tab" data-toggle="tab">客户信息</a>
</li> </li>
<li role="presentation"> <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> <a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li> </li>
{% if role == 'administrator' or role == 'editor' %} {% if role == 'administrator' or role == 'editor' %}
...@@ -36,13 +30,11 @@ ...@@ -36,13 +30,11 @@
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="customer"> <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' %} {% include 'customerDetail.html' %}
<hr>
{% include 'customerDemand.html' %}
<hr>
{% include 'customerInfo.html' %}
</div> </div>
<div role="tabpanel" class="tab-pane" id="customer_tracking"> <div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %} {% include 'save_customer_tracking.html' %}
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label>户型:</label> <label>户型:</label>
<select name="bedroom" id="bedroom" class="form-control"> <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="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
</select> </select>
<label for="bedroom"></label> <label for="bedroom"></label>
<select name="hall" id="hall" class="form-control"> <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="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
</select> </select>
<label for="hall"></label> <label for="hall"></label>
<select name="bathroom" id="bathroom" class="form-control"> <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="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
......
<div class="wrap"> <div class="wrap">
<h2>客户列表</h2> <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"> <input type="hidden" name="page" value="customerList">
<div id="search_form"> <div id="search_form">
<input type="hidden" name="hasSearch" value="1"/>
<label for="status" class="hidden"></label> <label for="status" class="hidden"></label>
<select name="status" id="status"> <select name="status" id="status">
<option value="-1">状态</option> <option value="-1">状态</option>
...@@ -24,6 +25,67 @@ ...@@ -24,6 +25,67 @@
<option value="1">二手房</option> <option value="1">二手房</option>
<option value="2">租房</option> <option value="2">租房</option>
</select> </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_name" value="{{ search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}"> <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}"> <input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}">
...@@ -37,12 +99,102 @@ ...@@ -37,12 +99,102 @@
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}"> <input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
</form>
<form method="post">
{{ function("addCustomerTable") }} {{ function("addCustomerTable") }}
<input type="hidden" name="allot_consultant_id" id="allot_consultant_id">
</form> </form>
</div> </div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#demand_type').val('{{ demand_type }}'); var demand_type_select = $('#demand_type');
demand_type_select.val('{{ demand_type }}');
search_form_set_page(); 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> </script>
\ No newline at end of file
<h2>添加特色</h2> {% if type == 0 %}
<label for="feature">特色:</label> {% set text = '标签' %}
{% else %}
{% set text = '特色' %}
{% endif %}
<h2>添加{{ text }}</h2>
<label for="feature">{{ text }}:</label>
<input id="feature" type="text"> <input id="feature" type="text">
<input type="submit" id="submit" class="button"> <input type="submit" id="submit" class="button">
<h2>特色列表</h2> <h2>{{ text }}列表</h2>
<table class="table"> <table class="table">
<thead> <thead>
</thead> </thead>
...@@ -19,7 +24,6 @@ ...@@ -19,7 +24,6 @@
</tbody> </tbody>
</table> </table>
<script> <script>
var admin_url = '{{ admin_url }}';
(function ($) { (function ($) {
$(document).ready(function () { $(document).ready(function () {
$('#submit').click(function () { $('#submit').click(function () {
...@@ -28,14 +32,14 @@ ...@@ -28,14 +32,14 @@
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/', url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name, data: 'action=add_feature&name=' + name + '&type={{ type }}',
success: function (data) { success: function (data) {
switch (data.code) { switch (data.code) {
case 2000: case 2000:
window.location.href = admin_url + 'admin.php?page=add_feature'; window.location.href = '{{ request_url }}';
break; break;
case 2001: case 2001:
alert('不能重复添加特色'); alert('不能重复添加{{ text }}');
break; break;
default: default:
break; break;
...@@ -43,7 +47,7 @@ ...@@ -43,7 +47,7 @@
} }
}); });
} else { } else {
alert('请输入特色'); alert('请输入{{ text }}');
} }
}); });
}); });
......
{% include 'listBlock.html' %}
{{ block('listBlock') }}
\ No newline at end of file
<style>
p {
font-size: 15px;
margin: 20px 0;
}
</style>
<h2>诚信宣言</h2> <h2>诚信宣言</h2>
<label for="introduction"> <p>
<textarea id="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ introduction }}</textarea> <label for="time">入职时间:</label>
</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> <p>
<input type="hidden" id="user_id" value="{{ user_id }}"> <input type="hidden" id="user_id" value="{{ user_id }}">
<input type="submit" id="submit" class="button"> <input type="submit" id="submit" class="button">
</p> </p>
<script> <script>
(function ($) { (function ($) {
var oldIntroduction = '{{ introduction }}';
$(document).ready(function () { $(document).ready(function () {
$('#submit').click(function () { $('#submit').click(function () {
var introduction = $('#introduction').val(); var introduction = $('#introduction').val();
var time = $('#time').val();
var user_id = $('#user_id').val(); var user_id = $('#user_id').val();
if (introduction.trim() != '' && oldIntroduction != introduction) { $.ajax({
$.ajax({ type: 'POST',
type: 'POST', url: '{{ url }}/wp-admin/admin-ajax.php/',
url: '{{ url }}/wp-admin/admin-ajax.php/', data: 'action=submit_introduction&time=' + time + '&introduction=' + introduction + '&user_id=' + user_id,
data: 'action=submit_introduction&introduction=' + introduction + '&user_id=' + user_id, success: function (data) {
success: function (data) { if (data) {
if (data) { alert('提交成功');
alert('提交成功');
}
} }
}); }
}else{ });
alert('请修改诚信宣言');
}
}); });
}); });
})(jQuery); })(jQuery);
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
} }
function existsCancel(){ function existsCancel(){
$("#preview,#houseImg,#feature").on("click",".existsCancel,.featureCancel",function(){ $("#preview,#houseImg,#feature,#mark").on("click",".existsCancel,.featureCancel",function(){
$(this).parent().remove(); $(this).parent().remove();
}); });
} }
......
{% 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,26 +6,51 @@ ...@@ -6,26 +6,51 @@
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <table class="form-table">
<div class="col-md-12"> <tbody>
<label for="mark">标签:</label> <tr>
<input name="mark" id="mark" type="text" value="{{mark}}" class="form-control"> <th><label for="mark">标签</label></th>
</div> <td>
</div> <div id="mark" class="row">
</div><br/>
<button type="button" class="button action" id="addTagBtn">
标签
</button>
</td>
</tr>
</tbody>
</table>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
//显示选中的特色 {% set markOld = function('SearchDao::searchFeatureOld', houseId, 0)|json_encode() %}
init_modal_addTag(1, function (id, value) { {% if markOld %}
addFeature(id, value); var data = {{ markOld }};
$.each(data, function (i, item) {
addTag(item.tag_id, item.name);
});
{% endif %}
var tagArray = [];
$('#addTagBtn').click(function(){
init_modal_addTag(0, function (id, value) {
tagArray = [];
$('input[name="data[houseTag][]"]').each(function (index, item) {
tagArray.push(Number($(item).val()));
});
if(tagArray.indexOf(Number(id)) == -1){
addTag(id, value);
}else{
alert('不能重复选择标签');
}
});
}); });
existsCancel();
}); });
function addFeature(id, value) { function addTag(id, value) {
var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id}); var houseTag = $("<input>").attr({"type": "hidden", "name": "data[houseTag][]", "value": id});
var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel "); var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel ");
var span = $("<span>").attr("style", "margin-right:5px").append(value); 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"); var divCol = $("<div>").append(houseTag).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
$("#feature").append(divCol); $("#mark").append(divCol);
} }
</script> </script>
\ No newline at end of file
...@@ -34,4 +34,4 @@ class Config { ...@@ -34,4 +34,4 @@ class Config {
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1'; const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
const other_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetCommonPlate?radomPla=123456'; const other_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetCommonPlate?radomPla=123456';
const organization_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetOrgnaziTion?radomOrg=123456'; const organization_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetOrgnaziTion?radomOrg=123456';
} }
\ No newline at end of file \ 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 ...@@ -27,6 +27,25 @@ class CustomerDao
} }
return $context; 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{ ...@@ -147,7 +147,7 @@ class InsertDao{
"house_area" => $data["$key"]["housearea"], "house_area" => $data["$key"]["housearea"],
"image_id" => $imgid "image_id" => $imgid
); );
$houseTypeAreaRes = $wpdb->insert('a_district_area', $houseTypeArea); $houseTypeAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if (!$houseTypeAreaRes) { if (!$houseTypeAreaRes) {
return 502; return 502;
} }
...@@ -157,7 +157,7 @@ class InsertDao{ ...@@ -157,7 +157,7 @@ class InsertDao{
'house_id' => $houseId, 'house_id' => $houseId,
'image_id' => $imgid, '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) { if (!$houseImgRes) {
return 503; return 503;
} }
...@@ -204,10 +204,10 @@ class InsertDao{ ...@@ -204,10 +204,10 @@ class InsertDao{
} }
} }
} }
public static function addHouseFeature($houseId,$data){ public static function addHouseFeature($houseId,$houseFeature){
global $wpdb; global $wpdb;
if($data["houseFeature"]){ if($houseFeature){
foreach($data["houseFeature"] as $val){ foreach($houseFeature as $val){
$a_house_feature = array( $a_house_feature = array(
"house_id" => $houseId, "house_id" => $houseId,
"tag_id" =>$val "tag_id" =>$val
...@@ -222,53 +222,23 @@ class InsertDao{ ...@@ -222,53 +222,23 @@ class InsertDao{
} }
public static function addHouseTag($tags, $house_id) public static function addHouseTag($house_id, $houseTag)
{ {
global $wpdb; global $wpdb;
$arr = array(',' => ',');
$in = explode(',', strtr($tags, $arr));
//string
$tags_string = InsertDao::arrayToString($in);
//房源的标签id数组
$tags_ids = array();
//查询存在的标签
$sql = "select * from 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->query(
$wpdb->prepare( $wpdb->prepare("DELETE FROM " . Config::A_HOUSE_TAG_TABLE .
"DELETE FROM a_house_tag " WHERE tag_id in(select tag_id from (select tag_id,tt.type from " . Config::A_HOUSE_TAG_TABLE . " as aht" .
WHERE tag_id in(select tag_id from (select tag_id,tt.type from a_house_tag as aht " left JOIN " . Config::TOSPUR_TAG_TABLE . " tt on aht.tag_id = tt.id) as a" .
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a " where house_id = %d and a.type = 0);", $house_id)
where house_id = %d and a.type = 0);", $house_id)
); );
foreach ($tags_ids as $value) { if ($houseTag) {
$wpdb->insert( foreach ($houseTag as $val) {
'a_house_tag', $a_house_tag = array(
array( "house_id" => $house_id,
'house_id' => $house_id, "tag_id" => $val
'tag_id' => $value );
) $wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
); }
} }
} }
......
...@@ -22,8 +22,8 @@ class TCSync { ...@@ -22,8 +22,8 @@ class TCSync {
$user = get_user_by( "login", $item['WorkNum'] ); $user = get_user_by( "login", $item['WorkNum'] );
$userdata = array( $userdata = array(
'ID' => $user->data->ID, 'ID' => $user->data->ID,
'display_name' => $item['Name'], 'role' => 'author',
'role' => 'author' 'display_name' => $item['Name']
); );
$user_id = wp_update_user( $userdata ) ; $user_id = wp_update_user( $userdata ) ;
}else{ }else{
......
...@@ -20,6 +20,8 @@ function tospur_init() ...@@ -20,6 +20,8 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php'); require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerDao.php'); require_once(PLUGIN_DIR . 'Dao/CustomerDao.php');
require_once(PLUGIN_DIR . 'Admin/House.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/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php'); require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouseList.php'); require_once(PLUGIN_DIR . 'Admin/secHandHouseList.php');
...@@ -27,13 +29,16 @@ function tospur_init() ...@@ -27,13 +29,16 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Admin/rentHouseList.php'); require_once(PLUGIN_DIR . 'Admin/rentHouseList.php');
require_once(PLUGIN_DIR . 'Admin/customer.php'); require_once(PLUGIN_DIR . 'Admin/customer.php');
require_once(PLUGIN_DIR . 'Admin/customerList.php'); require_once(PLUGIN_DIR . 'Admin/customerList.php');
require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php'); require_once(PLUGIN_DIR . 'Admin/customerTrackingList.php'); require_once(PLUGIN_DIR . 'Admin/feature.php');
require_once(PLUGIN_DIR . 'Admin/feature.php');
require_once(PLUGIN_DIR . 'Admin/introduction.php'); require_once(PLUGIN_DIR . 'Admin/introduction.php');
require_once(PLUGIN_DIR . 'Admin/Contract.php'); require_once(PLUGIN_DIR . 'Admin/Contract.php');
require_once(PLUGIN_DIR . 'Admin/consultant_score.php'); require_once(PLUGIN_DIR . 'Admin/consultant_score.php');
require_once(PLUGIN_DIR . 'Admin/view_house.php'); require_once(PLUGIN_DIR . 'Admin/view_house.php');
require_once(PLUGIN_DIR . 'Admin/tospur_sale.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'); add_action('admin_menu', 'reset_menu');
tospur_register_script_style(); tospur_register_script_style();
tospur_ajax_set(); tospur_ajax_set();
...@@ -86,8 +91,9 @@ function tospur_load_resources(){ ...@@ -86,8 +91,9 @@ function tospur_load_resources(){
wp_enqueue_script('validate'); wp_enqueue_script('validate');
wp_enqueue_style('jquery-ui_css'); wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('publicCss');
wp_enqueue_style('bootstrapMinCss'); wp_enqueue_style('bootstrapMinCss');
wp_enqueue_style('publicCss');
} }
function tospur_register_script_style(){ function tospur_register_script_style(){
...@@ -98,9 +104,9 @@ 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_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('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('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('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() function tospur_ajax_set()
...@@ -117,6 +123,8 @@ 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_nopriv_searchUnitPriceRange', 'SearchDao::ajax_searchUnitPriceRange');
add_action('wp_ajax_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice'); add_action('wp_ajax_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice');
add_action('wp_ajax_nopriv_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_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization'); add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' ); add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' );
...@@ -127,7 +135,9 @@ function tospur_ajax_set() ...@@ -127,7 +135,9 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_add_feature', 'feature::ajax_add_feature'); 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_submit_introduction', 'introduction::ajax_submit_introduction');
add_action('wp_ajax_nopriv_submit_introduction', 'introduction::ajax_submit_introduction'); add_action('wp_ajax_nopriv_submit_introduction', 'introduction::ajax_submit_introduction');
//标签和特色 add_action('wp_ajax_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
add_action('wp_ajax_nopriv_searchCustomerByNameOrPhone', 'CustomerDao::searchCustomerByNameOrPhone');
//标签和特色
add_action('wp_ajax_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature'); add_action('wp_ajax_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
add_action('wp_ajax_nopriv_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature'); add_action('wp_ajax_nopriv_searchTagOrFeature', 'SearchDao::ajax_searchTagOrFeature');
//后台处理 置业顾问评分 //后台处理 置业顾问评分
...@@ -169,20 +179,22 @@ function update_consultant() ...@@ -169,20 +179,22 @@ function update_consultant()
function reset_menu() function reset_menu()
{ {
add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync"); add_menu_page('新房列表','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_menu_page('nesHouseList','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view'); add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view');
add_menu_page('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', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html'); add_menu_page('租房列表','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_menu_page('rentHouseList','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html'); add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("introduction", "诚信宣言", "editor", "introduction", "introduction::introduction_html", 'dashicons-menu', 9); add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('contract','合同管理', 'edit_published_posts', 'contract', 'Contract::init_view', 'dashicons-menu', 10); add_menu_page('合同列表','合同列表', 'edit_published_posts', '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_menu_page('客户列表','客户列表', 'edit_published_posts', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html'); add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html');
add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12); add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13);
add_menu_page('添加标签', '添加标签', 'edit_published_posts', '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 ); remove_action( 'admin_notices', 'update_nag', 3 );
global $menu; global $menu;
...@@ -214,11 +226,4 @@ function reset_menu() ...@@ -214,11 +226,4 @@ 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 { ...@@ -368,7 +368,7 @@ a:hover {
#tabWrapper #tabScroller { #tabWrapper #tabScroller {
padding-bottom: 15px; padding-bottom: 15px;
} }
#tabWrapper #tabScroller .tab-pane ul li { .tab-content .tab-pane ul li {
width: 100%; width: 100%;
height: 60px; height: 60px;
line-height: 60px; line-height: 60px;
...@@ -376,10 +376,10 @@ a:hover { ...@@ -376,10 +376,10 @@ a:hover {
color: #898989; color: #898989;
font-size: 18px; font-size: 18px;
} }
#tabWrapper #tabScroller .tab-pane ul li:nth-child(odd) { .tab-content .tab-pane ul li:nth-child(odd) {
background-color: #ffffff; background-color: #ffffff;
} }
#tabWrapper #tabScroller .tab-pane ul li.arrow { .tab-content .tab-pane ul li.arrow {
width: 100%; width: 100%;
height: 60px; height: 60px;
background: url("../img/gray_leftarrow_icon.png") no-repeat; background: url("../img/gray_leftarrow_icon.png") no-repeat;
...@@ -387,17 +387,35 @@ a:hover { ...@@ -387,17 +387,35 @@ a:hover {
-webkit-background-size: 30px 30px; -webkit-background-size: 30px 30px;
background-position: 95% center; background-position: 95% center;
} }
#tabWrapper #tabScroller .tab-pane ul li label { .tab-content .tab-pane ul li label {
color: #000000; color: #000000;
margin-bottom: 0; margin-bottom: 0;
padding: 0 0 0 10px; 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; margin-bottom: 0;
padding: 0; padding: 0;
height: 100%; height: 100%;
} }
#tabWrapper #tabScroller .tab-pane ul li p .form-control { .tab-content .tab-pane ul li p .form-control {
color: #898989; color: #898989;
font-size: 18px; font-size: 18px;
background-color: transparent; background-color: transparent;
...@@ -407,16 +425,16 @@ a:hover { ...@@ -407,16 +425,16 @@ a:hover {
-webkit-box-shadow: none; -webkit-box-shadow: none;
-webkit-appearance: none; -webkit-appearance: none;
} }
#tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-outer-spin-button, .tab-content .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-inner-spin-button {
-webkit-appearance: none !important; -webkit-appearance: none !important;
margin: 0; margin: 0;
} }
#tabWrapper #tabScroller .tab-pane > p { .tab-content .tab-pane > p {
padding-right: 15px; padding-right: 15px;
color: #898989; color: #898989;
} }
#tabWrapper #tabScroller .tab-pane .btn { .tab-content .tab-pane .btn {
width: 86%; width: 86%;
display: block; display: block;
color: #ffffff; color: #ffffff;
...@@ -435,12 +453,12 @@ a:hover { ...@@ -435,12 +453,12 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9; box-shadow: 0 2px 0 0 #117bb9;
-webkit-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; background-color: #117bb9;
} }
#tabWrapper #tabScroller .tab-pane .btn:focus { .tab-content .tab-pane .btn:focus {
outline: 0; outline: 0;
} }
#tabWrapper #tabScroller .tab-pane:last-child .btn { .tab-content .tab-pane:last-child .btn {
margin-top: 5%; margin-top: 5%;
} }
...@@ -415,7 +415,6 @@ a:hover { ...@@ -415,7 +415,6 @@ a:hover {
} }
.container-fluid { .container-fluid {
width: 100%;
height: 100%; height: 100%;
background: url("../img/formBg.jpg") no-repeat; background: url("../img/formBg.jpg") no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
...@@ -565,6 +564,7 @@ a:hover { ...@@ -565,6 +564,7 @@ a:hover {
-webkit-border-bottom-right-radius: 4px; -webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9; box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9; -webkit-box-shadow: 0 2px 0 0 #117bb9;
border: 0;
} }
.container-fluid form .btn:active { .container-fluid form .btn:active {
......
...@@ -51,6 +51,12 @@ function page_template($template) ...@@ -51,6 +51,12 @@ function page_template($template)
case 'loan_calculator': case 'loan_calculator':
$page = $theme . '/loan_calculator.php'; $page = $theme . '/loan_calculator.php';
break; break;
case 'tax_calculator':
$page = $theme . '/tax_calculator.php';
break;
case 'ability_calculator':
$page = $theme . '/ability_calculator.php';
break;
case 'manager': case 'manager':
$page = $theme . '/manager.php'; $page = $theme . '/manager.php';
break; 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 @@ ...@@ -5,9 +5,33 @@
<meta name="viewport" content="width=360, user-scalable=0"/> <meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="renderer" content="webkit">
<title>登录</title> <title>登录</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/manager.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.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script> <script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script> <script src="{{ theme }}/js/bootstrap.min.js"></script>
...@@ -53,7 +77,7 @@ ...@@ -53,7 +77,7 @@
</head> </head>
<body> <body>
<div class="container-fluid text-center"> <div class="container-fluid">
<form id="loginForm" method="post"> <form id="loginForm" method="post">
<h2></h2> <h2></h2>
<p class="has-feedback username"> <p class="has-feedback username">
......
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