后端本地生活添加核销人员
This commit is contained in:
parent
0e669c2dc7
commit
cd948de612
@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\admin\controller\shop;
|
||||
|
||||
use app\admin\logic\groupbuy\GroupbuyLogic;
|
||||
use app\admin\logic\user\UserLogic;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\server\ConfigServer;
|
||||
@ -185,4 +186,41 @@ class LocalStore extends AdminBase
|
||||
}
|
||||
return JsonServer::success('', $result);
|
||||
}
|
||||
|
||||
public function verify()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$lists = LocalStoreLogic::verify_list($get);
|
||||
return JsonServer::success('获取成功', $lists);
|
||||
}
|
||||
|
||||
$lstore_id = $this->request->get('lstore_id');
|
||||
|
||||
return view('', [
|
||||
'lstore_id' => $lstore_id
|
||||
]);
|
||||
}
|
||||
|
||||
public function add_verify()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post();
|
||||
LocalStoreLogic::add_verify($params);
|
||||
return JsonServer::success('添加成功');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
public function del_verify()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$params = $this->request->post();
|
||||
$result = LocalStoreLogic::del_verify($params['ids']);
|
||||
if ($result) {
|
||||
return JsonServer::success('更新成功');
|
||||
}
|
||||
return JsonServer::error('更新失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ use app\common\server\ExportExcelServer;
|
||||
use app\common\server\WeChatServer;
|
||||
use EasyWeChat\Factory;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\localstore\LocalStoreVerify;
|
||||
|
||||
class LocalStoreLogic extends Logic
|
||||
{
|
||||
@ -344,4 +345,55 @@ class LocalStoreLogic extends Logic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取审核人员
|
||||
public static function verify_list($get)
|
||||
{
|
||||
$lists = LocalStoreVerify::with('user')
|
||||
->where([
|
||||
'lstore_id' => $get['lstore_id'],
|
||||
'is_delete' => 0
|
||||
])
|
||||
->paginate([
|
||||
'page' => $get['page'],
|
||||
'list_rows' => $get['limit'],
|
||||
'var_page' => 'page'
|
||||
])->toArray();
|
||||
return [
|
||||
'lists' => $lists['data'],
|
||||
'count' => $lists['total']
|
||||
];
|
||||
}
|
||||
|
||||
// 添加审核人员
|
||||
public static function add_verify($form = array())
|
||||
{
|
||||
try {
|
||||
$data['lstore_id'] = $form['lstore_id'];
|
||||
$data['user_id'] = $form['user_selected']['id'];
|
||||
LocalStoreVerify::create($data);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 删除审核人员
|
||||
public static function del_verify($ids)
|
||||
{
|
||||
try {
|
||||
$data = array();
|
||||
foreach ($ids as $k => $v) {
|
||||
$data[$k]['id'] = $v;
|
||||
$data[$k]['is_delete'] = 1;
|
||||
$data[$k]['delete_time'] = time();
|
||||
}
|
||||
(new LocalStoreVerify)->saveAll($data);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
app/admin/view/shop/local_store/add_verify.html
Executable file
120
app/admin/view/shop/local_store/add_verify.html
Executable file
@ -0,0 +1,120 @@
|
||||
{layout name="layout1" /}
|
||||
<style>
|
||||
.search {
|
||||
margin-top: 15px;
|
||||
}
|
||||
.search .layui-form-label {
|
||||
width: 120px;
|
||||
text-align: left;
|
||||
}
|
||||
.btns {
|
||||
margin-top: 15px;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<!--搜索区域-->
|
||||
<div class="search layui-form">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-label">用户信息</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="keyword" name="keyword" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-primary layui-bg-blue" lay-submit lay-filter="search">搜索</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="reset">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
<!--数据表格-->
|
||||
<table id="lists" lay-filter="lists"></table>
|
||||
<!--自定义模板-->
|
||||
<script type="text/html" id="user-info">
|
||||
<img src="{{d.avatar}}" style="height:60px;width: 60px" class="image-show">
|
||||
<div class="layui-input-inline" style="text-align: left;">
|
||||
<p>用户编号:{{d.user_sn}}</p>
|
||||
<p style="width: 300px;text-overflow:ellipsis;overflow: hidden">用户昵称:{{d.nickname}}</p>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="level-info">
|
||||
{{d.level_name}}({{d.weights}})级
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
layui.config({
|
||||
version:"{$front_version}",
|
||||
base: '/static/lib/'
|
||||
}).use(['table', 'form'], function () {
|
||||
let $ = layui.$
|
||||
, form = layui.form
|
||||
, table = layui.table;
|
||||
|
||||
//监听搜索
|
||||
form.on('submit(search)', function(data){
|
||||
var field = data.field;
|
||||
//执行重载
|
||||
table.reload('lists', {
|
||||
where: field,
|
||||
page: {curr: 1}
|
||||
});
|
||||
});
|
||||
|
||||
// 获取选中的用户信息
|
||||
window.user_selected = function user_selected()
|
||||
{
|
||||
var checkStatus = table.checkStatus('lists');
|
||||
return checkStatus.data[0]; //获取选中行的数据
|
||||
}
|
||||
|
||||
//清空查询
|
||||
form.on('submit(reset)', function(){
|
||||
$('#keyword').val('');
|
||||
$('#is_distribution').val('all');
|
||||
form.render('select');
|
||||
//刷新列表
|
||||
table.reload('lists', {
|
||||
where: [], page: {curr: 1}
|
||||
});
|
||||
});
|
||||
|
||||
// 数据表格渲染
|
||||
table.render({
|
||||
elem: '#lists'
|
||||
,url: '{:url("distribution.distribution_member/userLists")}' //数据接口
|
||||
,method: 'post'
|
||||
,page: true //开启分页
|
||||
,cols: [[ //表头
|
||||
{type: 'radio'}
|
||||
,{field: 'sn', title: '用户编号', width:380}
|
||||
,{field: 'nickname', title: '用户昵称', width:180}
|
||||
]]
|
||||
, text: {none: '暂无数据!'}
|
||||
, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count, //解析数据长度
|
||||
"data": res.data.lists, //解析数据列表
|
||||
};
|
||||
},
|
||||
response: {
|
||||
statusCode: 1
|
||||
}
|
||||
,done: function(res, curr, count){
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
@ -62,6 +62,7 @@
|
||||
<a class="layui-btn layui-btn-info layui-btn-sm" lay-event="download">下载二维码</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="verify">添加核销</a>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
@ -81,7 +82,7 @@
|
||||
, {field: "store_state", width: 150, align: "center", title: "审核状态", templet: '#storeState-operation'}
|
||||
, {field: "address", width: 300, align: "center", title: "商家位置"}
|
||||
, {field: "create_time", width: 200, align: "center", title: "创建时间"}
|
||||
, {fixed: 'right', title: '操作', width: 280, align: 'center', toolbar: '#localstore-operation'}
|
||||
, {fixed: 'right', title: '操作', width: 320, align: 'center', toolbar: '#localstore-operation'}
|
||||
]);
|
||||
|
||||
//图片放大
|
||||
@ -182,6 +183,37 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
verify(obj) {
|
||||
layer.open({
|
||||
type: 2
|
||||
, title: "添加核销人员"
|
||||
, content: "{:url('shop.LocalStore/verify')}?lstore_id=" + obj.data.lstore_id
|
||||
, area: ['90%', '90%']
|
||||
, btn: ["确定", "取消"]
|
||||
, yes: function (index, layero) {
|
||||
var iframeWindow = window["layui-layer-iframe" + index];
|
||||
var submit = layero.find("iframe").contents().find("#addSubmit");
|
||||
iframeWindow.layui.form.on("submit(addSubmit)", function (data) {
|
||||
like.ajax({
|
||||
url: "{:url('shop.LocalStore/verify')}",
|
||||
data: data.field,
|
||||
type: "POST",
|
||||
success: function (res) {
|
||||
if (res.code === 1) {
|
||||
layui.layer.msg(res.msg);
|
||||
layer.close(index);
|
||||
table.reload("like-table-lists", {
|
||||
where: {},
|
||||
page: {cur: 1}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
submit.trigger("click");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
like.eventClick(active);
|
||||
|
||||
136
app/admin/view/shop/local_store/verify.html
Executable file
136
app/admin/view/shop/local_store/verify.html
Executable file
@ -0,0 +1,136 @@
|
||||
{layout name="layout1" /}
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card">
|
||||
<input type="hidden" id="lstore_id" value="{$lstore_id}">
|
||||
<div class="layui-tab layui-tab-card" lay-filter="tab-all">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-card">
|
||||
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
||||
<div class="layui-form-item type">
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layuiadmin-btn-goods {$view_theme_color} select-goods">添加人员</button>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layuiadmin-btn-goods layui-btn-danger del-btn">删除人员</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-body">
|
||||
<table id="goods-lists" lay-filter="goods-lists"></table>
|
||||
<script type="text/html" id="avatar">
|
||||
<img src="{{d.user.abs_avatar}}" style="height:60px;width: 60px" class="image-show">
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="nickname">
|
||||
{{d.user.nickname}}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<input type="button" lay-submit lay-filter="select-submit" class="select-submit" id="select-submit" value="确认">
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.layui-table-cell {
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var table;
|
||||
layui.config({
|
||||
version:"{$front_version}",
|
||||
base: '/static/lib/' //静态资源所在路径
|
||||
}).use(['table','form'], function(){
|
||||
var $ = layui.$
|
||||
,form = layui.form
|
||||
,element = layui.element;
|
||||
|
||||
// 添加审核人员
|
||||
form.on('submit(addVerify)', function(){
|
||||
table.reload('goods-lists', {
|
||||
where: []
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
layui.define(['table', 'form'], function (exports) {
|
||||
var $ = layui.$
|
||||
, form = layui.form;
|
||||
table = layui.table;
|
||||
like.tableLists("#goods-lists", '{:url("shop.LocalStore/verify")}?lstore_id=' + $('#lstore_id').val(), [
|
||||
{type: 'checkbox'}
|
||||
, {field: "id", width: 60, title: "ID"}
|
||||
, {field: "avatar", width: 200, align: "center", title: "头像", templet: '#avatar'}
|
||||
, {field: "name", width: 120, align: "center", title: "昵称", templet: '#nickname'}
|
||||
]);
|
||||
})
|
||||
|
||||
// 选择人员
|
||||
$(document).on('click','.select-goods',function () {
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: '选择人员'
|
||||
,content: '{:url("shop.LocalStore/add_verify")}'
|
||||
,area: ['90%', '90%']
|
||||
,btn: ['确认', '取消']
|
||||
,yes: function(index, layero){
|
||||
var iframeWindow = window["layui-layer-iframe" + index];
|
||||
let user_selected = iframeWindow.user_selected();
|
||||
like.ajax({
|
||||
url: "{:url('shop.LocalStore/add_verify')}",
|
||||
data: {user_selected, lstore_id: $('#lstore_id').val()},
|
||||
type: "POST",
|
||||
success: function (res) {
|
||||
if (res.code === 1) {
|
||||
layui.layer.msg(res.msg);
|
||||
layer.close(index);
|
||||
table.reload("goods-lists", {
|
||||
where: {},
|
||||
page: {cur: 1}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
layer.close(index);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 删除
|
||||
$(document).on('click', '.del-btn', () => {
|
||||
var checkStatus = table.checkStatus('goods-lists');
|
||||
var checkData = checkStatus.data;
|
||||
var ids = [];
|
||||
// 取出选中的行ID
|
||||
checkData.forEach(function (item) {
|
||||
ids.push(parseInt(item['id']));
|
||||
});
|
||||
|
||||
if (ids.length <= 0) {
|
||||
layui.layer.msg('请先选择要删除的人员', {time: 1000});
|
||||
return false;
|
||||
}
|
||||
|
||||
layer.confirm('确定删除所选人员?', function(index){
|
||||
// 提交数据
|
||||
like.ajax({
|
||||
url:'{:url("shop.LocalStore/del_verify")}',
|
||||
data:{ids},
|
||||
type:"post",
|
||||
success:function(res) {
|
||||
if(res.code === 1) {
|
||||
layui.layer.msg(res.msg, {offset:'15px', icon:1 ,time: 1000});
|
||||
table.reload('goods-lists', { where: [] });
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\localstore;
|
||||
|
||||
use app\common\basics\Models;
|
||||
|
||||
class LocalStore extends Models
|
||||
{
|
||||
protected $table = 'ls_local_store';
|
||||
}
|
||||
16
app/common/model/localstore/LocalStoreVerify.php
Normal file
16
app/common/model/localstore/LocalStoreVerify.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\localstore;
|
||||
|
||||
use app\common\basics\Models;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class LocalStoreVerify extends Models
|
||||
{
|
||||
protected $table = 'ls_local_store_verify';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id')->field('id, avatar as abs_avatar, nickname');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user