13 changed files with 1318 additions and 35 deletions
@ -0,0 +1,63 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace app\admin\controller\content; |
|||
|
|||
|
|||
use app\admin\logic\content\HelpCategoryLogic; |
|||
use app\admin\logic\content\HelpLogic; |
|||
use app\admin\logic\content\ResourceCategoryLogic; |
|||
use app\admin\logic\content\ResourceLogic; |
|||
use app\admin\logic\content\ResourceLogLogic; |
|||
use app\admin\validate\content\HelpValidate; |
|||
use app\common\basics\AdminBase; |
|||
use app\common\enum\PayEnum; |
|||
use app\common\model\Client_; |
|||
use app\common\server\JsonServer; |
|||
|
|||
class ResourceLog extends AdminBase |
|||
{ |
|||
/** |
|||
* @NOTES: 帮助分类列表 |
|||
* @author: 张无忌 |
|||
*/ |
|||
public function lists() |
|||
{ |
|||
if ($this->request->isAjax()) { |
|||
$get = $this->request->get(); |
|||
$lists = ResourceLogLogic::lists($get); |
|||
return JsonServer::success("获取成功", $lists); |
|||
} |
|||
|
|||
// 订单来源 |
|||
$order_source = Client_::getClient(true); |
|||
// 支付方式 |
|||
$pay_way = PayEnum::getPayWay(true); |
|||
return view('', [ |
|||
'order_source' => $order_source, |
|||
'pay_way' => $pay_way, |
|||
]); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @NOTES: 删除帮助分类 |
|||
* @author: 张无忌 |
|||
*/ |
|||
public function del() |
|||
{ |
|||
if ($this->request->isAjax()) { |
|||
// (new HelpValidate())->goCheck('id'); |
|||
$id = $this->request->post('id'); |
|||
$res = ResourceLogLogic::del($id); |
|||
if ($res === false) { |
|||
$error = ResourceLogLogic::getError() ?: '删除失败'; |
|||
return JsonServer::error($error); |
|||
} |
|||
return JsonServer::success('删除成功'); |
|||
} |
|||
|
|||
return JsonServer::error('异常'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace app\admin\controller\content; |
|||
|
|||
|
|||
use app\admin\logic\content\HelpCategoryLogic; |
|||
use app\admin\logic\content\HelpLogic; |
|||
use app\admin\logic\content\ResourceCategoryLogic; |
|||
use app\admin\logic\content\ResourceDownloadLogic; |
|||
use app\admin\logic\content\ResourceLogic; |
|||
use app\admin\logic\content\ResourceLogLogic; |
|||
use app\admin\validate\content\HelpValidate; |
|||
use app\common\basics\AdminBase; |
|||
use app\common\enum\PayEnum; |
|||
use app\common\model\Client_; |
|||
use app\common\server\JsonServer; |
|||
|
|||
class UserResource extends AdminBase |
|||
{ |
|||
/** |
|||
* @NOTES: 帮助分类列表 |
|||
* @author: 张无忌 |
|||
*/ |
|||
public function lists() |
|||
{ |
|||
if ($this->request->isAjax()) { |
|||
$get = $this->request->get(); |
|||
$lists = ResourceDownloadLogic::lists($get); |
|||
return JsonServer::success("获取成功", $lists); |
|||
} |
|||
return view('',[ |
|||
'category' => ResourceCategoryLogic::getCategory() |
|||
]); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<?php |
|||
namespace app\admin\controller\user; |
|||
|
|||
|
|||
use app\admin\logic\order\OrderLogic; |
|||
use app\admin\logic\user\ShipLogic; |
|||
use app\admin\logic\user\ShipLogLogic; |
|||
use app\common\basics\AdminBase; |
|||
use app\common\enum\PayEnum; |
|||
use app\common\model\Client_; |
|||
use app\common\model\order\Order as OrderModel; |
|||
use app\common\server\ConfigServer; |
|||
use app\common\server\JsonServer; |
|||
use think\exception\ValidateException; |
|||
use app\admin\validate\user\LevelValidate; |
|||
use app\admin\logic\user\LevelLogic; |
|||
|
|||
class ShipLog extends AdminBase |
|||
{ |
|||
public function lists() |
|||
{ |
|||
if($this->request->isAjax()){ |
|||
$get = $this->request->get(); |
|||
$lists = ShipLogLogic::lists($get); |
|||
return JsonServer::success('', $lists); |
|||
} |
|||
// 订单来源 |
|||
$order_source = Client_::getClient(true); |
|||
// 支付方式 |
|||
$pay_way = PayEnum::getPayWay(true); |
|||
return view('', [ |
|||
'order_source' => $order_source, |
|||
'pay_way' => $pay_way, |
|||
]); |
|||
} |
|||
|
|||
public function del() |
|||
{ |
|||
$id = $this->request->post('id', '', 'intval'); |
|||
$result = ShipLogLogic::del($id); |
|||
if($result === true) { |
|||
return JsonServer::success('删除成功'); |
|||
} |
|||
return JsonServer::error(ShipLogLogic::getError()); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace app\admin\logic\content; |
|||
|
|||
|
|||
use app\common\basics\Logic; |
|||
use app\common\model\content\Help; |
|||
use app\common\model\content\Resource; |
|||
use app\common\model\user\UserResource; |
|||
use app\common\server\AreaServer; |
|||
use app\common\server\UrlServer; |
|||
use Exception; |
|||
|
|||
class ResourceDownloadLogic extends Logic |
|||
{ |
|||
/** |
|||
* 获取分类 |
|||
* @param $get |
|||
* @return array |
|||
*/ |
|||
public static function lists($get) |
|||
{ |
|||
try { |
|||
$where = [ |
|||
['a.type', '=', 0] |
|||
]; |
|||
|
|||
if (!empty($get['title']) and $get['title']) |
|||
$where[] = ['c.title', 'like', '%'.$get['title'].'%']; |
|||
|
|||
if (!empty($get['cid']) and is_numeric($get['cid'])) |
|||
$where[] = ['c.cid', '=', $get['cid']]; |
|||
|
|||
|
|||
$model = new UserResource(); |
|||
$lists = $model->field('c.*,a.create_time as download_time,b.nickname,b.avatar,b.mobile,d.name as cname') |
|||
->alias('a') |
|||
->join('user b','a.user_id=b.id','LEFT') |
|||
->join('resource c','a.resource_id=c.id','LEFT') |
|||
->join('resource_category d','c.cid=d.id','LEFT') |
|||
->where($where) |
|||
->order('a.create_time', 'desc') |
|||
->paginate([ |
|||
'page' => $get['page'], |
|||
'list_rows' => $get['limit'], |
|||
'var_page' => 'page' |
|||
]) |
|||
->toArray(); |
|||
|
|||
foreach ($lists['data'] as &$item) { |
|||
$item['category'] = $item['cname'] ?? '未知'; |
|||
$item['is_show'] = $item['is_show'] ? '显示' : '隐藏'; |
|||
$item['path'] = $item['path']?UrlServer::getFileUrl($item['path']):''; |
|||
$item['path_name']= $item['path']?substr($item['path'],strrpos($item['path'],"/")+1):''; |
|||
$item['address'] = $item['province_id']?AreaServer::getAddress([ |
|||
$item['province_id'], |
|||
$item['city_id'], |
|||
$item['district_id']]):''; |
|||
|
|||
} |
|||
|
|||
return ['count'=>$lists['total'], 'lists'=>$lists['data']]; |
|||
} catch (Exception $e) { |
|||
return ['error'=>$e->getMessage()]; |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
<?php |
|||
namespace app\admin\logic\content; |
|||
|
|||
use app\common\basics\Logic; |
|||
use app\common\enum\PayEnum; |
|||
use app\common\model\Client_; |
|||
use app\common\model\order\OrderResource; |
|||
use app\common\model\order\OrderUser; |
|||
use app\common\model\user\UserShip; |
|||
use app\common\model\user\UserTag; |
|||
use app\common\model\user\User; |
|||
|
|||
class ResourceLogLogic extends Logic |
|||
{ |
|||
public static function lists($get) |
|||
{ |
|||
|
|||
// 订单来源 |
|||
$order_source = Client_::getClient(true); |
|||
// 支付方式 |
|||
$pay_way = PayEnum::getPayWay(true); |
|||
|
|||
$where = []; |
|||
$where[] = ['a.del','=',0]; |
|||
|
|||
//订单类型 |
|||
if (isset($get['keyword']) && $get['keyword'] != '') { |
|||
$where[] = ['a.order_sn|b.nickname|b.mobile', 'like', "%".$get['keyword']."%"]; |
|||
} |
|||
|
|||
//订单类型 |
|||
if (isset($get['title']) && $get['title'] != '') { |
|||
$where[] = ['c.title', 'like', "%".$get['title']."%"]; |
|||
} |
|||
|
|||
//支付状态 |
|||
if (isset($get['pay_status']) && $get['pay_status'] != '') { |
|||
$where[] = ['a.pay_status', '=', $get['pay_status']]; |
|||
} |
|||
|
|||
//付款方式 |
|||
if (isset($get['pay_way']) && $get['pay_way'] != '') { |
|||
$where[] = ['a.pay_way', '=', $get['pay_way']]; |
|||
} |
|||
|
|||
//订单来源 |
|||
if (isset($get['order_source']) && $get['order_source'] != '') { |
|||
$where[] = ['a.order_source', '=', $get['order_source']]; |
|||
} |
|||
|
|||
//下单时间 |
|||
if (isset($get['start_time']) && $get['start_time'] != '') { |
|||
$where[] = ['a.create_time', '>=', strtotime($get['start_time'])]; |
|||
} |
|||
|
|||
if (isset($get['end_time']) && $get['end_time'] != '') { |
|||
$where[] = ['a.create_time', '<=', strtotime($get['end_time'])]; |
|||
} |
|||
$orderuser = new OrderResource(); |
|||
|
|||
|
|||
$lists = $orderuser |
|||
->where($where) |
|||
->field("a.*,b.nickname,b.avatar,b.mobile,c.title as resource_name") |
|||
->alias('a') |
|||
->join('user b','a.user_id=b.id','LEFT') |
|||
->join('resource c','a.org_id=c.id','LEFT') |
|||
->page($get['page'], $get['limit'])->order('a.create_time desc')->select()->toArray(); |
|||
|
|||
|
|||
$count = $orderuser ->alias('a')->alias('a') |
|||
->join('user b','a.user_id=b.id','LEFT')->where($where)->count(); |
|||
foreach ($lists as &$item){ |
|||
$item['pay_time_str'] = $item['pay_time']>0?date("Y-m-d H:i:s",$item['pay_time']):'--'; |
|||
$item['pay_status_str'] = $item['pay_status']==0?'未支付':'已支付'; |
|||
$item['order_source_name'] = $order_source[$item['order_source']]; |
|||
$item['pay_way_name'] = $item['pay_way']==0?'无':$pay_way[$item['pay_way']]; |
|||
} |
|||
return [ |
|||
'lists' => $lists, |
|||
'count' => $count |
|||
]; |
|||
} |
|||
|
|||
public static function del($id) |
|||
{ |
|||
try{ |
|||
$data = [ |
|||
'id' => $id, |
|||
'update_time' => time(), |
|||
'del' => 1 |
|||
]; |
|||
UserShip::update($data); |
|||
return true; |
|||
}catch(\Exception $e){ |
|||
self::$error = $e->getMessage(); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,99 @@ |
|||
<?php |
|||
namespace app\admin\logic\user; |
|||
|
|||
use app\common\basics\Logic; |
|||
use app\common\enum\PayEnum; |
|||
use app\common\model\Client_; |
|||
use app\common\model\order\OrderUser; |
|||
use app\common\model\user\UserShip; |
|||
use app\common\model\user\UserTag; |
|||
use app\common\model\user\User; |
|||
|
|||
class ShipLogLogic extends Logic |
|||
{ |
|||
public static function lists($get) |
|||
{ |
|||
|
|||
// 订单来源 |
|||
$order_source = Client_::getClient(true); |
|||
// 支付方式 |
|||
$pay_way = PayEnum::getPayWay(true); |
|||
|
|||
$where = []; |
|||
$where[] = ['a.del','=',0]; |
|||
$where[] = ['a.order_status','=',3]; |
|||
|
|||
|
|||
//订单类型 |
|||
if (isset($get['keyword']) && $get['keyword'] != '') { |
|||
$where[] = ['a.order_sn|b.nickname|b.mobile', 'like', "%".$get['keyword']."%"]; |
|||
} |
|||
|
|||
//订单类型 |
|||
if (isset($get['type']) && $get['type'] != '') { |
|||
$where[] = ['a.type', '=', $get['type']]; |
|||
} |
|||
|
|||
//付款方式 |
|||
if (isset($get['pay_way']) && $get['pay_way'] != '') { |
|||
$where[] = ['a.pay_way', '=', $get['pay_way']]; |
|||
} |
|||
|
|||
//订单来源 |
|||
if (isset($get['order_source']) && $get['order_source'] != '') { |
|||
$where[] = ['a.order_source', '=', $get['order_source']]; |
|||
} |
|||
|
|||
//下单时间 |
|||
if (isset($get['start_time']) && $get['start_time'] != '') { |
|||
$where[] = ['a.create_time', '>=', strtotime($get['start_time'])]; |
|||
} |
|||
|
|||
if (isset($get['end_time']) && $get['end_time'] != '') { |
|||
$where[] = ['a.create_time', '<=', strtotime($get['end_time'])]; |
|||
} |
|||
$orderuser = new OrderUser(); |
|||
|
|||
|
|||
$lists = $orderuser |
|||
->where($where) |
|||
->field("a.*,b.nickname,b.avatar,b.mobile,c.title as ship_name") |
|||
->alias('a') |
|||
->join('user b','a.user_id=b.id','LEFT') |
|||
->join('user_ship c','a.org_id=c.id','LEFT') |
|||
->page($get['page'], $get['limit'])->select()->toArray(); |
|||
|
|||
|
|||
$count = $orderuser ->alias('a')->alias('a') |
|||
->join('user b','a.user_id=b.id','LEFT')->where($where)->count(); |
|||
foreach ($lists as &$item){ |
|||
$item['pay_time_str'] = date("Y-m-d H:i:s",$item['pay_time']); |
|||
$item['type_name'] = $item['type']==0?'免费':'付费'; |
|||
$item['order_source_name'] = $order_source[$item['order_source']]; |
|||
$item['pay_way_name'] = $item['pay_way']==0?'无':$pay_way[$item['pay_way']]; |
|||
$item['overdue_time_str'] = $item['overdue_time'] == 0?'永久': date("Y-m-d",$item['overdue_time']); |
|||
|
|||
} |
|||
return [ |
|||
'lists' => $lists, |
|||
'count' => $count |
|||
]; |
|||
} |
|||
|
|||
public static function del($id) |
|||
{ |
|||
try{ |
|||
$data = [ |
|||
'id' => $id, |
|||
'update_time' => time(), |
|||
'del' => 1 |
|||
]; |
|||
UserShip::update($data); |
|||
return true; |
|||
}catch(\Exception $e){ |
|||
self::$error = $e->getMessage(); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,304 @@ |
|||
{layout name="layout1" /} |
|||
<div class="wrapper"> |
|||
<div class="layui-card"> |
|||
<div class="layui-card-body"> |
|||
<div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4"> |
|||
<div class="layui-colla-item"> |
|||
<h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2> |
|||
<div class="layui-colla-content layui-show"> |
|||
<p>*资料购买记录;</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body layui-form"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-row"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">会员搜索:</label> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<input type="text" name="keyword" id="keyword" placeholder="订单号/会员昵称/手机号" |
|||
autocomplete="off" class="layui-input"> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">资料搜索:</label> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<input type="text" name="title" id="title" placeholder="资料标题" |
|||
autocomplete="off" class="layui-input"> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">付款状态:</label> |
|||
<div class="layui-input-block"> |
|||
<select name="pay_status" id="pay_status"> |
|||
<option value="">全部</option> |
|||
<option value="0">未支付</option> |
|||
<option value="1">已支付</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">订单来源:</label> |
|||
<div class="layui-input-block"> |
|||
<select name="order_source" id="order_source"> |
|||
<option value="">全部</option> |
|||
{foreach $order_source as $item => $val} |
|||
<option value="{$item}">{$val}</option> |
|||
{/foreach} |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">付款方式:</label> |
|||
<div class="layui-input-block"> |
|||
<select name="pay_way" id="pay_way"> |
|||
<option value="">全部</option> |
|||
{foreach $pay_way as $item => $val} |
|||
<option value="{$item}">{$val}</option> |
|||
{/foreach} |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit |
|||
lay-filter="user-order-search">查询 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-tab layui-tab-card" lay-filter="tab-all"> |
|||
<div class="layui-card"> |
|||
|
|||
<div class="layui-card-body"> |
|||
|
|||
<table id="user_order_lists" lay-filter="user_order_lists"></table> |
|||
<script type="text/html" id="image"> |
|||
<img src="{{d.avatar}}" style="height:40px;width: 40px" class="image-show"> |
|||
</script> |
|||
<script type="text/html" id="dayname"> |
|||
{{# if(d.vip_day > 0){ }} |
|||
{{d.vip_day}}天 |
|||
{{# }else{ }} |
|||
永久 |
|||
{{# } }} |
|||
</script> |
|||
|
|||
<script type="text/html" id="user_level-operation"> |
|||
<!-- <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> |
|||
</script> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<style> |
|||
.layui-table-cell { |
|||
height: auto; |
|||
} |
|||
</style> |
|||
<script> |
|||
layui.config({ |
|||
version:"{$front_version}", |
|||
base: '/static/lib/' //静态资源所在路径 |
|||
}).use(['table','form'], function(){ |
|||
var $ = layui.$ |
|||
,form = layui.form |
|||
,table = layui.table |
|||
,element = layui.element; |
|||
|
|||
//图片放大 |
|||
$(document).on('click', '.image-show', function () { |
|||
var src = $(this).attr('src'); |
|||
like.showImg(src,600); |
|||
}); |
|||
|
|||
$('.layui-btn.layuiadmin-btn-user_level').on('click', function(){ |
|||
var type = $(this).data('type'); |
|||
active[type] ? active[type].call(this) : ''; |
|||
}); |
|||
layui.define(['table', 'form'], function(exports){ |
|||
var $ = layui.$ |
|||
,table = layui.table |
|||
,form = layui.form; |
|||
|
|||
table.render({ |
|||
id:'user_order_lists' |
|||
,elem: '#user_order_lists' |
|||
,url: '{:url("content.resourceLog/lists")}' //模拟接口 |
|||
,cols: [[ |
|||
{field: 'order_sn',width:160, title: '订单号'} |
|||
,{field: 'nickname', title: '用户昵称',width:130} |
|||
,{field: 'avatar', title: '用户头像',width:100,toolbar:'#image'} |
|||
,{field: 'mobile', title: '手机号',width:130} |
|||
,{field: 'order_source_name',width:100, title:'客户端'} |
|||
,{field: 'pay_status_str',width:100, title:'支付状态'} |
|||
,{field: 'pay_way_name',width:100, title:'支付类型'} |
|||
,{field: 'pay_money',width:100, title:'支付金额'} |
|||
,{field: 'money',width:100, title:'原价'} |
|||
,{field: 'resource_name',width:200, title:'资料标题'} |
|||
,{field: 'pay_time_str',width:160, title:'支付时间'} |
|||
,{field: 'create_time',width:160, title:'购买时间'} |
|||
,{fixed: 'right', title: '操作', width:160,align: 'center', toolbar: '#user_level-operation'} |
|||
]] |
|||
,page:true |
|||
,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()); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
//监听搜索 |
|||
form.on('submit(user-order-search)', function (data) { |
|||
var field = data.field; |
|||
console.log(field) |
|||
//执行重载 |
|||
table.reload('user_order_lists', { |
|||
where: field, |
|||
page: { |
|||
curr: 1 |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
//事件 |
|||
var active = { |
|||
add: function(){ |
|||
var index = layer.open({ |
|||
type: 2 |
|||
,title: '新增付费会员类型' |
|||
,content: '{:url("user.ship/add")}' |
|||
,area: ['90%', '90%'] |
|||
,btn: ['保存', '取消'] |
|||
,maxmin: true |
|||
,yes: function(index, layero){ |
|||
var iframeWindow = window['layui-layer-iframe'+ index] |
|||
,submitID = 'add-user_level-submit' |
|||
,submit = layero.find('iframe').contents().find('#'+ submitID); |
|||
//监听提交 |
|||
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){ |
|||
var field = data.field; |
|||
like.ajax({ |
|||
url:'{:url("user.ship/add")}', |
|||
data:field, |
|||
type:"post", |
|||
success:function(res) |
|||
{ |
|||
if(res.code == 1) |
|||
{ |
|||
layui.layer.msg(res.msg, { |
|||
offset: '15px' |
|||
, icon: 1 |
|||
, time: 1000 |
|||
}); |
|||
layer.close(index); //关闭弹层 |
|||
table.reload('user_level-lists'); //数据刷新 |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
submit.trigger('click'); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
} |
|||
|
|||
table.on('tool(user_order_lists)', function(obj) { |
|||
var id = obj.data.id; |
|||
if (obj.event === 'edit') { |
|||
var index = layer.open({ |
|||
type: 2 |
|||
, title: '编辑付费会员类型' |
|||
, content: '{:url("user.ship/edit")}?id=' + id |
|||
, area: ['90%', '90%'] |
|||
, btn: ['保存', '取消'] |
|||
, maxmin: true |
|||
, yes: function (index, layero) { |
|||
var iframeWindow = window['layui-layer-iframe' + index] |
|||
, submitID = 'edit-user_level-submit' |
|||
, submit = layero.find('iframe').contents().find('#' + submitID); |
|||
//监听提交 |
|||
iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) { |
|||
var field = data.field; |
|||
like.ajax({ |
|||
url: '{:url("user.ship/edit")}', |
|||
data: field, |
|||
type: "post", |
|||
success: function (res) { |
|||
if (res.code == 1) { |
|||
layui.layer.msg(res.msg, { |
|||
offset: '15px' |
|||
, icon: 1 |
|||
, time: 1000 |
|||
}); |
|||
layer.close(index); //关闭弹层 |
|||
table.reload('user_order_lists'); //数据刷新 |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
submit.trigger('click'); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
if (obj.event === 'del') { |
|||
layer.confirm('确定删除记录?', function (index) { |
|||
like.ajax({ |
|||
url: '{:url("content.resourceLog/del")}', |
|||
data: {id: id}, |
|||
type: "post", |
|||
success: function (res) { |
|||
if (res.code == 1) { |
|||
layui.layer.msg(res.msg, { |
|||
offset: '15px' |
|||
, icon: 1 |
|||
, time: 1000 |
|||
}); |
|||
layer.close(index); //关闭弹层 |
|||
table.reload('user_order_lists'); //数据刷新 |
|||
} |
|||
} |
|||
}); |
|||
layer.close(index); |
|||
}) |
|||
|
|||
} |
|||
}) |
|||
|
|||
}); |
|||
</script> |
|||
@ -0,0 +1,237 @@ |
|||
{layout name="layout1" /} |
|||
|
|||
<div class="wrapper"> |
|||
<div class="layui-card"> |
|||
<!-- 操作提示 --> |
|||
<div class="layui-card-body"> |
|||
<div class="layui-collapse" style="border:1px dashed #c4c4c4"> |
|||
<div class="layui-colla-item"> |
|||
<h2 class="layui-colla-title like-layui-colla-title">操作提示</h2> |
|||
<div class="layui-colla-content layui-show"> |
|||
<p>*平台的资料中心。用户可在商城的下载查看。</p> |
|||
<p>*排序值越小越前,排序值相同时新增在前。</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 搜索区域 --> |
|||
<div class="layui-card-body layui-form"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"> |
|||
<label for="title" class="layui-form-label">资料标题:</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" id="title" name="title" autocomplete="off" class="layui-input"> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label for="cid" class="layui-form-label">资料分类:</label> |
|||
<div class="layui-input-inline"> |
|||
<select name="cid" id="cid"> |
|||
<option value="">全部</option> |
|||
{volist name="category" id="vo"} |
|||
<option value="{$vo.id}">{$vo.name}</option> |
|||
{/volist} |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<a class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="search">搜索</a> |
|||
<a class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="clear-search">重置</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 主体区域 --> |
|||
<div class="layui-card-body"> |
|||
|
|||
<table id="like-table-lists" lay-filter="like-table-lists"></table> |
|||
<script type="text/html" id="table-image"> |
|||
{{# if(d.image){ }} |
|||
<img src="{{d.image}}" alt="图" style="width:28px;height:28px;"> |
|||
{{# } }} |
|||
</script> |
|||
<script type="text/html" id="table-avatar"> |
|||
{{# if(d.avatar){ }} |
|||
<img src="{{d.avatar}}" style="height:40px;width: 40px" class="image-show"> |
|||
{{# } }} |
|||
</script> |
|||
|
|||
<script type="text/html" id="table-file"> |
|||
{{# if(d.path){ }} |
|||
<a href="{{d.path}}" download="{{d.path_name}}">点击下载</a> |
|||
{{# }else { }} |
|||
-- |
|||
{{# } }} |
|||
</script> |
|||
<script type="text/html" id="table-type"> |
|||
{{# if(d.type == 0){ }} |
|||
免费 |
|||
{{# } }} |
|||
{{# if(d.type == 1){ }} |
|||
VIP用户免费 |
|||
{{# } }} |
|||
{{# if(d.type == 2){ }} |
|||
付费{{d.price}}元下载 |
|||
{{# } }} |
|||
</script> |
|||
<script type="text/html" id="table-operation"> |
|||
<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a> |
|||
{{# if(d.is_show == '显示'){ }}<a class="layui-btn layui-btn-normal layui-btn-sm layui-btn-warm" lay-event="hide">隐藏</a>{{# } }} |
|||
{{# if(d.is_show == '隐藏'){ }}<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="hide">显示</a>{{# } }} |
|||
<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a> |
|||
</script> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<script> |
|||
layui.use(["table", "form"], function(){ |
|||
var table = layui.table; |
|||
var form = layui.form; |
|||
|
|||
|
|||
like.tableLists("#like-table-lists", "{:url()}", [ |
|||
{field:"nickname", width:150, align:"center", title:"用户昵称"} |
|||
,{field:"avatar", width:100, align:"center", title:"用户头像", templet:"#table-avatar"} |
|||
,{field:"mobile", width:150, align:"center", title:"用户手机号"} |
|||
,{field:"title", align:"center", title:"资料标题"} |
|||
,{field:"create_time", width:180, align:"center", title:"下载时间"} |
|||
,{field:"image", width:100, align:"center", title:"封面图", templet:"#table-image"} |
|||
,{field:"category", width:150, align:"center", title:"资料分类"} |
|||
,{field:"address", width:180, align:"center", title:"资料区域"} |
|||
,{field:"type", width:150, align:"center", title:"付费类型", templet:"#table-type"} |
|||
,{field:"type", width:100, align:"center", title:"文件", templet:"#table-file"} |
|||
,{field:"is_show", width:100, align:"center", title:"资料状态"}, |
|||
]); |
|||
|
|||
|
|||
var active = { |
|||
add: function() { |
|||
layer.open({ |
|||
type: 2 |
|||
,title: "新增资料" |
|||
,content: "{:url('content.UserResource/add')}" |
|||
,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('content.Resource/add')}", |
|||
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"); |
|||
} |
|||
}); |
|||
}, |
|||
edit: function(obj) { |
|||
layer.open({ |
|||
type: 2 |
|||
,title: "编辑资料" |
|||
,content: "{:url('content.Resource/edit')}?id=" + obj.data.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){ |
|||
data.field['id'] = obj.data.id; |
|||
like.ajax({ |
|||
url: "{:url('content.Resource/edit')}", |
|||
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"); |
|||
} |
|||
}); |
|||
}, |
|||
del: function(obj) { |
|||
layer.confirm("确定删除资料:"+obj.data.title, function(index) { |
|||
like.ajax({ |
|||
url: "{:url('content.Resource/del')}", |
|||
data: {id: obj.data.id}, |
|||
type: "POST", |
|||
success: function (res) { |
|||
if (res.code === 1) { |
|||
layui.layer.msg(res.msg); |
|||
layer.close(index); |
|||
obj.del(); |
|||
} |
|||
} |
|||
}); |
|||
layer.close(index); |
|||
}) |
|||
}, |
|||
hide: function(obj) { |
|||
var text = obj.data.is_show === '显示' ? '确定隐藏:' : '确定显示:'; |
|||
layer.confirm(text+obj.data.title, function(index) { |
|||
like.ajax({ |
|||
url: "{:url('content.Resource/hide')}", |
|||
data: {id: obj.data.id}, |
|||
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 } |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
layer.close(index); |
|||
}) |
|||
} |
|||
}; |
|||
like.eventClick(active); |
|||
|
|||
form.on("submit(search)", function(data){ |
|||
table.reload("like-table-lists", { |
|||
where: data.field, |
|||
page: { |
|||
curr: 1 |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
form.on("submit(clear-search)", function(){ |
|||
$("#title").val(""); |
|||
form.render("select"); |
|||
table.reload("like-table-lists", { |
|||
where: {}, |
|||
page: { |
|||
curr: 1 |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
}) |
|||
</script> |
|||
@ -0,0 +1,297 @@ |
|||
{layout name="layout1" /} |
|||
<div class="wrapper"> |
|||
<div class="layui-card"> |
|||
<div class="layui-card-body"> |
|||
<div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4"> |
|||
<div class="layui-colla-item"> |
|||
<h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2> |
|||
<div class="layui-colla-content layui-show"> |
|||
<p>*会员卡开通记录;</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body layui-form"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-row"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">会员搜索:</label> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<input type="text" name="keyword" id="keyword" placeholder="订单号/会员昵称/手机号" |
|||
autocomplete="off" class="layui-input"> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">类型:</label> |
|||
<div class="layui-input-block"> |
|||
<select name="type" id="type"> |
|||
<option value="">全部</option> |
|||
<option value="0">免费</option> |
|||
<option value="1">付费</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">订单来源:</label> |
|||
<div class="layui-input-block"> |
|||
<select name="order_source" id="order_source"> |
|||
<option value="">全部</option> |
|||
{foreach $order_source as $item => $val} |
|||
<option value="{$item}">{$val}</option> |
|||
{/foreach} |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">付款方式:</label> |
|||
<div class="layui-input-block"> |
|||
<select name="pay_way" id="pay_way"> |
|||
<option value="">全部</option> |
|||
{foreach $pay_way as $item => $val} |
|||
<option value="{$item}">{$val}</option> |
|||
{/foreach} |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-inline"> |
|||
<button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit |
|||
lay-filter="user-order-search">查询 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-tab layui-tab-card" lay-filter="tab-all"> |
|||
<div class="layui-card"> |
|||
|
|||
<div class="layui-card-body"> |
|||
|
|||
<table id="user_order_lists" lay-filter="user_order_lists"></table> |
|||
<script type="text/html" id="image"> |
|||
<img src="{{d.avatar}}" style="height:40px;width: 40px" class="image-show"> |
|||
</script> |
|||
<script type="text/html" id="dayname"> |
|||
{{# if(d.vip_day > 0){ }} |
|||
{{d.vip_day}}天 |
|||
{{# }else{ }} |
|||
永久 |
|||
{{# } }} |
|||
</script> |
|||
|
|||
<script type="text/html" id="user_level-operation"> |
|||
<!-- <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> |
|||
</script> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<style> |
|||
.layui-table-cell { |
|||
height: auto; |
|||
} |
|||
</style> |
|||
<script> |
|||
layui.config({ |
|||
version:"{$front_version}", |
|||
base: '/static/lib/' //静态资源所在路径 |
|||
}).use(['table','form'], function(){ |
|||
var $ = layui.$ |
|||
,form = layui.form |
|||
,table = layui.table |
|||
,element = layui.element; |
|||
|
|||
//图片放大 |
|||
$(document).on('click', '.image-show', function () { |
|||
var src = $(this).attr('src'); |
|||
like.showImg(src,600); |
|||
}); |
|||
|
|||
$('.layui-btn.layuiadmin-btn-user_level').on('click', function(){ |
|||
var type = $(this).data('type'); |
|||
active[type] ? active[type].call(this) : ''; |
|||
}); |
|||
layui.define(['table', 'form'], function(exports){ |
|||
var $ = layui.$ |
|||
,table = layui.table |
|||
,form = layui.form; |
|||
|
|||
table.render({ |
|||
id:'user_order_lists' |
|||
,elem: '#user_order_lists' |
|||
,url: '{:url("user.shipLog/lists")}' //模拟接口 |
|||
,cols: [[ |
|||
{field: 'order_sn',width:160, title: '订单号'} |
|||
,{field: 'nickname', title: '用户昵称',width:130} |
|||
,{field: 'avatar', title: '用户头像',width:100,toolbar:'#image'} |
|||
,{field: 'mobile', title: '手机号',width:130} |
|||
,{field: 'type_name',width:100, title: '类型'} |
|||
,{field: 'order_source_name',width:100, title:'客户端'} |
|||
,{field: 'pay_way_name',width:100, title:'支付类型'} |
|||
,{field: 'pay_money',width:100, title:'支付金额'} |
|||
,{field: 'ship_name',width:100, title:'会员卡名称'} |
|||
,{field: 'money',width:100, title:'原价'} |
|||
,{field: 'vip_day',width:100, title: '会员时间',toolbar:'#dayname'} |
|||
,{field: 'overdue_time_str',width:120, title:'会员到期'} |
|||
,{field: 'pay_time_str',width:160, title:'支付时间'} |
|||
,{field: 'create_time',width:160, title:'开通时间'} |
|||
,{fixed: 'right', title: '操作', width:160,align: 'center', toolbar: '#user_level-operation'} |
|||
]] |
|||
,page:true |
|||
,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()); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
//监听搜索 |
|||
form.on('submit(user-order-search)', function (data) { |
|||
var field = data.field; |
|||
console.log(field) |
|||
//执行重载 |
|||
table.reload('user_order_lists', { |
|||
where: field, |
|||
page: { |
|||
curr: 1 |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
//事件 |
|||
var active = { |
|||
add: function(){ |
|||
var index = layer.open({ |
|||
type: 2 |
|||
,title: '新增付费会员类型' |
|||
,content: '{:url("user.ship/add")}' |
|||
,area: ['90%', '90%'] |
|||
,btn: ['保存', '取消'] |
|||
,maxmin: true |
|||
,yes: function(index, layero){ |
|||
var iframeWindow = window['layui-layer-iframe'+ index] |
|||
,submitID = 'add-user_level-submit' |
|||
,submit = layero.find('iframe').contents().find('#'+ submitID); |
|||
//监听提交 |
|||
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){ |
|||
var field = data.field; |
|||
like.ajax({ |
|||
url:'{:url("user.ship/add")}', |
|||
data:field, |
|||
type:"post", |
|||
success:function(res) |
|||
{ |
|||
if(res.code == 1) |
|||
{ |
|||
layui.layer.msg(res.msg, { |
|||
offset: '15px' |
|||
, icon: 1 |
|||
, time: 1000 |
|||
}); |
|||
layer.close(index); //关闭弹层 |
|||
table.reload('user_level-lists'); //数据刷新 |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
submit.trigger('click'); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
} |
|||
|
|||
table.on('tool(user_order_lists)', function(obj) { |
|||
var id = obj.data.id; |
|||
if (obj.event === 'edit') { |
|||
var index = layer.open({ |
|||
type: 2 |
|||
, title: '编辑付费会员类型' |
|||
, content: '{:url("user.ship/edit")}?id=' + id |
|||
, area: ['90%', '90%'] |
|||
, btn: ['保存', '取消'] |
|||
, maxmin: true |
|||
, yes: function (index, layero) { |
|||
var iframeWindow = window['layui-layer-iframe' + index] |
|||
, submitID = 'edit-user_level-submit' |
|||
, submit = layero.find('iframe').contents().find('#' + submitID); |
|||
//监听提交 |
|||
iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) { |
|||
var field = data.field; |
|||
like.ajax({ |
|||
url: '{:url("user.ship/edit")}', |
|||
data: field, |
|||
type: "post", |
|||
success: function (res) { |
|||
if (res.code == 1) { |
|||
layui.layer.msg(res.msg, { |
|||
offset: '15px' |
|||
, icon: 1 |
|||
, time: 1000 |
|||
}); |
|||
layer.close(index); //关闭弹层 |
|||
table.reload('user_order_lists'); //数据刷新 |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
submit.trigger('click'); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
if (obj.event === 'del') { |
|||
layer.confirm('确定删除开通记录?', function (index) { |
|||
like.ajax({ |
|||
url: '{:url("user.shipLog/del")}', |
|||
data: {id: id}, |
|||
type: "post", |
|||
success: function (res) { |
|||
if (res.code == 1) { |
|||
layui.layer.msg(res.msg, { |
|||
offset: '15px' |
|||
, icon: 1 |
|||
, time: 1000 |
|||
}); |
|||
layer.close(index); //关闭弹层 |
|||
table.reload('user_order_lists'); //数据刷新 |
|||
} |
|||
} |
|||
}); |
|||
layer.close(index); |
|||
}) |
|||
|
|||
} |
|||
}) |
|||
|
|||
}); |
|||
</script> |
|||
@ -1,4 +1,4 @@ |
|||
<?php |
|||
//000000000000 |
|||
exit();?> |
|||
a:5:{i:0;s:75:"D:\waibao\ahbcqz\server\runtime\cache\1e\9273b3315671b45227b5827559a179.php";i:1;s:75:"D:\waibao\ahbcqz\server\runtime\cache\a1\55016152d5af019afbbfd20daf7335.php";i:2;s:75:"D:\waibao\ahbcqz\server\runtime\cache\c0\cf484f10720659d936916d74e6362a.php";i:3;s:75:"E:\waibao\ahbcqz\server\runtime\cache\35\4c90d26061baaa2f7a972849339da3.php";i:4;s:75:"E:\waibao\ahbcqz\server\runtime\cache\64\80bd487ac5e230fd1fb2d74457b697.php";} |
|||
a:6:{i:0;s:75:"D:\waibao\ahbcqz\server\runtime\cache\1e\9273b3315671b45227b5827559a179.php";i:1;s:75:"D:\waibao\ahbcqz\server\runtime\cache\a1\55016152d5af019afbbfd20daf7335.php";i:2;s:75:"D:\waibao\ahbcqz\server\runtime\cache\c0\cf484f10720659d936916d74e6362a.php";i:3;s:75:"E:\waibao\ahbcqz\server\runtime\cache\35\4c90d26061baaa2f7a972849339da3.php";i:4;s:75:"E:\waibao\ahbcqz\server\runtime\cache\64\80bd487ac5e230fd1fb2d74457b697.php";i:5;s:75:"E:\waibao\ahbcqz\server\runtime\cache\11\e63c5fed23ed0b72e5c3d85dccdf6a.php";} |
|||
Loading…
Reference in new issue