137 行
4.0 KiB
HTML
可执行文件
137 行
4.0 KiB
HTML
可执行文件
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>商品规格属性</title>
|
|
|
|
<!--引入layui样式-->
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
|
|
|
<style>
|
|
.pxll_headerBox {
|
|
width: 100%;
|
|
padding: 10px 0 10px 0;
|
|
}
|
|
|
|
.pxll_header {
|
|
border-left: 2px solid #232b42;
|
|
text-indent: 10px;
|
|
}
|
|
</style>
|
|
|
|
|
|
</head>
|
|
<body style="padding: 0 20px 0 20px;">
|
|
<div class="pxll_allBox">
|
|
<!--顶部-->
|
|
<div class="pxll_headerBox">
|
|
<div class="pxll_header">
|
|
商品属性/规格
|
|
</div>
|
|
</div>
|
|
|
|
<!--新增按钮-->
|
|
<div class="pxll_btnBox">
|
|
<button class="layui-btn" id="createNew">新增</button>
|
|
</div>
|
|
|
|
<!--表格展示-->
|
|
<div class="pxll_tableBox">
|
|
<table class="layui-hide" id="attributes" lay-filter="demo"></table>
|
|
</div>
|
|
|
|
<script type="text/html" id="barDemo">
|
|
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
|
</script>
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
|
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
|
|
|
<script>
|
|
layui.use(['table', 'layer', 'form'], function () {
|
|
var table = layui.table,
|
|
layer = layui.layer;
|
|
|
|
table.render({
|
|
elem: '#attributes'
|
|
, url: "{:U('Attributes/attributesList')}"
|
|
, with: 800
|
|
, cols: [
|
|
[
|
|
{field: 'id', title: 'ID', sort: true}
|
|
, {field: 'name', title: '属性/规格名称'}
|
|
, {field: 'content', title: '属性/规格值', sort: true}
|
|
, {field: 'right', title: '操作', align: 'center', toolbar: '#barDemo'}
|
|
|
|
]
|
|
]
|
|
,id:"loadTable"
|
|
,page:true
|
|
});
|
|
|
|
//监听工具条
|
|
table.on('tool(demo)', function(obj){
|
|
var data = obj.data;
|
|
if(obj.event === 'del'){
|
|
layer.confirm('确定要删除该规格属性吗?',{title:"警告",icon:7}, function(index){
|
|
var id = data.id;
|
|
|
|
$.ajax({
|
|
url:"{:U('Attributes/attrDelete')}",
|
|
type:"POST",
|
|
data:{
|
|
id:id
|
|
},
|
|
success:function (res) {
|
|
if (res.status==1){
|
|
layer.msg(res.msg,{time:2000});
|
|
obj.del();
|
|
layer.close(index);
|
|
} else{
|
|
layer.msg(res.msg,{time:2000});
|
|
}
|
|
}
|
|
})
|
|
});
|
|
} else if(obj.event === 'edit'){
|
|
var id = data.id;
|
|
layer.open({
|
|
type:2
|
|
,title:"修改规格属性"
|
|
,area:['100%','100%']
|
|
,content:"{:U('Attributes/attributeSet')}?id="+id
|
|
,shade:0.3
|
|
,end:function () {
|
|
table.reload("loadTable")
|
|
}
|
|
})
|
|
|
|
}
|
|
});
|
|
|
|
//新增
|
|
$("#createNew").click(function () {
|
|
|
|
layer.open({
|
|
type:2
|
|
,title:"新增规格属性"
|
|
,area:['100%','100%']
|
|
,content:"{:U('Attributes/attributeSet')}"
|
|
,shade:0.3
|
|
,end:function () {
|
|
table.reload("loadTable")
|
|
}
|
|
})
|
|
})
|
|
});
|
|
</script>
|
|
|
|
</html> |