237 lines
6.1 KiB
HTML
237 lines
6.1 KiB
HTML
{extend name="app/shop/view/base.html"/}
|
|
{block name="resources"}
|
|
<style>
|
|
.screen {
|
|
margin-top: 15px;
|
|
}
|
|
</style>
|
|
{/block}
|
|
{block name="body"}
|
|
<div class="screen layui-collapse" lay-filter="selection_panel">
|
|
<div class="layui-colla-item">
|
|
<form class="layui-colla-content layui-form layui-show">
|
|
<div class="layui-form-item">
|
|
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">姓名:</label>
|
|
<div class="layui-input-inline">
|
|
<input type="text" id="real_name" name="real_name" placeholder="请输入姓名" class="layui-input" {if $parent_info}value="{$parent_info.parent_name}"{/if}>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">状态:</label>
|
|
<div class="layui-input-inline">
|
|
<select name="status" lay-filter="status">
|
|
<option value="">全部</option>
|
|
<option value="1">正常</option>
|
|
<option value="-1">已冻结</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" name="start_time" id="start_time" autocomplete="off" placeholder="开始时间" readonly>
|
|
<i class=" iconrili iconfont calendar"></i>
|
|
</div>
|
|
<div class="layui-form-mid">-</div>
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input" name="end_time" id="end_time" autocomplete="off" placeholder="结束时间" readonly>
|
|
<i class=" iconrili iconfont calendar"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" name="parent_id" {if $parent_info} value="{$parent_info.parent}"{/if}/>
|
|
<!-- 列表 -->
|
|
<table id="manage_list" lay-filter="manage_list"></table>
|
|
|
|
<input type="hidden" value="" id="param" />
|
|
|
|
<script type="text/html" id="memberInfo">
|
|
<div class='table-title'>
|
|
<div class='title-content'>
|
|
<p class="layui-elip">{{d.real_name}}</p>
|
|
<p class="layui-elip">{{d.mobile}}</p>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
<!-- 状态 -->
|
|
<script type="text/html" id="status">
|
|
{{# if(d.status == 1){ }}
|
|
<span style="color: green;">正常</span>
|
|
{{# }else if(d.status == -1){ }}
|
|
<span style="color: gray;">冻结</span>
|
|
{{# } }}
|
|
</script>
|
|
|
|
<!-- 工具栏操作 -->
|
|
<script type="text/html" id="operation">
|
|
{{# if(d.parent != parent_id || d.parent==0){ }}
|
|
<div class="table-btn">
|
|
<a class="layui-btn" lay-event="confirm">变更</a>
|
|
</div>
|
|
{{# } }}
|
|
{{# if(d.parent == parent_id){ }}
|
|
<div class="table-btn">
|
|
<a class="layui-btn" lay-event="cancelconfirm">取消</a>
|
|
</div>
|
|
{{# } }}
|
|
</script>
|
|
{/block}
|
|
|
|
{block name="script"}
|
|
<script>
|
|
var repeat_flag = false;
|
|
var parent_id = $("input[name='parent_id']").val();
|
|
layui.use(['form', 'laydate'], function() {
|
|
var table,
|
|
form = layui.form,
|
|
laydate = layui.laydate;
|
|
form.render();
|
|
//渲染时间
|
|
laydate.render({
|
|
elem: '#start_time',
|
|
type: 'datetime'
|
|
});
|
|
laydate.render({
|
|
elem: '#end_time',
|
|
type: 'datetime'
|
|
});
|
|
table = new Table({
|
|
elem: '#manage_list',
|
|
url: ns.url("saas://shop/site/change"),
|
|
where:{
|
|
parent_id : "{$parent_id}"
|
|
},
|
|
cols: [
|
|
[ {
|
|
title: '会员信息',
|
|
unresize: 'false',
|
|
width: '15%',
|
|
templet: '#memberInfo'
|
|
},
|
|
{
|
|
field: 'real_name',
|
|
title: '姓名',
|
|
unresize: 'false',
|
|
width: '30%'
|
|
},
|
|
{
|
|
field: 'status',
|
|
title: '当前状态',
|
|
templet: '#status',
|
|
unresize: 'false',
|
|
width: '10%'
|
|
}, {
|
|
field: 'create_time',
|
|
title: '添加时间',
|
|
unresize: 'false',
|
|
width: '15%',
|
|
templet: function(data) {
|
|
return ns.time_to_date(data.create_time);
|
|
}
|
|
}, {
|
|
title: '操作',
|
|
toolbar: '#operation',
|
|
unresize: 'false',
|
|
align:'right'
|
|
}]
|
|
]
|
|
});
|
|
|
|
/**
|
|
* 搜索功能
|
|
*/
|
|
form.on('submit(search)', function(data) {
|
|
table.reload({
|
|
page: {
|
|
curr: 1
|
|
},
|
|
where: data.field
|
|
});
|
|
return false;
|
|
});
|
|
|
|
/**
|
|
* 监听工具栏操作+
|
|
*/
|
|
table.tool(function(obj) {
|
|
var data = obj.data,
|
|
event = obj.event;
|
|
console.log(data)
|
|
switch (event) {
|
|
case 'confirm': //确认更改上下级关系
|
|
layer.confirm('确定要将该经理变更为主管经理吗?', function () {
|
|
if (repeat_flag) return;
|
|
repeat_flag = true;
|
|
$.ajax({
|
|
url: ns.url("saas://shop/site/confirmChange"),
|
|
data: {
|
|
parent:data.id,
|
|
manage_name:data.real_name,
|
|
id:"{$parent_id}",
|
|
site_id:"{$site_id}",
|
|
type:1
|
|
},
|
|
dataType: 'JSON',
|
|
type: 'POST',
|
|
async: false,
|
|
success: function(res) {
|
|
layer.msg(res.message);
|
|
repeat_flag = false;
|
|
if (res.code == 0) {
|
|
$("#param").val(1);
|
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
|
parent.layer.close(index); //再执行关闭
|
|
}
|
|
}
|
|
});
|
|
});
|
|
break;
|
|
case 'cancelconfirm': //确认更改上下级关系
|
|
layer.confirm('确定要取消主管吗?', function () {
|
|
if (repeat_flag) return;
|
|
repeat_flag = true;
|
|
$.ajax({
|
|
url: ns.url("saas://shop/site/confirmChange"),
|
|
data: {
|
|
parent:data.id,
|
|
manage_name:data.real_name,
|
|
id:"{$parent_id}",
|
|
site_id:"{$site_id}",
|
|
type:2
|
|
},
|
|
dataType: 'JSON',
|
|
type: 'POST',
|
|
async: false,
|
|
success: function(res) {
|
|
layer.msg(res.message);
|
|
repeat_flag = false;
|
|
if (res.code == 0) {
|
|
$("#param").val(1);
|
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
|
parent.layer.close(index); //再执行关闭
|
|
}
|
|
}
|
|
});
|
|
});
|
|
break;
|
|
}
|
|
});
|
|
});
|
|
function fun(callback) {
|
|
var param = $("#param").val();
|
|
callback(param);
|
|
}
|
|
</script>
|
|
{/block} |