seller_list.html
4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
<fieldset class="layui-elem-field layui-field-title">
<legend>{:$title}</legend>
</fieldset>
<blockquote class="layui-elem-quote">
<a href="{:url('Seller/sellerList')}" class="layui-btn layui-btn-sm layui-btn-danger">
<i class="fa fa-file-image-o"></i> 商家信息列表
</a>
<a href="{:url('Template/uploadFile')}" class="layui-btn layui-btn-sm">
<i class="fa fa-file-image-o"></i> GIF图片、短视频上传
</a>
<a href="{:url('Template/Vegetable')}" class="layui-btn layui-btn-sm">
<i class="fa fa-file-image-o"></i> 菜品库管理
</a>
</blockquote>
<div class="demoTable">
搜索商家:<div class="layui-inline">
<input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off">
</div>
<button class="layui-btn" id="search" data-type="reload">搜索</button>
</div>
<table class="layui-table" id="list" lay-filter="list"></table>
</div>
{include file="common/foot"/}
<script type="text/html" id="action">
<a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a>
<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>
<a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">线下短信充值</a>
</script>
<script>
layui.use(['table','form'], function() {
var table = layui.table,$ = layui.jquery;
var tableIn = table.render({
elem: '#list',
url: '{:url("sellerList")}',
method: 'post',
page:true,
cols: [[
{field: 'id', title: '{:lang("id")}', width:60, fixed: true},
{field: 'name', title: '版本', width: 150},
{field: 'sellername', title: '商家名称', width: 150},
{field: 'phone', title: '商家电话', width: 150},
{field: 'map_address', title: '商家地址', width: 300},
{field: 'last_num', align: 'center',title: '短信余量', width: 120},
{field: 'statusVal', align: 'center',title: '状态', width: 120},
{field: 'user_name', align: 'center',title: '创建人', width: 120},
{field: 'cdate', align: 'center',title: '创建日期', width: 180},
{width: 230, align: 'center',title: '操作', toolbar: '#action'}
]]
,id: 'testReload'
,page: true
,height: 471
});
//搜索
$('#search').on('click', function() {
var key = $('#key').val();
if($.trim(key)==='') {
layer.msg('{:lang("pleaseEnter")}店铺名称!',{icon:0});
return;
}
tableIn.reload({ page: {page: 1},where: {key: key}});
});
var $ = layui.$, active = {
reload: function(){
var key = $('#key');
//执行重载
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
key: {
id: key.val()
}
}
});
}
};
$('.demoTable .layui-btn').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
//启用、停用
table.on('tool(list)', function(obj){
var data = obj.data;
if(obj.event === 'stop'){
var statusVal = data.status==1 ? '停用' : '启用';
layer.confirm('请确定要 '+statusVal+" 该商家!", function(index){
$.post("{:url('configStop')}",{sellerid:data.id,status:data.status},function(res){
if(res.code==1){
layer.msg(res.msg,{time:1000,icon:1});
location.reload();
}else{
layer.msg(res.msg,{time:1000,icon:2});
}
});
layer.close(index);
});
}
});
})
</script>