123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel=icon type=image/png href="data:image/png;base64,iVBORw0KGgo=">
- <meta name="description" content="">
- <meta name="author" content="">
- <title>管理后台</title>
- <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
- <style>
- body {
- padding-top: 50px;
- }
- .sub-header {
- padding-bottom: 10px;
- border-bottom: 1px solid #eee;
- }
- .navbar-fixed-top {
- border: 0;
- }
- .sidebar {
- display: none;
- }
- @media (min-width: 768px) {
- .sidebar {
- position: fixed;
- top: 51px;
- bottom: 0;
- left: 0;
- z-index: 1000;
- display: block;
- padding: 20px;
- overflow-x: hidden;
- overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
- background-color: #f5f5f5;
- border-right: 1px solid #eee;
- }
- }
- .nav-sidebar {
- margin-right: -21px; /* 20px padding + 1px border */
- margin-bottom: 20px;
- margin-left: -20px;
- }
- .nav-sidebar > li > a {
- padding-right: 20px;
- padding-left: 20px;
- }
- .nav-sidebar > .active > a,
- .nav-sidebar > .active > a:hover,
- .nav-sidebar > .active > a:focus {
- color: #fff;
- background-color: #428bca;
- }
- .main {
- padding: 20px;
- }
- @media (min-width: 768px) {
- .main {
- padding-right: 40px;
- padding-left: 40px;
- }
- }
- .main .page-header {
- margin-top: 0;
- }
- .placeholders {
- margin-bottom: 30px;
- text-align: center;
- }
- .placeholders h4 {
- margin-bottom: 0;
- }
- .placeholder {
- margin-bottom: 20px;
- }
- .placeholder img {
- display: inline-block;
- border-radius: 50%;
- }
- </style>
- </head>
- <body>
- <nav class="navbar navbar-inverse navbar-fixed-top">
- <div class="container-fluid">
- <div class="navbar-header">
- <a class="navbar-brand" href="/">管理后台</a>
- </div>
- <ul class="nav navbar-nav navbar-right">
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{session('username')}} <span class="caret"></span></a>
- <ul class="dropdown-menu">
- <li><a href="/logout">退出</a></li>
- </ul>
- </li>
- </ul>
- </div>
- </nav>
- <div class="container-fluid">
- <div class="row">
- <div class="col-sm-3 col-md-2 sidebar">
- <ul class="nav nav-sidebar">
- <li class="{{$page == 'send_orders' ? 'active':''}}" ><a href="{{url('/sendorder/list')}}">派单统计</a></li>
- </ul>
- </div>
- <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
- @yield('content')
- </div>
- </div>
- </div>
- </body>
- <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
- <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <script>
- function AlertWindow(obj) {
- $.ajaxSetup({
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
- }
- });
- this.startEle = obj.startEle || '.js-alert-start';
- this.startAjax = obj.startAjax || false;
- this.endAjax = obj.endAjax || false;
- this.closeEle = obj.closeEle || ".js-modal-close";
- this.saveEle = obj.saveEle || ".js-modal-save";
- this.errorEle = obj.errorEle || ".js-error-msg";
- this.oStartEle = $(this.startEle);
- this.formHtml = obj.formHtml;
- this.saveHtml =obj.saveHtml;
- this.__init__();
- }
- AlertWindow.prototype.__init__ = function () {
- fromOldHtml = '';
- //打开
- var that = this;
- var editid = '';
- if(that.startAjax){
- that.oStartEle.on('click',function (e) {
- e.preventDefault();
- var data = {};
- if(that.startAjax.data){
- data[that.startAjax.data.key] = $(this).data(that.startAjax.data.key);
- }
- $.ajax({
- url:that.startAjax.url,
- type:that.startAjax.type || 'get',
- data:data,
- dataType:'json',
- success:function (res) {
- if(res.code == 1){
- //$(that.startAjax.target).html(res.data)
- that.formHtml = res.data;
- var title = $(this).data('title') || '编辑';
- editid = $(this).data('id');
- that.show(title);
- }
- },
- });
- })
- }else{
- that.oStartEle.on('click',function (e) {
- e.preventDefault();
- var title = $(this).data('title') || '编辑';
- editid = $(this).data('id');
- that.show(title);
- })
- }
- //提交
- console.log(that.saveEle);
- $("#myModal .modal-footer").on('click',that.saveEle,function () {
- var data = $('.js-ajax-from').serializeArray();
- var res = that.formcheck(data,that.endAjax.requiredata) ;
- if(!( res === true )){
- $('.'+res).addClass('has-error');
- $(that.errorEle).html("不能为空").css({"display":"inline"});
- return false;
- }
- //console.log(that.endAjax);
- //console.log(data);
- var newdata = {};
- for(var k in data){
- newdata[data[k]['name']] = data[k]['value'];
- }
- console.log(editid);
- if(editid){
- newdata['id'] = editid;
- }
- console.log(newdata);
- //return ;
- $.ajax({
- url:that.endAjax.url,
- type:"post",
- data:newdata,
- dataType:'json',
- success:function (response) {
- //console.log(response)
- if(response.code){
- that.hide();
- setTimeout(function () {
- var html = '<div class="alert alert-success" role="alert">'+response.msg+'</div>';
- $('.js-prepend').prepend(html);
- setTimeout(function () {
- //window.location.reload();
- },300)
- },10)
- }else {
- $('.'+res).addClass('has-error');
- $(that.errorEle).html(response.msg).css({"display":"inline"});
- return false;
- }
- },
- fail:function () {
- $(that.errorEle).html("error").css({"display":"inline"});
- return false;
- }
- })
- });
- //关闭
- $(that.closeEle).on('click',function () {
- that.hide(that.saveClass);
- /*setTimeout(function () {
- window.location.reload();
- },100)*/
- })
- };
- AlertWindow.prototype.show = function (title) {
- $("#myModal .modal-footer").html(this.saveHtml);
- $('#myModal .js-ajax-from').html(this.formHtml);
- $('body').addClass('modal-open');
- $('#myModal').addClass('in').css({"display":"block"});
- if(title){
- $('#myModalLabel').html(title);
- }
- $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii'});
- };
- AlertWindow.prototype.hide = function () {
- $("#myModal .modal-footer").html("");
- $('body').removeClass('modal-open');
- $('#myModal').removeClass('in').css({"display":"none"});
- };
- AlertWindow.prototype.ajax = function (obj) {
- //console.log(obj)
- $.ajax({
- obj
- });
- };
- AlertWindow.prototype.formcheck = function (form,require) {
- //console.log(require);
- if(!require.length)
- return true;
- for(var i = 0;i<require.length;i++){
- if( form[i].name == require[i] && form[i].value == '')
- return require[i];
- }
- return true;
- }
- $(function () {
- /*var total = $("#hidden-total").val();
- $("#js-order-page ul").append("<li><a href='javascript:;'>总计"+total+"</a></li>")
- $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii'});*/
- })
- </script>
- @stack('scripts')
- </html>
|