123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- {extend name="public/layout" /} {block name="title"}活动领取{/block} {block name="body"}
- <link rel="stylesheet" href="__LAYUI__/common.css" media="all">
- <style type="text/css">
- .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;
- }
- </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 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="img">
- <img style="display: inline-block; width: 15%; height: 100%;border-radius: 50%;" src={{d.headimgurl}}>
- </script>
- <script type="text/html" id="status">
- {{# if(d.status == 0){ }}
- <a lay-event="get" style="color: #0091FF;">确认领取</a>
- {{# }else{ }}
- 已领取
- {{# } }}
- </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
- });
- });
- //事件
- var active = {};
- var id = {$id};
- var tid = {$tid}
- //领取列表
- table.render({
- elem: '#spellgroup',
- autoSort: false,
- url: "{:url('spellgroup/receive')}?id="+id+"&tid="+tid,
- cols: [
- [{
- type: 'numbers',
- field: 'id',
- title: '序号',
- align: 'center',
- }, {
- field: 'cover',
- title: '头像',
- align: 'center',
- templet:'#img'
- }, {
- field: 'phone',
- align: 'center',
- title: '手机号',
- }, {
- title: '操作',
- align: 'center',
- toolbar: '#status'
- }]
- ],
- page: true,
- limit: 30,
- height: 'full-220',
- text: '对不起,加载出现异常!'
- });
- //监听审核
- table.on('tool(spellgroup)', function(obj) {
- var data = obj.data;
- console.log(data)
- if(obj.event === 'get') {
- $.ajax({
- type: 'post',
- url: "{:url('spellgroup/receive_success')}",
- data: {
- id: data.id
- },
- success: function(res) {
- if(res.code == 0) {
- layer.msg(res.msg, {
- anim: 0
- },function(){
- layui.table.reload('spellgroup'); //重载表格
- });
- } else {
- layer.msg(res.msg, {
- anim: 6
- });
- }
- }
- });
- }
- });
-
- $('.layui-btn.layuiadmin-btn-course').on('click', function() {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- });
- </script>
- {/block}
|