<!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="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>订单id：</p>
                                <input type="text" name="orderId"/>
                            </li>
                            <li>
                                <p>产品名称：</p>
                                <input type="text" id="productName"  name="params[productName]"/>
                            </li>
                            <li>
                                <p>订购数量：</p>
                                <input type="text" name="productCount"/>
                            </li>
                            <li>
                                <p>单价：</p>
                                <input type="text" name="salePrice"/>
                            </li>
                            <!-- <li>
                                <p>发货状态：</p>
                                <select name="shipStatus" th:with="type=${@dict.getType('order_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>发货单号：</p>
                                <input type="text" name="shipNo"/>
                            </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" onclick="$.operate.add()" shiro:hasPermission="crm:orderProduct:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="crm:orderProduct:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="crm:orderProduct:remove">
                    <i class="fa fa-remove"></i> 删除
                </a> -->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="crm:orderProduct: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 editFlag = [[${@permission.hasPermi('crm:orderProduct:edit')}]];
        var removeFlag = [[${@permission.hasPermi('crm:orderProduct:remove')}]];
        var shipStatusDatas = [[${@dict.getType('order_status')}]];
        var prefix = ctx + "crm/orderProduct";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
		        sortName: "createTime",
		        sortOrder: "desc",
                modalName: "订单关联产品信息",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'orderProductId', 
                    title : '订单产品ID',
                    visible: false
                },
                {
                    field : 'orderId', 
                    title : '订单id',
                    visible: false
                },
                {
                    field : 'productId', 
                    title : '产品id',
                    visible: false
                },
                {
                    field : 'order.orderName', 
                    title : '订单主题',
		            sortable: true
                },
                {
                    field : 'order.customer.customerName', 
                    title : '成交客户',
		            sortable: true
                },
                {
                    field : 'product.productName', 
                    title : '产品名称',
		            sortable: true
                },
                {
                    field : 'productCount', 
                    title : '订购数量',
		            sortable: true
                },
                {
                    field : 'sellPrice', 
                    title : '销售价',
		            sortable: true
                },
                {
                    field : 'discount', 
                    title : '折扣',
		            sortable: true
                },
                {
                    field : 'shipStatus', 
                    title : '发货状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(shipStatusDatas, value);
                    },
                    visible: false,
		            sortable: true
                },
                {
                    field : 'shipNo', 
                    title : '发货单号',
                    visible: false,
		            sortable: true
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>