
@{
    ViewData["Title"] = "非FBA销售订单";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "订单", ("非fba销售订单") };
}

<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom">
            <form id="toolbar">
                <input id="isfba" name="isfba" type="hidden" value="0" />
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <label>仓库类型：</label>
                        <select id="warehousetype" name="warehousetype" class="form-control">
                            <option value="">选择仓库类型</option>
                            <option value="国内仓">国内仓</option>
                            <option value="海外仓">海外仓</option>
                            <option value="FBA仓">FBA仓</option>
                            <option value="第三方仓库">第三方仓库</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>仓库：</label>
                        <select id="warehousecode" name="warehousecode" class="form-control" style="width:160px;">
                            <option value="">选择仓库</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>订单状态：</label>
                        <select id="orderstatus" name="orderstatus" class="form-control" style="width:160px;">
                            <option value="">全部</option>
                            <option value="Handling">处理中</option>
                            <option value="Finished">已完结</option>
                            <option value="Canceled">已取消</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>发货状态：</label>
                        <select id="shippingstatus" name="shippingstatus" class="form-control" style="width:160px;">
                            <option value="">全部</option>
                            <option value="UnShipping">未发货</option>
                            <option value="PartShipping">部分发货</option>
                            <option value="TotalShipping">全部发货</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <input id="sku" name="sku" class="form-control" style="width:130px;" placeholder="sku编码" />
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <input id="orderno" name="orderno" class="form-control" style="width:130px;" placeholder="平台订单号" />
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
                    </div>
                </div>
            </form>
        </div>

        <div class="ibox-content m-b-sm border-bottom">
            <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 () {
            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 160));

            list();

            listwarehouse();
        })

        function list() {
            var columns = [
                { field: 'transaction_id', title: '交易号', width: '200', sortable: false },
                {
                    field: 'bailun_order_id', title: '订单编号', width: '200', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.bailun_order_id + '">' + data.bailun_order_id + '</div>';
                    }
                },
                {
                    field: 'origin_order_id', title: '平台订单号', width: '190', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.origin_order_id + '">' + data.origin_order_id + '</div>';
                    }
                },
                {
                    field: 'bailun_sku', title: 'sku编码', width: '130', sortable: true, iscount: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.bailun_sku + '">' + data.bailun_sku+'</div>';
                    }
                },
                { field: '', title: '刊登sku编码', width: '130', sortable: false },
                {
                    field: 'sku_image', title: '主图', width: '100', sortable: false, iscount: true, formatter: function (idx, data) {
                        return '<img src="' + data.sku_image + '" style="width:60px" />';
                    }
                },
                {
                    field: 'category_name', title: '分类名称', width: '150', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.category_name + '">' + data.category_name + '</div>';
                    }
                },
                {
                    field: 'sku_title_en', title: '英文标题', width: '130', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.sku_title_en + '">' + data.sku_title_en + '</div>';
                    }
                },
                {
                    field: 'sku_title_cn', title: '中文标题', width: '130', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.sku_title_cn + '">' + data.sku_title_cn + '</div>';
                    }
                },
                { field: 'color', title: '颜色', width: '90', sortable: false },
                { field: 'character', title: '规格', width: '90', sortable: false },
                { field: 'price', title: '价格', width: '100', sortable: true },
                { field: 'bailun_sku_quantity_ordered', title: '订购数量', width: '110', sortable: true },
                { field: 'amount_product', title: '合计金额', width: '100', sortable: true, iscount: true },
                { field: 'order_currency', title: '币种', width: '90', sortable: false },
                { field: '', title: '币种（中）', width: '100', sortable: false },
                { field: 'platform_type', title: '平台', width: '100', sortable: false },
                { field: 'website', title: '站点', width: '90', sortable: false },
                {
                    field: 'seller_account', title: '销售帐号', width: '110', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account + '</div>';
                    }
                },
                {
                    field: 'seller_name', title: '销售员', width: '110', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.seller_name + '">' + data.seller_name + '</div>';
                    }
                },
                {
                    field: 'salecount', title: 'fba订单', width: '100', sortable: false, formatter: function (idx, data) {
                        return data.isfba == 1 ? "是" : "否";
                    }
                },
                { field: 'bailun_order_status', title: '订单状态', width: '100', sortable: false },
                { field: 'warehouse_name', title: '发货仓库', width: '110', sortable: false },
                { field: 'shipping_status', title: '发货状态', width: '140', sortable: false },
                { field: 'create_time', title: '创建时间', width: '160', sortable: true },
                { field: 'order_update_time', title: '更新时间', width: '160', sortable: true },
                { field: 'gmt_modified', title: '同步时间', width: '160', sortable: true },
            ];

            var url = '@Url.Content("~/Reports/Orders/SkuOrderListJson")' + '?' + $("#toolbar").serialize();

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

        
        function listwarehouse() {
            $.submit({
                url: '@Url.Content("~/Home/ListWareHouse")',
                paramData: '',
                type:'POST',
                func: function (result) {
                    if (result != null && result != undefined) {
                        $('#warehousecode').html('<option value="">仓库不限</option>');
                        for (var i = 0; i < result.length; i++) {
                            $('#warehousecode').append('<option value="' + result[i].warehouse_code + '">' + result[i].warehouse_name + '</option>');
                        }
                    }
                }
            })
        }

    </script>

}




