Commit 974ac51a by felix

每日一更

parent fa7e3348
......@@ -41,7 +41,7 @@ class House extends Tospur_House{
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 203){
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
print_r($result);
echo "新房房源修改失败";
......@@ -51,7 +51,7 @@ class House extends Tospur_House{
}
}else{
$result = House::data_insert($insert_tospur_house_array);
if($result != 200){
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
print_r($result);;
echo "新增房源失败";
......@@ -61,8 +61,7 @@ class House extends Tospur_House{
}
}
exit;
}else if(isset($_GET['edit']))
{
}else if(isset($_GET['edit'])){
$context['houseId'] = $_GET['id'];
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'],"edit"));
$context["district"] = SearchDao::searchCity($context['result']->city_id);
......@@ -82,8 +81,7 @@ class House extends Tospur_House{
public static function data_update($houseId,$insert_tospur_house_array){
global $wpdb;
$data = $_POST["data"];
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId));
$result = 203;
$result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId));
$exist_ids = array();
if(isset($_POST['exists'])){
foreach($_POST['exists'] as $id => $item){
......@@ -122,20 +120,21 @@ class House extends Tospur_House{
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
$res = InsertDao::addRecommend($houseId,$data);
if($res == 504){
$result = $res;
echo "推荐房源修改失败";
$result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
}
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
$res = InsertDao::addRecConsultant($houseId,$data);
if($res == 505){
$result = $res;
echo "推荐置业顾问修改失败";
$result = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
if(!is_numeric($result)){
return $result;
}
InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST); return $result;
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $result;
}
public static function data_insert($params){
......@@ -149,21 +148,31 @@ class House extends Tospur_House{
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT);
if (!$res) {
$houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
$mainImageRes = InsertDao::addMainImage($houseId,$data);
InsertDao::addMainImage($houseId,$data);
InsertDao::addRecommend($houseId,$data);
$recommendRes = InsertDao::addRecommend($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
$recConsultantRes = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
$customerTrackRes = CustomerTrackingDao::insert($houseId, $_REQUEST);
if(!is_numeric($mainImageRes)){
return $mainImageRes;
}else if(!is_numeric($recommendRes)){
return $recommendRes;
}else if(!is_numeric($recConsultantRes)){
return $recConsultantRes;
}else if(is_numeric($customerTrackRes)){
return $customerTrackRes;
}
}
return $houseId;
}else{
return 506;
return "房源已存在";
}
return 200;
}
}
\ No newline at end of file
......@@ -34,11 +34,11 @@ class QuotaYearList extends WP_List_Table
$this->_column_headers = array($columns, $hidden);
$data = array();
if(isset($_REQUEST["year"]) && isset($_REQUEST["oid"])){
if(isset($_REQUEST["year"]) && isset($_REQUEST["organization"])){
$sql = "select *, month,sum(quota) as quota from ".Config::TOSPUR_QUOTA_TABLE." where consultantId in(select id from ".Config::TOSPUR_CONSULTANT."
where subsidiaryId = %d) and year = %d group by year,month;";
$result = $wpdb->get_results($wpdb->prepare($sql,$_REQUEST["oid"],$_REQUEST["year"]));
$name = $wpdb->get_var($wpdb->prepare("select Name from tospur_organization where id = %d;",$_REQUEST["oid"]));
$result = $wpdb->get_results($wpdb->prepare($sql,$_REQUEST["organization"],$_REQUEST["year"]));
$name = $wpdb->get_var($wpdb->prepare("select Name from tospur_organization where id = %d;",$_REQUEST["organization"]));
$j = 0;
for($i = 1;$i<=12;$i++){
$item = $result[$j];
......@@ -48,7 +48,7 @@ class QuotaYearList extends WP_List_Table
$j++;
}
$data[$i] = array(
'oid' => $_REQUEST["oid"],
'oid' => $_REQUEST["organization"],
'year' => $_REQUEST["year"],
'month' => $i,
'name' => $name,
......
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class commissionList extends WP_List_Table
{
function __construct()
{
}
public function print_column_headers()
{
echo '<th rowspan="2">部门</th>';
echo '<th rowspan="2">员工</th>';
echo '<th colspan="2">目标业绩</th>';
echo '<th colspan="3">应收业绩</th>';
echo '<th colspan="3">实收业绩</th>';
echo '<th colspan="3">前期未收</th>';
echo '<th rowspan="2">到职日期</th>';
echo '</tr>';
echo '<tr>';
echo '<th>金额(万)</th>';
echo '<th>达成率%</th>';
echo '<th>买卖</th>';
echo '<th>租赁</th>';
echo '<th>合计</th>';
echo '<th>买卖</th>';
echo '<th>租赁</th>';
echo '<th>合计</th>';
echo '<th>买卖</th>';
echo '<th>租赁</th>';
echo '<th>合计</th>';
}
function column_default($item, $column_name)
{
switch ($column_name) {
default:
return $item[$column_name];
}
}
function get_columns()
{
$columns['organization_name'] = '部门';
$columns['consultant_name'] = '员工';
$columns['target_amount'] = '金额(万)';
$columns['achieving_rate'] = '达成率%';
$columns['business'] = '应收业绩买卖';
$columns['lease'] = '应收业绩租赁';
$columns['accounts'] = '应收业绩合计';
$columns['businessPaid'] = '实收业绩买卖';
$columns['leasePaid'] = '实收业绩租赁';
$columns['paid'] = '实收业绩合计';
$columns['unBusinessPaid'] = '前期未收买卖';
$columns['unLeasePaid'] = '实收业绩租赁';
$columns['unPaid'] = '前期未收租赁';
$columns['entry_time'] = '到职日期';
return $columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$year = date('Y');
$month = null;
if (isset($_REQUEST['year']) && $_REQUEST['year'] != -1) {
$year = $_REQUEST['year'];
if (isset($_REQUEST['month']) && $_REQUEST['month'] != -1) {
$month = $_REQUEST['month'];
}
}
$commission_time_sql = " where time >= '" . $year . "-1-1' and time < DATE_SUB('" . $year . "-1-1', INTERVAL -1 YEAR)";
$quota_time_sql = " where year = " . $year;
if ($month != null) {
$quota_time_sql .= " and month = " . $month;
$commission_time_sql = " where time >= '" . $year . "-" . $month . "-1' and time < DATE_SUB('" . $year . "-" . $month . "-1', INTERVAL -1 MONTH)";
}
$sql = "select *,(accounts-paid) as unPaid," .
"(business-businessPaid) as unBusinessPaid," .
"(lease-leasePaid) as unLeasePaid" .
" from (select consultantId,sum(accounts) as accounts,sum(case when t1.type = 0 then accounts else 0 end) business," .
"sum(case when t1.type = 1 then accounts else 0 end) lease from (select consultantId,accounts,tcn.type from tospur_commission tcn" .
" left join tospur_commission_log tcl on tcl.commissionId = tcn.id" .
$commission_time_sql . " group by consultantId ) t1 group by consultantId) should" .
" left join (select consultantId,sum(paid) as paid,sum(case when tcn.type = 0 then paid else 0 end) businessPaid," .
"sum(case when tcn.type = 1 then paid else 0 end) leasePaid from tospur_commission tcn" .
" left join tospur_commission_log tcl on tcl.commissionId = tcn.id" .
$commission_time_sql .
" group by consultantId) actual on actual.consultantId = should.consultantId" .
" left join (select id as consultantId,name as consultant_name,time as entry_time,subsidiaryId from tospur_consultant) tc" .
" on tc.consultantId = should.consultantId" .
" left join (select id as organization_id,name as organization_name from tospur_organization) torg on torg.organization_id = tc.subsidiaryId";
$sql .= " left join (select consultantId,sum(quota) as target_amount from tospur_quota" .
$quota_time_sql .
" group by consultantId) tq on tq.consultantId = should.consultantId where 1 = 1";
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and torg.organization_id = " . $_REQUEST['organization'];
}
if (isset($_REQUEST['search_consultant_name']) && $_REQUEST['search_consultant_name'] != null) {
$sql = $sql . " and tc.consultant_name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$target_amount = 0;
$achieving_rate = 0;
if ($value->target_amount) {
$target_amount = $value->target_amount;
$achieving_rate = round((($value->paid) / $target_amount / 10000), 2);
}
$data[$key] = array(
'organization_name' => $value->organization_name,
'consultant_name' => $value->consultant_name,
'target_amount' => $target_amount,
'achieving_rate' => $achieving_rate . '%',
'business' => round($value->business / 10000, 2),
'lease' => round($value->lease / 10000, 2),
'accounts' => round($value->accounts / 10000, 2),
'businessPaid' => round($value->businessPaid / 10000, 2),
'leasePaid' => round($value->leasePaid / 10000, 2),
'paid' => round($value->paid / 10000, 2),
'unBusinessPaid' => round($value->unBusinessPaid / 10000, 2),
'unLeasePaid' => round($value->unLeasePaid / 10000, 2),
'unPaid' => round($value->unPaid / 10000, 2),
'entry_time' => $value->entry_time
);
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$total_pages = ceil($total_items / $per_page);
if ($_REQUEST['paged'] > $total_pages) {
$current_page = $total_pages;
}
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function function_commissionList()
{
$context = array();
$context['req'] = $_REQUEST;
$context['year'] = date('Y');
Timber::render("commissionList.html", $context);
}
function addCommissionTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', $_SERVER['REQUEST_URI']);
$commissionList = new commissionList();
$commissionList->prepare_items();
$commissionList->display();
}
?>
......@@ -8,6 +8,11 @@ class customerList extends WP_List_Table
{
function __construct()
{
parent::__construct(array(
'singular' => 'customerList',
'plural' => 'customerList',
'ajax' => false
));
}
function column_default($item, $column_name)
......@@ -20,15 +25,58 @@ class customerList extends WP_List_Table
}
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" data-consultant="%3$s"/>',
$this->_args['singular'],
$item['id'],
$item['consultant_id']
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox"/>'
);
$columns['name'] = '姓名';
$columns['demand_type'] = '需求类型';
$columns['customer_remark'] = '客户备注';
$columns['consultant_name'] = '置业顾问';
$columns['status_name'] = '状态';
$columns['customer_remark'] = '客户备注';
return $columns;
}
function get_bulk_actions()
{
$actions = array(
'allot' => '分配置业顾问'
);
return $actions;
}
function process_bulk_action()
{
$action = $this->current_action();
if ($action) {
$string = null;
switch ($action) {
case 'allot':
$consultant_id = $_POST['allot_consultant_id'];
if ($consultant_id) {
$string = '(' . implode(',', array_map('intval', $_POST['customerlist'])) . ')';
global $wpdb;
$result = $wpdb->query('update ' . Config::TOSPUR_CUSTOMER_TABLE
. ' SET consultant_id = ' . $consultant_id
. ' where id in ' . $string);
if($result){
echo '<script>alert("分配置业顾问成功");</script>';
}
}
break;
}
}
}
function prepare_items()
{
......@@ -39,9 +87,15 @@ class customerList extends WP_List_Table
$this->_column_headers = array($columns, $hidden);
$this->process_bulk_action();
$sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name FROM tospur_customer tcs" .
" left join (SELECT * FROM tospur_status where status_type = 5) as ts on tcs.status = ts.status_id" .
" left join tospur_consultant tc on tcs.consultant_id = tc.id where 1 = 1";
$current_user = wp_get_current_user();
if($current_user->roles[0] == 'author'){
$sql = $sql . " and tcs.consultant_id = " . $current_user->ID;
}
if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_REQUEST['status'];
}
......@@ -65,6 +119,34 @@ class customerList extends WP_List_Table
$sql = $sql . " and " . $demand_type . " = 1";
}
}
if (isset($_REQUEST['listCity']) && $_REQUEST["listCity"] != -1) {
$sql = $sql . " and tcs.city_id = " . $_REQUEST["listCity"];
}
if (isset($_REQUEST['listDistrict']) && $_REQUEST["listDistrict"] != -1) {
$sql = $sql . " and tcs.district_id = " . $_REQUEST["listDistrict"];
}
if (isset($_REQUEST['listPlate']) && $_REQUEST["listPlate"] != -1) {
$sql = $sql . " and tcs.plate_id = " . $_REQUEST["listPlate"];
}
if ($_REQUEST["totalPrice"] != null) {
$priceArray = explode("-", $_REQUEST['totalPrice']);
$sql = $sql . " and (tcs.min_totalPrice >= " . $priceArray[0] . " and tcs.max_totalPrice <= " . $priceArray[1] . ")";
}
if ($_REQUEST["rentalPrice"] != null) {
$priceArray = explode("-", $_REQUEST['rentalPrice']);
$sql = $sql . " and (tcs.min_rent >= " . $priceArray[0] . " and tcs.max_rent <= " . $priceArray[1] . ")";
}
if (isset($_REQUEST['buildProperty']) && $_REQUEST["buildProperty"] != -1) {
if ($_REQUEST["buildProperty"] == 5) {
$sql = $sql . " and (tcs.bedroom >= " . $_REQUEST["buildProperty"] . " or tcs.bedroom = -1)";
} else {
$sql = $sql . " and (tcs.bedroom = " . $_REQUEST["buildProperty"] . " or tcs.bedroom = -1)";
}
}
if ($_REQUEST["acreage"] != null) {
$areaArray = explode("-", $_REQUEST['acreage']);
$sql = $sql . " and (tcs.min_coveredArea >= " . $areaArray[0] . " and tcs.max_coveredArea <= " . $areaArray[1] . ")";
}
if (isset($_REQUEST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_REQUEST['search_name'] . "%'";
}
......@@ -96,6 +178,7 @@ class customerList extends WP_List_Table
'name' => $value->name,
'demand_type' => implode("、", $demand_type_array),
'customer_remark' => $value->customer_remark,
'consultant_id' => $value->consultant_id,
'consultant_name' => $value->consultant_name,
'status_name' => $value->status_name
);
......@@ -125,9 +208,28 @@ class customerList extends WP_List_Table
function function_customerList()
{
$context = array();
//
$context['city'] = SearchDao::searchCity();
$context['buildProperty'] = SearchDao::searchBuildProperty();
//
$context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6);
if (isset($_REQUEST['hasSearch'])) {
$context['district'] = SearchDao::searchCity($_REQUEST['listCity']);
$context['plate'] = SearchDao::searchCity($_REQUEST['listCity'], $_REQUEST['listDistrict']);
$context['dicTotalPrice'] = searchDao::searchTotalPrice($_REQUEST['listCity']);
$context['dicRentalPrice'] = searchDao::searchRentalPrice($_REQUEST['listCity']);
$context['dicArea'] = searchDao::searchArea($_REQUEST['listCity']);
$context['cityId'] = $_REQUEST['listCity'];
$context['districtId'] = $_REQUEST['listDistrict'];
$context['plateId'] = $_REQUEST['listPlate'];
$context['buildPropertyId'] = $_REQUEST['buildProperty'];
$context['totalPrice'] = $_REQUEST['totalPrice'];
$context['rentalPrice'] = $_REQUEST['rentalPrice'];
$context['acreage'] = $_REQUEST['acreage'];
}
$context['status_id'] = $_REQUEST['status'];
$context['demand_type'] = isset($_REQUEST['demand_type']) ? $_REQUEST['demand_type'] : -1;
$context['customer_type_id'] = isset($_REQUEST['customer_type']) ? $_REQUEST['customer_type'] : -1;
......
......@@ -50,14 +50,15 @@ class RentHouse extends Tospur_House{
"entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"],
"rent"=>$_POST["rent"],
"status" => $_POST["status"]
"status" => $_POST["status"],
"property_money"=>$_POST["property_money"]
);
if($type==3){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
$result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
if($result != 202){
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
print_r($result);;
echo "租房房源修改失败";
......@@ -68,7 +69,7 @@ class RentHouse extends Tospur_House{
}else {
$result = RentHouse::rentHouseData_insert($insert_tospur_house_array);
if ($result != 200) {
if (is_numeric($result)) {
$wpdb->query("ROLLBACK");
print_r($result);
echo "租房房源新增失败";
......@@ -108,29 +109,42 @@ class RentHouse extends Tospur_House{
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT);
if(!$res){
$houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
$mainImageRes = InsertDao::addMainImage($houseId,$data);
InsertDao::addMainImage($houseId,$data);
InsertDao::addRecommend($houseId,$data);
$recommendRes = InsertDao::addRecommend($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
$recConsultantRes = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
$houseFeatureRes = InsertDao::addHouseFeature($houseId, $data['houseFeature']);
$customerTrackRes = CustomerTrackingDao::insert($houseId, $_REQUEST);
if(!is_numeric($mainImageRes)){
return $mainImageRes;
}else if(!is_numeric($recommendRes)){
return $recommendRes;
}else if(!is_numeric($recConsultantRes)){
return $recConsultantRes;
}else if(is_numeric($customerTrackRes)){
return $customerTrackRes;
}else if(is_numeric($houseFeatureRes)){
return $houseFeatureRes;
}
}
return $houseId;
}else{
return 508;
return "房源已存在";
}
return 200;
}
public static function data_update($houseId,$params){
global $wpdb;
$data = $_POST["data"];
$res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$result = 202;
$result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
InsertDao::addMainImage($houseId,$data);
$exists_photo_ids = array();
if(isset($_POST['exists_photo'])){
......@@ -150,11 +164,16 @@ class RentHouse extends Tospur_House{
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
InsertDao::addRecommend($houseId,$data);
$result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
}
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data);
$result = InsertDao::addRecConsultant($houseId,$data);
if(!is_numeric($result)){
return $result;
}
InsertDao::addHouseTag($houseId, $data['houseTag']);
return $result;
}
......
......@@ -13,7 +13,7 @@ class SecHandHouse extends Tospur_House{
'name' => $_POST['housename'],
'total_price' =>$_POST['total_price'],
'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'],
'buildproperty_id'=>$_POST['roomNum'],
'covered_area' =>$_POST['covered_area'],
'floor' =>$_POST['floor'],
'faceto'=>$_POST['faceto'],
......@@ -48,15 +48,16 @@ class SecHandHouse extends Tospur_House{
"garage"=>$_POST["garage"],
"entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"],
"status" => $_POST["status"]
"status" => $_POST["status"],
"property_money"=>$_POST["property_money"],
"mortgage" =>$_POST["mortgage"]
);
if($type==2){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
if($result != 201){
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
print_r( $result);;
echo "二手房房源修改失败";
......@@ -67,7 +68,7 @@ class SecHandHouse extends Tospur_House{
}else {
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) {
if (!is_numeric($result)) {
$wpdb->query("ROLLBACK");
print_r( $result);;
echo "二手房房源新增失败";
......@@ -105,26 +106,36 @@ class SecHandHouse extends Tospur_House{
//获取新房信息,存入tospur_house表
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT);
if(!$res){
$houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
$mainImageRes = InsertDao::addMainImage($houseId,$data);
InsertDao::addMainImage($houseId,$data);
InsertDao::addRecommend($houseId,$data);
$recommendRes = InsertDao::addRecommend($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
$recConsultantRes = InsertDao::addRecConsultant($houseId,$data['recConsultant']);
InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseFeature($houseId, $data['houseFeature']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
$houseFeatureRes = InsertDao::addHouseFeature($houseId, $data['houseFeature']);
$customerTrackRes = CustomerTrackingDao::insert($houseId, $_REQUEST);
if(!is_numeric($mainImageRes)){
return $mainImageRes;
}else if(!is_numeric($recommendRes)){
return $recommendRes;
}else if(!is_numeric($recConsultantRes)){
return $recConsultantRes;
}else if(is_numeric($customerTrackRes)){
return $customerTrackRes;
}else if(is_numeric($houseFeatureRes)){
return $houseFeatureRes;
}
}
return $houseId;
}else{
return 507;
return "房源已存在";
}
return 200;
}
public static function data_update($houseId,$params){
......@@ -153,10 +164,15 @@ class SecHandHouse extends Tospur_House{
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
InsertDao::addRecommend($houseId,$data);
$result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
}
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data);
$result = InsertDao::addRecConsultant($houseId, $data['recConsultant']);
if(!is_numeric($result)){
return $result;
}
$wpdb->query(
$wpdb->prepare(
......@@ -167,7 +183,11 @@ class SecHandHouse extends Tospur_House{
);
InsertDao::addHouseTag($houseId, $data['houseTag']);
InsertDao::addHouseFeature($houseId, $data['houseFeature']);
$result = InsertDao::addHouseFeature($houseId, $data['houseFeature']);
if(!is_numeric($result)){
return $result;
}
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
return $result;
}
......
<table class="form-table">
<tbody>
<tr>
<th><label for="periphery">置业顾问</label></th>
<th style="width:11.7%"><label for="periphery" style="margin-left: 30px">置业顾问:</label></th>
<td>
<div id="consultantImg">
</div><br />
</div>
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
选择置业顾问
</button>
......
<table class="form-table">
<tbody>
<tr>
<th><label for="feature">房源特色</label></th>
<th style="width:11.7%"><label for="feature" style="margin-left: 30px">特色筛选:</label></th>
<td>
<div id="feature" class="row">
</div><br/>
</div>
<button type="button" class="button action" id="addFeatureBtn">
添加特色
</button>
......
<table class="form-table">
<table class="form-table" id="recHouseTable">
<tbody>
<tr>
<th><label for="traffic">推荐房源</label></th>
<th style="width:11.7%"><label for="traffic" style="margin-left: 30px">推荐房源:</label></th>
<td>
<div id="houseImg">
</div><br />
</div>
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
添加房源
</button>
......@@ -35,7 +35,7 @@
function addRecHouse(data){
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value":data.id});
var url = url;
var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px"});
var img = $("<img>").attr({"src":data.path,"height":90,"width":140,"style":"margin-right:50px;margin-bottom:10px;"});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseImg").append(p);
......
<div class="wrap">
<h2>收佣进度表</h2>
<form method="get">
<input type="hidden" name="page" value="commissionList">
{% include 'selectOrganization.html' %}
<div id="search_form">
<label for="year" class="hidden"></label>
<select name="year" id="year">
<option value="2015">2015</option>
<option value="2016">2016</option>
</select>
<label for="month" class="hidden"></label>
<select name="month" id="month">
<option value="-1">请选择月份</option>
<option value="1">一月</option>
<option value="2">二月</option>
<option value="3">三月</option>
<option value="4">四月</option>
<option value="5">五月</option>
<option value="6">六月</option>
<option value="7">七月</option>
<option value="8">八月</option>
<option value="9">九月</option>
<option value="10">十月</option>
<option value="11">十一月</option>
<option value="12">十二月</option>
</select>
<label for="search_consultant_name" class="hidden"></label>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
value="{{ req.search_consultant_name }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
{{ function("addCommissionTable") }}
</div>
<script>
$(document).ready(function () {
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
{% if req %}
$("#year").val('{{ req.year|default(year) }}');
$("#month").val('{{ req.month|default(-1) }}');
{% endif %}
});
</script>
\ No newline at end of file
......@@ -8,3 +8,11 @@ label.my-error-class {
color: #EA5200;
}
p[class^=col-]{
padding: 0;
}
#preview,#addPhotos,#recHouseTable{
border-bottom: 1px solid;
border-bottom: 1px solid #ddd;
}
\ No newline at end of file
......@@ -20,12 +20,6 @@
<a href="#customer" aria-controls="customer" role="tab" data-toggle="tab">客户信息</a>
</li>
<li role="presentation">
<a href="#demand" aria-controls="demand" role="tab" data-toggle="tab">需求信息</a>
</li>
<li role="presentation">
<a href="#house" aria-controls="house" role="tab" data-toggle="tab">详细需求</a>
</li>
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li>
{% if role == 'administrator' or role == 'editor' %}
......@@ -36,13 +30,11 @@
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="customer">
{% include 'customerInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="demand">
{% include 'customerDemand.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="house">
{% include 'customerDetail.html' %}
<hr>
{% include 'customerDemand.html' %}
<hr>
{% include 'customerInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %}
......
......@@ -141,7 +141,7 @@
<div class="col-md-6">
<label>户型:</label>
<select name="bedroom" id="bedroom" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="-1" selected="selected">不限</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
......@@ -154,7 +154,7 @@
</select>
<label for="bedroom"></label>
<select name="hall" id="hall" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="-1" selected="selected">不限</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
......@@ -163,7 +163,7 @@
</select>
<label for="hall"></label>
<select name="bathroom" id="bathroom" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="-1" selected="selected">不限</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
......
......@@ -3,6 +3,7 @@
<form method="get">
<input type="hidden" name="page" value="customerList">
<div id="search_form">
<input type="hidden" name="hasSearch" value="1"/>
<label for="status" class="hidden"></label>
<select name="status" id="status">
<option value="-1">状态</option>
......@@ -24,6 +25,67 @@
<option value="1">二手房</option>
<option value="2">租房</option>
</select>
<label for="listCity" class="hidden"></label>
<select id="listCity" name="listCity">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="listDistrict" class="hidden"></label>
<select id="listDistrict" name="listDistrict">
<option value="-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="listPlate" class="hidden"></label>
<select id="listPlate" name="listPlate">
<option value="-1">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="totalPrice" class="hidden"></label>
<select id="totalPrice" name="totalPrice" class="hidden">
<option value="">总价</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="rentalPrice" class="hidden"></label>
<select id="rentalPrice" name="rentalPrice" class="hidden">
<option value ="">月租</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<label for="buildProperty" class="hidden"></label>
<select id="buildProperty" name="buildProperty">
<option value="-1">房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="acreage" class="hidden"></label>
<select id="acreage" name="acreage">
<option value="">面积</option>
{% if acreage %}
{% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
</div>
<div style="margin-top: 10px;">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}">
......@@ -37,12 +99,63 @@
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
<form method="post">
{{ function("addCustomerTable") }}
<input type="hidden" name="allot_consultant_id" id="allot_consultant_id">
</form>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
$(document).ready(function () {
$('#demand_type').val('{{ demand_type }}');
var demand_type_select = $('#demand_type');
demand_type_select.val('{{ demand_type }}');
search_form_set_page();
var acreage = $("#acreage");
var totalPrice = $("#totalPrice");
var rentalPrice = $("#rentalPrice");
var listCity = $('#listCity');
listCity.change(function () {
var cityId = $('#listCity').val();
setCity('listCity', 'listDistrict', 'listPlate');
acreage.find('option:not(:first-child)').remove();
totalPrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove();
//面积
searchAcreage(cityId, acreage);
setTotalOrRentalPrice(demand_type_select, cityId);
});
//设置区域
$('#listDistrict').change(function () {
setArea('listCity', 'listDistrict', 'listPlate');
});
demand_type_select.change(function () {
totalPrice.find('option:not(:first-child)').remove();
rentalPrice.find('option:not(:first-child)').remove();
setTotalOrRentalPrice($(this), listCity.val());
});
setTotalOrRentalPrice(demand_type_select, listCity.val());
function setTotalOrRentalPrice(self, cityId) {
var demand_type = self.val();
if (demand_type == 0 || demand_type == 1) {
totalPrice.removeClass('hidden');
rentalPrice.addClass('hidden');
searchTotalPrice(cityId, totalPrice);
} else if (demand_type == 2) {
rentalPrice.removeClass('hidden');
totalPrice.addClass('hidden');
searchRentalPrice(cityId, rentalPrice);
}else{
rentalPrice.addClass('hidden');
totalPrice.addClass('hidden');
}
}
allot_consultant('customerlist');
});
</script>
\ No newline at end of file
......@@ -200,9 +200,10 @@
function search_form_set_page(){
var search_flag = false;
var search_form = $('#search_form');
$('form').submit(function () {
var search_select = $(this).find('#search_form select');
var search_input = $(this).find('#search_form input[type=text],input[type=date]');
var search_select = search_form.find('select');
var search_input = search_form.find('input[type=text],input[type=date]');
$.each(search_select, function (index, item) {
var search_select_value = $(item).find('option:selected').val();
if (search_select_value != -1) {
......@@ -221,6 +222,49 @@
});
}
function allot_consultant(name) {
//批量操作
$('select[name=action],select[name=action2]').change(function () {
//分配置业顾问
if ($(this).find('option:selected').val() == 'allot') {
//选择房/客源
var checkbox = $('input[name="' + name + '[]"]');
if (checkbox.is(':checked')) {
var array = [];
$('input[name="' + name + '[]"]:checked').map(function () {
var consultant_id = Number($(this).data('consultant'));
if (array.indexOf(consultant_id) == -1) {
array.push(consultant_id);
}
});
var confirmFlag = true;
if (array.length > 1) {
confirmFlag = confirm('当前选择的房/客源置业顾问不同,是否继续');
}
if (confirmFlag) {
$('#myConsultant').modal('show');
}
//未选择房/客源,下拉框显示批量操作
} else {
$(this).find('option:first').attr('selected', 'selected');
alert('请选择房/客源');
return false;
}
}
});
init_modal_myConsultantList(function (data) {
var consultant_id = Number(data.id);
$('#allot_consultant_id').val(consultant_id);
});
$("#myConsultant").on("hide.bs.modal", function () {
var allot_consultant_id = Number($('#allot_consultant_id').val());
if (!allot_consultant_id) {
$('select[name=action],select[name=action2]').find('option:first').attr('selected', 'selected');
}
});
}
//城市区域联动
function setCity(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var baseArea = $("#"+areaSelector);
var basePlate = $("#"+plateSelector);
baseArea.find('option:not(:first-child)').remove();
basePlate.find('option:not(:first-child)').remove();
//城市联动区域
searchCity(cityId,baseArea)
}
//区域联动板块
function setArea(citySelector,areaSelector,plateSelector){
var cityId = $("#"+citySelector).val();
var areaId = $("#"+areaSelector).val();
var basePlate = $("#"+plateSelector);
basePlate.find('option:not(:first-child)').remove();
searchArea(cityId,areaId,basePlate);
}
//搜索城市的方法
function searchCity(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//搜索区域的方法
function searchArea(cityId,areaId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
addOption(json,optionId);
}
});
}
function existsCancel(){
$("#preview,#houseImg,#feature,#mark").on("click",".existsCancel,.featureCancel",function(){
$(this).parent().remove();
});
}
//租房与二手房中钥匙与车库的选项
function setCheckBox(){
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
}
//控制当二手房租房中钥匙与车库被勾选时,后面的文本域可使用
function textDisable(checkId,textId){
if($('input[id="'+checkId+'"]:checked').length > 0){
$("#"+textId).removeAttr("disabled");
}else{
$("#"+textId).attr("disabled","true");
}
}
//搜索置业顾问的方法
//function searchConsultant(consulCityId,consultantName){
// $.ajax({
// type: "GET",
// url: "/tospur/wp-admin/admin-ajax.php",
// data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
// success:function(json){
// for(var i = 0; i <=json.length-1; i++){
// var name = json[i]["consultantName"];
// var imgUrl = json[i]["imageUrl"];
// var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
// var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
// $("#consultantList").append(li);
// }
// }
// });
//}
//往给定id的select中添加option
function addOption(json,select){
var selectId = select.attr("id");
//select.find('option:not(:first-child)').remove();
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId.indexOf("creage") > -1|| selectId.indexOf("rice") > -1){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
//控制推荐房源与置业顾问的个数
function controlCommand(id,number,type){
var num = $("#"+id+" > p").length;
if(num>number){
if(type==0){
alert("最多只能推荐3个房源");
}else if(type==1){
alert("您只能推荐一位置业顾问");
}
$("#"+id).find("p:last-child").remove();
}
}
function getUrlParmas(){
var href = location.search.substr(1,location.search.length-1);
var params = href.split("&");
var map = {};
for(item in params){
var key = params[item].split("=")[0] || "";
var value = params[item].split("=")[1] || "";
map[key] = value;
}
return map;
}
function setDate(id){
$("#"+id).datepicker({
dateFormat: "yy-mm-dd"
});
}
//建筑年代的下拉框
function setAge(){
for(var i = 1981; i<= 2020; i++){
var option = $("<option>").append(i);
$("#pageAge").append(option);
}
}
//租房二手房中,修改界面下拉框的信息还原
function revertOption(data){
$.each(data,function(i,item){
$("form").find("select[name='"+i+"']").val(item);
});
}
//搜索面积的方法
function searchAcreage(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchArea&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
//搜索单价的方法
function searchPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchUnitPriceRange&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchTotalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchTotalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function searchRentalPrice(cityId,optionId){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchRentalPrice&cityId="+cityId,
success:function(json){
addOption(json,optionId);
}
});
}
function search_form_set_page(){
var search_flag = false;
var search_form = $('#search_form');
$('form').submit(function () {
var search_select = search_form.find('select');
var search_input = search_form.find('input[type=text],input[type=date]');
$.each(search_select, function (index, item) {
var search_select_value = $(item).find('option:selected').val();
if (search_select_value != -1) {
search_flag = true;
}
});
$.each(search_input, function (index, item) {
var search_input_value = $(item).val();
if (search_input_value != '') {
search_flag = true;
}
});
if (search_flag) {
$('input[name=paged]').val('1');
}
});
}
function allot_consultant(name) {
//批量操作
$('select[name=action],select[name=action2]').change(function () {
//分配置业顾问
if ($(this).find('option:selected').val() == 'allot') {
//选择房/客源
var checkbox = $('input[name="' + name + '[]"]');
if (checkbox.is(':checked')) {
var array = [];
$('input[name="' + name + '[]"]:checked').map(function () {
var consultant_id = Number($(this).data('consultant'));
if (array.indexOf(consultant_id) == -1) {
array.push(consultant_id);
}
});
var confirmFlag = true;
if (array.length > 1) {
confirmFlag = confirm('当前选择的房/客源置业顾问不同,是否继续');
}
if (confirmFlag) {
$('#myConsultant').modal('show');
}
//未选择房/客源,下拉框显示批量操作
} else {
$(this).find('option:first').attr('selected', 'selected');
alert('请选择房/客源');
return false;
}
}
});
init_modal_myConsultantList(function (data) {
var consultant_id = Number(data.id);
$('#allot_consultant_id').val(consultant_id);
});
$("#myConsultant").on("hide.bs.modal", function () {
var allot_consultant_id = Number($('#allot_consultant_id').val());
if (!allot_consultant_id) {
$('select[name=action],select[name=action2]').find('option:first').attr('selected', 'selected');
}
});
}
{% block listBlock %}
<div class="wrap">
<h2> {% if house_type == 0%}新房列表{% elseif house_type == 1 %}二手房列表{% else %}租房房列表{% endif %}</h2>
<form id="scores-filter" method="GET">
<form id="scores-filter" method="GET" class="form-inline">
<br />
{% include 'selectOrganization.html' %}
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="{{page}}"/>
<select id="listCity" name="listCity">
<option value="0"> 城市</option>
<select id="listCity" name="listCity" class="form-control">
<option value="-1"> 城市</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>
<select id="listDistrict" name="listDistrict" class="form-control">
<option value="-1">区域</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>
<select id="listPlate" name="listPlate" class="form-control">
<option value="-1">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
......@@ -27,7 +29,7 @@
{% endif %}
</select>
{% if house_type == 2%}
<select id="rentalPrice" name="rentalPrice">
<select id="rentalPrice" name="rentalPrice" class="form-control">
<option value ="">租金</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
......@@ -35,8 +37,13 @@
{% endfor %}
{% endif %}
</select>
{% elseif house_type == 0 %}
<select id="averagePrice" name="averagePrice" class="form-control">
<option value ="">单价</option>
<!--<option {{ item.value == average_price ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>-->
</select>
{% else%}
<select id="totalPrice" name="totalPrice">
<select id="totalPrice" name="totalPrice" class="form-control">
<option value ="">价格</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
......@@ -46,20 +53,20 @@
</select>
{% endif %}
{% if house_type == 0%}
<select id="room" name="room">
<option value="0">类型</option>
<select id="room" name="room" class="form-control">
<option value="-1">类型</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>
<select id="buildProperty" name="buildProperty" class="form-control">
<option value="-1"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage">
<select id="acreage" name="acreage" class="form-control">
<option value ="">面积</option>
{% if acreage %}
{% for item in dicArea %}
......@@ -67,16 +74,25 @@
{% endfor %}
{% endif %}
</select>
<select name="status" name="status">
<select name="status" name="status" class="form-control">
<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="text" placeholder="请出入楼盘名" name="searchText" class="form-control">
<br />
<label for="beginDate" >开始日期:</label>
<input type="date" name="beginDate" class="form-control" {% if req %}value="{{req.beginDate}}"{% endif %}>
<label for="endDate">结束日期:</label>
<input type="date" name="endDate" class="form-control" {% if req %}value="{{req.endDate}}"{% endif %}>
<label for="stuff">员工:</label>
<input type="text" name="stuff" class="form-control" {% if req %}value="{{req.stuff}}"{% endif %}>
<input type="hidden" name="hasSearch" value="1"/>
<input type="hidden" id="house_type" value="{{house_type}}"/>
<input type="submit" id="submit" class="button action" value="搜索">
</form>
<form method="post">
<!-- Now we can render the completed list table -->
{% if house_type == 0 %}
{{function("addNewHouseTable")}}
......@@ -85,14 +101,18 @@
{% else %}
{{function("addRentTable")}}
{% endif %}
<input type="hidden" name="allot_consultant_id" id="allot_consultant_id">
</form>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
(function ($) {
$(document).ready(function(){
var acreage =$("#acreage");
var totalPrice = $("#totalPrice");
var rentalPrice = $("#rentalPrice");
var averagePrice = $("#averagePrice");
$("#listCity").change(function() {
var cityId = $("#listCity").val();
setCity("listCity", "listDistrict", "listPlate");
......@@ -104,7 +124,10 @@
//城市联动房子价格
if ($("#house_type").val() == 2) {
searchRentalPrice(cityId, rentalPrice);
}else{
}else if($("#house_type").val() == 0){
searchPrice(cityId,averagePrice);
}
else{
searchTotalPrice(cityId,totalPrice);
}
});
......@@ -112,6 +135,23 @@
$("#listDistrict").change(function(){
setArea("listCity","listDistrict","listPlate");
})
{% if house_type == 1 %}
allot_consultant('sechandhouselist');
{% elseif house_type == 2 %}
allot_consultant('renthouselist');
{% endif %}
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
});
})(jQuery);
</script>
......
<div id="preview">
<table class="form-table">
<tbody>
<tr>
<th style="width:11.7%"><label for="traffic" style="margin-left: 30px">主力房源:</label></th>
<td>
<input type="file" name="files[0]" property="0" class = "files form-control"multiple style="width: 30%;">
</td>
</tr>
</tbody>
</table>
{% set exists_ids = "" %}
{% for item in mainImage %}
{% if exists_ids != "" %}
......@@ -7,7 +17,7 @@
{% 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">
<select name="exists[{{item.id}}][buildProperty]" style="margin-right: 50px;width: 10%;display: inline-block" class="form-control">
{% for i in buildProperty %}
<option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option>
{% endfor %}
......@@ -16,9 +26,11 @@
<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>
......@@ -38,12 +50,12 @@
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 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"});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files form-control").css("width","20%");
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px;width:10%;display:inline-block"}).addClass("form-control");
{% for item in buildProperty %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
......
......@@ -13,31 +13,16 @@
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div>
<form action="" method="POST" enctype="multipart/form-data" id="newHouse" class="form-inline form-horizontal">
<form action="" method="POST" enctype="multipart/form-data" id="newHouse" class="form-horizontal">
<div class="row">
<div class="col-xs-10">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a>
<a href="#info" aria-controls="info" role="tab" data-toggle="tab">基本信息</a>
</li>
<li role="presentation">
<a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a>
</li>
<li role="presentation">
<a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a>
</li>
<li role="presentation">
<a href="#mainHouse" aria-controls="mainHouse" role="tab" data-toggle="tab">主力户型</a>
</li>
<li role="presentation">
<a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a>
</li>
<li role="presentation">
<a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a>
</li>
<li role="presentation">
<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>
<a href="#mainHouse" aria-controls="mainHouse" role="tab" data-toggle="tab">图片</a>
</li>
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
......@@ -52,25 +37,16 @@
{% else %}
{% include 'newHouseInfo.html' %}
{% endif %}
</div>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="mainHouse">
<br/>
{% include 'mainHouse.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="photos">
<br/>
{% include 'photos.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addRecHouse">
<br/>
{% include 'addRecHouse.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addConsultant">
<br/>
{% include 'addConsultant.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="customer_tracking">
......@@ -87,7 +63,7 @@
<div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status">
<select id="status" name="status" class="form-control">
{% for item in status %}
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
......@@ -122,7 +98,6 @@
$("#baseAreaId").change(function(){
setArea("baseCity","baseAreaId","basePlateId");
});
setDate("checkin");
var json = {"decoration":"{{result.decoration}}"};
revertOption(json);
$('#newHouse').validate({
......@@ -136,7 +111,7 @@
community_name:'required',
address:'required',
average_price:'required',
latest_news:'required',
description:'required',
baseCity:{
citySelectcheck: true
},
......@@ -153,7 +128,7 @@
community_name:'请输入小区名称',
address:'请输入地址',
average_price:'请输入均价',
latest_news:'请输入最新动态'
description:'请输入跟进说明'
},
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1",
......
<table class="form-table">
<thead>
<tr>
<th>类型</th>
<div class="row" id="addPhotos">
<div class="col-md-12">
<table class="form-table" style="margin-left: 30px">
<thead >
<tr >
<th >类型</th>
<th>相册</th>
<th>设为封面</th>
<th></th>
......@@ -31,15 +33,16 @@
<td>
<input type="button" value="删除" class="button action cancel existsCancel">
</td>
</div>
</tr>
{% endfor %}
</tbody>
</table>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
<button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px">
</table>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
<button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px;margin-left: 30px">
新增
</button>
</button>
</div>
</div>
<script>
(function($){
......@@ -48,7 +51,7 @@
$("#housePicture").click(function(){
var tr = $("<tr>");
var td = $("<td>");
var select = $("<select>").attr({"name":"data["+i+"][type]"}).addClass("form-control");
var select = $("<select>").attr({"name":"data["+i+"][type]"}).addClass("form-control").css("width","30%");
{% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
......@@ -60,7 +63,7 @@
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i}).addClass("form-control");
var td3 = td.clone().append(radio);
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel form-control");
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
var td4 = td.clone().append(picDelet);
tr.append(td1).append(td2).append(td3).append(td4);
......
......@@ -2,12 +2,12 @@
<h2>业绩列表</h2>
<form method="get">
<input type="hidden" name="page" value="quotaList">
{% include 'selectOrganization.html' %}
<div id="search_form">
<select name="year" id="year">
<option value="2015">2015</option>
<option value="2016">2016</option>
</select>
<input name="oid" type="text" id="oid" />
<input type="submit" id="submit" class="button action" value="搜索">
<!--
<select name="month" id="month">
......@@ -33,7 +33,17 @@
$(document).ready(function () {
{% if req %}
$("#year").val({{req.year}});
$("#oid").val({{req.oid}});
{% endif %}
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
});
</script>
\ No newline at end of file
......@@ -13,31 +13,16 @@
<div class="alert alert-danger" role="alert" id="messageBox1" style="display:none;">
</div>
<form action="" method="POST" enctype="multipart/form-data" id="rentHouse" class="form-inline form-horizontal">
<form action="" method="POST" enctype="multipart/form-data" id="rentHouse" class=" form-horizontal">
<div class="row">
<div class="col-xs-10">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">楼盘情况</a></li>
<li role="presentation">
<a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a>
</li>
<li role="presentation">
<a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a>
</li>
{% if not houseId %}
<li role="presentation">
<a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a>
</li>
{% endif %}
<li role="presentation">
<a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">房源相册</a>
<li role="presentation" class="active">
<a href="#info" aria-controls="info" role="tab" data-toggle="tab">基本信息</a>
</li>
<li role="presentation">
<a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a>
</li>
<li role="presentation">
<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>
<a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">图片</a>
</li>
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
......@@ -48,22 +33,9 @@
<div role="tabpanel" class="tab-pane active" id="info">
{% include 'houseInfo.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="weixin">
{% include 'weixin.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="business">
{% include 'business.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="owner">
{% include 'owner.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="photos">
{% include 'photos.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addRecHouse">
{% include 'addRecHouse.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %}
</div>
<div role="tabpanel" class="tab-pane" id="customer_tracking">
......@@ -114,9 +86,6 @@
});
setCheckBox();
setAge();
setDate("entrustDay");
setDate("deadLine");
var json = {
"faceto":"{{result.faceto}}",
"age":"{{result.age}}",
......@@ -137,6 +106,7 @@
mark:'required',
rent:'required',
community_name:'required',
description:'required',
baseCity:{
citySelectcheck: true
},
......@@ -164,7 +134,8 @@
owner_name:'请输入业主姓名',
owner_phone:'请输入业主电话',
rent:'请输入租金',
community_name:'请输入小区名称'
community_name:'请输入小区名称',
description:'请输入跟进说明'
},
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1",
......
......@@ -16,7 +16,7 @@
</div>
<form action="" method="POST" enctype="multipart/form-data" id="secHouse" class="form-inline form-horizontal">
<form action="" method="POST" enctype="multipart/form-data" id="secHouse" class="form-horizontal">
<div class="row">
<div class="col-xs-10">
<!-- Nav tabs -->
......@@ -24,29 +24,9 @@
<li role="presentation" class="active">
<a href="#info" aria-controls="info" role="tab" data-toggle="tab">基本信息</a>
</li>
<!--<li role="presentation">-->
<!--<a href="#weixin" aria-controls="weixin" role="tab" data-toggle="tab">微信营销</a>-->
<!--</li>-->
<!--<li role="presentation">-->
<!--<a href="#business" aria-controls="business" role="tab" data-toggle="tab">业务信息</a>-->
<!--</li>-->
<!--{% if not houseId %}-->
<!--<li role="presentation">-->
<!--<a href="#owner" aria-controls="owner" role="tab" data-toggle="tab">业主信息</a>-->
<!--</li>-->
<!--{% endif %}-->
<li role="presentation">
<a href="#photos" aria-controls="photos" role="tab" data-toggle="tab">图片</a>
</li>
<!--<li role="presentation">-->
<!--<a href="#addRecHouse" aria-controls="addRecHouse" role="tab" data-toggle="tab">推荐房源</a>-->
<!--</li>-->
<!--<li role="presentation">-->
<!--<a href="#addFeature" aria-controls="addFeature" role="tab" data-toggle="tab">房源特色</a>-->
<!--</li>-->
<!--<li role="presentation">-->
<!--<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>-->
<!--</li>-->
<li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li>
......@@ -55,36 +35,13 @@
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="info">
{% include 'houseInfo.html' %}
{% include 'weixin.html' %}
{% if not houseId %}
{% include 'owner.html' %}
{% endif %}
{% include 'business.html' %}
</div>
<!--<div role="tabpanel" class="tab-pane" id="weixin">-->
<!--{% include 'weixin.html' %}-->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="business">-->
<!---->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="owner">-->
<!---->
<!--</div>-->
<div role="tabpanel" class="tab-pane" id="photos">
{% include 'photos.html' %}
{% include 'addRecHouse.html' %}
{% include 'addFeature.html' %}
{% include 'addConsultant.html' %}
</div>
<!--<div role="tabpanel" class="tab-pane" id="addRecHouse">-->
<!---->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="addFeature">-->
<!---->
<!--</div>-->
<!--<div role="tabpanel" class="tab-pane" id="addConsultant">-->
<!---->
<!--</div>-->
<div role="tabpanel" class="tab-pane" id="customer_tracking">
{% include 'save_customer_tracking.html' %}
{% import "macro.html" as macro %}
......@@ -99,7 +56,7 @@
<div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status">
<select id="status" name="status" class="form-control">
{% for item in status %}
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
......@@ -134,8 +91,6 @@
});
setCheckBox();
setAge();
setDate("entrustDay");
setDate("deadLine");
var json = {
"faceto":"{{result.faceto}}",
"age":"{{result.age}}",
......@@ -158,6 +113,7 @@
community_name:'required',
average_price:'required',
latest_news:'required',
description:'required',
baseCity:{
citySelectcheck: true
},
......@@ -185,7 +141,8 @@
owner_phone:'请输入业主电话',
total_price:'请输入售价',
community_name:'请输入小区名称',
average_price:'请输入单价'
average_price:'请输入单价',
description:'请输入跟进说明'
},
errorContainer: "#messageBox1",
errorLabelContainer: "#messageBox1",
......
{% set organization = function('SearchDao::searchOrganization')|json_encode() %}
<div id="organization" style="margin-bottom: 10px;">
<span>门店</span>
<label for="depth_1" class="hidden"></label>
<select data-depth="1" id="depth_1">
<option value="-1">请选择</option>
</select>
<label for="depth_2" class="hidden"></label>
<select data-depth="2" id="depth_2" class="hidden">
<option value="-1">请选择</option>
</select>
<label for="depth_3" class="hidden"></label>
<select data-depth="3" id="depth_3" class="hidden">
<option value="-1">请选择</option>
</select>
<label for="depth_4" class="hidden"></label>
<select data-depth="4" id="depth_4" class="hidden">
<option value="-1">请选择</option>
</select>
</div>
<script>
$(document).ready(function () {
var organization = eval('{{ organization }}');
$.each(organization, function (index, item) {
var select = $('#depth_' + item.Depth);
var css = '';
if (item.Depth != 1) {
css = 'class="hidden"';
}
select.append('<option value="' + item.Id + '" data-parent="' + item.ParentId + '" ' + css + '>' + item.Name + '</option>');
});
$.each($('select[data-depth]:not(:last)'), function (index, item) {
var next_depth = Number($(item).data('depth')) + 1;
var next_select = $('#depth_' + next_depth);
$(item).change(function () {
var parent_id = $(this).val();
$(this).nextAll().find('option:not(:first)').addClass('hidden');
$(this).nextAll().find('option:first').attr('selected', 'selected');
$(this).nextAll().addClass('hidden');
$.each(next_select.find('option[data-parent=' + parent_id + ']'), function (index, item) {
$(item).removeClass('hidden');
next_select.removeClass('hidden');
});
});
});
var search_organization = Number('{{ req.organization }}');
if (search_organization > 0) {
var organization_select = $('select[data-depth]');
var search_option = organization_select.find('option[value=' + search_organization + ']');
var index = search_option.parent().index('[data-depth]');
for (var i = 0; i <= index; i++) {
var option = organization_select.find('option[value=' + search_organization + ']');
//显示 筛选门店
option.attr('selected', 'selected');
search_organization = option.data('parent');
//显示 筛选门店 相同parent门店
var same_parent_option = organization_select.find('option[data-parent=' + search_organization + ']');
same_parent_option.removeClass('hidden');
//下拉框
option.parent().removeClass('hidden');
}
}
});
function getOrganization() {
return Number($('select[data-depth]:not(.hidden):last').val());
}
</script>
\ No newline at end of file
<br />
<div class="row">
<div class="col-md-4 form-group">
<label for="housename" class="col-sm-5 control-label">标题:</label>
<div class="row form-group">
<div class="col-xs-4">
<label for="housename" class="col-xs-5 control-label" >微信标题:</label>
<p class="col-xs-7">
<input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
</p>
</div>
{% if house_type == 0 %}
<div class="col-xs-4">
<label for="average_price" class="col-xs-5 control-label">均价:</label>
<p class="col-xs-6">
<input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control">
</p>
<p class="col-xs-1" style="margin-top: 10px">
&nbsp;
</p>
</div>
{% endif %}
</div>
<br />
<table class="form-table">
<tbody>
<tbody >
<tr>
<th><label for="mark">标签</label></th>
<th style="width:11.9%"><label for="mark" style="margin-left: 42px">标签:</label></th>
<td>
<div id="mark" class="row">
</div><br/>
</div>
<button type="button" class="button action" id="addTagBtn">
标签
</button>
......@@ -30,7 +42,6 @@
addTag(item.tag_id, item.name);
});
{% endif %}
var tagArray = [];
$('#addTagBtn').click(function(){
init_modal_addTag(0, function (id, value) {
......
......@@ -22,4 +22,18 @@ class HouseDao {
return $wpdb->last_error;
return $result;
}
public static function houseAllotConsultant($consultant_id, $house_ids)
{
if ($consultant_id) {
$string = '(' . implode(',', array_map('intval', $house_ids)) . ')';
global $wpdb;
$result = $wpdb->query('update ' . Config::A_HOUSE_USER_TABLE
. ' SET user_id = ' . $consultant_id
. ' where house_id in ' . $string);
if($result){
echo '<script>alert("分配置业顾问成功");</script>';
}
}
}
}
\ No newline at end of file
......@@ -6,12 +6,12 @@ class InsertDao{
$houseRes = $wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params);
$houseId = $wpdb->insert_id;
if(!InsertDao::setHouseNumber($houseId,$params['house_type'],$params['city_id'])){
return 510;
return "房源代码生成失败";
}
if($houseRes){
return $houseId;
}else{
return 500;
return $wpdb->last_error;
}
}
......@@ -46,7 +46,7 @@ class InsertDao{
if($imgRes){
return $imgId;
}else{
return 501;
return $wpdb->last_error;
}
}
public static function insert_a_district_area($params){
......@@ -55,7 +55,7 @@ class InsertDao{
if($districtAreaRes){
return $districtAreaRes;
}else{
return 502;
return $wpdb->last_error;
}
}
......@@ -65,7 +65,7 @@ class InsertDao{
if($houseImageRes){
return $houseImageRes;
}else{
return 503;
return $wpdb->last_error;
}
}
......@@ -75,7 +75,7 @@ class InsertDao{
if($houseImageRes){
return $houseImageRes;
}else{
return 504;
return $wpdb->last_error;
}
}
......@@ -85,7 +85,7 @@ class InsertDao{
if($houseUserRes){
return $houseUserRes;
}else{
return 505;
return $wpdb->last_error;
}
}
......@@ -148,8 +148,10 @@ class InsertDao{
"image_id" => $imgid
);
$houseTypeAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if (!$houseTypeAreaRes) {
return 502;
if ($houseTypeAreaRes) {
return $houseTypeAreaRes;
}else{
return $wpdb->last_error;
}
}
//将房源id与图片id储存到关联表中
......@@ -158,8 +160,8 @@ class InsertDao{
'image_id' => $imgid,
);
$houseImgRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
if (!$houseImgRes) {
return 503;
if ($houseImgRes) {
return $houseImgRes;
}
} else {
return $movefile['error'];
......@@ -180,30 +182,35 @@ class InsertDao{
"recommend_id" =>$value
);
$a_house_recommendRes = $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray);
if(!$a_house_recommendRes){
return 504;
}
if($a_house_recommendRes){
return $a_house_recommendRes;
}else{
return $wpdb->last_error;
}
}
}
public static function addRecConsultant($houseId,$data){
public static function addRecConsultant($houseId, $consultant){
global $wpdb;
if($data["recConsultant"]){
if($consultant){
//插入推荐置业顾问user_id与新房id到关联表a_house_recommend
foreach($data["recConsultant"] as $val){
foreach($consultant as $val){
$a_house_userArray = array(
"user_id" => $val,
"house_id" => $houseId,
"user_type" =>1
"user_type" => 1
);
$a_house_userRes = $wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
if(!$a_house_userRes){
return 505;
}
if($a_house_userRes){
return $a_house_userRes;
}else{
return $wpdb->last_error;
}
}
}
public static function addHouseFeature($houseId,$houseFeature){
global $wpdb;
if($houseFeature){
......@@ -212,11 +219,13 @@ class InsertDao{
"house_id" => $houseId,
"tag_id" =>$val
);
$a_house_featureRes = $wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
if(!$a_house_featureRes){
return 506;
}
if($a_house_featureRes){
return $a_house_featureRes;
}else{
return $wpdb->last_error;
}
}
}
......@@ -260,6 +269,4 @@ class InsertDao{
}
?>
\ No newline at end of file
......@@ -126,14 +126,14 @@ class SearchDao
wp_send_json(SearchDao::searchOrganization($_GET['parentId']));
}
public static function searchOrganization($parentId = 1)
public static function searchOrganization($parentId = NULL)
{
global $wpdb;
$where = " where 1=1 ";
if ($parentId != NULL) {
$where .= " and ParentId = %d";
}
$result = $wpdb->get_results($wpdb->prepare('select Id as id,Name as name from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
$result = $wpdb->get_results($wpdb->prepare('select * from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
return $result;
}
......
......@@ -43,7 +43,7 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Admin/TCSyncView.php');
require_once(PLUGIN_DIR . 'Admin/Contract_List.php');
require_once(PLUGIN_DIR . 'Admin/commissionManage.php');
require_once(PLUGIN_DIR . 'Admin/commissionList.php');
add_action('admin_menu', 'reset_menu');
tospur_register_script_style();
tospur_ajax_set();
......@@ -201,7 +201,7 @@ function reset_menu()
add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13);
add_menu_page('置业顾问评分', '置业顾问评分', 'moderate_comments', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 14);
add_submenu_page('consultant_score', '置业顾问业绩', '置业顾问业绩', 'edit_published_posts', 'quotaList', 'QuotaYearList::showHtml');
add_menu_page('添加标签', '添加标签', 'edit_published_posts', 'add_tag', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page('收佣进度表', '收佣进度表', 'moderate_comments', 'commissionList', 'function_commissionList', 'dashicons-menu', 15); 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');
//移除更新信息
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
Timber::render('ability_calculator.html', $context);
?>
\ No newline at end of file
......@@ -368,7 +368,7 @@ a:hover {
#tabWrapper #tabScroller {
padding-bottom: 15px;
}
#tabWrapper #tabScroller .tab-pane ul li {
.tab-content .tab-pane ul li {
width: 100%;
height: 60px;
line-height: 60px;
......@@ -376,10 +376,10 @@ a:hover {
color: #898989;
font-size: 18px;
}
#tabWrapper #tabScroller .tab-pane ul li:nth-child(odd) {
.tab-content .tab-pane ul li:nth-child(odd) {
background-color: #ffffff;
}
#tabWrapper #tabScroller .tab-pane ul li.arrow {
.tab-content .tab-pane ul li.arrow {
width: 100%;
height: 60px;
background: url("../img/gray_leftarrow_icon.png") no-repeat;
......@@ -387,17 +387,35 @@ a:hover {
-webkit-background-size: 30px 30px;
background-position: 95% center;
}
#tabWrapper #tabScroller .tab-pane ul li label {
.tab-content .tab-pane ul li label {
color: #000000;
margin-bottom: 0;
padding: 0 0 0 10px;
}
#tabWrapper #tabScroller .tab-pane ul li p {
.tab-content .tab-pane ul li label input[type="radio"] {
display: none;
}
.tab-content .tab-pane ul li label input[type="radio"]:checked + span {
background-position: -27px -1px;
}
.tab-content .tab-pane ul li label span {
width: 25px;
height: 25px;
background: url("../img/radio_icon.png") no-repeat;
background-size: 53px 27px;
-webkit-background-size: 53px 27px;
background-position: -1px -1px;
display: inline-block;
position: relative;
top: 8px;
margin-right: 5px;
}
.tab-content .tab-pane ul li p {
margin-bottom: 0;
padding: 0;
height: 100%;
}
#tabWrapper #tabScroller .tab-pane ul li p .form-control {
.tab-content .tab-pane ul li p .form-control {
color: #898989;
font-size: 18px;
background-color: transparent;
......@@ -407,16 +425,16 @@ a:hover {
-webkit-box-shadow: none;
-webkit-appearance: none;
}
#tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-outer-spin-button,
#tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-inner-spin-button {
.tab-content .tab-pane ul li p .form-control::-webkit-outer-spin-button,
.tab-content .tab-pane ul li p .form-control::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}
#tabWrapper #tabScroller .tab-pane > p {
.tab-content .tab-pane > p {
padding-right: 15px;
color: #898989;
}
#tabWrapper #tabScroller .tab-pane .btn {
.tab-content .tab-pane .btn {
width: 86%;
display: block;
color: #ffffff;
......@@ -435,12 +453,12 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
#tabWrapper #tabScroller .tab-pane .btn:active {
.tab-content .tab-pane .btn:active {
background-color: #117bb9;
}
#tabWrapper #tabScroller .tab-pane .btn:focus {
.tab-content .tab-pane .btn:focus {
outline: 0;
}
#tabWrapper #tabScroller .tab-pane:last-child .btn {
.tab-content .tab-pane:last-child .btn {
margin-top: 5%;
}
......@@ -415,7 +415,6 @@ a:hover {
}
.container-fluid {
width: 100%;
height: 100%;
background: url("../img/formBg.jpg") no-repeat;
background-size: 100% 100%;
......@@ -565,6 +564,7 @@ a:hover {
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
border: 0;
}
.container-fluid form .btn:active {
......
......@@ -51,6 +51,12 @@ function page_template($template)
case 'loan_calculator':
$page = $theme . '/loan_calculator.php';
break;
case 'tax_calculator':
$page = $theme . '/tax_calculator.php';
break;
case 'ability_calculator':
$page = $theme . '/ability_calculator.php';
break;
case 'manager':
$page = $theme . '/manager.php';
break;
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
Timber::render('tax_calculator.html', $context);
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<title>购房能力评估计算器</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/component.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/animations.css"/>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_calculator.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/loan_detail.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/modernizr.custom.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
</head>
<body>
<div id="pt-main" class="pt-perspective">
<div class="pt-page pt-page-1">
<ul id="tab" class="list-unstyled btn-group-justified tab">
<li class="btn-group active">
<a href="#ability" data-toggle="tab" class="btn">购房能力评估</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="ability">
<ul class="list-unstyled">
<li>
<label class="col-xs-5">现持有资金:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="hold">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">现家庭月收入:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="income">
</p>
<p class="col-xs-2"></p>
</li>
<li>
<label class="col-xs-5">家庭月固定支出:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="expense">
</p>
<p class="col-xs-2"></p>
</li>
<li class="arrow">
<label class="col-xs-5">还款年限:</label>
<p class="col-xs-7">
<select class="form-control" id="month">
<option value="12">1年(12期)</option>
<option value="24">2年(24期)</option>
<option value="36">3年(36期)</option>
<option value="48">4年(48期)</option>
<option value="60">5年(60期)</option>
<option value="72">6年(72期)</option>
<option value="84">7年(84期)</option>
<option value="96">8年(96期)</option>
<option value="108">9年(108期)</option>
<option value="120">10年(120期)</option>
<option value="132">11年(132期)</option>
<option value="144">12年(144期)</option>
<option value="156">13年(156期)</option>
<option value="168">14年(168期)</option>
<option value="180">15年(180期)</option>
<option value="192">16年(192期)</option>
<option value="204">17年(204期)</option>
<option value="216">18年(216期)</option>
<option value="228">19年(228期)</option>
<option value="240" selected="selected">20年(240期)</option>
<option value="300">25年(300期)</option>
<option value="360">30年(360期)</option>
</select>
</p>
</li>
<li>
<label class="col-xs-4">房屋面积:</label>
<p class="col-xs-5">
<input type="number" class="form-control" id="area">
</p>
<p class="col-xs-3">平方米</p>
</li>
</ul>
<input type="submit" value="开始计算" class="btn btn-lg">
</div>
</div>
</div>
<div class="pt-page pt-page-2">
<div id="wrapper" style="top: 0;">
<div id="scroller">
<ul class="list-unstyled" id="result">
</ul>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<script type="text/javascript" src="{{ theme }}/js/pagetransitions.js"></script>
<script>
var page = 0;
var resultList;
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('input[type=submit]').tap(function () {
var hold = Number($('#hold').val().trim());
var income = Number($('#income').val().trim());
var expense = Number($('#expense').val().trim());
var month = Number($('#month').val());
var area = Number($('#area').val().trim());
console.log(hold);
console.log(income);
console.log(expense);
console.log(month);
console.log(area);
if (hold == '') {
notice.html('请输入现持有资金');
myModal.modal('show');
} else if (income == '') {
notice.html('请输入现家庭月收入');
myModal.modal('show');
} else if (expense == '') {
notice.html('请输入家庭月固定支出');
myModal.modal('show');
} else if (month == '') {
notice.html('请输入还款年限');
myModal.modal('show');
} else if (area == '') {
notice.html('请输入房屋面积');
myModal.modal('show');
} else {
resultList = $('#result');
var abilityResult = abilityCalculator(month, hold, income, expense, area);
resultList.html('<li><span class="col-xs-4">房屋总价:</span><span>' + abilityResult.total + '元</span></li>' +
'<li><span class="col-xs-4">房屋单价:</span><span>' + abilityResult.avgPrice + '元/平方</span></li>');
page = 1;
window.location.href = '#result';
PageTransitions.nextPage({
animation: 1,
showPage: page
});
}
return false;
});
if (window.location.hash == '#result') {
window.history.back();
}
window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) {
page = 0;
PageTransitions.nextPage({
animation: 2,
showPage: page
});
resultList.html('');
}
});
});
function abilityCalculator(month, holdMoney, income, outcome, area) {
var year = parseInt(month / 12);
var lilu = 0.00576;
if (year > 5)
lilu = 0.00594;
var d1 = income - outcome;
var d2 = Math.pow(1 + lilu, month) - 1;
var d3 = lilu * Math.pow(1 + lilu, month);
//房屋总价
var total = Math.round(((d1 * d2) / d3) + holdMoney);
//房屋单价
var avgPrice = total / area;
var result = {
total: total,
avgPrice: avgPrice
};
return result;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -5,9 +5,33 @@
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="renderer" content="webkit">
<title>登录</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/manager.css">
<!--[if lte IE 8]>
<style type="text/css">
.container-fluid {
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/formBg.jpg',sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/formBg.jpg', sizingMethod='scale');
}
.container-fluid form .has-feedback.username .form-control-feedback {
background: none;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_username_icon.png',sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_username_icon.png', sizingMethod='scale');
}
.container-fluid form .has-feedback.password .form-control-feedback {
background: none;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_password_icon.png',sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{{ theme }}/img/gray_password_icon.png', sizingMethod='scale');
}
.container-fluid form .has-feedback .form-control {
width: 74%;
height: 40px;
line-height: 40px;
}
</style>
<![endif]-->
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
......@@ -45,12 +69,15 @@
notice.html('<span>{{ error }}</span>');
myModal.modal('show');
{% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
});
</script>
</head>
<body>
<div class="container-fluid text-center">
<div class="container-fluid">
<form id="loginForm" method="post">
<h2></h2>
<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