
@{
    ViewData["Title"] = "Ebay新政策海外仓发货情况";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "统计", "Ebay海外仓发货分析" };
}

<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom">
            <form id="toolbar">
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <label>付款时间</label>
                        <input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />至
                        <input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
                    </div>
                    <div class="form-group">
                        <label>letter占比</label>
                        <input id="l_start" name="l_start" type="number" class="form-control" style="width:60px" value="0" />%-
                        <input id="l_end" name="l_end" type="number" class="form-control" style="width:60px" value="0" />%
                    </div>
                    <div class="form-group">
                        <label>包裹占比</label>
                        <input id="bg_start" name="bg_hstart" type="number" class="form-control" style="width:60px" value="0" />%-
                        <input id="bg_end" name="bg_end" type="number" class="form-control" style="width:60px" value="0" />%
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <button type="button" class="btn btn-primary" onclick="data();"><i class="fa fa-search"></i>&nbsp;查询</button>
                    </div>
                </div>
            </form>
        </div>

        <div class="ibox-content m-b-sm border-bottom">
            @*<table id="roletable" class="table table-hover table-bordered table-condensed table-striped" style="table-layout:fixed;">
            <thead>
                <tr>
                    <th>卖家帐号</th>
                    <th>订单数</th>
                    <th>专线平邮出单数</th>
                    <th>专线包裹出单数</th>
                    <th>专线总出单</th>
                    <th>专线占比%</th>
                    <th>海外仓平邮出单数</th>
                    <th>海外仓包裹出单数</th>
                    <th>海外仓总出单数</th>
                    <th>海外仓占比%</th>
                    <th>需新增海外仓数</th>
                    <th>累积总差额</th>
                </tr>
            </thead>
            <tbody id="tb"></tbody>
        </table>*@

            <table id="roletable" style="table-layout:fixed;"></table>

        </div>
    </div>
</div>
@section css{
    <style>
        .mules {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
}
@section scripts{
    <script type="text/javascript">
        var tb;
        $(document).ready(function () {
            laydate.render({ elem: '#start' });
            laydate.render({ elem: '#end' });

            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 170));

            list();
            //data();
        })

        function list() {
            var columns = [
                {
                    field: 'seller_account', title: '卖家帐号', width: '130', sortable: false, iscount: true, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account+'</div>';
                    }
                },
                { field: 'ordercount', title: '订单数', width: '100', sortable: true,iscount:true },
                { field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '130', sortable: false, iscount: true },
                { field: 'hpackagecount', title: '海外仓包裹出单数', width: '130', sortable: false, iscount: true },
                { field: 'percenl', title: '包裹/letter倍数', width: '130', sortable: false, iscount: true },
                { field: 'needcount_bg', title: '需新增包裹数', width: '110', sortable: false, iscount: true }
            ];

            var url = '@Url.Content("~/Logistics/Home/EbayUkReportJson")' + '?' + $("#toolbar").serialize();

            if (tb == undefined) {
                tb = OnlyTable("roletable", columns, url, "", { showfooter: true, showCount: true }, undefined,1000);
            }
            else {
                tb.bootstrapTable('refresh', { url: url });
            }
        }

        function data() {
            var start = $('#start').val();
            if (start == '') {
                alert('请选择发货开始时间');
                return false;
            }

            var end = $('#end').val();
            if (end == '') {
                alert("请选择发货结束时间");
                return false;
            }

            var index = layer.load();
            $.submit({
                type: 'POST',
                url: '@Url.Content("~/Logistics/Home/EbayUkReportJson")',
                paramData: $("#toolbar").serialize(),
                func: function (result) {
                    layer.close(index);
                    if (result && result.length > 0) {
                        $('#tb').html('');
                        for (var i = 0; i < result.length; i++) {
                            var s = '<tr><td>' + result[i].seller_account + '</td>';
                            s += '<td>' + result[i].ordercount + '</td>';
                            s += '<td>' + result[i].zsurfacemailcount + '</td>';
                            s += '<td>' + result[i].zpackagecount + '</td>';
                            s += '<td>' + result[i].zcount + '</td>';
                            s += '<td>' + result[i].percenz + '</td>';
                            s += '<td>' + result[i].hsurfacemailcount + '</td>';
                            s += '<td>' + result[i].hpackagecount + '</td>';
                            s += '<td>' + result[i].hcount + '</td>';
                            s += '<td>' + result[i].percenh + '</td>';
                            s += '<td>' + result[i].needaddh + '</td>';
                            s += '<td>' + result[i].needcount + '</td>';
                            s += '</tr>';
                            $('#tb').append(s);
                        }
                    }
                }
            })

        }
        
    </script>

}

