|
|
|
1
|
+{include file="common/head"/}
|
|
|
|
2
|
+<div class="admin-main layui-anim layui-anim-upbit">
|
|
|
|
3
|
+ <fieldset class="layui-elem-field layui-field-title">
|
|
|
|
4
|
+ <legend>{:$title}</legend>
|
|
|
|
5
|
+ </fieldset>
|
|
|
|
6
|
+ <div class="demoTable">
|
|
|
|
7
|
+ 商家:
|
|
|
|
8
|
+ <div class="layui-input-inline">
|
|
|
|
9
|
+ <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off">
|
|
|
|
10
|
+ </div>
|
|
|
|
11
|
+
|
|
|
|
12
|
+ 商家来源:
|
|
|
|
13
|
+ <div class="layui-input-inline layui-form">
|
|
|
|
14
|
+ <div class="layui-input-8">
|
|
|
|
15
|
+ <select name="class" id="channel" lay-filter="myselect">
|
|
|
|
16
|
+ <option value="-1">全部</option>
|
|
|
|
17
|
+ <option value="1" selected>合作</option>
|
|
|
|
18
|
+ <option value="2">推广</option>
|
|
|
|
19
|
+ <option value="3">测试</option>
|
|
|
|
20
|
+ </select>
|
|
|
|
21
|
+ </div>
|
|
|
|
22
|
+ </div>
|
|
|
|
23
|
+ 厂商:
|
|
|
|
24
|
+ <div class="layui-input-inline layui-form">
|
|
|
|
25
|
+ <div class="layui-input-8">
|
|
|
|
26
|
+ <select name="class" id="manufacturer" lay-filter="manufacturer">
|
|
|
|
27
|
+ <option value="-1">全部</option>
|
|
|
|
28
|
+ {foreach $facturer as $key=>$vo}
|
|
|
|
29
|
+ <option value="{$vo.id}" {if $vo.id eq 1} selected{/if}>{$vo.facturer}</option>
|
|
|
|
30
|
+ {/foreach}
|
|
|
|
31
|
+ </select>
|
|
|
|
32
|
+ </div>
|
|
|
|
33
|
+ </div>
|
|
|
|
34
|
+ <button class="layui-btn" id="search" data-type="reload">查询</button>
|
|
|
|
35
|
+ </div>
|
|
|
|
36
|
+ <table class="layui-table" id="list" lay-filter="list"></table>
|
|
|
|
37
|
+</div>
|
|
|
|
38
|
+{include file="common/foot"/}
|
|
|
|
39
|
+<script type="text/html" id="checkboxTpl">
|
|
|
|
40
|
+ <!-- 这里的 checked 的状态只是演示 -->
|
|
|
|
41
|
+ <input type="checkbox" name="lock" value="{{d.id}}" title="锁定" lay-filter="lockDemo" {{ d.id == 10006 ? 'checked' : '' }}>
|
|
|
|
42
|
+</script>
|
|
|
|
43
|
+<script>
|
|
|
|
44
|
+ layui.use(['table','form','laydate'], function() {
|
|
|
|
45
|
+ var table = layui.table,laydate = layui.laydate,$ = layui.jquery;
|
|
|
|
46
|
+ var tableIn = table.render({
|
|
|
|
47
|
+ elem: '#list',
|
|
|
|
48
|
+ url: '{:url("devicelists")}',
|
|
|
|
49
|
+ method: 'post',
|
|
|
|
50
|
+ title: '设备列表',
|
|
|
|
51
|
+ page:true,
|
|
|
|
52
|
+ toolbar: '#toolbarDemo',
|
|
|
|
53
|
+ cols: [[
|
|
|
|
54
|
+ //{checkbox:true,fixed: true},
|
|
|
|
55
|
+ //{field: 'id', title: '{:lang("id")}',width:100,fixed: true},
|
|
|
|
56
|
+ {field: 'sid',title: '商家编号',width:100},
|
|
|
|
57
|
+ {field: 'sellername', title: '所属商家'},
|
|
|
|
58
|
+ {field: 'device', title: '设备编号'},
|
|
|
|
59
|
+ {field: 'type', title: '厂商'},
|
|
|
|
60
|
+ {field: 'version', title: '设备版本号'},
|
|
|
|
61
|
+ {field: 'call_jump_page', align: 'center', edit: 'text', title: '1=订座页/2=桌位页'},
|
|
|
|
62
|
+
|
|
|
|
63
|
+ ]],
|
|
|
|
64
|
+ done: function(res, curr, count){
|
|
|
|
65
|
+ }
|
|
|
|
66
|
+ ,id: 'testReload'
|
|
|
|
67
|
+ ,page: true
|
|
|
|
68
|
+ ,limit:15
|
|
|
|
69
|
+ });
|
|
|
|
70
|
+
|
|
|
|
71
|
+ //监听单元格编辑
|
|
|
|
72
|
+ table.on('edit(list)', function(obj){
|
|
|
|
73
|
+ var value = obj.value, //得到修改后的值
|
|
|
|
74
|
+ data = obj.data, //得到所在行所有键值
|
|
|
|
75
|
+ field = obj.field; //得到字段
|
|
|
|
76
|
+ switch(field){
|
|
|
|
77
|
+ case 'call_jump_page':
|
|
|
|
78
|
+ var new_field = '来电跳转页面';
|
|
|
|
79
|
+ var msg_tips = value == 1 ? '跳转订座' : '跳转桌位';
|
|
|
|
80
|
+ break;
|
|
|
|
81
|
+ }
|
|
|
|
82
|
+ if(field=='call_jump_page' && !(/(^[1-2]\d*$)/.test(value))){
|
|
|
|
83
|
+ layer.msg('只能输入1或者2!',{time:1500,icon:2});return;
|
|
|
|
84
|
+ }
|
|
|
|
85
|
+
|
|
|
|
86
|
+ //layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改为:'+ value);
|
|
|
|
87
|
+ layer.confirm('请确认将 '+ data.sellername +'商家的 ' + new_field + ' 设置为:'+ msg_tips, function(index){
|
|
|
|
88
|
+ $.post("{:url('upcalljumppage')}",{device:data.device,status:value},function(res){
|
|
|
|
89
|
+ if(res.code==1){
|
|
|
|
90
|
+ layer.msg(res.msg,{time:1500,icon:1});
|
|
|
|
91
|
+ }else{
|
|
|
|
92
|
+ layer.msg(res.msg,{time:1500,icon:2});
|
|
|
|
93
|
+ }
|
|
|
|
94
|
+ });
|
|
|
|
95
|
+ layer.close(index);
|
|
|
|
96
|
+ });
|
|
|
|
97
|
+ });
|
|
|
|
98
|
+
|
|
|
|
99
|
+ //搜索
|
|
|
|
100
|
+ $('#search').on('click', function() {
|
|
|
|
101
|
+ //关键字
|
|
|
|
102
|
+ var key = $('#key').val();
|
|
|
|
103
|
+ //传参
|
|
|
|
104
|
+ tableIn.reload({ page: {page: 1},where: {key: key,channel: $('#channel').val(),manufacturer: $('#manufacturer').val()}});
|
|
|
|
105
|
+ });
|
|
|
|
106
|
+
|
|
|
|
107
|
+ var $ = layui.$, active = {
|
|
|
|
108
|
+ reload: function(){
|
|
|
|
109
|
+ var key = $('#key');
|
|
|
|
110
|
+ var channel = $('#channel');
|
|
|
|
111
|
+ //执行重载
|
|
|
|
112
|
+ table.reload('testReload', {
|
|
|
|
113
|
+ page: {
|
|
|
|
114
|
+ curr: 1 //重新从第 1 页开始
|
|
|
|
115
|
+ }
|
|
|
|
116
|
+ ,where: {
|
|
|
|
117
|
+ key: {
|
|
|
|
118
|
+ id: key.val(),
|
|
|
|
119
|
+ channel: channel.val()
|
|
|
|
120
|
+ }
|
|
|
|
121
|
+ }
|
|
|
|
122
|
+ });
|
|
|
|
123
|
+ }
|
|
|
|
124
|
+ };
|
|
|
|
125
|
+ })
|
|
|
|
126
|
+</script> |