544782275@qq.com il y a 3 ans
Parent
commit
42dda6c9cb

+ 159 - 0
application/store/controller/CouponConfig.php

@@ -0,0 +1,159 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use app\store\service\ExtendService;
+use library\Controller;
+use library\tools\Data;
+use think\Db;
+
+/**
+ * 优惠券配置
+ * Class Config
+ * @package app\store\controller
+ */
+class  CouponConfig extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'StoreCouponConfig';
+
+    /**
+     * 优惠券管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '优惠券配置';
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+    }
+
+
+    /**
+     * 添加优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加优惠券';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 编辑优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑优惠券';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 表单数据处理
+     * @param array $data
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    protected function _form_filter(&$data)
+    {
+        if($this->request->isPost()){
+
+            if($data['low_amount']<=0){
+                $this->error('使用条件需大于零');
+            }
+
+            if($data['amount']>$data['low_amount']){
+                $this->error('优惠金额不能大于限制金额');
+            }
+            if($data['low_day'] <= 0){
+                $this->error('使用期限许大于零');
+            }
+        }else{
+
+        }
+    }
+
+
+
+
+    /**
+     * 禁用优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+}

+ 228 - 0
application/store/controller/CouponList.php

@@ -0,0 +1,228 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use app\store\service\ExtendService;
+use library\Controller;
+use library\tools\Data;
+use think\Db;
+
+/**
+ * 优惠券列表
+ * Class Config
+ * @package app\store\controller
+ */
+class  CouponList extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'StoreCouponList';
+
+    /**
+     * 优惠券管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '优惠券列表';
+        $coupon_id=$this->request->get('coupon_id');
+
+        $this->byWhere(1)
+            ->field('a.*,b.name,b.headimg')
+            ->where('a.config_id',$coupon_id)
+            ->order('a.id desc')
+            ->page();
+    }
+
+    /**
+     * 搜索条件
+     * @return \library\helper\QueryHelper
+     */
+    protected  function byWhere($type)
+    {
+        if ($type == 1) {
+            $query = $this->_query($this->table);
+        } elseif ($type == 2) {
+            $query = Db::name($this->table);
+        }
+        $query = $query->alias('a')
+            ->join('store_member b', 'a.user_id=b.id');
+
+        if (isset($_GET['status']) && $_GET['status']) {
+            $query->where('a.status', $_GET['status']);
+        }
+        if (isset($_GET['title']) && $_GET['title']) {
+            $query->where('a.title', 'like','%'.$_GET['title'].'%');
+        }
+        if (isset($_GET['user_info']) && $_GET['user_info']) {
+            $query->where('b.name|b.phone', 'like', '%' . $_GET['user_info'] . '%');
+        }
+        return $query;
+    }
+
+    /**
+     * 数据列表处理
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as $k=>&$v) {
+
+            if($v['status'] == 0 && $v['end'] < date('Y-m-d')){
+                Db::name('store_coupon_list')->where('id',$v['id'])->update(array('status'=>2));
+                $v['status'] = 2;
+            }
+            $v['member'] = Db::table('store_member')->where('id',$v['user_id'])->find();
+        }
+
+    }
+
+
+    /**
+     * 添加优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加优惠券';
+        if($this->request->isPost()){
+
+            if($this->request->post('user')==0){
+                $user_ids=explode(',',$this->request->post('user_ids'));
+                //指定用户发放
+            }else{
+                //全部用户发方
+                $user_ids=Db::table('store_member')->where('status',1)->column('id');
+            }
+            if(empty($user_ids[0])){
+                $this->error('没有要发放的用户');
+            }
+            $coupon=Db::table('store_coupon_config')->where('id',$this->request->post('coupon_id'))->where('status',1)->where('is_deleted',0)->find();
+            if(empty($coupon)){
+                $this->error('优惠券不存在或已禁用');
+            }
+
+            $error=[];
+            foreach ($user_ids as $k=>$v){
+                $data=[];
+                $data['config_id']=$coupon['id'];
+                $data['user_id']=$v;
+                $data['title']=$coupon['title'];
+                $data['low_amount']=$coupon['low_amount'];
+                $data['amount']=$coupon['amount'];
+                $data['start']=date('Y-m-d');
+                $data['end']=date('Y-m-d', strtotime('+'.$coupon['low_day'].' days') );
+                $data['status']=0;
+                Db::table('store_coupon_list')->insert($data);
+            }
+            $msg='发放成功';
+            if($error){
+                $name=Db::table('store_member')->where('id','in',$error)->column('name');
+                $name=implode(',',$name);
+                $msg='发放成功'.$name.'等用户因规则原因,发放失败';
+            }
+            $this->success($msg);
+        }else{
+            $this->_form($this->table, 'form');
+        }
+    }
+
+    /**
+     * 编辑优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑优惠券';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 表单数据处理
+     * @param array $data
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    protected function _form_filter(&$data)
+    {
+        if($this->request->isPost()){
+
+
+        }else{
+            $coupon_id=$this->request->get('coupon_id');
+            $this->coupon_id=$coupon_id;
+            $this->member=Db::table('store_member')->field('id,phone,name')->where('status',1)->select();
+            $this->member_count=count($this->member);
+        }
+    }
+
+    /**
+     * 禁用优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除优惠券
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+}

+ 77 - 0
application/store/view/coupon_config/form.html

@@ -0,0 +1,77 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">优惠券名称:</label>
+            <label class="layui-col-xs10">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入优惠券名称" class="layui-input">
+            </label>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">使用条件:</label>
+            <label class="layui-col-xs10">
+                <input name="low_amount"  value='{$vo.low_amount|default=0}' class="layui-input">
+                <p class="help-block">消费满多少可用, 空或0后台默认比下列优惠金额大0.01</p>
+            </label>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <div>
+                <label class="layui-col-xs2 think-form-label" >优惠金额:</label>
+                <label class="think-radio layui-col-xs2 think-form-label margin-top-0 padding-left-0 text-left padding-right-0" style="width: auto;">
+                    <span style="margin-right: 12px;">立</span>减
+                </label>
+                <input name="amount"  value='{$vo.amount|default=0}'  class="layui-input inline-block" style="width: 180px;margin-right: 5px;">
+                <span>元</span>
+            </div>
+        </div>
+        <div class="layui-row margin-bottom-15">
+            <div>
+                <label class="layui-col-xs2 think-form-label" >使用期限:</label>
+                <label class="think-radio layui-col-xs2 think-form-label margin-top-0 padding-left-0 text-left padding-right-0" style="width: auto;">
+                获得后
+                </label>
+                <input name="low_day"  value='{$vo.low_day|default=0}'  class="layui-input inline-block" style="width: 180px;margin-right: 5px;">
+                <span>天内有效</span>
+            </div>
+
+        </div>
+        <div class="layui-row margin-bottom-15">
+            <div>
+                <label class="layui-col-xs2 think-form-label" >新人券:</label>
+                <label class="think-radio layui-col-xs2 think-form-label margin-top-0 padding-left-0 text-left padding-right-10" style="width: 70%">
+
+                    <input type="radio" {if (isset($vo['id']) && $vo['is_new']==1)}checked{/if} name="is_new" value="1" lay-ignore >是
+
+                    <input type="radio" {if (isset($vo['id']) && $vo['is_new']==0) || (!isset($vo['id']))}checked{/if} name="is_new" value="0" lay-ignore class="margin-left-10">否
+                    <span style="margin-left: 10px;">注:只要设置的新人券,新人注册成功后都会获得</span>
+                </label>
+            </div>
+
+        </div>
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+</form>
+<script>
+    window.form.render();
+    layui.use('form', function () {
+        var form = layui.form;
+        //日期时间范围
+        laydate.render({
+            elem: '#time'
+            ,type: 'date'
+            ,range: '~'
+            ,min:'nowTime'
+            ,max:60,
+        });
+    })
+
+</script>

+ 86 - 0
application/store/view/coupon_config/index.html

@@ -0,0 +1,86 @@
+{extend name='admin@main'}
+
+{block name="button"}
+{if auth("store/coupon_config/add")}
+<button data-modal='{:url("add")}' data-title="添加优惠券" class='layui-btn layui-btn-sm layui-btn-primary'>添加优惠券</button>
+{/if}
+{if auth("store/coupon_config/remove")}
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除优惠券</button>
+{/if}
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='coupon_config/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='text-left nowrap'>优惠券名称</th>
+            <th class='text-left nowrap'>限制时间</th>
+            <th class='text-left nowrap'>优惠金额</th>
+            <th class='text-left nowrap'>类型</th>
+            <th class="text-left">状态</th>
+            <th class="text-center">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'>
+                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
+            </td>
+
+            <td class='text-left nowrap'>
+                {$vo.title|default=''}
+            </td>
+
+            <td class='text-left nowrap'>
+                自领取后{$vo.low_day}天有效
+            </td>
+            <td class='text-left nowrap'>
+                满{$vo.low_amount}元立减{$vo.amount}元
+            </td>
+            <td class='text-left nowrap'>
+                {if $vo.is_new==1} 新人券 {else} 非新人券 {/if}
+            </td>
+
+            <td class='text-left nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">禁用</span>{else}<span class="layui-badge layui-bg-green">正常</span>{/eq}<br>
+            </td>
+            <td class='text-center nowrap'>
+
+
+                {if auth("store/coupon_config/edit") && $vo.is_new == 0 && $vo.status == 1}
+                <a data-title="发放优惠券" class="layui-btn layui-btn-sm" data-modal='{:url("coupon_list/add")}?coupon_id={$vo.id}'>发放</a>
+                {/if}
+
+                {if auth("store/coupon_config/edit")}
+                <a data-title="领取记录" class="layui-btn layui-btn-sm" data-open='{:url("coupon_list/index")}?coupon_id={$vo.id}'>领取记录</a>
+                {/if}
+                {if auth("store/coupon_config/edit")}
+                <a data-title="编辑优惠券" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {/if}
+
+                {if $vo.status eq 1 and auth("store/coupon_config/forbid")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
+                {elseif auth("store/coupon_config/resume")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
+                {/if}
+
+                {if auth("store/coupon_config/remove")}
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                {/if}
+
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 31 - 0
application/store/view/coupon_config/index_search.html

@@ -0,0 +1,31 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">优惠券名称</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入优惠券名称" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach [''=>'- 全部状态 -','1'=>'正常','0'=>'禁用'] as $k=>$v}
+                    <!--{eq name='Think.get.status' value='$k.""'}-->
+                    <option selected value="{$k}">{$v}</option>
+                    <!--{else}-->
+
+                    <option value="{$k}">{$v}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 64 - 0
application/store/view/coupon_list/form.html

@@ -0,0 +1,64 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off" style="height: 600px;">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <div>
+                <label class="layui-col-xs2 think-form-label" >发放:</label>
+                <label class="think-radio layui-col-xs2 think-form-label margin-top-0 padding-left-0 text-left padding-right-0" style="width: 40%;">
+                    <input type="radio"checked name="user" value="0" lay-ignore lay-filter="user" onclick="checkeds(this)" >指定用户
+                    <input type="radio"  name="user" value="1" lay-ignore class="margin-left-10" lay-filter="user" onclick="checkeds(this)">全部用户({$member_count}人)
+                </label>
+            </div>
+        </div>
+
+
+        <div class="layui-row margin-bottom-15" id="goods">
+        <div>
+            <label class="layui-col-xs2 think-form-label">选择用户:</label>
+            <label class="layui-col-xs10">
+                <select class="layui-select" required name="user_ids" lay-search >
+                    <!-- {foreach $member as $me}-->
+                    <option  value="{$me.id}">{$me.phone}-{$me.name}</option>
+                    <!-- {/foreach}-->
+                </select>
+            </label>
+        </div>
+    </div>
+
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center margin-bottom-40">
+        {notempty name='coupon_id'}<input type='hidden' value='{$coupon_id}' name='coupon_id'>{/notempty}
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>发放</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+</form>
+<script>
+    window.form.render();
+    layui.use('form', function () {
+        var form = layui.form;
+        //日期时间范围
+        laydate.render({
+            elem: '#time'
+            ,type: 'date'
+            ,range: '~'
+            ,min:'nowTime'
+            ,max:60,
+        });
+    })
+
+
+    function checkeds(obj){
+        if($(obj).attr('value')==0){
+            $('#goods').show();
+        }else{
+            $('#goods').hide();
+        }
+    }
+
+
+
+</script>

+ 63 - 0
application/store/view/coupon_list/index.html

@@ -0,0 +1,63 @@
+{extend name='admin@main'}
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='coupon_list/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='text-left nowrap'>用户昵称</th>
+            <th class='text-left nowrap'>优惠券名称</th>
+            <th class='text-left nowrap'>类型</th>
+            <th class='text-left nowrap'>限制时间</th>
+            <th class='text-left nowrap'>优惠金额</th>
+            <th class="text-center">状态</th>
+
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'>
+                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
+            </td>
+
+            <td class='text-left nowrap'>
+                用户昵称:{$vo.member.name|default='--'}<br>
+                用户手机:{$vo.member.phone|default=''}
+            </td>
+            <td class='text-left nowrap'>
+
+                {$vo.title|default=''}
+            </td>
+            <td class='text-left nowrap'>
+                {if $vo.is_new==1}
+                    新人券
+                {else}
+                    非新人券
+                {/if}
+            </td>
+
+            <td class='text-left nowrap'>
+                {$vo.start} 至 {$vo.end}
+            </td>
+
+            <td class='text-left nowrap'>
+                满{$vo.low_amount}元立减{$vo.amount}元
+            </td>
+
+            <td class='text-center nowrap'>
+                {if $vo['status']==0}<span class="layui-badge">未使用</span>{elseif $vo['status']==1}<span class="layui-badge layui-bg-green">已使用</span>{else}<span class="layui-badge layui-bg-green">已过期</span>{/if}<br>
+            </td>
+
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 31 - 0
application/store/view/coupon_list/index_search.html

@@ -0,0 +1,31 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">用户信息</label>
+            <div class="layui-input-inline">
+                <input name="user_info" value="{$Think.get.user_info|default=''}" placeholder="请输入用户手机号或昵称" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">使用状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach [''=>'- 全部状态 -','1'=>'已使用的优惠券','0'=>'未使用的优惠券','2'=>'已过期优惠券'] as $k=>$v}
+                    <!--{eq name='Think.get.status' value='$k.""'}-->
+                    <option selected value="{$k}">{$v}</option>
+                    <!--{else}-->
+
+                    <option value="{$k}">{$v}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>