Commit c4a8cea1 by shz

tospur

parent 42721446
......@@ -60,11 +60,12 @@ class House extends Tospur_House{
}else{
$insert_tospur_house_array['status'] = $_POST['status'];
$result = House::data_insert($insert_tospur_house_array);
if($result != 200){
if($result == 506){
$wpdb->query("ROLLBACK");
print_r($result);;
echo "新增房源失败";
}else{
$house_id = $result;
$wpdb->query("COMMIT");
echo "新增房源成功";
}
......@@ -143,6 +144,7 @@ class House extends Tospur_House{
echo "推荐置业顾问修改失败";
}
InsertDao::addHouseTag($_POST['mark'],$houseId);
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $result;
}
......@@ -166,10 +168,12 @@ class House extends Tospur_House{
InsertDao::addHouseTag($_POST['mark'],$houseId);
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $houseId;
}else{
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>
<html>
<head>
......@@ -290,6 +291,8 @@
</tr>
</tbody>
</table>
{{ macro.customer_tracking_list(houseId) }}
{% include "save_customer_tracking.html" %}
<input type="text" name="type" value="1" hidden="hidden">
{% if houseId %}
<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 {
const TOSPUR_VERIFY_TABLE = 'tospur_verify';
const TOSPUR_SALE_TABLE = 'tospur_sale';
const WP_USERS_TABLE = 'wp_users';
const TOSPUR_STATUS_TABLE = 'tospur_status';
const TOSPUR_CUSTOMER_TRACKING_TABLE = 'tospur_customer_tracking';
//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()
require_once('consultant_score.php');
require_once('view_house.php');
require_once('tospur_sale.php');
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php');
add_action('admin_menu', 'reset_menu');
tospur_register_script_style();
tospur_ajax_set();
......@@ -144,7 +145,7 @@ function update_consultant()
function reset_menu()
{
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_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
......
......@@ -1571,11 +1571,7 @@ IScroll.prototype = {
this._key(e);
break;
case 'click':
if (!e._constructed) {
if (!e._constructed && target.type != "submit") {
e.preventDefault();
e.stopPropagation();
}
if ( !e._constructed ) {
e.preventDefault();
e.stopPropagation();
}
......
......@@ -12,6 +12,7 @@
<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.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>
</head>
<body>
......@@ -211,7 +212,7 @@
<script>
var notice;
var myModal;
var flag = true;
var flag = false;
var user_id = '{{ user_id }}';
var phone = '{{ phone }}';
var myScroll;
......@@ -304,15 +305,12 @@
},
submitHandler: function (form) {
flag = true;
}
});
form.submit(function () {
if (flag) {
var house_type = form.data('house');
var house_type = $(form).data('house');
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=submit_sale&user_id='+user_id+'&phone=' + phone + '&house_type=' + house_type + '&' + form.serialize(),
data: 'action=submit_sale&user_id='+user_id+'&phone=' + phone + '&house_type=' + house_type + '&' + $(form).serialize(),
success: function (data) {
if (data.code == 2000) {
notice.html('<span>提交成功</span>');
......@@ -326,6 +324,11 @@
}
});
}
}
});
form.find('input[type=submit]').tap(function () {
alert('111');
form.submit();
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