@{
    ViewData["Title"] = "平台账单流水";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "销售平台流水", (ViewBag.platform == "" ? "其他" : ViewBag.platform) + "账单流水" };
}

<button id="btn_Upload" type="button" style="" class="btn btn-warning">导入销售订单费用配置</button>

<button id="btn_LogisticFee" type="button" style="" class="btn btn-success">导入物流费配置</button>

@section css{
    <link href="~/js/webuploader-0.1.5/webuploader.css" rel="stylesheet" />
    <style>

        .webuploader-pick {
            position: relative;
            display: block;
            cursor: pointer;
            background: none;
            padding: 0px;
            color: #fff;
            text-align: center;
            border-radius: 3px;
            overflow: hidden;
        }

        .webuploader-container {
            background-color: cornflowerblue !important;
        }

        .mules {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
}


@section scripts{
    <script src="~/js/webuploader-0.1.5/webuploader.min.js"></script>
    <script type="text/javascript">
        var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';

        $(document).ready(function () {
            uploadfile('btn_Upload',
                '@Url.Content("~/Home/UploadDemoFile")',
                function (result) {
                    alert('上传成功！');
                });

            //物流商配置    UploadLogisticFeeConfig

            uploadfile('btn_LogisticFee',
                '@Url.Content("~/Home/UploadLogisticFeeConfig")',
                function (result) {
                    alert('上传成功！');
                });


        })

         function uploadfile(id,url,callback)
        {
            var uploader = new WebUploader.Uploader({
                // swf文件路径
                swf: BASE_URL + 'Uploader.swf',
                // 文件接收服务端。
                server: url!=undefined?url:'@Url.Content("~/File/UploadFile")',
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#'+id,
                // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
                resize: false,
                auto: true,
                timeout: 0,
                accept: {
                    extensions: "xls,xlsx",
                    mimeTypes: ".xls,.xlsx"
                }
            });

            uploader.on('uploadSuccess', function (file, response) {
                if(callback!=undefined)
                {
                    callback(response);
                }
            });

            uploader.on('uploadError', function (file) {
                layer.msg("上传出错");
            });
        }
    </script>
}