<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=no">
    <th:block th:include="include :: header('兑换记录')" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<style>
    /* 设置 ul 的基本样式 */
    ul {
        list-style-type: none; /* 去掉项目符号 */
        padding: 0; /* 去掉默认的内边距 */
        display: grid; /* 使用网格布局 */
        grid-template-columns: repeat(5, 1fr); /* 设置三列 */
    }

    /* 设置 li 的基本样式 */
    li {
        /*background-color: lightblue; *//* 背景颜色 */
        /*padding: 1px; !* 内边距 *!*/
        text-align: right; /* 文本居中 */
    }
</style>

<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse" >
                <form id="SHyglJfglOrderinfo-form">
                    <input type="hidden" id="deptId" name="deptId">
                    <input type="hidden" id="parentId" name="parentId">
                    <h4>查询条件</h4>
                    <hr>
                    <div class="select-list" >
                        <ul>
                            <li>
                                订单号:<input type="text" class="styled-input" placeholder="请输入订单号" name="orderID" autocomplete="off"/>
                            </li>
                            <li>
                                商品类型 <select name="productType"  th:with="type=${@dict.getType('sys_select_product_type')}" class="styled-input">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                    ></option>
                                </select>
                            </li>
                            <li>
                                兑换渠道
                                <select name="redemptionChannel"  th:with="type=${@dict.getType('sys_select_jfdh_qd')}" class="styled-input">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                    ></option>
                                </select>
                            </li>
                            <li>
                                特价订单
                                <select name="specialOrder"  th:with="type=${@dict.getType('sys_select_jfdhtj_order')}" class="styled-input">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                    ></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="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                    <div class="select-list" >
                        <ul>
                            <li>
                                自提码:<input type="text" class="styled-input"  placeholder="请输入自提码" name="redemptionChannel" autocomplete="off"/>
                            </li>

                            <li>
                                核销门店:<input type="text" class="styled-input"  placeholder="请输入核销门店" name="verificationStore" autocomplete="off"/>
                            </li>
                            <li>
                                兑换状态
                                <select name="redemptionStatus"  th:with="type=${@dict.getType('sys_select_jfdh_status')}" class="styled-input">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                    ></option>
                                </select>
                            </li>

                            <li class="select-time">
                                <label>下单时间: </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="xdbeginTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="xdendTime"/>
                            </li>


                        </ul>
                    </div>

                <div class="select-list">
                    <ul>
                        <li>
                            手机号<input type="text" class="styled-input"  placeholder="请输入手机号" name="memberPhoneOrCardNo" autocomplete="off"/>
                        </li>
                        <li>
                            积分区间:
                            <input type="number" style="width: 92px;" class="styled-input"  placeholder="最大" name="pointsMax" autocomplete="off"/>
                            ~
                            <input type="number" style="width: 92px;" class="styled-input"  placeholder="最小" name="pointsMin" autocomplete="off"/>
                        </li>
                    </ul>
                </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-success" onclick="checkProduct()" shiro:hasPermission="system:user: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>
</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('dtp:pmService:edit')}]];
    var removeFlag = [[${@permission.hasPermi('dtp:pmService:remove')}]];
    var prefix = ctx + "hygl/shygljfglorderinfo";
    $(function() {
        var panehHidden = false;
        if ($(this).width() < 1590) {
            panehHidden = true;
        }
        $('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win:$('.ui-layout-center'),
                doc:$('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }
        queryArchivesList();
    });

    function queryArchivesList() {
        var options = {
            url: prefix + "/sHyglJfglOrderinfoList",
            viewUrl: prefix + "/sHyglJfglOrderinfoView/{id}",
            createUrl: prefix + "/sHyglJfglOrderinfoAdd",
            updateUrl: prefix + "/sHyglJfglOrderinfoEdit/{id}",
            removeUrl: prefix + "/sHyglJfglOrderinfoRemove",
            /*exportUrl: prefix + "/export",
            importUrl: prefix + "/importData",
            importTemplateUrl: prefix + "/importTemplate",*/
            sortName: "id",
            sortOrder: "asc",
            modalName: "核销商品",
            fitColumns: true,
            striped: true,
            autoRowHeight: true,
            rowNumbers: true,
            showFooter:true,  //是否显示表格底部区域。
            clickToSelect: true, //是否启用点击行时选中整行的功能。
            singleSelect: true, //是否仅允许选择一行
            columns: [{
                checkbox: true
            },
                { field: 'id', title: '主键', align: 'center' ,visible:false},
                    { field: 'orderID', title: '订单号', align: 'center' },
                    { field: 'productName', title: '商品名', align: 'center' },
                    { field: 'productType', title: '商品类型', align: 'center' },
                    { field: 'orderTotalPrice', title: '订单总价', align: 'center' },
                    { field: 'externalPointsPaid', title: '外部积分支付', align: 'center' },
                    { field: 'isPromotionOrder', title: '是否特价订单', align: 'center' },
                    { field: 'redemptionQuantity', title: '兑换数量', align: 'center' },
                    { field: 'redemptionChannel', title: '兑换渠道', align: 'center' },
                    { field: 'paymentMethod', title: '支付方式', align: 'center' },
                    { field: 'redemptionStatus', title: '兑换状态', align: 'center' },
                    { field: 'orderTime', title: '下单时间', align: 'center' },
                    { field: 'memberPhoneOrCardNo', title: '会员手机号/卡号', align: 'center' },
                    { field: 'userRole', title: '用户身份', align: 'center' },
                    { field: 'pickupOrRedemptionStore', title: '自提/兑换门店', align: 'center' },
                    { field: 'recommendingEmployee', title: '推荐兑换员工', align: 'center' },
                    { field: 'recommendingStore', title: '推荐兑换门店', align: 'center' },
                    { field: 'verificationStore', title: '核销门店', align: 'center' },
                    { field: 'verifiedBy', title: '核销人', align: 'center' },
                    { field: 'verificationTime', title: '核销时间', align: 'center' },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        if (row.serviceId != 1) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit_page(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                            var more = [];
                            /*more.push("<a class='btn btn-default btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.userId + ")'><i class='fa fa-key'></i>重置密码</a> ");
                            more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
                            actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');*/
                            return actions.join('');
                        } else {
                            return "";
                        }
                    }
                }]
        };
        $.table.init(options);
    }

    /* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
    function resetPre() {
        resetDate();
        $("#SHyglJfglOrderinfo-form")[0].reset();
        $("#deptId").val("");
        $("#parentId").val("");
        $(".curSelectedNode").removeClass("curSelectedNode");
        $.table.search();
        var resetButton = document.getElementById('SHyglJfglOrderinfo-form');
        resetButton.addEventListener('click', function() {
            _refresh();
        });
    }
    function edit_page(id){
        table.set();
        var url = "/404.html";
        if ($.common.isNotEmpty(id)) {
            url = table.options.updateUrl.replace("{id}", id);
        } else {
            var id = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
            if (id.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            url = table.options.updateUrl.replace("{id}", id);
        }
        $.modal.openTab("修改" + table.options.modalName, url + "?status=1" );
    }

    /* 用户状态显示 */
    function statusTools(row) {
        if (row.status == 1) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
        }
    }

    function checkProduct() {
        var url = ctx + 'hygl/shygljfglorderinfo/checkProduct';
        $.modal.open("核销商品", url, '600', '220');
    }


</script>
</body>

</html>
