<!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>
                                <label>用户编号：</label>
                                <input type="text" name="userId"/>
                            </li>
                            <li>
                                <label>订单编号：</label>
                                <input type="text" name="orderId"/>
                            </li>
                            <li>
                                <label>订单状态：</label>
                                <select name="orderState">
                                    <option value="">所有</option>
                                    <option value="0">初始</option>
                                    <option value="1">待付款</option>
                                    <option value="2">已取消</option>
                                    <option value="3">已失败</option>
                                    <option value="4">已过期</option>
                                    <option value="9">完成</option>
                                </select>
                            </li>
                            <li>
                                <label>支付渠道：</label>
                                <select name="payChannel">
                                    <option value="">所有</option>
                                    <option value="WECHAT">微信</option>
                                    <option value="ALIPAY">支付宝</option>
                                    <option value="APPLE">苹果</option>
                                </select>
                            </li>
                            <li>
                                <label>会员到期时间：</label>
                                <input type="text" class="time-input" placeholder="请选择会员到期时间" name="vipExpireTime"/>
                            </li>
                            <li>
                                <label>支付宝交易号：</label>
                                <input type="text" name="tradeNo"/>
                            </li>
                            <li>
                                <label>商品编号：</label>
                                <input type="text" name="goodsId"/>
                            </li>
                            <li>
                                <label>商品描述：</label>
                                <input type="text" name="goodsDesc"/>
                            </li>
                            <li>
                                <label>用户手机号码：</label>
                                <input type="text" name="userPhone"/>
                            </li>
                            <li>
                                <label>订单失效时间：</label>
                                <input type="text" class="time-input" placeholder="请选择订单失效时间" name="exprireTime"/>
                            </li>
                            <li>
                                <label>订单金额：</label>
                                <input type="text" name="amt"/>
                            </li>
                            <li>
                                <label>订单原始金额：</label>
                                <input type="text" name="orignalAmt"/>
                            </li>
                            <li>
                                <label>附加数据：</label>
                                <input type="text" name="attach"/>
                            </li>
                            <li>
                                <label>应用ID：</label>
                                <input type="text" name="appId"/>
                            </li>
                            <li>
                                <label>商户编号：</label>
                                <input type="text" name="mchId"/>
                            </li>
                            <li>
                                <label>设备号：</label>
                                <input type="text" name="deviceInfo"/>
                            </li>
                            <li>
                                <label>公司名称：</label>
                                <input type="text" name="companyName"/>
                            </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="business:order:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:order:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:order:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:order: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" />
    <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('business:order:edit')}]];
        var removeFlag = [[${@permission.hasPermi('business:order:remove')}]];
        var prefix = ctx + "business/order";

        var payStatus = [[${@dict.getType('api_pay_status')}]];
        var paytypes = [[${@dict.getType('api_pay_type')}]];
        var payChannels = [[${@dict.getType('api_pay_channel')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "订单",
                fixedColumns: true,
                fixedNumber: 3,
                fixedRightNumber:1,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户编号'
                },
                {
                    field: 'orderId',
                    title: '订单编号'
                },
                {
                    field: 'orderState',
                    title: '订单状态',
                    formatter : function(value,row,index){
                        return $.table.selectDictLabel(payStatus, value);
                    }

                },
                {
                    field: 'type',
                    title: '套餐类型',
                    formatter : function(value, row, index){
                        return $.table.selectDictLabel(paytypes, value);
                    }
                },
                {
                    field: 'subType',
                    title: '子类型'
                },
                {
                    field: 'payChannel',
                    title: '支付渠道',
                    formatter : function(value, row, index){
                        return $.table.selectDictLabel(payChannels, value);
                    }
                },
                {
                    field: 'vipExpireTime',
                    title: '会员到期时间'
                },
                {
                    field: 'tradeNo',
                    title: '支付宝交易号'
                },
                {
                    field: 'goodsId',
                    title: '商品编号'
                },
                {
                    field: 'goodsDesc',
                    title: '商品描述'
                },
                {
                    field: 'userPhone',
                    title: '用户手机号码'
                },
                {
                    field: 'exprireTime',
                    title: '订单失效时间'
                },
                {
                    field: 'amt',
                    title: '订单金额',
                    formatter :function(value, row, index){
                        return parent.$math.fen2Yuan(value);
                    }
                },
                {
                    field: 'orignalAmt',
                    title: '订单原始金额',
                    formatter :function(value, row, index){
                        return parent.$math.fen2Yuan(value);
                    }
                },
                {
                    field: 'attach',
                    title: '附加数据'
                },
                {
                    field: 'appId',
                    title: '应用ID'
                },
                {
                    field: 'mchId',
                    title: '商户编号'
                },
                {
                    field: 'deviceInfo',
                    title: '设备号'
                },
                {
                    field: 'returnCode',
                    title: '下单接口返回码'
                },
                {
                    field: 'returnMsg',
                    title: '下单接口返回码信息',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value, 20, "open");
                    }
                },
                {
                    field: 'tradeType',
                    title: '交易类型'
                },
                {
                    field: 'nonceStr',
                    title: '微信返回的随机字符串'
                },
                {
                    field: 'prepayId',
                    title: '预支付交易会话标识'
                },
                {
                    field: 'subsId',
                    title: '关联ID'
                },
                {
                    field: 'queryParam',
                    title: '查询条件',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value, 15, "open");
                    }
                },
                {
                    field: 'url',
                    title: '导出excel地址',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value, 12, "open");
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'companyName',
                    title: '公司名称'
                },
                {
                    field: 'recordId',
                    title: '解锁记录id'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + 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>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>