
@{
    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>专线占比</label>
                        <input id="zstart" name="zstart" type="number" class="form-control" style="width:60px" value="0" />%-
                        <input id="zend" name="zend" type="number" class="form-control" style="width:60px" value="0" />%
                    </div>
                    <div class="form-group">
                        <label>海外仓占比</label>
                        <input id="hstart" name="hstart" type="number" class="form-control" style="width:60px" value="0" />%-
                        <input id="hend" name="hend" 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: 'zsurfacemailcount', title: '专线平邮出单数', width: '130', sortable: false, iscount: true },
                { field: 'zpackagecount', title: '专线包裹出单数', width: '130', sortable: false, iscount: true },
                { field: 'zcount', title: '专线总出单', width: '130', sortable: false, iscount: true },
                { field: 'percenz', title: '专线占比%', width: '110', sortable: false, iscount: true },
                { field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '130', sortable: false, iscount: true },
                { field: 'hpackagecount', title: '海外仓包裹出单数', width: '130', sortable: false, iscount: true },
                { field: 'hcount', title: '海外仓总出单数', width: '150', sortable: false, iscount: true },
                { field: 'percenh', title: '海外仓占比%', width: '120', sortable: false, iscount: true },
                { field: 'needaddh', title: '需新增海外仓数', width: '130', sortable: true, iscount: true },
                { field: 'needcount', title: '累积总差额', width: '120', 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});
            }
            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>

}

