<!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>
                                <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-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
		            <i class="fa fa-download"></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 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: prefix + "/detail/" + couType + "/{id}",
                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: 'eventAmt',
                        title: '手机号'
                    },
                    {
                        field: 'bindType',
                        title: '总积分',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(dicCouponBindType, value);
                        }
                    },
                    {
                        field: 'busiType',
                        title: '已使用积分',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(dicCouponBusiType, value);
                        }
                    },
                    {
                        field: 'title',
                        title: '剩余积分'
                    },
                    {
                        field: 'notice',
                        title: '积分状态'
                    },
                    {
                        title: '操作',
                        // align: 'center',
                        formatter: function (value, row, index) {
                            let dataArr = [];
                            return `<span class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openModal('${index}')"><i class="fa fa-search"></i>查看</span>
                            <span class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openModal('${index}')"><i class="fa fa-search"></i>加入黑名单</span>`
                        }
                    }]
            };
            $.table.init(options);
        });

        /* 查看码列表 */
        function couponCodeList(couponId) {
            var url = 'candy/coupon/code?couponId=' + couponId;
            $.modal.openTab("积分明细列表", url);
        }
        function openModal(id) {
            // console.log('111111')
            $.modal.confirm("加入黑名单后，用户将不可使用积分功能", function() {
                console.log(12121212)
                // $.operate.post(prefix + "/edit_onsale", { "memberId": memberId, "onsale": 2 });
            });
        }
    </script>
</body>
</html>