cardputforplat.html
4.5 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
{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/platformcard')}" class="layui-btn layui-btn-lg">
<i class="fa fa-file-image-o"></i> 优惠券
</a>
<a href="{:url('card/cardputforplat')}" class="layui-btn layui-btn-lg layui-btn-danger">
<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/platcarddatalist')}" class="layui-btn layui-btn-lg">
<i class="fa fa-file-image-o"></i> 数据统计
</a>
</blockquote>
<table class="layui-table" id="list" lay-filter="list"></table>
</div>
{include file="common/foot"/}
<script type="text/html" id="action">
{{#if(d.status==1){}}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="stop">停止投放</a>
{{#} else if(d.status==2) {}}
<a class="layui-btn layui-btn-xs" lay-event="putin">投放</a>
{{#} else {}}
暂无操作
{{#}}}
</script>
<script>
layui.use(['table','form','laydate'], function() {
var table = layui.table,laydate = layui.laydate,form = layui.form,$ = layui.jquery,layer = layui.layer;
var tableIn = table.render({
elem: '#list',
url: '{:url("cardputforplat")}',
method: 'post',
title: '卡券列表',
cols: [[
{field: 'id', title: '卡券编号',hide:true, fixed: true},
{field: 'card_title', title: '卡券名称'},
{field: 'price', align: 'center',title: '金额'},
{field: 'contributor_time', align: 'center', title: '投放日期'},
{field: 'contributor', align: 'center', title: '投放人'},
{field: 'status_msg', align: 'center',title: '状态'},
{align: 'center', width:200,title: '操作', toolbar: '#action'}
]]
,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("我是从父级传来的值哟……")
}*/
});
});
//停止投放、投放
table.on('tool(list)', function(obj){
var data = obj.data;
//停止投放
if(obj.event === 'stop'){
layer.confirm('确认要停止发放这个红包吗? 停止后,用户将不能在领取这个红包,已经领取的可以在有效期内继续消费。', function(index){
$.post("{:url('cardstop')}",{id:data.id},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);
});
}
//投放
if(obj.event === 'putin'){
layer.open({
type: 2,
title: '投放卡券',
shadeClose: true,
shade: 0.8,
area: ['90%', '90%'],
content: '{:url("cardputin")}?id='+obj.data.id //iframe的url
/*success:function(dom){
let $iframeDom=$(dom[0]).find("iframe").eq(0).contents();
$iframeDom.find("#test").html("我是从父级传来的值哟……")
}*/
});
}
});
})
</script>