<!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>

<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse" >
                <div class="query-condition-container">
                    <h4 class="query-condition-title">查询条件</h4>
                    <div class="query-buttons">
                        <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>
                    </div>
                </div>
                <form id="SDdglOrderStore-form" class="customize-search-form">
                    <div class="customize-form-group-container">
                        <div class="customize-form-group select-time">
                            <label>订单日期:</label>
                            <input type="text" class="time-input" id="beginTime" placeholder="开始时间" name="beginTime">
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime">
                        </div>
                        <div class="customize-form-group">
                            <label>订单号:</label>
                            <input type="text" class="styled-input" placeholder="请输入订单号" name="orderId" autocomplete="off"/>
                        </div>
                        <div class="customize-form-group">
                                <label>配送类型:</label>
                                <select name="deliveryType"  class="styled-input">
                                    <option value="">全部</option>
                                    <option value="自提">自提</option>
                                    <option value="非自提">非自提</option>
                                </select>
                        </div>
                        <div class="customize-form-group">
                                <label>渠道名称:</label>
                                <select name="channelName"  class="styled-input">
                                    <option value="">全部</option>
                                    <option value="药急送">药急送</option>
                                    <option value="美团外卖">美团外卖</option>
                                    <option value="京东到家">京东到家</option>
                                    <option value="天猫商城">天猫商城</option>
                                    <option value="饿了么">饿了么</option>
                                </select>
                        </div>
                        <div class="customize-form-group">
                                <label>订单状态:</label>
                                <select name="orderStatus"  th:with="type=${@dict.getType('sys_select_order_status')}" class="styled-input">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                    ></option>
                                </select>
                        </div>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
                    <i class="fa fa-plus"></i> 新增
                </a>
                 <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:user:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:user:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: hidden;">
                <table id="bootstrap-table" class="fixed-layout-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 :: bootstrap-table-fixed-columns-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 + "ddgl/sddglorderstore";
    $(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 + "/sDdglOrderStoreList",
            viewUrl: prefix + "/sDdglOrderStoreView/{id}",
            createUrl: prefix + "/sDdglOrderStoreAdd",
            updateUrl: prefix + "/sDdglOrderStoreEdit/{id}",
            removeUrl: prefix + "/sDdglOrderStoreRemove",
            /*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: false, //是否仅允许选择一行
            fixedColumns: true,
            //fixedNumber: 3,
            fixedRightNumber: 1,
            columns: [{
                checkbox: true
            },
                { field: 'id', title: '主键', align: 'center' ,visible:false},
                    { field: 'orderId', title: '订单号', align: 'center' },
                    { field: 'deliveryType', title: '配送类型', align: 'center' },
                    { field: 'mobileNumber', title: '手机号', align: 'center' },
                    { field: 'channelName', title: '渠道名称', align: 'center' },
                    { field: 'channelOrderNo', title: '渠道单号', align: 'center' },
                    { field: 'psoSaleOrderNo', title: 'PSO销售单号', align: 'center' },
                    { field: 'orderStatus', title: '订单状态', align: 'center' },
                    { field: 'deliveryStatus', title: '配送状态', align: 'center' },
                    { field: 'orderDate', title: '订单日期', align: 'center' },
                    { field: 'storeName', title: '门店名称', align: 'center' },
                    { field: 'consumptionTime', title: '消费时间', align: 'center' },
                    { field: 'memberId', title: '会员ID', align: 'center' },
                    { field: 'memberName', title: '会员名称', align: 'center' },
                    { field: 'systemLoginUserId', title: '系统登录人Id', align: 'center' },
                    { field: 'orderPlacer', title: '下单人', align: 'center' },
                    { field: 'orderTime', title: '下单时间', align: 'center' },
                    { field: 'settlementId', title: '结账单id', align: 'center' },
                    { field: 'settlementCode', title: '结账单code', align: 'center' },
                    { field: 'finalPaymentTime', title: '最后完成支付时间', align: 'center' },
                    { field: 'totalDrugQuantity', title: '药品总数量', align: 'center' },
                    { field: 'cardNumber', title: '卡号', align: 'center' },
                    { field: 'shippingAddress', title: '发货地址', align: 'center' },
                    { field: 'orderAddress', title: '下单地址', align: 'center' },
                    { field: 'orderType', title: '订单类型', align: 'center' },
                    { field: 'orderSource', title: '订单来源', align: 'center' },
                    { field: 'totalAmount', title: '订单总金额', align: 'center' },
                    { field: 'deliveryFee', title: '订单费用外送费', align: 'center' },
                    { field: 'refundAmount', title: '退款金额', align: 'center' },
                    { field: 'deliveryPickupMethod', title: '外送提货方式', align: 'center' },
                    { field: 'deliveryPickupTime', title: '外送提货时间', align: 'center' },
                    { field: 'remarks', title: '备注', align: 'center' },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        if (row.id) {
                            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();
        $("#SDdglOrderStore-form")[0].reset();
        $.table.search();
        _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 + "?editTage=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> ';
        }
    }
</script>
</body>

</html>
