123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- {extend name="public/layout" /} {block name="title"}活动管理{/block} {block name="body"}
- <link rel="stylesheet" href="__LAYUI__/common.css" media="all">
- <style type="text/css">
- html,
- body {
- display: block;
- min-width: 1100px;
- font-family: inherit;
- }
- .layui-table thead tr,
- .layui-table-header {
- background-color: #D8E6F1 !important;
- }
- .layui-fluid {
- display: block;
- box-shadow: 0 0 4px 0 #B6CADE;
- border-radius: 5px;
- margin: 15px;
- background-color: #ffffff;
- }
- .layui-form-label {
- width: auto;
- }
- .layui-laydate-range {
- width: 581px;
- }
- .layui-table-page>div {
- display: flex;
- justify-content: flex-start;
- }
- .layui-btn-primary,
- .layui-btn-primary:hover {
- border: 1px solid #249EFB;
- background-color: #fff;
- color: #249EFB;
- }
- .layui-form-item .layui-inline {
- margin-right: 0px;
- }
- .layui-btn-normal,
- .layui-btn-normal:hover {
- border: 1px solid #249EFB;
- background-color: #fff;
- color: #249EFB;
- }
- .layui-btn-danger,
- .layui-btn-danger:hover {
- color: #FF5722;
- border: 1px solid #FF5722;
- background-color: #fff;
- }
- .layui-form-select dl {
- z-index: 999999999;
- }
- .ahref {
- font-style: normal;
- color: #249EFB !important;
- }
- </style>
- <body>
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-form layui-card-header layuiadmin-card-header-auto">
- <div class="layui-form-item">
- <div class="layui-inline" style="float: left;">
- <button class="layui-btn layui-btn-primary layuiadmin-btn-course" data-type="add">添加活动</button>
- </div>
- <div style="float:right;">
- <div class="layui-inline">
- <label class="layui-form-label">活动名称</label>
- <div class="layui-input-inline">
- <input type="text" name="keyword" placeholder="请输入活动名称" autocomplete="off"
- class="layui-input">
- </div>
- </div>
- <!-- <div class="layui-inline">
- <label class="layui-form-label">分类</label>
- <div class="layui-input-inline">
- <select name="type" lay-filter="type" id="type">
- <option value="">请选择分类</option>
- </select>
- </div>
- </div> -->
- <div class="layui-inline">
- <label class="layui-form-label">活动时间</label>
- <div class="layui-input-inline select-date">
- <input type="text" name="date" id="select_date" placeholder="活动时间" autocomplete="off"
- class="layui-input">
- </div>
- </div>
- <!-- <div class="layui-inline">
- <label class="layui-form-label">标签</label>
- <div class="layui-input-inline">
- <select name="label" id="label">
- <option value="">请选择标签</option>
- </select>
- </div>
- </div> -->
- <div class="layui-inline" style="margin-right: 0px;">
- <label class="layui-form-label">上传人</label>
- <div class="layui-input-inline">
- <select name="employee_id" id="employee">
- <option value="">请选择人员</option>
- {volist name="employee" id="e"}
- <option value="{$e.id}">{$e.name}</option>
- {/volist}
- </select>
- </div>
- </div>
- <div class="layui-inline">
- <button class="layui-btn layuiadmin-btn-course searchBtn" lay-submit
- lay-filter="LAY-user-front-search">
- <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
- </button>
- </div>
- </div>
- </div>
- </div>
- <div class="layui-card-body" style="text-align: center;">
- <table id="company-activity" lay-filter="company-activity"></table>
- <script type="text/html" id="cover">
- {{# if(d.cover){ }}
- <img style="display: inline-block; width: 25%; height: 100%;" src="{{d.cover}}?x-oss-process=image/resize,w_50">
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="numbertpl">
- {{# if(d.number){ }}
- <span>{{d.number}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="type">
- {{# if(d.type == 1){ }}
- 获客
- {{# }else{ }}
- 定金
- {{# } }}
- </script>
- <script type="text/html" id="titletpl">
- {{# if(d.title){ }}
- <span>{{d.title}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="start_datetpl">
- {{# if(d.start_date){ }}
- <span>{{d.start_date}}-{{d.end_date}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="end_datetpl">
- {{# if(d.end_date){ }}
- <span>{{d.end_date}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="activitype">
- {{# if(d.cate){ }}
- <span>外场</span>
- {{# }else{ }}
- <span>内场</span>
- {{# } }}
- </script>
- <script type="text/html" id="timestate">
- {{# if(d.timestate == 0){ }}
- <span>预热中</span>
- {{# }else if(d.timestate == 1){ }}
- <span>进行中</span>
- {{# }else{ }}
- <span>已结束</span>
- {{# } }}
- </script>
- <script type="text/html" id="show">
- <input type="checkbox" name="show" value="{{d.id}}" lay-skin="switch" lay-text="上架|下架" lay-filter="show" {{ d.show == 1 ? 'checked' : '' }} id="clickshow">
- </script>
- <script type="text/html" id="table-user-bind">
- <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
- 编辑
- </a>
- <a class="layui-btn layui-btn-normal layui-btn-xs ahref" href="{:url('activity/source_material')}?id={{d.id}}">
- 活动素材
- </a>
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
- <i class="layui-icon layui-icon-delete"></i>
- 删除
- </a>
- </script>
- <script type="text/html" id="employee_name">
- {{# if(d.opt_name){ }}
- <span>{{d.opt_name}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="qrcode_name">
- {{# if(d.qrcode_name){ }}
- <span>{{d.qrcode_name}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- </div>
- </div>
- </div>
- </body>
- {/block} {block name="js"}
- <script>
- layui.config({
- base: '__LAYUI__/',
- urlbase: '/sys'
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['index', 'form', 'table', 'laydate'], function () {
- var $ = layui.$,
- form = layui.form,
- laydate = layui.laydate,
- table = layui.table;
- //日期范围
- laydate.render({
- elem: '#select_date',
- range: true
- });
- //监听搜索
- form.on('submit(LAY-user-front-search)', function (data) {
- var field = data.field;
- //执行重载
- table.reload('company-activity', {
- where: field
- });
- });
- //事件
- var active = {
- add: function () {
- layer.open({
- type: 2,
- title: ['活动添加', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("activity/add")}',
- resize: false,
- area: ['80%', '80%'],
- // btn: ['确定', '取消'],
- yes: function (index, layero) {
- //点击确认触发 iframe 内容中的按钮提交
- // var submit = layero.find('iframe').contents().find("#activity-submit");
- // submit.click();
- }
- });
- }
- };
- //活动列表
- table.render({
- elem: '#company-activity',
- // autoSort: false,
- // url: layui.setter.urlbase + '/Activity/list.html',
- url: "{:url('activity/list')}",
- height: 'full-160',
- cols: [
- [
- // {align:'center',field: 'number',title: '活动编号',width: '7%',templet:'#numbertpl'},
- { align: 'center', field: 'title', title: '活动名称', width: '15%', templet: '#titletpl' },
- { align: 'center', title: '活动时间', minWidth: 300, templet: '#start_datetpl' },
- { align: 'center', field: 'address', title: '活动地点',minWidth: 300 },
- { align: 'center', field: 'collect_count', title: '收藏人数',minWidth: 100 },
- { align: 'center', field: 'activity_sign_count', title: '报名数量',minWidth: 100 },
- { align: 'center', field: 'material_count', title: '素材数量',minWidth: 100 },
- { align: 'center', title: '操作', width: '20%', align: 'center', toolbar: '#table-user-bind', fixed: 'right' }
- ]
- ],
- page: true,
- // limit: 30,
- // height: 'full-220',
- text: '对不起,加载出现异常!'
- });
- //监听审核
- table.on('tool(company-activity)', function (obj) {
- var data = obj.data;
- if (obj.event === 'customer') {
- layer.open({
- type: 2,
- title: ['客户详情', 'color:#333333;background-color:#D8E6F1;'],
- content: "{:url('activity/customer')}?id=" + data.id + "&cate=" + data.cate,
- // content: layui.setter.urlbase + "/activity/edit/id/" + data.id,
- resize: false,
- area: ['80%', '80%'],
- // btn: ['确定', '取消'],
- yes: function (index, layero) {
- //点击确认触发 iframe 内容中的按钮提交
- // var submit = layero.find('iframe').contents().find("#activity-submit");
- // submit.click();
- }
- });
- } else if (obj.event === 'source_material') {
- //活动素材
- } else if (obj.event === 'edit') {
- layer.open({
- type: 2,
- title: ['活动修改', 'color:#333333;background-color:#D8E6F1;'],
- content: "{:url('activity/edit')}?id=" + data.id,
- // content: layui.setter.urlbase + "/activity/edit/id/" + data.id,
- resize: false,
- area: ['80%', '80%'],
- // btn: ['确定', '取消'],
- yes: function (index, layero) {
- //点击确认触发 iframe 内容中的按钮提交
- // var submit = layero.find('iframe').contents().find("#activity-submit");
- // submit.click();
- }
- });
- } else if (obj.event === 'del') {
- layer.confirm('确定删除此活动?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
- $.ajax({
- type: 'post',
- // url: layui.setter.urlbase + "/activity/del",
- url: "{:url('activity/del')}",
- data: {
- id: data.id
- },
- success: function (res) {
- if (res.code == 0) {
- layer.msg(res.msg, {
- anim: 0
- }, function () {
- //执行重载
- table.reload('company-activity');
- // obj.del();
- layer.close(index);
- });
- } else {
- layer.msg(res.msg, {
- anim: 6
- });
- }
- }
- });
- });
- } else if (obj.event === 'end') {
- layer.confirm('确定结束此活动?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
- $.ajax({
- type: 'post',
- // url: layui.setter.urlbase + "/activity/del",
- url: "{:url('activity/end')}",
- data: {
- id: data.id
- },
- success: function (res) {
- if (res.code == 0) {
- layer.msg(res.msg, {
- anim: 0
- }, function () {
- //执行重载
- table.reload('company-activity');
- // obj.del();
- layer.close(index);
- });
- } else {
- layer.msg(res.msg, {
- anim: 6
- });
- }
- }
- });
- });
- } else if (obj.event === 'assign'){
- layer.open({
- type: 2,
- title: ['指派', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("activity/activity_assign")}?id=' + data.id,
- area: ['80%', '80%'],
- btn: ['确定', '取消'],
- yes: function (index, layero) {
- layer.close(index);
- //点击确认触发 iframe 内容中的按钮提交
- },
- end: function () {
- }
- });
- }
- });
- form.on('switch(show)', function (obj) {
- var id = obj.value;
- $.ajax({
- type: "post",
- url: '{:url("activity/show")}',
- data: {
- id: id
- },
- success: function (res) {
- layer.msg(res.msg);
- }
- });
- });
- $('.layui-btn.layuiadmin-btn-course').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- //发布
- form.on('switch(show)', function (obj) {
- // console.log(obj)
- // return false;
- var id = obj.value;
- $.ajax({
- type: "post",
- url: '{:url("activity/show")}',
- data: {
- id: id,
- cate: 'case'
- },
- success: function (res) {
- layer.msg(res.msg, { time: 2000 });
- }
- });
- });
- });
- </script>
- {/block}
|