Commit 3058ca34 by 朱继来

temp

parent 45b1e240
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Model\PaymentDaysModel; use App\Model\PaymentDaysModel;
use App\Model\Pcb\PcbOrderModel; use App\Model\Pcb\PcbOrderModel;
use App\Model\Pcb\PcbPublicModel; use App\Model\Pcb\PcbPublicModel;
use App\Model\Pcb\PcbPurchaseModel; use App\Model\Pcb\PcbPurchaseModel;
use App\Model\Pcb\PcbServerModel; use App\Model\Pcb\PcbServerModel;
use Illuminate\Http\Request; use App\Model\KefuModel;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ApiController extends Controller class ApiController extends Controller
{ {
...@@ -90,4 +90,12 @@ class ApiController extends Controller ...@@ -90,4 +90,12 @@ class ApiController extends Controller
private function ApiSetOrderProduct($request){ private function ApiSetOrderProduct($request){
echo (new PcbServerModel())->setOrdserProduct($request->user->userId,$request->input("purchase_id")); echo (new PcbServerModel())->setOrdserProduct($request->user->userId,$request->input("purchase_id"));
} }
// 获取客服池
public function ApiKefuList($request)
{
$KefuModel = new KefuModel;
return $KefuModel->lists($request);
}
} }
...@@ -57,7 +57,7 @@ class WebController extends Controller ...@@ -57,7 +57,7 @@ class WebController extends Controller
public function info(Request $request,$id=''){ public function info(Request $request,$id=''){
$data=$this->getPageInfo($request); $data=$this->getPageInfo($request);
$data['id']=$id; $data['id']=$id;
return $this->$id($request, $data,$id ); return $this->$id($request, $data, $id);
} }
private function PaymentDaysList($request,$data,$id){ private function PaymentDaysList($request,$data,$id){
...@@ -270,4 +270,12 @@ class WebController extends Controller ...@@ -270,4 +270,12 @@ class WebController extends Controller
return view("Pcb",$data); return view("Pcb",$data);
} }
// 订单客服池
public function kefu($request, $data, $id)
{
$data['title'] = '客服池';
return view('web', $data);
}
} }
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class KefuModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_kefu';
protected $primaryKey = 'id';
protected $guarded = ['id'];
public $timestamps = true;
const CREATED_AT = 'add_time';
const UPDATED_AT = 'update_time';
/** * @param \DateTime|int $value * @return false|int * @author dividez */
public function fromDateTime($value)
{
return strtotime(parent::fromDateTime($value));
}
// 获取客服
public function lists($request, $export='')
{
$page = $request->input('page', 1);
$limit = $request->input('limit', 10);
$field = ['id', 'sale_id', 'sale_name', 'email', 'status', 'operator_id', 'operator_name', 'create_time', 'update_time'];
$map['sale_name'] = $request->input('sale_name', ''); // 客服名称
$map['email'] = $request->input('email', ''); // 邮箱
$map['begin_time'] = $request->input('begin_time', '') ? strtotime($request->input('begin_time')) : '';
$map['end_time'] = $request->input('end_time', '') ? strtotime($request->input('end_time')) + 86399 : '';
$list = $this->where(function($query) use ($map) {
// 客服名称
if ($map['sale_name']) {
$query->where('sale_name', 'like', $map['sale_name'].'%');
}
})->where(function($query) use ($map) {
// 邮箱
if ($map['email']) {
$query->where('email', '=', $map['email']);
}
})->where(function($query) use ($map) {
// 创建时间
if(!empty($map['begin_time']) && !empty($map['end_time'])) {
$query->whereBetween('create_time', [$map['begin_time'], $map['end_time']]);
}
else if(!empty($map['begin_time'])) {
$query->where('create_time', '>=', $map['begin_time']);
}
else if(!empty($map['end_time'])) {
$query->where('create_time', '<=', $map['end_time']);
}
})
->select($field)
->orderBy('add_time', 'desc');
if ($export) {
$list = $list->get()->toArray();
if (empty($list)) {
echo '<script>alert("导出数据为空");history.go(-1);</script>';die;
}
return $list;
} else {
$list = $list->paginate($limit, ['*'], 'page', $page)->toArray();
return ['code'=>0, 'msg'=>'获取成功', 'data'=>$list['data'], 'count'=>$list['total']];
}
}
}
\ No newline at end of file
layui.use(['form', 'table', 'laydate'], function(){
var form = layui.form;
var table = layui.table;
var laydate = layui.laydate;
laydate.render({
elem: '#begin_time' //指定元素
});
laydate.render({
elem: '#end_time' //指定元素
});
var renderTable = function () {
table.render({
id: 'list'
,elem: '#kefu'
,url: '/api/ApiKefuList' //数据接口
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
,cols: [[ //表头
{title: '序号', type: 'numbers', fixed: 'left', width: 78}
,{field: 'sale_id', title: '客服ID', width: 300}
,{field: 'sale_name', title: '客服名称', width: 160}
,{field: 'email', title: '邮箱', width: 150}
,{field: 'operator_name', title: '操作人名称', width: 150}
,{field: 'status', title: '审核状态', templet: '#status', width: 160}
,{field: 'create_time', title: '创建时间', width: 200}
,{title: '操作', align:'center', fixed: 'right', toolbar: '#list_action', width: 200}
]]
,limit: 10
,limits: [10, 20, 50,]
,done:function(res,curr,count){
// 图片展示
layer.photos({
photos: '.layer-img'
,shift: 5 //0-6的选择,指定弹出图片动画类型,默认随机
});
}
});
};
renderTable();
form.on('submit(load)', function(data) {
//执行重载
table.reload('list', {
page: {
curr: 1
}
,where: data.field
});
return false;
});
// tool操作
table.on('tool(auth)', function(obj){ //注:tool是工具条事件名,test是table原始容器的属性lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
var title = '';
var content = '';
var url = '/ajax/authCheck';
var datax = {};
datax.id = data.id;
datax.user_id = data.user_id;
if(layEvent === 're-check') { // 重新审核
title = '重新审核会员认证';
content = '确定重新审核会员认证吗?';
datax.status = 1;
} else if (layEvent === 'pass') { // 通过
title = '审核会员认证';
content = '确定通过会员认证吗?';
datax.status = 3;
// datax.company_name = data.company_name;
// datax.auth_type = data.auth_type;
// datax.company_type = data.company_type;
} else if (layEvent === 'reject') { // 驳回
title = '驳回会员认证';
content = '<div class="layui-form-item layui-form-text">'+
'<textarea placeholder="请输入驳回原因" class="layui-textarea" name="reason" id="reason"></textarea>'+
'</div>';
datax.status = 2;
} else if (layEvent === 'cancel') { // 取消认证
title = '取消会员认证';
content = '<div class="layui-form-item layui-form-text">'+
'<textarea placeholder="请输入取消原因" class="layui-textarea" name="reason" id="reason"></textarea>'+
'</div>';
datax.status = -1;
}
layer.open({
// area: ['400px', '200px'],
title: title,
content: content,
btn: ['确认', '取消'],
yes: function(index) {
if (layEvent == 'reject' || layEvent == 'cancel') {
var reason = $('#reason').val();
if (!reason) {
layer.tips('请输入原因', $('#reason'));
return false;
}
datax.reason = reason;
}
$.ajax({
url : url,
type: 'post',
data: datax,
dataType: 'json',
success: function(resp) {
if (resp.err_code == 0) {
layer.msg(resp.err_msg);
renderTable(); // 重新加载table
return false;
}
layer.alert(resp.err_msg);
},
error: function(err) {
console.log(err)
}
})
layer.msg(title+'中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
return false;
},
cancel: function(index) {
layer.close(index);
}
})
});
});
\ No newline at end of file
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<style>
.well .form-group {
margin-right: 0px;
margin-left: 0px;
}
</style>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{config('website.webTitle')}} | {{$title}}</title>
<script>document.domain="{{ config('website.domain') }}";</script>
<link href="/js/layui/css/layui.css" rel="stylesheet">
@include('table.css')
<script src="/js/jquery-2.2.1.js"></script>
<style>
label{
box-sizing:content-box;
}
</style>
<script>
var k1='';
var k2='';
var UploadImgUrl='';
var exts='png|jpg|gif';
</script>
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
@include('layouts.header')
<div class="layui-col-md6 layui-col-space12" style="margin: 10px;width: 100%;height: 100%;padding-right: 20px">
<div class="layui-card">
<div class="layui-card-body" style="padding-top: 20px; padding-bottom: 30px;">
@include("web.$id")
</div>
</div>
</div>
</div>
</div>
@include('table.js')
<script src="/js/layui/layui.js"></script>
<script src="/js/common.js"></script>
@if(empty($into))
<script src="/js/web/{{$id}}.js?v={{time()}}"></script>
@endif
</body>
<form class="layui-form layui-box" method="post">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">客服名称</label>
<div class="layui-input-inline">
<input type="text" name="sale_name" placeholder="客服名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">客服邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" placeholder="客服邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">创建时间</label>
<div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-btn-container" style="text-align: center; margin-top: 10px;">
<button lay-submit lay-filter="load" class="layui-btn" data-type="search">搜索</button>
<button type="button" class="layui-btn layui-btn-normal export">导出</button>
</div>
</div>
</form>
<table id="kefu" lay-filter="kefu"></table>
<script type="text/html" id="status">
@{{# if (d.status == 1) { }}
<div style="color:#DC143C;">待分配</div>
@{{# } else { }}
<div style="color:#ccc;">等待中</div>
@{{# } }}
</script>
<script type="text/html" id="list_action">
<a class="btn btn-xs btn-warning" lay-event="edit">编辑</a>
<a class="btn btn-xs btn-danger" lay-event="del">删除</a>
</script>
<form class="layui-form layui-box" method="post">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">注册手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" placeholder="填写注册手机" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">认证状态</label>
<div class="layui-input-inline">
<select name="auth_status" lay-verify="" lay-search>
<option value=""></option>
@if (Config('params.auth_status'))
@foreach (Config('params.auth_status') as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
@endforeach
@endif
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">账号状态</label>
<div class="layui-input-inline">
<select name="status" lay-verify="" lay-search>
<option value=""></option>
<option value="1">使用中</option>
<option value="2">已禁用</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">注册时间</label>
<div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-btn-container" style="text-align: center; margin-top: 10px;">
<button lay-submit lay-filter="load" class="layui-btn" data-type="search">搜索</button>
<button type="button" class="layui-btn layui-btn-normal export">导出</button>
</div>
</div>
</form>
<table id="list" lay-filter="list"></table>
<script type="text/html" id="status">
@{{# if (d.status == 1) { }}
<div>使用中</div>
@{{# } else if (d.status == 2) { }}
<div style="color:#ccc;">已禁用</div>
@{{# } }}
</script>
<script type="text/html" id="list_action">
@{{# if (d.status == 1) { }}
<a class="btn btn-xs btn-danger" lay-event="forbidden">禁用</a>
@{{# } else if (d.status == 2) { }}
<a class="btn btn-xs btn-info" lay-event="restore">启用</a>
@{{# } }}
<a class="btn btn-xs btn-success" href="/web/editUser?user_id=@{{ d.user_id }}" target="_blank">编辑</a>
</script>
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 sign in to comment