179 行
6.3 KiB
HTML
可执行文件
179 行
6.3 KiB
HTML
可执行文件
<!DOCTYPE html>
|
|
<html>
|
|
<!--[1.2.7]-->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title></title>
|
|
<link rel="stylesheet" href="__PUBLIC__/bootstrap/css/bootstrap.css">
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
|
<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;
|
|
}
|
|
.goods_edit{
|
|
box-sizing: border-box;
|
|
padding: 10px 25px 0px 25px;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.goods_table{
|
|
box-sizing: border-box;
|
|
padding: 0px 25px;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body style="cursor: pointer;">
|
|
<div class="goodsBox">
|
|
<div class="goods_edit">
|
|
<button type="button" class="layui-btn" id="retu">返回</button>
|
|
<form action="#" class="form-inline PromotionForm">
|
|
<if condition="$authArr['score_banner_add'] eq true">
|
|
<button type="button" class="layui-btn" id="add" style="margin: 0 0 0 20px;">添加</button>
|
|
</if>
|
|
</form>
|
|
</div>
|
|
<div class="goods_table">
|
|
<table class="layui-hide" id="test" lay-filter="demo"></table>
|
|
</div>
|
|
<script type="text/html" id="switchTpl">
|
|
<input type="checkbox" name="status" <if condition="$authArr['score_status'] neq true"> disabled</if> 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>
|
|
<script type="text/html" id="barDemo">
|
|
<if condition="$authArr['score_delimg'] eq true">
|
|
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>
|
|
</if>
|
|
</script>
|
|
<script src="__PUBLIC__/jquery/js/jquery.min.js"></script>
|
|
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
|
<script>
|
|
layui.use(['form', 'table'], function () {
|
|
var table = layui.table;
|
|
var form = layui.form;
|
|
//展示已知数据
|
|
table.render({
|
|
elem: '#test',
|
|
url: "{:U('bannerData')}",
|
|
method:'post',
|
|
cols: [
|
|
[ //标题栏
|
|
{
|
|
field: 'index',
|
|
title: '序号',
|
|
width: 60
|
|
},{
|
|
field: 'image',
|
|
title: '图片',
|
|
style: 'height:100%;',
|
|
align:'center',
|
|
templet: '<div><img src="{{ d.image}}" style="max-width: 200px!important;"></div>'
|
|
}, {
|
|
field: 'status',
|
|
title: '状态',
|
|
templet: '#switchTpl',
|
|
align:'center'
|
|
}, {
|
|
field: 'right',
|
|
title: '操作',
|
|
align: 'center',
|
|
toolbar: '#barDemo',
|
|
align:'center'
|
|
}]
|
|
],
|
|
page: {
|
|
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
|
}, //是否开启分页
|
|
});
|
|
//监听状态操作
|
|
form.on('switch(sexDemo)', function(obj){
|
|
console.log($(this).attr('date-value'));
|
|
this.value = this.value == 1 ? 2 : 1;
|
|
var status = this.value;
|
|
var id = $(obj.elem).attr('data-id');
|
|
$.ajax({
|
|
url: "{:U('score_status')}",
|
|
type: 'POST',
|
|
data: {
|
|
status: status,
|
|
id: id
|
|
},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
layer.msg('修改成功', {icon: 1, time: 500})
|
|
} else {
|
|
layer.msg('修改失败', {icon: 4, time: 500})
|
|
}
|
|
}
|
|
})
|
|
});
|
|
$('#Preservation').click(function () {
|
|
table.reload('test', {
|
|
page: {
|
|
curr: 1 //重新从第 1 页开始
|
|
}
|
|
, where: {
|
|
keyword: $('#keyword').val()
|
|
}
|
|
});
|
|
})
|
|
table.on('tool(demo)', function (obj) {
|
|
var data = obj.data;
|
|
var layEvent = obj.event;
|
|
var tr = obj.tr;
|
|
|
|
if (layEvent === 'detail') { //查看
|
|
window.location.href = "{:U('shiftingdetail')}?id=" + data.id;
|
|
} else if (layEvent === 'del') { //删除
|
|
layer.confirm('确定删除这个图片吗?', function (index) {
|
|
layer.close(index);
|
|
//向服务端发送删除指令
|
|
$.ajax({
|
|
url: "{:U('score_delimg')}",
|
|
data: {id: data.id},
|
|
type: 'post',
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
layer.msg(res.msg, {icon: 1, time: 1000})
|
|
obj.del();
|
|
} else {
|
|
layer.msg(res.msg, {icon: 4, time: 1000})
|
|
}
|
|
}
|
|
})
|
|
});
|
|
}
|
|
});
|
|
$('#add').click(function () {
|
|
layer.open({
|
|
type: 2,
|
|
content: "{:U('score_banner_add')}",
|
|
title: "添加",
|
|
area: ["90%", '90%'],
|
|
btnAlign: 'c',
|
|
end: function () {
|
|
table.reload('test', {});
|
|
}
|
|
})
|
|
|
|
})
|
|
})
|
|
$('#retu').click(function () {
|
|
window.history.go(-1);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|