Commit c4a8cea1 by shz

tospur

parent 42721446
...@@ -60,11 +60,12 @@ class House extends Tospur_House{ ...@@ -60,11 +60,12 @@ class House extends Tospur_House{
}else{ }else{
$insert_tospur_house_array['status'] = $_POST['status']; $insert_tospur_house_array['status'] = $_POST['status'];
$result = House::data_insert($insert_tospur_house_array); $result = House::data_insert($insert_tospur_house_array);
if($result != 200){ if($result == 506){
$wpdb->query("ROLLBACK"); $wpdb->query("ROLLBACK");
print_r($result);; print_r($result);;
echo "新增房源失败"; echo "新增房源失败";
}else{ }else{
$house_id = $result;
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
echo "新增房源成功"; echo "新增房源成功";
} }
...@@ -143,6 +144,7 @@ class House extends Tospur_House{ ...@@ -143,6 +144,7 @@ class House extends Tospur_House{
echo "推荐置业顾问修改失败"; echo "推荐置业顾问修改失败";
} }
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($_POST['mark'],$houseId);
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $result; return $result;
} }
...@@ -166,10 +168,12 @@ class House extends Tospur_House{ ...@@ -166,10 +168,12 @@ class House extends Tospur_House{
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($_POST['mark'],$houseId);
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $houseId;
}else{ }else{
return 506; return 506;
} }
return 200;
} }
} }
\ No newline at end of file
{# 定义宏以便多次调用 #}
{% macro customer_tracking_list(houseId) %}
{% set list = function('CustomerTrackingDao::search', houseId) %}
<button class="button" style="margin-bottom: 20px;">房源跟进</button>
{% if list %}
<table class="table table-bordered">
<tr>
<th class="col-md-2 text-center">跟进类型</th>
<th class="col-md-3 text-center">置业顾问</th>
<th class="col-md-3 text-center">时间</th>
<th class="col-md-4 text-center">跟进说明</th>
</tr>
{% for item in list %}
<tr>
<td class="col-md-2 text-center">{{ item.status_name }}</td>
<td class="col-md-3 text-center">{{ item.name }}</td>
<td class="col-md-3 text-center">{{ item.time }}</td>
<td class="col-md-4 text-center">{{ item.description }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endmacro %}
\ No newline at end of file
{% import "macro.html" as macro %}
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
...@@ -290,6 +291,8 @@ ...@@ -290,6 +291,8 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
{{ macro.customer_tracking_list(houseId) }}
{% include "save_customer_tracking.html" %}
<input type="text" name="type" value="1" hidden="hidden"> <input type="text" name="type" value="1" hidden="hidden">
{% if houseId %} {% if houseId %}
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
......
<style>
.customer_tracking h2 {
margin-bottom: 30px;
}
.customer_tracking p {
margin: 20px 0;
}
.customer_tracking p span:nth-of-type(1) {
font-weight: bold;
font-size: 14px;
display: inline-block;
width: 100px;
}
.customer_tracking p span:nth-of-type(2) {
font-size: 14px;
display: inline-block;
width: 400px;
}
</style>
<div class="customer_tracking">
<h2>新增客户跟踪</h2>
<h4>跟进记录</h4>
<p>
<span>跟进类型:</span>
<span>
<select id="customer_tracking_status" name="customer_tracking_status">
{% set customer_tracking_status = function('CustomerTrackingDao::search_status') %}
{% for item in customer_tracking_status %}
<option value="{{ item.status_id }}">{{ item.status_name }}</option>
{% endfor %}
</select>
<label for="customer_tracking_status"></label>
</span>
</p>
<p>
<span style="vertical-align: top;">跟进说明:</span>
<span>
<textarea rows="8" id="description" name="description" class="form-control" style="width: 250px;resize: none;"></textarea>
<label for="description"></label>
</span>
</p>
</div>
\ No newline at end of file
...@@ -25,6 +25,8 @@ class Config { ...@@ -25,6 +25,8 @@ class Config {
const TOSPUR_VERIFY_TABLE = 'tospur_verify'; const TOSPUR_VERIFY_TABLE = 'tospur_verify';
const TOSPUR_SALE_TABLE = 'tospur_sale'; const TOSPUR_SALE_TABLE = 'tospur_sale';
const WP_USERS_TABLE = 'wp_users'; const WP_USERS_TABLE = 'wp_users';
const TOSPUR_STATUS_TABLE = 'tospur_status';
const TOSPUR_CUSTOMER_TRACKING_TABLE = 'tospur_customer_tracking';
//sync url //sync url
......
<?php
require_once(PLUGIN_DIR . 'Config.php');
class CustomerTrackingDao
{
public static function insert($house_id, $request)
{
$page = $request['page'];
$origin = 0;
switch ($page) {
case 'newHouse':
case 'secHandHouse':
case 'rentHouse':
$origin = 1;
break;
case 'customer':
$origin = 2;
break;
}
global $wpdb;
$array = array(
'house_id' => $house_id,
'status_type' => $request['customer_tracking_status'],
'consultant_id' => wp_get_current_user()->ID,
'time' => current_time('Y-m-d H:i:s'),
'description' => $request['description'],
'origin' => $origin
);
$result = $wpdb->insert(Config::TOSPUR_CUSTOMER_TRACKING_TABLE, $array);
if ($result) {
return $wpdb->insert_id;
} else {
return '新增客户跟踪失败';
}
}
public static function search($house_id)
{
global $wpdb;
$sql = 'SELECT tct.*,ts.status_name,tc.name FROM ' . Config::TOSPUR_CUSTOMER_TRACKING_TABLE . ' tct' .
' left join (SELECT * FROM ' . Config::TOSPUR_STATUS_TABLE . ' where status_type = 3) as ts on tct.status_type = ts.status_id' .
' left join ' . Config::TOSPUR_CONSULTANT . ' tc on tct.consultant_id = tc.id' .
' where tct.house_id = ' . $house_id;
return $wpdb->get_results($sql);
}
public static function search_status()
{
global $wpdb;
$sql = 'SELECT * FROM ' . Config::TOSPUR_STATUS_TABLE . ' where status_type = 3';
return $wpdb->get_results($sql);
}
}
?>
\ No newline at end of file
...@@ -28,6 +28,7 @@ function tospur_init() ...@@ -28,6 +28,7 @@ function tospur_init()
require_once('consultant_score.php'); require_once('consultant_score.php');
require_once('view_house.php'); require_once('view_house.php');
require_once('tospur_sale.php'); require_once('tospur_sale.php');
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.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();
...@@ -144,7 +145,7 @@ function update_consultant() ...@@ -144,7 +145,7 @@ function update_consultant()
function reset_menu() function reset_menu()
{ {
add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync"); add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync");
add_menu_page('nesHouseList','新房列表', 'moderate_comments', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6); add_menu_page('newHouseList','新房列表', 'moderate_comments', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'moderate_comments', 'newHouse', 'House::init_view'); add_submenu_page('newHouseList', '添加新房', '添加新房', 'moderate_comments', 'newHouse', 'House::init_view');
add_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7); add_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html'); add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
......
...@@ -258,7 +258,7 @@ function IScroll (el, options) { ...@@ -258,7 +258,7 @@ function IScroll (el, options) {
snapThreshold: 0.334, snapThreshold: 0.334,
// INSERT POINT: OPTIONS // INSERT POINT: OPTIONS
startX: 0, startX: 0,
startY: 0, startY: 0,
...@@ -1571,11 +1571,7 @@ IScroll.prototype = { ...@@ -1571,11 +1571,7 @@ IScroll.prototype = {
this._key(e); this._key(e);
break; break;
case 'click': case 'click':
if (!e._constructed) { if ( !e._constructed ) {
if (!e._constructed && target.type != "submit") {
e.preventDefault();
e.stopPropagation();
}
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script> <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/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.validate.js"></script> <script type="text/javascript" src="{{ theme }}/js/jquery.validate.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script> <script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
</head> </head>
<body> <body>
...@@ -211,7 +212,7 @@ ...@@ -211,7 +212,7 @@
<script> <script>
var notice; var notice;
var myModal; var myModal;
var flag = true; var flag = false;
var user_id = '{{ user_id }}'; var user_id = '{{ user_id }}';
var phone = '{{ phone }}'; var phone = '{{ phone }}';
var myScroll; var myScroll;
...@@ -304,28 +305,30 @@ ...@@ -304,28 +305,30 @@
}, },
submitHandler: function (form) { submitHandler: function (form) {
flag = true; flag = true;
} if (flag) {
}); var house_type = $(form).data('house');
form.submit(function () { $.ajax({
if (flag) { type: 'POST',
var house_type = form.data('house'); url: '{{ url }}/wp-admin/admin-ajax.php/',
$.ajax({ data: 'action=submit_sale&user_id='+user_id+'&phone=' + phone + '&house_type=' + house_type + '&' + $(form).serialize(),
type: 'POST', success: function (data) {
url: '{{ url }}/wp-admin/admin-ajax.php/', if (data.code == 2000) {
data: 'action=submit_sale&user_id='+user_id+'&phone=' + phone + '&house_type=' + house_type + '&' + form.serialize(), notice.html('<span>提交成功</span>');
success: function (data) { notice.show();
if (data.code == 2000) { myModal.modal('show');
notice.html('<span>提交成功</span>'); } else {
notice.show(); notice.html('<span>提交失败</span>');
myModal.modal('show'); notice.show();
} else { myModal.modal('show');
notice.html('<span>提交失败</span>'); }
notice.show();
myModal.modal('show');
} }
} });
}); }
} }
});
form.find('input[type=submit]').tap(function () {
alert('111');
form.submit();
return false; return false;
}); });
} }
......
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