123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- {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;
- }
- .layui-table thead tr, .layui-table-header {
- background-color: #D4E4ED !important;
- border-color: #D4E4ED !important;
- }
- .layui-fluid {
- display: block;
- box-shadow: 0 0 4px 0 #B6CADE;
- border-radius: 5px;
- margin: 15px;
- background-color: #ffffff;
- }
- .layui-tab {
- padding: 15px;
- height: 100%;
- }
- .layui-form-item {
- width: 100%;
- }
- .layui-form-item .layui-inline {
- display: block;
- float: left;
- width: 145px;
- height: 38px;
- line-height: 38px;
- background: #FFFFFF;
- margin-right: 16px;
- }
- .layui-form-item .layui-input-inline {
- width: 145px;
- height: 38px;
- line-height: 38px;
- margin-bottom: 0;
- }
- .layui-form-item .layui-input-inline .layui-input {
- border: 1px solid #9DB6CF;
- border-radius: 5px;
- }
- .layui-form-select dl dd.layui-this {
- background-color: #249EFB;
- }
- .layui-form-item div.searchBox {
- width: 320px;
- background: #FFFFFF;
- border: 1px solid #B6CADE;
- border-radius: 24px;
- height: 38px;
- overflow: hidden;
- padding-left: 18px;
- position: relative;
- margin-bottom: 0px;
- float: right;
- }
- .searchBox .inputBox {
- width: 240px;
- float: left;
- height: 36px;
- line-height: 36px;
- border-width: 0;
- }
- .searchBtn {
- position: absolute;
- top: 0;
- right: 0;
- width: 51px;
- height: 38px;
- background-color: #fff;
- }
- .searchBtn img {
- position: absolute;
- width: 26px;
- top: 6px;
- left: 0;
- }
- .editBox,
- .deltBox {
- width: auto;
- height: auto;
- padding: 0;
- line-height: 0;
- border-width: 0;
- background-color: transparent;
- }
- .editBox {
- margin-right: 20px;
- }
- .deltBox {
- margin-left: 20px !important;
- }
- .editBox img,
- .deltBox img {
- display: block;
- width: 14px;
- }
- </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 clearfix relative">
- <div style="padding-bottom: 10px; float:left">
- <button class="layui-btn layuiadmin-btn-course" data-type="add">创建拼团</button>
- </div>
- <div class="layui-inline pull-left clearfix searchBox">
- <input type="text" name="keyword" placeholder="请输入搜索拼团标题" autocomplete="off" class="layui-input inputBox">
- <button class="layui-btn layuiadmin-btn-course searchBtn" lay-submit lay-filter="LAY-user-front-search">
- <img src="__LAYUI__/image/sous.png" alt="">
- </button>
- </div>
- </div>
- </div>
- <div class="layui-card-body">
- <table id="spellgroup" lay-filter="spellgroup"></table>
- <script type="text/html" id="cover">
- <img style="display: inline-block; width: 50%; height: 100%;" src={{d.cover}}>
- </script>
- <script type="text/html" id="date">
- {{d.start_date}}至{{d.end_date}}
- </script>
- <script type="text/html" id="team">
- <a style="color: #0091FF;" lay-event="teamlist">{{d.team_num}}</a>
- </script>
- <script type="text/html" id="publish">
- <input type="checkbox" name="show" value="{{d.id}}" lay-skin="switch" lay-text="上架|下架" lay-filter="show" {{ d.publish == 1 ? 'checked' : '' }}>
- </script>
- <script type="text/html" id="table-user-bind">
- {auth:check name="spellgroup/edit"}
- <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
- {/auth:check}
- {auth:check name="spellgroup/receive"}
- <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="receive"><i class="layui-icon"></i>活动领取</a>
- {/auth:check}
- {auth:check name="spellgroup/del"}
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
- {/auth:check}
- </script>
- </div>
- </div>
- </div>
- </body>
- {/block} {block name="js"}
- <script>
- layui.config({
- base: '__LAYUI__/',
- urlbase: '/sys'
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['index', 'form', 'table'], function() {
- var $ = layui.$,
- form = layui.form,
- table = layui.table;
- //监听搜索
- form.on('submit(LAY-user-front-search)', function(data) {
- var field = data.field;
- //执行重载
- table.reload('spellgroup', {
- where: field
- ,page: {curr:1}
- });
- });
- //事件
- var active = {
- add: function() {
- layer.open({
- type: 2,
- title: '拼团添加',
- content: '{:url("spellgroup/add")}',
- maxmin: true,
- area: ['60%', '90%'],
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- //点击确认触发 iframe 内容中的按钮提交
- var submit = layero.find('iframe').contents().find("#spellgroup-submit");
- submit.click();
- }
- });
- }
- };
- //活动列表
- table.render({
- elem: '#spellgroup',
- autoSort: false,
- url: "{:url('spellgroup/list.html')}",
- cols: [
- [{
- type: 'numbers',
- field: 'id',
- title: '序号',
- }, {
- field: 'title',
- title: '名称',
- width: '20%'
- }, {
- field: 'cover',
- title: '图片',
- templet:'#cover'
- }, {
- field: 'start_date',
- title: '活动时间',
- minWidth: 200,
- templet: '#date'
- }, {
- field: 'join_user_num',
- title: '参与人数',
- }, {
- title: '参与团队',
- templet: '#team'
- }, {
- field: 'hour',
- title: '拼团时限',
- }, {
- field: 'number',
- title: '拼团人数',
- }, {
- title: '上/下架',
- templet: '#publish'
- }, {
- field: 'addtime',
- title: '创建时间'
- }, {
- title: '操作',
- width: '20%',
- toolbar: '#table-user-bind',
- fixed: 'right',
- }]
- ],
- page: true,
- limit: 30,
- height: 'full-220',
- text: '对不起,加载出现异常!'
- });
- //监听审核
- table.on('tool(spellgroup)', function(obj) {
- var data = obj.data;
- if(obj.event === 'edit') {
- if(data.end == 1){
- layer.msg('活动已开始,不支持编辑', {anim: 6});
- return false;
- }
- layer.open({
- type: 2,
- title: '活动修改',
- content: "{:url('spellgroup/edit')}?id=" + data.id,
- maxmin: true,
- area: ['60%', '80%'],
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- //点击确认触发 iframe 内容中的按钮提交
- var submit = layero.find('iframe').contents().find("#spellgroup-submit");
- submit.click();
- }
- });
- } else if(obj.event === 'del') {
- layer.confirm('确定删除此拼团?', function(index) {
- $.ajax({
- type: 'post',
- url: "{:url('spellgroup/del')}",
- data: {
- id: data.id
- },
- success: function(res) {
- if(res.code == 0) {
- layer.msg(res.msg, {
- anim: 0
- },function(){
- obj.del();
- layer.close(index);
- });
- } else {
- layer.msg(res.msg, {
- anim: 6
- });
- }
- }
- });
-
- });
- } else if(obj.event === 'receive') {
- layer.open({
- type: 2,
- title: '活动领取',
- content: "{:url('spellgroup/receive')}?id=" + data.id,
- maxmin: false,
- area: ['50%', '70%'],
- });
- } else if(obj.event === 'teamlist') {
- layer.open({
- type: 2,
- title: '团队数',
- content: "{:url('spellgroup/team')}/id/" + data.id + '/hour/' + data.hour,
- maxmin: false,
- area: ['50%', '70%'],
- });
- }
- });
-
- form.on('switch(show)', function (obj) {
- var id = obj.value;
- $.ajax({
- type: "post",
- url: '{:url("spellgroup/publish")}',
- 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) : '';
- });
- });
- </script>
- {/block}
|