Commit e4dd6739 authored by clone's avatar clone

Merge branch 'test'

parents 4e86c667 f7fd99c7
...@@ -277,9 +277,9 @@ class Client extends Basic ...@@ -277,9 +277,9 @@ class Client extends Basic
if($search_type == '0') if($search_type == '0')
{ {
//客户电话 //客户电话
$conditions['user_phone'] = ['LIKE', $phone_or_name.'%']; $conditions['user_phone'] = ['LIKE', '%'.$phone_or_name.'%'];
}elseif ($search_type == '1'){//客户 }elseif ($search_type == '1'){//客户
$conditions['user_name'] = ['LIKE', $phone_or_name.'%']; $conditions['user_name'] = ['LIKE', '%'.$phone_or_name.'%'];
} }
elseif ($search_type == '3'){//客户 elseif ($search_type == '3'){//客户
$conditions['id'] = $phone_or_name; $conditions['id'] = $phone_or_name;
...@@ -297,6 +297,7 @@ class Client extends Basic ...@@ -297,6 +297,7 @@ class Client extends Basic
} }
} }
$user = new Users(); $user = new Users();
$conditions['status'] = ['<', 2];
$user_res = $user->all_user($conditions,$pagesize,$pagenum); $user_res = $user->all_user($conditions,$pagesize,$pagenum);
$total = $user->all_user_count($conditions); $total = $user->all_user_count($conditions);
}else{ }else{
......
...@@ -538,7 +538,7 @@ class OrderLog extends Basic ...@@ -538,7 +538,7 @@ class OrderLog extends Basic
} }
$source = empty($this->params['source']) ? 0 : $this->params['source']; $source = empty($this->params['source']) ? 0 : $this->params['source'];
$bargain = new OBargainModel(); $bargain = new OBargainModel();
$data['data'] = $bargain->addBargainCommission($this->params['id'], $this->userId, $this->params['agent_id'], $data['data'] = $bargain->addBargainCommission($this->params['id'], $this->agentId, $this->params['agent_id'],
$this->params['role'], $this->params['scale_fee'], $this->params['scale'], $source); $this->params['role'], $this->params['scale_fee'], $this->params['scale'], $source);
if ($data['data'] == 0) { if ($data['data'] == 0) {
......
...@@ -125,6 +125,10 @@ class Agent extends Basic ...@@ -125,6 +125,10 @@ class Agent extends Basic
return $this->response(101, '门店id为空!'); return $this->response(101, '门店id为空!');
} }
if (empty($this->params['district_id'])) {
return $this->response(101, '部门id为空!');
}
$num = 0; //判断重复手机号 $num = 0; //判断重复手机号
//新增或者编辑数据 //新增或者编辑数据
...@@ -157,9 +161,7 @@ class Agent extends Basic ...@@ -157,9 +161,7 @@ class Agent extends Basic
return $this->response(101, '手机号重复'); return $this->response(101, '手机号重复');
} }
$store = new AStore(); $data['district_id'] = $this->params['district_id'];
$data['district_id'] = $store->getStoreKeyById('district_id', ['id'=>$this->params['store_id']]);
$data['name'] = trim($this->params['name']); $data['name'] = trim($this->params['name']);
$data['store_id'] = $this->params['store_id']; $data['store_id'] = $this->params['store_id'];
$data['phone'] = trim($this->params['phone']); $data['phone'] = trim($this->params['phone']);
...@@ -174,7 +176,7 @@ class Agent extends Basic ...@@ -174,7 +176,7 @@ class Agent extends Basic
} }
} else { } else {
//查看 //查看
$info = $m_agent->verifyUser('id,name,phone,password,store_id,sex,admin_off,remarks', '', ['id'=>$id]); $info = $m_agent->verifyUser('id,name,phone,password,district_id,store_id,sex,admin_off,remarks', '', ['id'=>$id]);
return $this->response(200, '查看', $info); return $this->response(200, '查看', $info);
} }
} }
......
...@@ -675,7 +675,7 @@ class Finance extends Basic ...@@ -675,7 +675,7 @@ class Finance extends Basic
} }
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
$bargain_data = $m_bargain->getCheckBargain('id,agent_id,role', $this->params['bargain_id']); $bargain_data = $m_bargain->getCheckBargain('a.id,a.agent_id,a.role', $this->params['bargain_id']);
//排除成交报告其它状态 //排除成交报告其它状态
if (empty($bargain_data['id'])) { if (empty($bargain_data['id'])) {
...@@ -686,7 +686,6 @@ class Finance extends Basic ...@@ -686,7 +686,6 @@ class Finance extends Basic
$m_partial = new OPartialCommission(); $m_partial = new OPartialCommission();
$data = $this->params["commission_date"]; $data = $this->params["commission_date"];
$add_arr = $update_arr = []; $add_arr = $update_arr = [];
$i = $j = 0; $i = $j = 0;
foreach ($data as $item) { foreach ($data as $item) {
...@@ -810,7 +809,7 @@ class Finance extends Basic ...@@ -810,7 +809,7 @@ class Finance extends Basic
} }
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
$bargain_data = $m_bargain->getCheckBargain('id', $this->params['bargain_id']); $bargain_data = $m_bargain->getCheckBargain('a.id', $this->params['bargain_id']);
//排除成交报告其它状态 //排除成交报告其它状态
if (empty($bargain_data['id'])) { if (empty($bargain_data['id'])) {
...@@ -942,7 +941,7 @@ class Finance extends Basic ...@@ -942,7 +941,7 @@ class Finance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo']; $pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize']; $pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$fields = 'a.id,a.create_time,e.name,e.phone,a.fee,b.house_number,d.internal_address,b.agent_id,b.father_id,b.order_id'; $fields = 'a.id,a.create_time,e.name,e.phone,a.fee,b.house_number,d.internal_address,a.agent_id,b.father_id,b.order_id';
$where['c.is_del'] = 0; $where['c.is_del'] = 0;
$where['b.status'] = [ 'in', 10, 11 ]; //10已提交 11审核成功 $where['b.status'] = [ 'in', 10, 11 ]; //10已提交 11审核成功
...@@ -1258,8 +1257,8 @@ class Finance extends Basic ...@@ -1258,8 +1257,8 @@ class Finance extends Basic
} }
//商铺地址 //商铺地址
if (!empty($this->params['house_address'])) { if (!empty($this->params['internal_address'])) {
$where['a.step_content'] = ['like', '%'.$this->params['house_address'].'%']; $where['a.step_content'] = ['like', '%'.$this->params['internal_address'].'%'];
} }
//经纪人名字 //经纪人名字
...@@ -1294,9 +1293,11 @@ class Finance extends Basic ...@@ -1294,9 +1293,11 @@ class Finance extends Basic
*/ */
public function editRecordLog(int $bargain_id, string $step_content = '', int $type = 1, string $house_number = '', int $is_open = 0) { public function editRecordLog(int $bargain_id, string $step_content = '', int $type = 1, string $house_number = '', int $is_open = 0) {
if (empty($house_number)) {
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
$house_number = $m_bargain->getCheckBargain('house_number', (int)$bargain_id); $house_number = $m_bargain->getCheckBargain('a.house_number,c.internal_address', (int)$bargain_id);
$step_content .= "[{$house_number['internal_address']}]";
if (empty($house_number)) {
$house_number = $house_number['house_number']; $house_number = $house_number['house_number'];
} }
......
...@@ -228,6 +228,12 @@ class Member extends Basic{ ...@@ -228,6 +228,12 @@ class Member extends Basic{
$type = 4; $type = 4;
} }
//客方手机号
if (!empty($params['user_agent'])) {
$where['b.phone'] = $params['user_agent'];
$type = 3;
}
$fields = 'a.id,a.user_nick,a.user_name,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.registration_time,a.user_name,a.last_login_ip,a.status'; $fields = 'a.id,a.user_nick,a.user_name,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.registration_time,a.user_name,a.last_login_ip,a.status';
$data['list'] = $this->user->getUserAgent($pageNo, $pageSize, 'a.id DESC', $fields, $where, $type); $data['list'] = $this->user->getUserAgent($pageNo, $pageSize, 'a.id DESC', $fields, $where, $type);
$data['total'] = $this->user->getUserAgentTotal($where, $type); $data['total'] = $this->user->getUserAgentTotal($where, $type);
......
...@@ -41,9 +41,6 @@ class Remark extends Basic ...@@ -41,9 +41,6 @@ class Remark extends Basic
$u_phone_follow = new UPhoneFollowPp(); $u_phone_follow = new UPhoneFollowPp();
$where['e.store_name'] = ['NULL'];
$where['f.district_name'] = ['NULL'];
if (!empty($this->params['start_date']) && empty($this->params['end_date'])) { if (!empty($this->params['start_date']) && empty($this->params['end_date'])) {
$where['a.create_time'] = ['> time', $this->params['start_date']. ' 00:00:00']; $where['a.create_time'] = ['> time', $this->params['start_date']. ' 00:00:00'];
} }
......
...@@ -96,8 +96,16 @@ ...@@ -96,8 +96,16 @@
<input type="text" class="form-control btn6" name="password" id="password" value="44444" placeholder="填写密码"> <input type="text" class="form-control btn6" name="password" id="password" value="44444" placeholder="填写密码">
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">绑定门店ID:</label> <label class="col-sm-3 control-label">所属部门:</label>
<input type="number" class="form-control btn6" name="store_id" value="" placeholder="填写门店ID"> <select name="district_id" class="form-control btn6">
<option value="">选择所属部门</option>
</select>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属门店:</label>
<select name="store_id" class="form-control btn6">
</select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">性别:</label> <label class="col-sm-3 control-label">性别:</label>
......
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
<input class="form-control btn2 margin-top-ld" data-rule-phoneus="false" data-rule-required="false" name="phone" placeholder="客户姓名或手机号" type="text" value=""> <input class="form-control btn2 margin-top-ld" data-rule-phoneus="false" data-rule-required="false" name="phone" placeholder="客户姓名或手机号" type="text" value="">
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="invite_phone" placeholder="邀请人(C端用户)手机号" type="text" value=""> <input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="invite_phone" placeholder="邀请人(C端用户)手机号" type="text" value="">
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="invite_agent_phone" placeholder="邀请人(经纪人)手机号" type="text" value="">
<!--业态选择--> <!--业态选择-->
<select class="form-control btn2 margin-top-ld" name="industry_type"> <select class="form-control btn2 margin-top-ld" name="industry_type">
...@@ -199,30 +199,40 @@ ...@@ -199,30 +199,40 @@
<option value="2"></option> <option value="2"></option>
<option value="1"></option> <option value="1"></option>
</select> </select>
<select class="form-control btn2 margin-top-ld input" name="" id="district_id" placeholder="" title=" <select class="form-control btn2 margin-top-ld" name="public_status">
<option value="2">客户状态</option>
<option value="0">求租</option>
<option value="1">已租</option>
<option value="-1">无效</option>
</select>
<select class="form-control btn2 margin-top-ld input" name="" id="district_id" title="
客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项"> 客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项">
<option value="">客方所属部门</option>
</select> </select>
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" id="guest_stores" placeholder="客方所属门店" type="text" value="" title=" <select class="form-control btn2 margin-top-ld input" name="" id="guest_stores" title="
客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项"> 客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项" value="">
</select>
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="user_agent" placeholder="客方手机号" type="text" value="">
<!--邀请人--> <!--邀请人-->
<select class="form-control btn2 margin-top-ld input" name="" id="district_id2" placeholder="" title=" <select class="form-control btn2 margin-top-ld input" name="" id="district_id2" title="
客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项"> 客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项">
<option value="">邀请人所属部门</option>
</select> </select>
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" id="guest_stores2" placeholder="邀请人所属门店" type="text" value="" title=" <select class="form-control btn2 margin-top-ld input" name="" id="guest_stores2" title="
客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项"> 客方所属部门、客方所属门店 与邀请人所属部门、邀请人所属门店 不作为并列筛选项">
</select>
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="invite_agent_phone" placeholder="邀请人(经纪人)手机号" type="text" value="">
<!--<div class="clear"></div>--> <!--<div class="clear"></div>-->
<!--<span class='left bottom'>(注:客方所属部门,客方所属门店与邀请人所属部门,邀请人所属门店不作为并列筛选项)</span>--> <!--<span class='left bottom'>(注:客方所属部门,客方所属门店与邀请人所属部门,邀请人所属门店不作为并列筛选项)</span>-->
<select class="form-control btn2 margin-top-ld" name="public_status">
<option value="2">客户状态</option>
<option value="0">求租</option>
<option value="1">已租</option>
<option value="-1">无效</option>
</select>
<div class="clear"></div> <div class="clear"></div>
......
...@@ -194,8 +194,7 @@ ...@@ -194,8 +194,7 @@
<select name="qx-store" class="form-control btn2" id="qx-store"> <select name="qx-store" class="form-control btn2" id="qx-store">
<option value="" selected="selected">选择部门</option> <option value="" selected="selected">选择部门</option>
</select> </select>
<select name="mend_name" class="form-control btn2" id="mend_name"></select>
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="mend_name" placeholder="门店名称" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="name" placeholder="店长姓名" type="text" value=""> <input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="name" placeholder="店长姓名" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="phone" placeholder="店长手机号" type="text" value=""> <input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="phone" placeholder="店长手机号" type="text" value="">
<span class="btn btn-default btn3" id="search">搜索</span> <span class="btn btn-default btn3" id="search">搜索</span>
......
...@@ -446,7 +446,8 @@ class OBargainModel extends Model ...@@ -446,7 +446,8 @@ class OBargainModel extends Model
if ($data['audit_level'] == 2 && $status == 10) { if ($data['audit_level'] == 2 && $status == 10) {
$update_data['status'] = 13; $update_data['status'] = 13;
$update_data['account_statement'] = 1; $update_data['account_statement'] = 1;
$update_data['account_time'] = time(); $update_data['account_time'] = date('Y-m-d H:i:s');
$this->where('id', $bargain_data['id'])->whereOr('father_id',$bargain_data['id'])->update($update_data);
$this->save($update_data, [ 'id' => $bargain_data['id'] ]); $this->save($update_data, [ 'id' => $bargain_data['id'] ]);
} else { } else {
$update_data['status'] = 11; $update_data['status'] = 11;
...@@ -709,6 +710,7 @@ class OBargainModel extends Model ...@@ -709,6 +710,7 @@ class OBargainModel extends Model
$insert_data['account_statement'] = $bargain_data['account_statement']; $insert_data['account_statement'] = $bargain_data['account_statement'];
$insert_data['is_commission'] = $bargain_data['is_commission']; $insert_data['is_commission'] = $bargain_data['is_commission'];
$insert_data['content'] = $bargain_data['content']; $insert_data['content'] = $bargain_data['content'];
$insert_data['industry_type'] = $bargain_data['industry_type'];
$result = $this->insert($insert_data); $result = $this->insert($insert_data);
if ($result == 1) { if ($result == 1) {
$this->commit(); $this->commit();
...@@ -943,9 +945,11 @@ class OBargainModel extends Model ...@@ -943,9 +945,11 @@ class OBargainModel extends Model
*/ */
public function getCheckBargain(string $field, int $id) public function getCheckBargain(string $field, int $id)
{ {
return $this->field($field) return $this->field($field)->alias('a')
->where('status', 'in', '10,11') ->join('o_order b', 'a.order_id=b.id', 'left')
->where('id', $id) ->join('g_houses c', 'b.house_id=c.id', 'left')
->where('a.status', 'in', '10,11')
->where('a.id', $id)
->find(); ->find();
} }
} }
\ No newline at end of file
...@@ -10,7 +10,25 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -10,7 +10,25 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
agent.event(); agent.event();
}, },
event: function () { event: function () {
var _doc = $(document);
agent.getDistrict(function(){
_doc.on('input', '[name=district_id]', function(){
var _this = $(this);
var _id = _this.val();
var _objTemp = _this.parent().next().find('select');
_objTemp.html('');//先清空
if(_id && _id != '0'){
agent.getDistrictStoreList(_id, function(_data){
var _str = '';
$.each(_data, function(i,item) {
_str += '<option value="'+item.id+'">'+item.store_name+'</option>';
});
_objTemp.html(_str);
});
}else{
};
});
})
$('#search').click(function (pageNo) { $('#search').click(function (pageNo) {
agent.getList(1); agent.getList(1);
}); });
...@@ -23,6 +41,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -23,6 +41,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
$("#title").html("新增经纪人"); $("#title").html("新增经纪人");
$("#password").parent().addClass('hide'); //新增不显示密码 $("#password").parent().addClass('hide'); //新增不显示密码
$(".form-horizontal")[0].reset(); //重置表单 $(".form-horizontal")[0].reset(); //重置表单
agent.emptyInput();//清空表单
}); });
$(document).delegate(".edit", "click", function () {//点击编辑 $(document).delegate(".edit", "click", function () {//点击编辑
...@@ -31,6 +50,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -31,6 +50,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
agent.agent_id = $(this).attr("data-id"); agent.agent_id = $(this).attr("data-id");
$("#password").parent().removeClass('hide'); //编辑显示密码 $("#password").parent().removeClass('hide'); //编辑显示密码
$("#password").attr('type','text'); $("#password").attr('type','text');
agent.emptyInput();//清空表单
agent.Edit(); agent.Edit();
}); });
...@@ -112,16 +132,26 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -112,16 +132,26 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
success: function (data) { success: function (data) {
if (data.code == 200) { if (data.code == 200) {
if(data.data){
$("input[name = id]").val(data.data.id); $("input[name = id]").val(data.data.id);
$("input[name = phone]").val(data.data.phone); $("input[name = phone]").val(data.data.phone);
$("input[name = name]").val(data.data.name); $("input[name = name]").val(data.data.name);
$("input[name = store_id]").val(data.data.store_id); $("[name = district_id]").val(data.data.district_id);
$("#admin_off").val(data.data.admin_off); if(data.data.district_id){
agent.getDistrictStoreList(data.data.district_id, function(_data){
var _str = '';
$.each(_data, function(i,item) {
_str += '<option value="'+item.id+'">'+item.store_name+'</option>';
});
$("[name = store_id]").html(_str).val(data.data.store_id);
});
}else{
}
$("#remarks").val(data.data.remarks); $("#remarks").val(data.data.remarks);
$("#password").val(data.data.password); $("#password").val(data.data.password);
$("input[name='password']").attr('form-group'); $("input[name='password']").attr('form-group');
// store.getDistrict(data.data.district_name);
if (data.data.sex == '0') { if (data.data.sex == '0') {
$("#sex0").attr('checked', true); $("#sex0").attr('checked', true);
} else if (data.data.sex == '1') { } else if (data.data.sex == '1') {
...@@ -129,6 +159,8 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -129,6 +159,8 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
} else { } else {
$("#sex2").attr('checked', true); $("#sex2").attr('checked', true);
} }
}
} else { } else {
alert('获取经纪人数据失败'); alert('获取经纪人数据失败');
} }
...@@ -142,7 +174,8 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -142,7 +174,8 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
params.id = agent.agent_id; params.id = agent.agent_id;
params.name = $("input[name = name]").val(); params.name = $("input[name = name]").val();
params.password = $("#password").val(); params.password = $("#password").val();
params.store_id = $("input[name = store_id]").val(); params.district_id = $("[name = district_id]").val();
params.store_id = $("[name = store_id]").val();
params.phone = $("input[name = phone]").val(); params.phone = $("input[name = phone]").val();
params.admin_off = $("#admin_off").val(); params.admin_off = $("#admin_off").val();
params.sex = $("input[name =sex]:checked").val(); params.sex = $("input[name =sex]:checked").val();
...@@ -156,8 +189,15 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -156,8 +189,15 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
return false; return false;
} }
if (params.district_id == '') {
alert('所属部门必填');
$("#modal-edit").show();
return false;
}
if (params.store_id == '') { if (params.store_id == '') {
alert('绑定门店ID必填'); alert('所属门店必填');
$("#modal-edit").show(); $("#modal-edit").show();
return false; return false;
} }
...@@ -184,6 +224,17 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -184,6 +224,17 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
}); });
}, },
emptyInput: function(){
console.count('emptyInput');
$("input[name = name]").val('');
$("input[name = phone]").val('');
$("#password").val('');
$("[name = district_id]").val('');
$("[name = store_id]").html('');
$("input[name =sex]").val('0');
$("#admin_off").val('0');
$("#remarks").val('');
},
getList: function (pageNo) { getList: function (pageNo) {
agent.pageNo = pageNo; agent.pageNo = pageNo;
var params = {}; var params = {};
...@@ -229,6 +280,42 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -229,6 +280,42 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
} }
}); });
},
getDistrict : function (fn) {
$.ajax ({
url: '/index/getDistrict',
type: 'GET',
async: true,
data: {"pageSize":1000},
dataType: 'json',
success: function (data) {
if (data.code == 200 && data.data != null) {
var str = '';
$.each(data.data, function(i,item) {
str += '<option value="'+item.id+'">'+item.district_name+'</option>';
});
$('[name=district_id]').append(str);
fn && fn();
}
}
});
},
getDistrictStoreList: function(id, fn){
$.ajax ({
url: '/index/getDistrictStoreList',
type: 'GET',
async: true,
data: {
'id':id,
"pageSize":1000
},
dataType: 'json',
success: function (data) {
if (data.code == 200 && data.data != null) {
fn && fn(data.data);
}
}
});
} }
}; };
return agent; return agent;
......
...@@ -21,16 +21,37 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -21,16 +21,37 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
$("body").append(template); $("body").append(template);
store.getList(); store.getList();
store.event(); store.event();
store.getRegionsDisc();
store.getDistrict();
}, },
event: function() { event: function() {
var _doc = $(document);
$("#search").click(function() { $("#search").click(function() {
store.getList(1); store.getList(1);
}); });
$("#reset").click(function() { //重置 $("#reset").click(function() { //重置
document.getElementById("form_search").reset(); document.getElementById("form_search").reset();
$('#mend_name').html('');
});
store.getDistrict({
'type': 1
}, function(){
_doc.on('input', '#qx-store', function(){
var _this = $(this);
var _id = _this.val();
_this.next().html('');//先清空
if(_id && _id != '0'){
store.getDistrictStoreList(_id, function(_data){
var _str = '';
$.each(_data, function(i,item) {
_str += '<option value="'+item.store_name+'">'+item.store_name+'</option>';
});
_this.next().html(_str);
});
}else{
};
});
}); });
$(document).delegate(".del_modal", "click", function() { $(document).delegate(".del_modal", "click", function() {
...@@ -67,7 +88,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -67,7 +88,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
$ (document).delegate (".add", "click", function () {//list2消失 $ (document).delegate (".add", "click", function () {//list2消失
document.getElementById('form_id').reset(); document.getElementById('form_id').reset();
store.getDistrict();
}); });
/************************************************百度地址定位相关*************************************************************/ /************************************************百度地址定位相关*************************************************************/
...@@ -185,29 +205,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -185,29 +205,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
/************************************************百度地址定位相关****结束*************************************************************/ /************************************************百度地址定位相关****结束*************************************************************/
}, },
getRegionsDisc: function(name) {
var params = {};
params.parent_code = 310100;
$.ajax({
url: '/index/regions',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.code == 200) {
var _html = '';
$.each(data.data, function(i, n) {
_html += '<option value="' + n.fullName + '">' + n.fullName + '</option>';
});
$("#area").append(_html);
} else {
alert('请求省市区错误');
}
}
});
},
Edit:function(){//获取编辑的数据 Edit:function(){//获取编辑的数据
$.ajax({ $.ajax({
'type': 'GET', 'type': 'GET',
...@@ -229,7 +226,10 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -229,7 +226,10 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
$("#latitude").val(data.data.latitude)//经纬度 $("#latitude").val(data.data.latitude)//经纬度
store.agents_id=data.data.agents_id;//经纪人id store.agents_id=data.data.agents_id;//经纪人id
store.district_id=data.data.district_id;//部门id store.district_id=data.data.district_id;//部门id
store.getDistrict(data.data.district_name); store.getDistrict({
'type': 2,
'name': data.data.district_name
});
} }
else { else {
alert('获取失败!'); alert('获取失败!');
...@@ -350,7 +350,7 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -350,7 +350,7 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
} }
}); });
}, },
getDistrict: function(name) { getDistrict: function(obj, fn) {
$.ajax({ $.ajax({
url: '/index/getDistrictListByName', url: '/index/getDistrictListByName',
type: 'GET', type: 'GET',
...@@ -359,24 +359,42 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -359,24 +359,42 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if(data.code == 200) { if(data.code == 200) {
var _html = ' <option value="" selected="selected">请选择</option>'; var _html = '';
$.each(data.data, function(i, n) { $.each(data.data, function(i, n) {
if (n.district_name == name && (typeof name != undefined)) { if (obj.type == '2' && n.district_name == obj.name) {
_html += '<option selected="selected" value="' + n.id + '">' + n.district_name + '</option>'; _html += '<option selected="selected" value="' + n.id + '">' + n.district_name + '</option>';
} else { } else {
_html += '<option value="' + n.id + '">' + n.district_name + '</option>'; _html += '<option value="' + n.id + '">' + n.district_name + '</option>';
} }
}); });
if(obj.type == '2'){
$("#ss-store").html(_html); $("#ss-store").html(_html);
}else if(obj.type == '1'){
$("#qx-store").append(_html); $("#qx-store").append(_html);
}else{}
// $("#qx-store").html(_html); fn && fn();
} else { } else {
alert('获取部门信息失败'); alert('获取部门信息失败');
} }
} }
}); });
},
getDistrictStoreList: function(id, fn){
$.ajax ({
url: '/index/getDistrictStoreList',
type: 'GET',
async: true,
data: {
'id':id,
"pageSize":1000
},
dataType: 'json',
success: function (data) {
if (data.code == 200 && data.data != null) {
fn && fn(data.data);
}
}
});
} }
}; };
return store; return store;
......
...@@ -11,8 +11,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -11,8 +11,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
$ ("body").append (template); $ ("body").append (template);
user.getList (); user.getList ();
user.event (); user.event ();
user.getDistrict();
user.getDistricttwo();
//时间控件初始化 //时间控件初始化
/* $('#datetimepicker').datetimepicker({ /* $('#datetimepicker').datetimepicker({
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
...@@ -24,6 +22,23 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -24,6 +22,23 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
}, },
event: function () { event: function () {
var _doc = $(document); var _doc = $(document);
user.getDistrict(function(){
_doc.on('input', '#district_id, #district_id2', function(){
var _this = $(this);
var _id = _this.val();
_this.next().html('');//先清空
if(_id && _id != '0'){
user.getDistrictStoreList(_id, function(_data){
var _str = '';
$.each(_data, function(i,item) {
_str += '<option value="'+item.store_name+'">'+item.store_name+'</option>';
});
_this.next().html(_str);
});
}else{
};
});
});
$ (".Bannertu").click (function () { $ (".Bannertu").click (function () {
BrowseServer ('cover_image'); BrowseServer ('cover_image');
}); });
...@@ -33,6 +48,8 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -33,6 +48,8 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
$("#reset").click(function () { $("#reset").click(function () {
document.getElementById("form_search").reset(); document.getElementById("form_search").reset();
$('#guest_stores').html('');
$('#guest_stores2').html('');
}); });
...@@ -174,6 +191,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -174,6 +191,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
}); });
// =================== // ===================
}, },
addphone:function(obj){ addphone:function(obj){
var user_ht=$(obj).html(); var user_ht=$(obj).html();
...@@ -377,15 +395,14 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -377,15 +395,14 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
getList: function (pageNo) { getList: function (pageNo) {
user.pageNo = pageNo; user.pageNo = pageNo;
var params = {}; var params = {};
console.log($("#start_date").val()); // if($("#district_id").val()!=0||$("#guest_stores").val()!=''){
if($("#district_id").val()!=0||$("#guest_stores").val()!=''){ // $("#district_id2").val('0');
$("#district_id2").val('0'); // $("#guest_stores2").val('');
$("#guest_stores2").val(''); // };
}; // if($("#district_id2").val()!=0||$("#guest_stores2").val()!=''){
if($("#district_id2").val()!=0||$("#guest_stores2").val()!=''){ // $("#district_id1").val('0');
$("#district_id1").val('0'); // $("#guest_stores1").val('');
$("#guest_stores1").val(''); // };
};
// 输入 name // 输入 name
// params.name = $("input[name='user']").val(); // params.name = $("input[name='user']").val();
params.phone = $("input[name='phone']").val(); params.phone = $("input[name='phone']").val();
...@@ -408,6 +425,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -408,6 +425,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
params.activate = $("select[name=activate]").val(); params.activate = $("select[name=activate]").val();
params.pageNo = user.pageNo; params.pageNo = user.pageNo;
params.pageSize = user.pageSize; params.pageSize = user.pageSize;
params.user_agent = $("input[name='user_agent']").val();
params.invite_agent_phone = $("input[name='invite_agent_phone']").val(); params.invite_agent_phone = $("input[name='invite_agent_phone']").val();
params.area_type = $("select[name=area_type]").val(); params.area_type = $("select[name=area_type]").val();
params.price_type = $("select[name=price_type]").val(); params.price_type = $("select[name=price_type]").val();
...@@ -430,11 +448,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -430,11 +448,6 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
/*分页代码*/ /*分页代码*/
add_page(data.data.total,pageNo,user.pageSize,user.getList); add_page(data.data.total,pageNo,user.pageSize,user.getList);
$("#total_page").html(data.data.total); $("#total_page").html(data.data.total);
console.log(data.data.total);
console.log(user.pageSize);
console.log(pageNo);
} }
}); });
}, },
...@@ -520,40 +533,39 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -520,40 +533,39 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
} }
}); });
}, },
getDistrict : function () { getDistrict : function (fn) {
$.ajax ({ $.ajax ({
url: '/index/getDistrict', url: '/index/getDistrict',
type: 'GET', type: 'GET',
async: true, async: true,
data: {"pageSize":50}, data: {"pageSize":1000},
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
if (data.code == 200 && data.data != null) { if (data.code == 200 && data.data != null) {
var str = '<option value="0">客方所属部门</option>'; var str = '';
$.each(data.data, function(i,item) { $.each(data.data, function(i,item) {
str += '<option value="'+item.id+'">'+item.district_name+'</option>'; str += '<option value="'+item.id+'">'+item.district_name+'</option>';
}); });
$("#district_id").html(str); $("#district_id").append(str);
$("#district_id2").append(str);
fn && fn();
} }
} }
}); });
}, },
getDistricttwo : function () { getDistrictStoreList: function(id, fn){
$.ajax ({ $.ajax ({
url: '/index/getDistrict', url: '/index/getDistrictStoreList',
type: 'GET', type: 'GET',
async: true, async: true,
data: {"pageSize":50}, data: {
'id':id,
"pageSize":1000
},
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
if (data.code == 200 && data.data != null) { if (data.code == 200 && data.data != null) {
var str = '<option value="0">邀请人所属部门</option>'; fn && fn(data.data);
$.each(data.data, function(i,item) {
str += '<option value="'+item.id+'">'+item.district_name+'</option>';
});
$("#district_id2").html(str);
} }
} }
}); });
......
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