123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- {layout name="layout1" /}
- <style>
- .layui-border-box {
- margin-left: 40px;
- margin-right: 40px;
-
- }
-
- .record {
- display: none;
- margin-top: 20px;
- }
- </style>
-
- <div class="wrapper">
- <div class="layui-form">
- <div class="layui-card">
- <div class="layui-card-body">
- <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
- <div class="layui-colla-item">
- <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
- <div class="layui-colla-content layui-show">
- <p>*用户每天签到一次可获得每天签到奖励,包括积分和成长值。</p>
- <p>*点击新增连续签到奖励可以设置满足连续签到天数时的额外奖励,连续天数规则不能重复。</p>
- <p>*用户签到中断会重新计算连续天数;超过设置的最大连续签到奖励天数后,也会重新计算连续天数,循环发放连续奖励。</p>
- </div>
- </div>
- </div>
- </div>
- <div class="layui-tab layui-tab-card" lay-filter="tab-all">
- <ul class="layui-tab-title">
- <li data-type=1 class="layui-this">签到设置</li>
- <li data-type=2>签到记录</li>
- </ul>
- <div class="layui-card-header"></div>
- <div class="layui-form-item record">
- <div class="layui-inline">
- <label class="layui-form-label">会员信息:</label>
- <div class="layui-input-inline">
- <select name="type" id="type">
- <option value=""></option>
- <option value="sn">会员编号</option>
- <option value="nickname">会员昵称</option>
- <option value="mobile">手机号码</option>
- </select>
- </div>
- <div class="layui-input-inline">
- <input type="text" name="keyword" id="keyword" placeholder="请输入关键词" autocomplete="off"
- class="layui-input">
- </div>
- <div class="layui-inline">
- <button class="layui-btn layui-btn-sm {$view_theme_color}"lay-submit lay-filter="record-search">查询</button>
- <button class="layui-btn layui-btn-sm layui-btn-primary " lay-submit lay-filter="record-clear-search">清空查询</button>
- </div>
- </div>
- </div>
- <!--每天签到奖励-->
- <div class="layui-form-item sigh">
- <label class="layui-form-label " style="margin-left: 20px;width: 100px">每天签到奖励:</label>
- <div class="layui-input-inline " style="margin-right: 0px;width: 110px">
- <input type="checkbox" name="integral_status" title="赠送积分" min="0" lay-skin="primary" {if
- condition="$config['dailySign']['integral_status'] eq 1" }checked{/if}>
- </div>
- <div class="layui-input-inline">
- <input type="number" name="integral" value="{$config.dailySign.integral}" lay-verType="tips" placeholder="请输入积分" autocomplete="off" class="layui-input">
- </div>
- <div class="layui-input-inline">
- <label class="layui-form-mid">积分</label>
- </div>
- </div>
-
- <div class="layui-form-item sigh">
- <label class="layui-form-label" style="margin-left: 20px;width: 100px"></label>
- <div class="layui-input-inline" style="margin-right: 0px;width: 110px">
- <input type="checkbox" name="growth_status" title="赠送成长值" min="0" lay-skin="primary"
- {if condition="$config['dailySign']['growth_status'] eq 1" }checked{/if}>
- </div>
-
- <div class="layui-input-inline">
- <input type="number" name="growth" value="{$config.dailySign.growth}" lay-vertype="tips" placeholder="请输入成长值" autocomplete="off" class="layui-input">
- </div>
- <div class="layui-input-inline">
- <label class="layui-form-mid">成长值</label>
- </div>
- </div>
-
- <div class="layui-form-item sigh">
- <div class="layui-inline">
- <label class="layui-form-label" style="margin-left: 20px;width: 100px">连续签到奖励:</label>
- <div class=" layui-form-mid layui-word-aux">连续签到奖励断签后会重新计算连续签到天数,达到连续天数后即可获得连续奖励</div>
- </div>
- </div>
- <!--新增连续签到奖励-->
- <div class="layui-form-item sigh">
- <div class="layui-inline " style="margin-left: 15px;width: 100px">
- <button class="layui-btn layui-btn-sm layEvent {$view_theme_color}" lay-event="add">新增连续签到奖励</button>
- </div>
- </div>
-
-
- <div class="layui-card-body" style="margin-top: -20px">
- <div class="layui-card">
- <table id="like-table-lists" class="layui-border-box" lay-filter="like-table-lists"></table>
-
- <script type="text/html" id="status">
- <input type="checkbox" lay-filter="switch-status" data-id={{d.id}} data-field='is_recommend'
- lay-skin="switch"
- lay-text="是|否" {{# if(d.is_recommend){ }} checked {{# } }}/>
- </script>
-
- <!--连续天数-->
- <script type="text/html" id="daysTpl">
- {{# if( d.days == null || d.days == 0 || d.days == ''){ }}
- ----
- {{# } else { }}
- {{d.days}}天
- {{# } }}
- </script>
-
- <script type="text/html" id="table-operation">
- <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a>
- <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a>
- </script>
-
- <!--会员信息-->
- <script type="text/html" id="user">
- <img src="{{d.avatar}}" style="height:80px;width: 80px" class="image-show">
- <div class="layui-input-inline" style="text-align: left">
- <p>会员编号:{{d.sn}}</p>
- <p>昵称:{{d.nickname}}</p>
- <p>手机号:{{d.mobile}}</p>
- <p>性别:{{d.sex}}</p>
- <p>注册时间:{{d.create_time}}</p>
- </div>
- </script>
-
- <!--签到奖励-->
- <script type="text/html" id="integral">
- 赠送{{d.integral}}积分;赠送{{d.growth}}成长值
- </script>
-
- <!--连续奖励-->
- <script type="text/html" id="continuous_integral">
- 赠送{{d.continuous_integral}}积分;赠送{{d.continuous_growth}}成长值
- </script>
- </div>
- </div>
- <!--签到规则说明-->
- <div class="layui-form-item sigh">
- <div class="layui-card">
- <label class="layui-form-label" style="margin-left: 20px;width: 100px">签到规则说明:</label>
- <div class="layui-input-inline" style="width: 500px">
- <textarea name="instructions" id="instructions" placeholder="请输入签到规则说明"
- class="layui-textarea" style="width: 500px;height: 200px">{$config.instructions| default=''}</textarea>
-
- </div>
- <div class="layui-input-inline">
- <button class="layui-btn layui-btn-primary " id="default">使用默认说明
- </button>
- </div>
- </div>
- </div>
-
- <div class="layui-form-item sigh">
- <label class="layui-form-label" style="width: 100px"></label>
- <div class="layui-input-block" style="text-align: center; width: 950px;height: 60px">
- <button class="layui-btn layui-btn-sm {$view_theme_color}" lay-submit lay-filter="formSign">
- 确认保存
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- layui.use(['table'], function () {
- var $ = layui.$
- , form = layui.form
- , table = layui.table
- , element = layui.element;
-
- //监听搜索
- form.on('submit(record-search)', function (data) {
- var field = data.field;
- //执行重载
- table.reload('like-table-lists', {
- where: field,
- page: {curr: 1}
- });
- });
-
- //清空记录查询
- form.on('submit(record-clear-search)', function () {
- $('#keyword').val('');
- $('#type').val('');
- form.render('select');
- table.reload('like-table-lists', {
- where: [],
- page: {curr: 1}
- });
- });
-
- //图片放大
- $(document).on('click', '.image-show', function () {
- var src = $(this).attr('src');
- like.showImg(src, 600);
- });
-
- getList(1);
- //切换列表
- element.on('tab(tab-all)', function (data) {
- var type = $(this).attr('data-type');
- if (type == 1) {
- $('.sigh').show();
- $('.record').hide();
- }
-
- if (type == 2) {
- $('.sigh').hide();
- $('.record').show();
- }
- getList(type);
- });
-
- //签到规则默认说明
- $('#default').click(function () {
- $('#instructions').val('1.每天签到可以获得每天签到奖励;\n' +
- '2.每日最多可签到1次,断签则会重新计算连签天数,达到连续天数后即可获得连续奖励;\n' +
- '3.活动以及奖励最终解释权归商家所有。')
- })
-
-
- //确定保存按钮
- form.on('submit(formSign)', function (data) {
- set(data, "{:url('sign_daily.SignDaily/signRule')}");
- });
-
- function set(data, url) {
- like.ajax({
- url: url
- , data: data.field
- , type: "post",
- success: function (res) {
- if (res.code == 1) {
- layui.layer.msg(res.msg, {
- offset: '15px'
- , icon: 1
- , time: 1000
- }, function () {
- location.href = location.href;
- });
- }
- }
- });
- }
-
- function getList(type) {
- var tablecols = [
- {field: 'days', title: '连续天数', templet: '#daysTpl',width:300}
- , {field: 'award_tips', title: '连续奖励',width:400}
- , {title: '操作', align: 'center', fixed: 'right', toolbar: '#table-operation',width:350}
- ];
- var page = false;
- var url = '{:url("sign_daily.SignDaily/lists")}';
-
- if (type == 2) {
- tablecols = [
- {type:'numbers',title:'序号'}
- , {field: 'user', title: '会员信息', align: 'center',templet:'#user',width:400}
- , {field: 'days', title: '连续天数',width:100}
- , {field: 'reward_tips', title: '签到奖励',templet:'#integral',width:250}
- , {field: 'continuous_reward', title: '连续奖励',templet:'#continuous_integral',width:250}
- , {fixed: 'right', field:'sign_time',title:'签到时间',width:250}
- ];
- page = true;
- url = '{:url("sign_daily.SignDaily/record")}';
- }
- like.tableLists("#like-table-lists", url, tablecols, {}, page);
- }
-
- //事件
- var active = {
- add: function () {
- layer.open({
- type: 2
- , title: '新增连续签到奖励'
- , content: '{:url("sign_daily.SignDaily/add",["type"=>2])}'
- , area: ['60%', '60%']
- , btn: ['确定', '取消']
- , yes: function (index, layero) {
- var iframeWindow = window['layui-layer-iframe' + index]
- , submitID = 'addSubmit'
- , submit = layero.find('iframe').contents().find('#' + submitID);
- //监听提交
- iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
- var field = data.field;
- like.ajax({
- url: '{:url("sign_daily.SignDaily/add")}',
- data: field,
- type: "post",
- success: function (res) {
- if (res.code == 1) {
- layui.layer.msg(res.msg, {
- offset: '15px'
- , icon: 1
- , time: 1000
- });
- layer.close(index);
- table.reload('like-table-lists');
- }
- }
- });
- });
- submit.trigger('click');
- }
- });
- },
- edit: function (obj) {
- var id = obj.data.id;
- layer.open({
- type: 2
- , title: '编辑连续签到奖励'
- , content: '{:url("sign_daily.SignDaily/edit")}?id=' + id
- , area: ['60%', '60%']
- , btn: ['确定', '取消']
- , yes: function (index, layero) {
- var iframeWindow = window['layui-layer-iframe' + index]
- , submitID = 'edit-sign_daily-submit'
- , submit = layero.find('iframe').contents().find('#' + submitID);
- //监听提交
- iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
- var field = data.field;
- like.ajax({
- url: '{:url("sign_daily.SignDaily/edit")}',
- data: field,
- type: "post",
- success: function (res) {
- if (res.code == 1) {
- layui.layer.msg(res.msg, {
- offset: '15px'
- , icon: 1
- , time: 1000
- });
- layer.close(index);
- table.reload('like-table-lists');
- }
- }
- });
- });
- submit.trigger('click');
- }
- })
- },
- del: function (obj) {
- var id = obj.data.id;
- var day = obj.data.days;
- layer.confirm('确定移除连续签到奖励:' + '<span style="color: red">' + day + '天</span>', function (index) {
- like.ajax({
- url: '{:url("sign_daily.SignDaily/del")}',
- data: {'id': id},
- type: "post",
- success: function (res) {
- if (res.code == 1) {
- obj.del();
- layui.layer.msg(res.msg, {
- offset: '15px'
- , icon: 1
- , time: 1000
- });
- layer.close(index);
- }
- },
- });
- });
- }
- }
- like.eventClick(active);
- });
- </script>
|