178 行
5.9 KiB
HTML
可执行文件
178 行
5.9 KiB
HTML
可执行文件
<!--[1.8.91]-->
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/goodsList.css"/>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
table {
|
|
border: 1px solid #f1f1f1;
|
|
margin-top: 40px;
|
|
}
|
|
|
|
.layui-table-cell {
|
|
height: auto;
|
|
}
|
|
|
|
#exchange {
|
|
margin: 0 0 0 20px;
|
|
}
|
|
</style>
|
|
<div class="goodsBox">
|
|
<div class="goods_title">
|
|
<div class="goods_title_inner">
|
|
会员卡通知
|
|
</div>
|
|
</div>
|
|
<div class="goods_edit">
|
|
<form action="#" class="form-inline PromotionForm">
|
|
<if condition="$authArr['add_notice'] eq true">
|
|
<button type="button" class="layui-btn" id="add">新增通知</button>
|
|
</if>
|
|
</form>
|
|
</div>
|
|
<script type="text/html" id="switchTpl">
|
|
|
|
<input type="checkbox"
|
|
<if condition="$authArr['doChangeNotice'] neq true"> disabled
|
|
</if> name="status" date-value="{{d.status}}" data-id="{{d.id}}" value="{{d.status}}"
|
|
lay-skin="switch" lay-text="启用|禁用" lay-filter="sexDemo" {{ d.status== 1 ? 'checked' : '' }}>
|
|
|
|
</script>
|
|
<div class="goods_edit">
|
|
<table class="layui-hide" id="test" lay-filter="demo"></table>
|
|
<script type="text/html" id="barDemo">
|
|
<if condition="$authArr['edit_notice'] eq true">
|
|
<button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button>
|
|
</if>
|
|
<if condition="$authArr['del_notice'] eq true">
|
|
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>
|
|
</if>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
layui.use(['form', 'layedit', 'laydate', 'table'], function () {
|
|
// 日期
|
|
var laydate = layui.laydate, form = layui.form;
|
|
var table = layui.table;
|
|
//展示已知数据
|
|
table.render({
|
|
elem: '#test',
|
|
url: "{:U('notice_getNotice')}",
|
|
method: 'post',
|
|
cols: [
|
|
[{
|
|
field: 'index',
|
|
title: '序号',
|
|
width: 60
|
|
}, {
|
|
field: 'content',
|
|
title: '标题',
|
|
align: 'center'
|
|
}, {
|
|
field: 'url',
|
|
title: '浏览路径',
|
|
align: 'center'
|
|
}, {
|
|
field: 'addtime',
|
|
title: '添加时间',
|
|
align: 'center'
|
|
}, {
|
|
field: 'status',
|
|
title: '状态',
|
|
templet: '#switchTpl',
|
|
align: 'center'
|
|
}, {
|
|
field: 'right',
|
|
title: '操作',
|
|
align: 'center',
|
|
toolbar: '#barDemo'
|
|
}]
|
|
],
|
|
page: {
|
|
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
|
}, //是否开启分页
|
|
});
|
|
$('#Preservation').click(function () {
|
|
table.reload('test', {
|
|
page: {
|
|
curr: 1 //重新从第 1 页开始
|
|
}
|
|
, where: {
|
|
keyword: $('#keyword').val()
|
|
}
|
|
});
|
|
})
|
|
form.on('switch(sexDemo)', function (obj) {
|
|
var status = this.value;
|
|
var id = $(obj.elem).attr('data-id');
|
|
console.log(status);
|
|
console.log(id);
|
|
$.post("{:U('doChangeNotice')}", {
|
|
status: status,
|
|
id: id
|
|
}, function (res) {
|
|
console.log(res);
|
|
$(obj.elem).val(res.value);
|
|
if (res.value == 1) {
|
|
top.layer.msg(res.msg, {time: 1000});
|
|
$(obj.elem).parent().find('div').addClass('layui-form-onswitch');
|
|
$(obj.elem).parent().find('em').html('启用');
|
|
} else {
|
|
top.layer.msg(res.msg, {time: 1500});
|
|
$(obj.elem).parent().find('div').removeClass('layui-form-onswitch');
|
|
$(obj.elem).parent().find('em').html('禁用');
|
|
}
|
|
})
|
|
});
|
|
table.on('tool(demo)', function (obj) {
|
|
var data = obj.data;
|
|
var layEvent = obj.event;
|
|
var tr = obj.tr;
|
|
|
|
if (layEvent === 'del') { //删除
|
|
layer.confirm('确定删除这个通知吗?', function (index) {
|
|
layer.close(index);
|
|
$.post("{:U('del_notice')}", {
|
|
id: data.id
|
|
}, function (res) {
|
|
if (res.status == 1) {
|
|
obj.del();
|
|
} else {
|
|
top.layer.msg(res.msg, {time: 1000})
|
|
}
|
|
})
|
|
});
|
|
} else if (layEvent === 'edit') { //编辑
|
|
top.layer.open({
|
|
type: 2,
|
|
content: "{:U('edit_notice')}?id=" + data.id,
|
|
title: "编辑通知",
|
|
area: ["600px", '450px'],
|
|
btnAlign: 'c',
|
|
end: function () {
|
|
table.reload('test')
|
|
}
|
|
})
|
|
}
|
|
});
|
|
$('#add').click(function () {
|
|
console.log(111);
|
|
top.layer.open({
|
|
type: 2,
|
|
content: "{:U('add_notice')}",
|
|
title: "新增通知",
|
|
area: ["600px", '450px'],
|
|
btnAlign: 'c',
|
|
end: function () {
|
|
table.reload('test')
|
|
}
|
|
})
|
|
|
|
});
|
|
})
|
|
</script>
|