init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,146 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--[1.5.84]-->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
||||
<style>
|
||||
.layui-word-aux {
|
||||
margin-left: 110px;
|
||||
}
|
||||
|
||||
.default_img {
|
||||
width: 150px;
|
||||
border: 1px solid #ddd;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.default_img_box {
|
||||
padding: 10px 0px;
|
||||
}
|
||||
|
||||
.default_img_box {
|
||||
padding: 10px 0px;
|
||||
padding-left: 108px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="padding: 30px;">
|
||||
<form class="layui-form" action="">
|
||||
<input type="hidden" id="id" value="{$group.id}" name="id">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">等级名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" value="{$group.name}" id="groupname" required lay-verify="required"
|
||||
placeholder="请输入等级名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">折扣</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="{$group.discount}" name="discount" id="discount" required
|
||||
lay-verify="required" placeholder="请输入折扣" autocomplete="off" class="layui-input">
|
||||
(如:九折输入应为0.9)
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" type="button" id="submit">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.use(['form', 'upload', 'layer', 'laydate'], function () {
|
||||
var laydate = layui.laydate;
|
||||
laydate.render({
|
||||
elem: '#begin_time'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#end_time'
|
||||
});
|
||||
var form = layui.form;
|
||||
var upload = layui.upload;
|
||||
var layer = layui.layer;
|
||||
//执行实例
|
||||
$('#submit').click(function () {
|
||||
var groupname = $('#groupname').val();
|
||||
var discount = $('#discount').val();
|
||||
var id = $('#id').val();
|
||||
var reg=/^(0\.(0[1-9]|[1-9]{1,2}|[1-9]0)$)|^1$/;
|
||||
if (!groupname || !discount) {
|
||||
layer.msg('请先完善您的表单信息', {time: 2000})
|
||||
return false;
|
||||
} else if (discount > 1) {
|
||||
layer.msg('折扣设置错误', {time: 2000})
|
||||
return false;
|
||||
} else if(!reg.test(discount)){
|
||||
layer.msg('折扣设置错误', {time: 2000})
|
||||
return false;
|
||||
}else {
|
||||
$.ajax({
|
||||
url: "{:U('addAgentgroup')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
name: groupname,
|
||||
discount: discount
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
top.layer.msg(res.msg, {icon: 1, time: 1200}, function () {
|
||||
top.layer.closeAll();
|
||||
})
|
||||
} else {
|
||||
layer.msg(res.msg, {time: 1200})
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
//三级联动的ajax
|
||||
|
||||
$('#city').change(function () {
|
||||
$city = $('#city').val();//这变量是有数据的
|
||||
if (!$city) {
|
||||
$city = "{$cache.city}";
|
||||
}
|
||||
var check = "{$cache.area}";
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{:U('Area')}",
|
||||
data: 'city_id=' + $city + "&check=" + check,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$('#area').html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#pro').change(function () {
|
||||
$prov = $('#pro').val();//这变量是有数据的
|
||||
var check = "{$cache.city}";
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{:U('City')}",
|
||||
data: 'pro_id=' + $prov + "&check=" + check,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$('#city').html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#pro').change();
|
||||
$('#city').change();
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,221 @@
|
||||
<!--[1.5.22]-->
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #f1f1f1;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.layui-table-cell {
|
||||
height: 85px;
|
||||
line-height: 85px;
|
||||
padding: 0 15px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.layui-laypage .layui-laypage-curr .layui-laypage-em {
|
||||
background-color: #409EFF;
|
||||
}
|
||||
|
||||
.layui-btn-danger {
|
||||
background-color: #bbb;
|
||||
}
|
||||
|
||||
.layui-form-onswitch {
|
||||
background-color: #409EFF;
|
||||
border-color: #409EFF;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<form action="#" class="form-inline PromotionForm">
|
||||
<if condition="$authArr['addgroup'] eq true">
|
||||
<button type="button" class="layui-btn" id="add" style="background-color:#409EFF;">添加等级
|
||||
</button>
|
||||
</if>
|
||||
</form>
|
||||
<table class="layui-hide" id="test" lay-filter="demo"></table>
|
||||
</div>
|
||||
<script type="text/html" id="statusTpl">
|
||||
<if condition="$authArr['change'] eq true">
|
||||
<input type="checkbox" name="status" value="{{d.status}}" lay-skin="switch" data-id="{{d.id}}" lay-text="启用|禁用"
|
||||
lay-filter="status" {{ d.status== 1 ? 'checked' : '' }}>
|
||||
<else/>
|
||||
{{d.status==1?'启用':'禁用'}}
|
||||
</if>
|
||||
</script>
|
||||
<script type="text/html" id="barDemo">
|
||||
<if condition="$authArr['addgroup'] eq true">
|
||||
<button class="layui-btn layui-btn-xs" lay-event="edit" style="background-color:#409EFF">编辑</button>
|
||||
</if>
|
||||
<if condition="$authArr['delgroup'] eq true">
|
||||
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>
|
||||
</if>
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['form', 'layedit', 'laydate', 'table'], function () {
|
||||
// 日期
|
||||
var laydate = layui.laydate;
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
//展示已知数据
|
||||
table.render({
|
||||
elem: '#test',
|
||||
url: "{:U('indexshow')}",
|
||||
method: 'post',
|
||||
cols: [
|
||||
[{
|
||||
field: 'id',
|
||||
title: '序号',
|
||||
align: 'center',
|
||||
width: 60
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '代理商等级名称',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'discount',
|
||||
title: '代理折扣',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
field: 'addtime',
|
||||
title: '添加时间',
|
||||
align: 'center',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
width: 100,
|
||||
templet: '#statusTpl',
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
align: 'center',
|
||||
toolbar: '#barDemo'
|
||||
}]
|
||||
],
|
||||
page: {
|
||||
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
||||
}, //是否开启分页
|
||||
});
|
||||
// 日期
|
||||
lay('.test-item').each(function () {
|
||||
laydate.render({
|
||||
elem: this,
|
||||
trigger: 'click'
|
||||
});
|
||||
});
|
||||
table.on('tool(demo)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
|
||||
var data = obj.data; //获得当前行数据
|
||||
var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
|
||||
var tr = obj.tr; //获得当前行 tr 的DOM对象
|
||||
if (layEvent === 'del') { //删除
|
||||
layer.confirm('确定删除吗?', function (index) {
|
||||
layer.close(index);
|
||||
//向服务端发送删除指令
|
||||
$.ajax({
|
||||
url: "{:U('delgroup')}",
|
||||
data: {id: data.id},
|
||||
type: 'post',
|
||||
success: function (res) {
|
||||
// console.log(res)
|
||||
if (res.status == 1) {
|
||||
top.layer.msg(res.msg, {time: 1000}, function () {
|
||||
|
||||
})
|
||||
table.reload('test', {
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
}
|
||||
});
|
||||
} else {
|
||||
top.layer.msg(res.msg, {icon: 4, time: 1000})
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
} else if (layEvent === 'edit') { //编辑
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
content: "{:U('addgroup')}?id=" + data.id,
|
||||
title: "编辑-代理商等级",
|
||||
area: ["600px", '350px'],
|
||||
btnAlign: 'c',
|
||||
end: function () {
|
||||
table.reload('test', {});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
$('#add').click(function () {
|
||||
top.layer.open({
|
||||
type: 2,
|
||||
content: "{:U('addgroup')}",
|
||||
title: "添加代理商等级",
|
||||
area: ["600px", '450px'],
|
||||
btnAlign: 'c',
|
||||
end: function () {
|
||||
table.reload('test', {});
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
//监听状态操作
|
||||
form.on('switch(status)', function (obj) {
|
||||
var id = $(this).attr("data-id")
|
||||
var status = obj.elem.checked ? '1' : '2';
|
||||
$.ajax({
|
||||
url: "{:U('change')}",
|
||||
type: "POST",
|
||||
data: {id: id, status: status},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
top.layer.msg(res.msg, {time: 1500});
|
||||
} else {
|
||||
top.layer.msg(res.msg, {time: 1500}, function () {
|
||||
table.reload('test');
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
$('#submit').click(function () {
|
||||
var money = $('#money').val();
|
||||
if (!money) {
|
||||
layer.msg('请先完善您的表单信息', {time: 2000})
|
||||
return false;
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "{:U('addAgentmoney')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
money: money,
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status == 1) {
|
||||
top.layer.msg(res.msg, {icon: 1, time: 1200}, function () {
|
||||
layer.closeAll();
|
||||
window.location.reload();
|
||||
})
|
||||
} else {
|
||||
layer.msg(res.msg, {time: 1200})
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户