You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
408 lines
18 KiB
408 lines
18 KiB
<?php /*a:2:{s:62:"E:\waibao\ahbcqz\server\app\shop\view\coupon\coupon\lists.html";i:1679478874;s:50:"E:\waibao\ahbcqz\server\app\shop\view\layout1.html";i:1679478874;}*/ ?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title><?php echo url(); ?></title>
|
|
<meta name="renderer" content="webkit">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
<link rel="stylesheet" href="/static/lib/layui/css/layui.css?v=<?php echo htmlentities($front_version); ?>">
|
|
<link rel="stylesheet" href="/static/admin/css/app.css">
|
|
<link rel="stylesheet" href="/static/admin/css/like.css">
|
|
<script src="/static/lib/layui/layui.js?v=<?php echo htmlentities($front_version); ?>"></script>
|
|
<script src="/static/admin/js/app.js"></script>
|
|
</head>
|
|
<body >
|
|
<?php echo $js_code; ?>
|
|
<script src="/static/admin/js/jquery.min.js"></script>
|
|
<script src="/static/admin/js/function.js"></script>
|
|
|
|
<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>
|
|
<p>* 已下架的优惠券停止发放,已发放的优惠券在用券时间内能继续使用。</p>
|
|
<p>* 已下架的优惠券可以删除,删除后已发放的优惠券不能继续使用并且用户不可见。</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--搜索模块-->
|
|
<div class="layui-form" style="margin-top: 30px;">
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">优惠券名称:</label>
|
|
<div class="layui-input-inline" style="width: 200px;">
|
|
<input type="text" id="name" name="name" placeholder="请输入优惠券名称" autocomplete="off" class="layui-input">
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">领取方式:</label>
|
|
<div class="layui-input-inline" style="width: 200px;">
|
|
<select name="get_type" id="get_type">
|
|
<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" class="layui-input time" id="start_time" name="start_time" autocomplete="off">
|
|
</div>
|
|
<div class="layui-input-inline" style="margin-right: 5px;width: 10px;">
|
|
<label class="layui-form-mid">-</label>
|
|
</div>
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input time" id="end_time" name="end_time" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-coupon <?php echo htmlentities($view_theme_color); ?>" lay-submit lay-filter="coupon-search">查询</button>
|
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-coupon layui-btn-primary }" lay-submit lay-filter="coupon-clear-search">重置</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--选项卡-->
|
|
<div class="layui-tab layui-tab-card" lay-filter="tab-all">
|
|
|
|
<ul class="layui-tab-title">
|
|
<li data-type='1' class="layui-this">上架中</li>
|
|
<li data-type='0' >已下架</li>
|
|
</ul>
|
|
|
|
<div class="layui-tab-item layui-show">
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<div style="padding-bottom: 10px;">
|
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-coupon <?php echo htmlentities($view_theme_color); ?>" data-type="add">新增优惠券</button>
|
|
</div>
|
|
<!-- 动态表格-->
|
|
<table id="coupon-lists" lay-filter="coupon-lists"></table>
|
|
<!-- 行工具模板 功能按钮-->
|
|
<script type="text/html" id="coupon-operation">
|
|
<a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="detail">详情</a>
|
|
<a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="log">发放记录</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="status">
|
|
{{# if(d.status){ }}
|
|
下架
|
|
{{# } else { }}
|
|
上架
|
|
{{# } }}
|
|
</a>
|
|
{{# if(d.status == 0){ }}
|
|
<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a>
|
|
{{# } }}
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<style>
|
|
.layui-table-cell {
|
|
height: auto;
|
|
}
|
|
.layui-form-label{
|
|
width: 86px;
|
|
}
|
|
</style>
|
|
<script>
|
|
layui.config({
|
|
version:"<?php echo htmlentities($front_version); ?>",
|
|
base: '/static/lib/' //静态资源所在路径
|
|
}).use(['table','laydate','form'], function(){
|
|
var $ = layui.$
|
|
,form = layui.form
|
|
,table = layui.table
|
|
,laydate = layui.laydate
|
|
,element = layui.element;
|
|
|
|
// 监听行工具栏按钮
|
|
$('.layui-btn.layuiadmin-btn-coupon').on('click', function(){
|
|
var type = $(this).data('type');
|
|
active[type] ? active[type].call(this) : '';
|
|
});
|
|
|
|
//日期时间范围
|
|
laydate.render({
|
|
elem: '#start_time'
|
|
, type: 'datetime'
|
|
,theme: '#1E9FFF'
|
|
});
|
|
|
|
laydate.render({
|
|
elem: '#end_time'
|
|
, type: 'datetime'
|
|
,theme: '#1E9FFF'
|
|
});
|
|
|
|
//事件
|
|
var active = {
|
|
add: function(){
|
|
var index = layer.open({
|
|
type: 2
|
|
,title: '新增优惠券'
|
|
,content: '<?php echo url("coupon.coupon/add"); ?>'
|
|
,area: ['90%', '90%']
|
|
,btn: ['保存', '取消']
|
|
,maxmin: true
|
|
,yes: function(index, layero){
|
|
var iframeWindow = window['layui-layer-iframe'+ index]
|
|
,submitID = 'add-coupon-submit'
|
|
,submit = layero.find('iframe').contents().find('#'+ submitID)
|
|
,goods_ids = iframeWindow.callbackdata();
|
|
//监听提交
|
|
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
|
|
var field = data.field;
|
|
field.goods_ids = goods_ids;
|
|
like.ajax({
|
|
url:'<?php echo url("coupon.coupon/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('coupon-lists'); //数据刷新
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
submit.trigger('click');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
//监听搜索
|
|
form.on('submit(coupon-search)', function(data){
|
|
var field = data.field;
|
|
//执行重载
|
|
table.reload('coupon-lists', {
|
|
where: field,
|
|
page: {
|
|
curr: 1 //重新从第 1 页开始
|
|
}
|
|
});
|
|
});
|
|
//清空查询
|
|
form.on('submit(coupon-clear-search)', function(){
|
|
$('#name').val(''); //清空输入框
|
|
$('#get_type').val('');
|
|
$('#start_time').val('');
|
|
$('#end_time').val('');
|
|
form.render('select');
|
|
//刷新列表
|
|
table.reload('coupon-lists', {
|
|
where: [],
|
|
page: {
|
|
curr: 1 //重新从第 1 页开始
|
|
}
|
|
});
|
|
});
|
|
//获取列表
|
|
getList('1')
|
|
//切换列表
|
|
element.on('tab(tab-all)', function (data) {
|
|
var type = $(this).attr('data-type');
|
|
getList(type)
|
|
});
|
|
|
|
//监听工具条
|
|
table.on('tool(coupon-lists)', function(obj){
|
|
var id = obj.data.id;
|
|
if(obj.event === 'detail'){
|
|
layer.open({
|
|
type: 2
|
|
,title: '优惠券详情'
|
|
,content: '<?php echo url("coupon.coupon/detail"); ?>?id='+id
|
|
,area: ['90%', '90%']
|
|
})
|
|
}
|
|
//优惠券编辑
|
|
if(obj.event === 'edit'){
|
|
layer.open({
|
|
type: 2
|
|
,title: '编辑优惠券'
|
|
,content: '<?php echo url("coupon.coupon/edit"); ?>?id='+id
|
|
,area: ['90%', '90%']
|
|
,btn: ['保存', '取消']
|
|
,maxmin: true
|
|
,yes: function(index, layero){
|
|
var iframeWindow = window['layui-layer-iframe'+ index]
|
|
,submitID = 'edit-coupon-submit'
|
|
,submit = layero.find('iframe').contents().find('#'+ submitID)
|
|
,goods_ids = iframeWindow.callbackdata();
|
|
//监听提交
|
|
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
|
|
var field = data.field;
|
|
field.goods_ids = goods_ids;
|
|
like.ajax({
|
|
url:'<?php echo url("coupon.coupon/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('coupon-lists'); //数据刷新
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
submit.trigger('click');
|
|
}
|
|
|
|
})
|
|
}
|
|
//发放记录
|
|
if(obj.event === 'log'){
|
|
layer.open({
|
|
type: 2
|
|
,title: '发放记录'
|
|
,content: '<?php echo url("coupon.coupon/log"); ?>?id='+id
|
|
,area: ['90%', '90%']
|
|
})
|
|
|
|
}
|
|
if(obj.event === 'status'){
|
|
var name = obj.data.name;
|
|
|
|
if(obj.data.status == 0) {
|
|
var tips = '确定要上架优惠券:'+'<span style="color: red">'+name+'</span>';
|
|
}else {
|
|
var tips = '确定要下架优惠券:'+'<span style="color: red">'+name+'</span>';
|
|
}
|
|
|
|
layer.confirm(tips, function(index){
|
|
like.ajax({
|
|
url:'<?php echo url("coupon.coupon/changeStatus"); ?>',
|
|
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('coupon-lists'); //数据刷新
|
|
}
|
|
}
|
|
});
|
|
layer.close(index);
|
|
|
|
|
|
})
|
|
|
|
}
|
|
//优惠券删除
|
|
if(obj.event == 'del'){
|
|
var name = obj.data.name;
|
|
layer.confirm('确定删除优惠券:'+'<span style="color: red">'+name+'</span>', function(index){
|
|
like.ajax({
|
|
url:'<?php echo url("coupon.coupon/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('coupon-lists'); //数据刷新
|
|
}
|
|
}
|
|
});
|
|
layer.close(index);
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
function getList(type) {
|
|
layui.define(['table', 'form'], function(exports){
|
|
var $ = layui.$
|
|
,table = layui.table
|
|
,form = layui.form;
|
|
|
|
var cols = [
|
|
{field: 'name',align: 'center',width:120,title: '优惠券名称'}
|
|
,{field: 'use_goods_type_desc',align: 'center',width:120, title: '使用场景'}
|
|
,{field: 'condition_type_desc',align: 'center',width:220, title: '优惠金额'}
|
|
,{field: 'send_total_type_desc',align: 'center',width:320, title: '已领取/剩余'}
|
|
,{field: 'get_type_desc',align: 'center',width:180,title: '领取方式'}
|
|
,{field: 'statusDesc',align: 'center',width:180,title: '状态'}
|
|
,{field: 'send_time',align: 'center',width: 320, align: 'center',title:'发放时间'}
|
|
,{field: 'use_time_desc',align: 'center',width:320, title:'用券时间'}
|
|
,{field: 'create_time',align: 'center',width:160, title:'创建时间'}
|
|
,{fixed: 'right', title: '操作',width:360, align: 'center', toolbar: '#coupon-operation'}
|
|
];
|
|
|
|
table.render({
|
|
id:'coupon-lists'
|
|
,elem: '#coupon-lists'
|
|
,url: '<?php echo url("coupon.coupon/lists"); ?>?type='+type //模拟接口
|
|
,cols: [cols]
|
|
,page:true
|
|
,text: {none: '暂无数据!'}
|
|
,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
|
|
return {
|
|
"code":res.code,
|
|
"msg":res.msg,
|
|
"count": res.data.count, //解析数据长度
|
|
"data": res.data.list, //解析数据列表
|
|
};
|
|
},
|
|
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>
|
|
</body>
|
|
</html>
|