Commit 29c59b60 authored by zfc's avatar zfc Committed by hujun

经纪人列表

parent a359ef7c
<?php
/**
* 经济人表
* @param id
* @param store_id ------门店id关联门店表
* @param district_id --区域id关联区域表
* @param level ---------等级 10业务员 20店长 30总监
* @param name ----------经济人姓名
* @param phone ---------手机号
* @param password ------登录密码
* @param sex -----------性别 0保密 1男 2女
* @param img -----------头像
* @param status --------账号状态,0正常 1冻结 2离职
* @param inviter_id ---邀请人id
* @param create_time ---创建时间
* @param update_time ---修改时间
* Created by PhpStorm.
* User: zfc
* Date: 2018/2/26
* Time: 13:51
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AuthGroup;
use app\model\AuthRule;
use app\model\AAgents;
use think\Db;
use think\Session;
class Agent extends Basic
{
protected $authGroupModel;
protected $authRuleModel;
function _initialize()
{
}
//经纪人显示页面
public function agent(){
return view('agent');
}
//编辑页面
public function updateAgent(){
return view('save_agent');
}
/*********************接口******************************/
//首页显示列表
public function AgentList(){
$table= new AAgents;
$data['status'] = 200;
$data['msg'] = '';
$params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件
$where='';
$search=$params['search'];
if(!empty($search)){
Session::set("search.agent",$search);
$where.=" id='$search' or name like '%$search%' or phone like '%$search%' ";
$data['search']=$search;
}else{
$search=Session::get("search.agent");
if(!empty($search)){
$where.=" id='$search' or name like '%$search%' or phone like '%$search%' ";
$data['search']=$search;
}
}
$where='a.status in(0,1)';
$field="a.id,a.store_id,a.district_id,a.`level`,a.`name`,a.phone,a.sex,a.img,a.`status`,a.inviter_id,a.create_time,
ifnull(s.store_name,'')store_name,ifnull(d.district_name,'')district_name";
$order='a.id asc';
$join=[
['a_store s', ' a.store_id=a.id','left'],
['a_district d','a.district_id=d.id','left']
];
$data['list'] = $table->getList($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal('status=1');
// prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr
return $this->response(200,'成功',$data);
}
//新增or修改
public function saveAgent(){
}
//删除(冻结)
public function updateStatus(){
}
//批量变更角色
public function updateRole(){
}
//
}
\ No newline at end of file
...@@ -17,16 +17,8 @@ class Auth extends Basic ...@@ -17,16 +17,8 @@ class Auth extends Basic
protected $authGroupModel; protected $authGroupModel;
protected $authRuleModel; protected $authRuleModel;
function _initialize()
{
}
/** /**
* 权限列表页 * 权限列表页
* *
...@@ -248,7 +240,7 @@ class Auth extends Basic ...@@ -248,7 +240,7 @@ class Auth extends Basic
$data['msg'] = ''; $data['msg'] = '';
$params = $this->request->param(); $params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 20 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件 //条件
$field="a.id,a.name,a.title,a.depend_flag,a.type,a.pid,a.icon,a.sort,if(a.is_menu,'是','否')is_menu,a.status,ifnull(b.title,'顶级') as title2"; $field="a.id,a.name,a.title,a.depend_flag,a.type,a.pid,a.icon,a.sort,if(a.is_menu,'是','否')is_menu,a.status,ifnull(b.title,'顶级') as title2";
$where='a.status=1'; $where='a.status=1';
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="agent" /><!--关联js文件-->
<div class="builder listbuilder-box" style="min-height: 1426px; width: 1035px; float: left; margin-left: 20px;">
<!-- Tab导航 -->
<!-- 顶部工具栏按钮 -->
<div class="builder-toolbar mt-10 mb-20">
<div class="row">
<div class="col-xs-12 col-sm-12 button-list clearfix">
<!-- 工具栏按钮 -->
<!--<div class="form-group">-->
<a title="新增" class="btn btn-primary btn-sm" href="/admin.php/admin/user/edit.html">新增</a>&nbsp;
<a title="删除" target-form="ids" class="btn btn-danger ajax-post confirm btn-sm" model="User" href="/admin.php/admin/user/setstatus/status/delete/model/User.html">删除</a>&nbsp;
<a target-form="ids" class="btn btn-info btn-raised btn-sm" title="<i class=&quot;fa fa-comment-o&quot;></i> 发送消息" onclick="send_msg()"><i class="fa fa-comment-o"></i> 发送消息</a>&nbsp;
<a target-form="ids" class="btn btn-info btn-sm" title="<i class=&quot;fa fa-users&quot;></i> 变更角色" onclick="role_move()"><i class="fa fa-users"></i> 变更角色</a>&nbsp;
<!-- </div>-->
<!-- 搜索框 -->
<div class="col-xs-12 col-sm-3 clearfix fr pr0">
<form class="form form-inline" method="get" action="/admin.php/admin/user/index.html">
<div class="form-group">
<div class="input-group search-form">
<input type="text" name="keyword" class="form-control search-input pull-right" value="" placeholder="请输入ID/用户名/昵称">
<span class="input-group-btn"><button type="button" class="btn btn-success search-btn"><i class="glyphicon glyphicon-search"></i></button></span>
</div>
</div>
</form>
</div>
</div>
</div><!--row-->
</div>
<!-- 数据列表 -->
<div class="builder-container">
<div class="row">
<div class="builder-table col-sm-12">
<table class="table table-responsive table-bordered table-hover dataTable">
<thead>
<tr>
<th width="50" class="checkbox-toggle"><div class="icheckbox_minimal-blue" aria-checked="false" aria-disabled="false" style="position: relative;"><input class="check-all" type="checkbox" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div><!-- <span class="checkbox-toggle" style="color:#ddd;font-size:23px;cursor:pointer;"><i class="fa fa-square-o"></i></span> --></th>
<th>UID</th>
<th>头像</th>
<th>用户名</th>
<th>手机号</th>
<th>门店名</th>
<th>地址</th>
<th>注册时间</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody id="agentlist">
<!--<tr>-->
<!--<td><div class="icheckbox_minimal-blue" aria-checked="false" aria-disabled="false" style="position: relative;"><input class="ids" type="checkbox" value="1" name="ids[]" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div></td>-->
<!--<td>1</td>-->
<!--<td><img style="width:40px;height:40px;" src="http://img.eacoomall.com/images/static/assets/img/default-avatar.svg"></td>-->
<!--<td>创始人</td>-->
<!--<td>admin</td>-->
<!--<td>admin@admin.com</td>-->
<!--<td></td>-->
<!--<td>2018-01-18 16:53:36</td>-->
<!--<td><span class="fa fa-check text-success"></span></td>-->
<!--<td>正常</td>-->
<!--<td><a title="编辑" class="btn btn-primary btn-xs" href="/admin.php/admin/user/edit/uid/1.html" style="margin-right:6px;">编辑</a><a title="删除" class="btn btn-danger btn-xs ajax-get confirm" model="User" href="/admin.php/admin/user/setstatus/status/delete/ids/1/model/User.html" style="margin-right:6px;">删除</a></td>-->
<!--</tr>-->
</tbody>
</table>
<!-- 列表底部按钮 -->
<div class="paginations" id="pagediv">
</div>
</div>
</div>
</div>
<div class="modal fade mt100" id="moveroleModal">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<p class="modal-title">移动至</p>
</div>
<div class="modal-body">
<form action="/admin.php/admin/auth/addtogroup.html" method="post" class="form-move" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<select name="group_id" class="form-control"><option value="1">das</option><option value="2">管理员</option><option value="3">普通用户</option><option value="4">客服</option></select>
</div>
<div class="form-group">
<input type="hidden" name="uids">
<input type="hidden" name="batch">
<button class="btn btn-primary btn-block submit ajax-post" type="submit" target-form="form-move">确 定</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
<li role="presentation"> <li role="presentation">
<a href="/admin.php/index/auth.html">角色管理</a> <a href="/admin.php/index/auth.html">角色管理</a>
</li> </li>
<li role="presentation">
<a href="/admin.php/index/agent.html">经纪人列表</a>
</li>
<li role="presentation"> <li role="presentation">
<a href="/admin.php/index/authRuleIndex.html">权限管理</a> <a href="/admin.php/index/authRuleIndex.html">权限管理</a>
</li> </li>
......
...@@ -12,5 +12,23 @@ namespace app\model; ...@@ -12,5 +12,23 @@ namespace app\model;
class AAgents extends BaseModel class AAgents extends BaseModel
{ {
public function saveList(){
}
//分页列表
public function getList($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '',$join='', $where = '')
{
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select();
return $data;
}
} }
\ No newline at end of file
...@@ -80,7 +80,7 @@ class AuthRule extends BaseModel ...@@ -80,7 +80,7 @@ class AuthRule extends BaseModel
} }
//查询带分页 //查询带分页
public function authRuleList($p = 1, $pageSize = 20, $order_ = '', $field = '',$join='', $where = ''){ public function authRuleList($p = 1, $pageSize = 15, $order_ = '', $field = '',$join='', $where = ''){
$data = $this->field($field) $data = $this->field($field)
->alias('a') ->alias('a')
->join($join) ->join($join)
......
...@@ -78,7 +78,7 @@ Route::group('index', [ ...@@ -78,7 +78,7 @@ Route::group('index', [
'addVersion' => ['index/version/addVersion',['method'=>'post']], 'addVersion' => ['index/version/addVersion',['method'=>'post']],
//权限管理 //权限管理
'classList' => ['index/auth/classList',['method'=>'get']], //分类列表 'classList' => ['index/auth/classList',['method'=>'get']], //分类列表
'getAuth' => ['index/auth/getAuth', ['method' => 'get']], //角色列表 'getAuth' => ['index/auth/getAuth', ['method' => 'get']], //角色列表
'roleedit' => ['index/auth/roleEdit', ['method' => 'get']], //--编辑角色页面 'roleedit' => ['index/auth/roleEdit', ['method' => 'get']], //--编辑角色页面
'access' => ['index/auth/access', ['method' => 'get']], //--权限分配角色页面 'access' => ['index/auth/access', ['method' => 'get']], //--权限分配角色页面
...@@ -86,12 +86,21 @@ Route::group('index', [ ...@@ -86,12 +86,21 @@ Route::group('index', [
'addAuth' => ['index/auth/addAuth', ['method' => 'post']], //--添加角色【接口】 'addAuth' => ['index/auth/addAuth', ['method' => 'post']], //--添加角色【接口】
'accessLook'=>['index/auth/accessLook', ['method' => 'post']], //--查看编辑角色权限【接口】 'accessLook'=>['index/auth/accessLook', ['method' => 'post']], //--查看编辑角色权限【接口】
'setStatus'=>['index/auth/setStatus', ['method' => 'post']], //--设置角色的状态【接口】 'setStatus'=>['index/auth/setStatus', ['method' => 'post']], //--设置角色的状态【接口】
'authRuleIndex'=>['index/auth/authRuleIndex', ['method' => 'get']], //权限列表界面
'authRuleList'=>['index/auth/authRuleList', ['method' => 'get']], //--规则列表 'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权
'authRuleBox'=>['index/auth/authRuleBox', ['method' => 'get']], //--编辑规则 'authRuleIndex'=>['index/auth/authRuleIndex', ['method' => 'get']], //权限列表界面
'updateAuthRule'=>['index/auth/updateAuthRule', ['method' => 'post']],//--编辑规则接口 'authRuleList'=>['index/auth/authRuleList', ['method' => 'get']], //--规则列表
'authClass'=>['index/auth/authClass', ['method' => 'get']], //--规则分类列表 'authRuleBox'=>['index/auth/authRuleBox', ['method' => 'get']], //--编辑规则
'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权 'updateAuthRule'=>['index/auth/updateAuthRule', ['method' => 'post']], //--编辑规则接口
'authClass'=>['index/auth/authClass', ['method' => 'get']], //--规则分类列表
'agent'=>['index/agent/agent', ['method' => 'get']], //列表
'saveAgentIndex'=>['index/agent/saveAgentIndex', ['method' => 'get']], //列表
'AgentList'=>['index/agent/AgentList', ['method' => 'get']], //列表
'saveAgent'=>['index/agent/saveAgent', ['method' => 'get']], //列表
'updateStatus'=>['index/agent/updateStatus', ['method' => 'get']], //列表
'updateRole'=>['index/agent/updateRole', ['method' => 'get']], //列表
//商圈 //商圈
'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表 'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表
......
define (['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css','pagination','bootstrapJs'], function (doT, template) {
agent={
pageNo:1,
pageSize:15,
init:function () {
//初始化dot
$("body").append(template);
agent.getList();
agent.event();
},
event:function () {
},
getList:function(pageNo){
agent.pageNo =pageNo;
var params ={};
params.pageNo =agent.pageNo;
params.pageSize=agent.pageSize;
$.ajax({
url: '/index/AgentList.html',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function (data) {
var temp=document.getElementById('agent_tpl').innerHTML;
var doTempl=doT.template(temp);
$("#agentlist").html(doTempl(data.data.list));
/*分页代码*/
$ ("#pagediv").pagination ({
length: data.data.total,
current: pageNo,
every: agent.pageSize,
onClick: function (el) {
agent.getList (el.num.current);
}
});
}
})
}
}
return agent;
});
\ No newline at end of file
<script id="agent_tpl" type="text/template">
[% if(it) { %]
[% for(var item in it){ %]
<tr>
<td><div class="icheckbox_minimal-blue" style="" aria-checked="false" aria-disabled="false">
<!--<input type="checkbox" name="ids[]" value="1" class="ids" style="">-->
</div>
</td>
<td>[%= it[item]["id"] %]</td>
<td><img src="./index/[%= it[item]['img'] %]" alt=""></td>
<td>[%= it[item]["name"] %]</td>
<td>[%= it[item]["phone"] %]</td>
<td>[%= it[item]["store_name"] %]</td>
<td>[%= it[item]["district_name"] %]</td>
<td>[%= it[item]["create_time"] %]</td>
<td>[%= it[item]["status"] %]</td>
<!--<td><span class="fa fa-check text-success"></span></td>-->
<td>
<a style="margin-right:6px;" href="/index/authRuleBox.html?id=[%= it[item]['id'] %]" class="btn btn-primary btn-xs" title="编辑">编辑</a>
<a style="margin-right:6px;" href="" class="btn btn-warning btn-xs ajax-get confirm" title="禁用">禁用</a>
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
\ No newline at end of file
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