<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('店铺列表')" />
</head>
<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="coupon-form">
                    <div class="select-list">
                        <ul>
                            <input type="hidden" name="couType" th:value="${couType}"/>
                            <li>
                                <input type="text" name="keyword" placeholder="店铺名称搜索"/>
                            </li>
                            <li>
                                审核状态：<select name="bindType">
                                <option value="">全部</option>
                                <option value="1">已通过</option>
                                <option value="2">待审核</option>
                                <option value="1">未通过</option>
                            </select>
                            </li>
                            <li>
                                类型：<select name="busiType">
                                <option value="1">个体</option>
                                <option value="1">企业</option>
                            </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <!-- <a class="btn btn-success" th:onclick="$.operate.addTab([[${couType}]])" shiro:hasPermission="candy:coupon:mgt:add">
                    <i class="fa fa-plus"></i> 新增
                </a> -->
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer"/>
    <script th:inline="javascript">
        var dicCouponBusiType = [[${@dict.getType('zhengzai_coupon_busi_type')}]];
        var dicCouponBindType = [[${@dict.getType('zhengzai_coupon_bind_type')}]];
        var prefix = ctx + "candy/coupon/mgt";
        var prefix2 = ctx + "local";

        var viewMgtCouponFlag = [[${@permission.hasPermi('candy:coupon:mgt:detail')}]];
        var cancelMgtCouponFlag = [[${@permission.hasPermi('candy:coupon:mgt:cancel')}]];

        var couType = [[${couType}]];

        $(function () {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add/{id}",
                detailUrl: prefix2 + "/shopDetail",
                removeUrl: prefix + "/cancel/{id}",
                // updateUrl: prefix + "/edit/{id}",
                // exportUrl: prefix + "/export",
                sortName: "createdAt",
                sortOrder: "desc",
                modalName: "",
                columns: [
                    {
                        checkbox: true
                    },
                    {
                        field: 'valFace',
                        title: '店铺名称',
                        formatter: function (value, row, index) {
                            return '¥' + value;
                        }
                    },
                    {
                        field: 'bindType',
                        title: '类型',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(dicCouponBindType, value);
                        }
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            // if (row.bindType === 0 && row.state === 1) {
                                actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="passOrRejecte(\'' + row.couponId + '\', 1)">通过</a> ');
                            // }
                            actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="passOrRejecte(\'' + row.couponId + '\', 2)">驳回</a> ');
                            actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.mcouponId + '\')"><i class="fa fa-search"></i>详情</a>');
                            // if (row.state === 0) {
                            //     actions.push('<a class="btn btn-danger btn-xs ' + cancelMgtCouponFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mcouponId + '\')"><i class="fa fa-remove"></i>取消</a>');
                            // }
                            
                            return actions.join('');
                        }
                    }]
            };
            $.table.init(options);
        });

        /* 查看码列表 */
        function couponCodeList(couponId) {
            var url = 'candy/coupon/code?couponId=' + couponId;
            $.modal.openTab("代金码列表", url);
        }
    </script>
</body>
</html>