sellercard.html
5.02 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{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('card/sellercard')}" class="layui-btn layui-btn-lg layui-btn-danger">
<i class="fa fa-file-image-o"></i> 优惠券
</a>
<a href="{:url('card/cardput')}" class="layui-btn layui-btn-lg">
<i class="fa fa-file-image-o"></i> 卡券投放
</a>
<a href="{:url('card/cardwriteoff')}" class="layui-btn layui-btn-lg">
<i class="fa fa-file-image-o"></i> 卡券核销
</a>
<a href="{:url('card/sellercarddatalist')}" class="layui-btn layui-btn-lg">
<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>
商家来源:
<div class="layui-input-inline layui-form">
<div class="layui-input-8">
<select name="class" id="channel" lay-filter="myselect">
<option value="4">全部</option>
<option value="1" selected>合作</option>
<option value="2">推广</option>
<option value="3">测试</option>
</select>
</div>
</div>
<button class="layui-btn" id="search" data-type="reload">搜索</button> <button class="layui-btn" style="float:right;" id="addcard">新建卡券</button>
</div>
<table class="layui-table" id="list" lay-filter="list"></table>
</div>
{include file="common/foot"/}
<script>
layui.use(['table','form'], function() {
var table = layui.table,laydate = layui.laydate,form = layui.form,$ = layui.jquery,layer = layui.layer;
var tableIn = table.render({
elem: '#list',
url: '{:url("sellercard")}',
method: 'post',
title: '卡券列表',
toolbar: '#toolbarDemo',
cols: [[
{field: 'id', title: '商家卡券编号',hide:true, fixed: true},
{field: 'sid', title: '商家编号', fixed: true},
{field: 'sellername', title: '商家名称'},
{field: 'card_title', title: '卡券名称'},
{field: 'price', align: 'center',title: '金额'},
{field: 'create_time', align: 'center', title: '创建日期'},
{field: 'creator', align: 'center', title: '创建人'},
{field: 'status', align: 'center',title: '状态'}
]]
,id: 'cardReload'
,page: true
});
//监听行双击事件
table.on('rowDouble(list)', function(obj){
//table.on('row(list)', function(obj){ 双击事件
//console.log(obj.tr) //得到当前行元素对象
console.log(obj.data) //得到当前行数据
layer.open({
type: 2,
title: obj.data.sellername,
shadeClose: true,
shade: 0.8,
area: ['90%', '90%'],
content: '{:url("carddetail")}?id='+obj.data.id //iframe的url
/*success:function(dom){
let $iframeDom=$(dom[0]).find("iframe").eq(0).contents();
$iframeDom.find("#test").html("我是从父级传来的值哟……")
}*/
});
});
//搜索
$('#search').on('click', function() {
//关键字
var key = $('#key').val();
var channel = $('#channel').val();
//传参
tableIn.reload({ page: {page: 1},where: {key: key,channel: channel}});
});
var $ = layui.$, active = {
reload: function(){
var channel = $('#channel');
var key = $('#key');
//执行重载
table.reload('cardReload', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
key: {
id: key.val(),
channel: channel.val()
}
}
});
}
};
//新建卡券
$('#addcard').on('click', function() {
layer.open({
type: 2,
title: '创建优惠券',
shadeClose: true,
shade: 0.8,
area: ['90%', '90%'],
content: '{:url("selectseller")}' //iframe的url
/*success:function(dom){
let $iframeDom=$(dom[0]).find("iframe").eq(0).contents();
$iframeDom.find("#test").html("我是从父级传来的值哟……")
}*/
});
});
})
</script>