<?php if (!defined('THINK_PATH')) exit();?>
 <!doctype html>
  <html class="no-js">
  <head>

        <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Catering - background management</title>
    <link rel="stylesheet" href="/canyin2/Public/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/core.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/menu.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/index.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/admin.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/page/typography.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/page/form.css" />
    <link rel="stylesheet" href="/canyin2/Public/assets/css/component.css" />
    <link rel="stylesheet" href="/canyin2/Public/layui2/css/layui.css" />
    <script type="text/javascript" src="/canyin2/Public/assets/js/jquery.min.js" ></script>
    <script type="text/javascript" src="/canyin2/Public/assets/js/app.js" ></script>
    <script type="text/javascript" src="/canyin2/Public/assets/js/jquery-2.1.0.js" ></script>
    <script src="/canyin2/Public/layer/layer.js"></script>
    <script src="/canyin2/Public/layui2/layui.all.js"></script>
    <style type="text/css">
        .am-padding-0 {
            padding: 0!important;
            overflow-y: hidden;
        }
        .content-page {
            flex: 1;
            -webkit-flex: 1;
            background: white;
        }
    </style>
    <style type="text/css">
      .am-form{width:500px;margin-left:20px;float: left;}
      #editor {font-size: 12px;}
      .am-form label span{font-size: 13px;font-weight:normal;}
      .am-form label p{display: inline;color: #f00;}
      .am-form .am-form-inline-2 input[type=file]{width: 246px}
      .am-form .am-form-inline-3 input[type=text]{width: 160px}
      .am-form .am-form-inline-3 select{width: 160px}
      .am-form .am-form-inline-4 input[type=text]{width: 120px}
      .am-form .am-form-inline-4 select{width: 120px}
      .two-input {display: flex;}
      .am-form .am-form-inline-4 .two-input input[type=text]{width: 50px;}
      .am-form .am-form-inline-4 .two-input input[type=text]:nth-of-type(2){width: 20px;padding: 8px 2px;cursor: default;background: #fff; border-left: 0; border-right: 0;}

      .am-form input[type=file]{display:none;}
      .am-form .am-form-group img{height: 60px;min-width: 60px;max-width: 100px;margin-top: 2px;display: block;cursor: pointer;}
      input[readonly]{background-color: #fff!important;cursor: default!important;}
      .am-form-group input{
        height: 30px;font-size: 14px;margin-bottom: 10px !important;
      }
      .am-form-group select{
        height: 30px;font-size: 14px;margin-bottom: 10px !important;
      }

      .cc{
        padding: 7px;
      }
      #kucun-table{
        width: 100%;
      }
      #kucun-table th ,#kucun-table td{
         line-height: 40px;
         border-bottom: 1px solid #eee;
         text-align: center;
      }
      
    </style>
  </head>
  <body>
  <!-- Begin page -->
        <header class="am-topbar am-topbar-fixed-top" style="    border-top: 3px solid #ebeff2;">
            <div class="am-topbar-left am-hide-sm-only">
                <a href="#" class="logo"><span>Admin<span></span></span><i class="zmdi zmdi-layers"></i></a>
            </div>
    
            <div class="contain">
                <ul class="am-nav am-navbar-nav am-navbar-left">

                    <li><h4 class="page-title">Admin Backend Management</h4></li>
                </ul>
                
                <ul class="am-nav am-navbar-nav am-navbar-right">
                    <!-- <li class="hidden-xs am-hide-sm-only" style=" margin-top: 8px;">
                        <form role="search" class="app-search">
                            <input type="text" placeholder="Search..." class="form-control">
                            <a href=""><img src="/canyin2/Public/assets/img/search.png"></a>
                        </form>
                    </li> -->
                    <li class="inform" style="margin: 0px">
                        <section data-am-widget="accordion" style="margin-left:10px; margin-top:0px" class="am-accordion am-accordion-basic" data-am-accordion='{  }'>
                            <dl class="am-accordion-item " style="width: 80px">
                                <dt class="am-accordion-title" style="padding: 0">
                                    <span class="am-icon-home "></span>
                                </dt>
                                <dd class="am-accordion-bd am-collapse">
                                    <!-- 规避 Collapase 处理有 padding 的折叠内容计算计算有误问题， 加一个容器 -->
                                    <div class="am-accordion-content" style=" background: #f3f3f3;">
                                        <a href="javascript: ;" id="change_pw">Change the password</a><br/>
                                        <a href="<?php echo U('login/logout');?>">exit</a><br/>
                                    </div>
                                </dd>
                            </dl>
                        </section>
                    </li>
                </ul>
            </div>

        </header>
<div class="am-modal am-modal-prompt am-modal-active" tabindex="-1" id="my-prompt-pw" style="">
    <div class="am-modal-dialog" style="color: #000;">
        <div class="am-modal-hd">Change the password</div>
        <div class="am-modal-bd">

            <input type="password" class="am-modal-prompt-input input-pw" id="old_pw" placeholder="The original password">
            <input type="password" class="am-modal-prompt-input input-pw" id="new_pw" placeholder="The new password">
            <input type="password" class="am-modal-prompt-input input-pw" id="mew_pw" placeholder="Repeat the password">
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel="">cancel</span>
            <span class="am-modal-btn" id="confirm_pw" data-am-modal-confirm="">confirm</span>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $("#confirm_pw").on('click',function(){
            var old_pw = $("#old_pw").val();
            var new_pw = $("#new_pw").val();
            var mew_pw = $("#mew_pw").val();
            if(!old_pw){
                layer.msg("Please enter the original password");
                return false;
            }
            if(!new_pw){
                layer.msg("Please enter a new password");
                return false;
            }
            if(!mew_pw){
                layer.msg("Please enter a duplicate password");
                return false;
            }
            if(new_pw != mew_pw){
                layer.msg("The passwords entered do not match");
                return false;
            }
        });
    });
    $(function(){
        $("#change_pw").on('click',function(){
            $('#my-prompt-pw').modal({
                relatedTarget: this,
                closeOnConfirm: false,
                onConfirm: function(e) {
                    var old_pw = $("#old_pw").val();
                    var new_pw = $("#new_pw").val();
                    var mew_pw = $("#mew_pw").val();
                    if(!old_pw || !new_pw || !mew_pw || new_pw!= mew_pw){return false;}

                    $.ajax({type:'post',url:'<?php echo U("Smi/Login/change_pw");?>',
                        data:{old_pw:old_pw,new_pw:new_pw},
                        success:function(result){
//                        alert(result);
                            if(result == 1){
                                alert("Modified successfully, please login again");
                                window.location.href = "<?php echo U('Login/logout');?>";
                            }else{
                                alert('The original password is wrong, please input again');
                            // $(".input-pw").val('');
                            // return false;
                        }
                        }
                    });
                },
                onCancel: function(e) {
                    $(".input-pw").val('');
                }
            });
        });
    });
</script>

<!-- end page -->

  <div class="am-cf admin">

    ﻿                  <div class="admin-sidebar am-offcanvas  am-padding-0" id="admin-offcanvas" style=" overflow-y: scroll;">
                    <div class="am-offcanvas-bar admin-offcanvas-bar">
                        <!-- User -->
                        <div class="user-box am-hide-sm-only">
                            <div class="user-img">
                                <img src="/canyin2/Uploads/<?php echo session('picture');?>"  alt="user-img" title="Mat Helme" class="img-circle img-thumbnail img-responsive">
                                <!--<?php echo ($_SESSION['admin_picture']); ?>-->
                                <div class="user-status offline"><i class="am-icon-dot-circle-o" aria-hidden="true"></i></div>
                            </div>
                            <h5><a href="#"><?php echo ($_SESSION['admin']); ?></a> </h5>
                            <ul class="list-inline">
                                <li>
                                    <a href="#">
                                        <i class="fa fa-cog" aria-hidden="true"></i>
                                    </a>
                                </li>
    
                                <li>
                                    <a href="#" class="text-custom">
                                        <i class="fa fa-cog" aria-hidden="true"></i>
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <!-- End User -->
                        
                 <ul class="am-list admin-sidebar-list" style="margin-bottom: 2rem;">
                  <?php foreach ($menu_list as $vo) : ?>
                    <li class="admin-parent">
                        <a class="am-cf" data-am-collapse="{target: '#<?php echo ($vo['nav']); ?>-nav'}">
                            <span class="am-icon-file"></span>
                            <?php echo ($vo["title"]); ?>
                            <span class="am-icon-angle-right am-fr am-margin-right"></span>
                        </a>
                          <ul class="am-list am-collapse admin-sidebar-sub <?php if($nav == $vo['nav']): ?>am-in<?php endif; ?>" id="<?php echo ($vo["nav"]); ?>-nav">
                          <?php foreach ($vo['menu_list'] as $vv) : ?>
                          <li>
                              <a href="<?php echo U($vv['url']);?>" class="am-cf">
                                  <span class="am-icon-calendar"></span>
                                  <?php echo ($vv['title']); ?>
                              </a>
                          </li>
                          <?php endforeach;?>
                        </ul>
                    </li>
                  <?php endforeach;?>
              </ul>
              <br><br>
              <br>
              <br><br><br><br>
          </div>
      </div>
        <!-- sidebar end -->
    <div class="content-page" style="background: white;">

      <div class="admin-content" style="background: white;">
        <div class="admin-content-body">
          <div class="am-cf am-padding">
            <div class="am-fl am-cf">
              <strong class="am-text-primary am-text-lg">Product Management</strong> /
              <small> List of Product / <?php echo $_GET['id']?"Edit":"Add"; ?><span style="color: red;">(Product Image 307*260)</span></small>
            </div>
          </div>
          <hr style="margin-top:0px;">
          <form action="" method="POST" id="saveForm" enctype="multipart/form-data">
            <div class="am-form">
              <input type="hidden" name="op" value="save" />
              <input type="hidden" name="id" value="<?php echo ($goods["id"]); ?>" />
              <div class="am-form-group am-form-inline">
                <div class="am-form-group">
                  <label>Sort<span></span></label>
                  <input type="text" name="seat_no" data-type="zs" value="<?php echo ($goods["seat_no"]); ?>">
                </div>
                <div class="am-form-group" style="margin-left:10px;">
                  <label >Enable/Disable</label>
                  <div class="tttt-switch" style="margin:4px 14px;">
                    <input type="checkbox" name="status" <?php if($goods[status]) echo "checked";?>>
                    <span class="tttt-switch-btn"></span>
                  </div>
                  <input type="hidden" name="old_status" value="<?php echo $goods[status]?>">
                </div>




                 <div class="am-form-group" style="margin-left:10px;float: right;">
                  <label >Appear in Homescreen</label>
                  <div class="ttt-switch" style="margin:4px 14px;">
                    <input type="checkbox" name="home_show" <?php if($goods['home_show'] == 2) echo "checked";?>>
                    <span class="ttt-switch-btn"></span>
                  </div>
                  
                </div>

              </div>
              <div class="am-form-group am-form-inline">

                <div class="am-form-group" style="width:220px;">
                  <label>Product Name <p>*</p></label>
                  <input type="text" name="title" value="<?php echo ($goods["title"]); ?>">
                </div>
                <div class="am-form-group" style="width:150px;">
                  <label>Serial No.</label>
                  <input type="text" name="model" value="<?php echo ($goods["model"]); ?>">
                </div>
                <script type="text/javascript">
                    $("#img_preview").on('click',function(){
                        $("input[name=img]").click();
                    });
                    $("input[name=img]").on('change', function() {
                        var reader = new FileReader();
                        reader.onload = function(e){
                            $('#img_preview').attr('src', e.target.result);
                        }
                        if(this.files[0]){
                            reader.readAsDataURL(this.files[0]);
                        }else{
                            $('#img_preview').attr('src','');
                        }
                    });
                </script>
              </div>
              <div class="am-form-group am-form-inline">
                <!--<div class="am-form-group" style="width: 310px;">-->
                  <!--<label>商品副名称<span>（用于商品搜索）</span></label>-->
                  <!--<input type="text" name="title2" value="<?php echo ($goods["title2"]); ?>">-->
                <!--</div>-->
                <!-- <div class="am-form-group">
                  <label>品牌</label>
                  <input type="text" name="brand" value="<?php echo ($goods["brand"]); ?>">
                </div> -->
              </div>

              <div class="am-form-group am-form-inline am-form-inline-4">
                <!-- <div class="am-form-group">
                  <label>首周价格 <p>*</p></label>
                  <input type="text" name="price" data-type="xs" value="<?php echo ($goods["price"]); ?>">
                </div> -->
                <!-- <div class="am-form-group">
                  <label>续租价格 <p>*</p></label>
                  <input type="text" name="price2" data-type="xs" value="<?php echo ($goods["price2"]); ?>">
                </div> -->
                <!--<div class="am-form-group">-->
                  <!--<label>进货价</label>-->
                  <!--<input type="text" name="buy_price" data-type="xs" value="<?php echo ($goods["buy_price"]); ?>" style="width: 130px;">-->
                <!--</div>-->
                <!--<div class="am-form-group">-->
                  <!--<label>原价<p>*</p></label>-->
                  <!--<input type="text" name="orig_price" data-type="xs" value="<?php echo ($goods["orig_price"]); ?>" style="width: 130px;">-->
                <!--</div>-->
                <div class="am-form-group" >
                  <label>Price<p>*</p></label>
                  <input type="text" name="price" data-type="xs" value="<?php echo ($goods["price"]); ?>" style="width: 220px" >
                </div>
                <div class="am-form-group">
                  <label>Virtual Sales</label>
                  <input type="text" name="false_sell" value="<?php echo ($goods["false_sell"]); ?>" style="width:150px;">
                </div>
                <!--<div class="am-form-group">-->
                  <!--<label>商品单位名称<p>*</p></label>-->
                  <!--<input type="text" name="unit"  value="<?php echo ($goods["unit"]); ?>" style="width: 130px;">-->
                <!--</div>-->
                <!--<div class="am-form-group">-->
                  <!--<label>商品属性<p>*</p></label>-->
                  <!--<select name="is_hot" style="width: 130px;">-->
                    <!--<option value="0">正常</option>-->
                    <!--<option value="1">特价</option>-->
                    <!--<option value="2">新品</option>-->
                  <!--</select>-->
                <!--</div>-->
                <!--<div class="am-form-group">-->
                  <!--<label>最大下单数量</label>-->
                  <!--<input type="text" name="max_buy" data-type="xs" placeholder="特价商品时填写" style="height: 30px;font-size: 14px;" value="<?php echo ($goods["max_buy"]); ?>" style="width: 130px;">-->
                <!--</div>-->
              </div>
              <div class="am-form-group am-form-inline am-form-inline-4">

                <!--<div class="am-form-group">-->
                  <!--<label>库存</label>-->
                  <!--<input type="text" name="total" value="<?php echo ($goods["total"]); ?>">-->
                  <!--&lt;!&ndash; <input type="text" data-type="zzs" value="<?php echo ($goods["total"]); ?>" readonly onclick="layer.msg('请在右下角添加供应记录')"> &ndash;&gt;-->
                <!--</div>-->



              </div>
              <div class="am-form-group am-form-inline am-form-inline-4"    >
                <div class="am-form-group">
                  <label>Category <p>*</p></label>
                  <select id="one" name="cat_id1" style="width: 150px;">
                    <option value="">Please Select</option>}
                    <?php foreach($one as $i=>$val){?>
                    <option value="<?php echo $val['id'] ?>" <?php if($val['id']==$goods['cat_id1']){?> selected="selected" <?php } ?> ><?php echo $val['title'] ?></option>}
                    <?php } ?>
                  </select>
                </div>
            </div>


             <?php if($goods['attr_lists']){?>
        <div class="am-form-group am-form-inline am-form-inline-4" id="attr_lists">
        <?php foreach($goods['attr_lists'] as $i=>$val){?>

          <div class="am-form-group am-form-inline am-form-inline-4" id="attr<?php echo $val['id']; ?>">
            
            <div class="am-form-group aa" data="<?php echo $val['id']; ?>" style="width: 80px;text-align: center">
              <?php echo $val['title']; ?>
            </div>
            <input type="hidden" class="hiden_input" value="<?php echo $val['id']; ?>" name="attr[<?php echo $i;?>][cateattr_id]" >

            <input type="hidden" value="<?php echo $i; ?>" id="attrkey<?php echo $val['id'];?>" >
            <?php if($val['data']!=""){?>
              <?php foreach($val['data'] as $k=>$vel){?>
              <input type="hidden" name="attr[<?php echo $i;?>][data][<?php echo $k; ?>][id]" value="<?php echo $vel['id'] ?>" >
                <div class="am-form-group">
                  <input class="bb" data="<?php echo $i;?>" key="<?php echo $k; ?>" style="width:150px;margin-right: 10px;<?php if($k==0){?>margin-left: 8px; <?php }else{?> margin-left: 92px; <?php }?>height: 30px;font-size: 14px;" name="attr[<?php echo $i;?>][data][<?php echo $k; ?>][title]" type="text" value="<?php echo $vel['attr_title'] ?>" placeholder="Specification name" />
                </div>
                
                <div class="am-form-group">
                 <input class="cc" data="<?php echo $i;?>" key="<?php echo $k; ?>" style="width:150px;height: 30px;font-size: 14px;" name="attr[<?php echo $i;?>][data][<?php echo $k; ?>][price]" type="text" value="<?php echo $vel['attr_price'] ?>" placeholder="price" />
                </div>
                <?php if($k==0){?>  
                  <div class="am-form-group">
                    <i class="iconfont icon-jia" style="margin-left: 5px" onclick="add_attr(<?php echo $val['id']; ?>)" ><img src="/canyin2/Public/Admin/img/+++.png" alt="" style="width: 30px;height:30px;margin-bottom: 10px "></i>
                  </div> 
                <?php } ?>
                <?php if($k>0){?>  
                  <div class="am-form-group">
                    <i class="iconfont icon-icon-test" style="margin-left: 5px" onclick="sub_attr(this)" ><img src="/canyin2/Public/Admin/img/---.png" alt="" style="width: 30px;height:30px;margin-bottom: 10px "></i>
                  </div> 
                <?php } ?>
            <?php } ?>
            <?php }else{?>
                
                <div class="am-form-group">
                  <input class="bb" data="0" key="0" style="width:150px;margin-right: 10px;margin-left: 8px; height: 30px;font-size: 14px;" name="attr[<?php echo $i;?>][data][0][title]" type="text" value="" placeholder="Specification name" />
                </div>
                <div class="am-form-group">
                 <input class="cc" data="0" key="0" style="width:150px;height: 30px;font-size: 14px;" name="attr[<?php echo $i;?>][data][0][price]" type="text" value="" placeholder="price" />
                </div>
                <div class="am-form-group">
                    <i class="iconfont icon-jia" style="margin-left: 5px" onclick="add_attr(<?php echo $val['id']; ?>)" ><img src="/canyin2/Public/Admin/img/+++.png" alt="" style="width: 30px;height:30px;margin-bottom: 10px "></i>
                  </div> 
            <?php } ?>
          </div>
        <?php }?>
       </div>
       <?php }else{?>
          <div class="am-form-group am-form-inline am-form-inline-4" id="attr_lists">
          </div>
       <?php } ?>
                
            
            <script>
              $("#one").change(function(){
    
                  var province=$(this).val();

                  if(province){
                    
                    $.ajax({
                      type:"post",
                      url:"<?php echo U('Goods/get_attr');?>",
                      async:false,
                      data: "id="+province,
                      datatype:'json',
                      success:function(data){
                        // alert(data);    
                        data=eval("("+data+")");
                        var str="";
                        $.each(data, function(i,val) {
                          
                          str+='<div class="am-form-group am-form-inline am-form-inline-4" id="attr'+val.id+'" >';

                          str+='<div class="am-form-group" style="width: 80px;text-align: center">'+val.title+'</div>';

                          str+='<input type="hidden" value="'+val.id+'" name="attr['+i+'][cateattr_id]" >';

                          str+='<input type="hidden" value="'+i+'" id="attrkey'+val.id+'" >';

                          str+='<input type="hidden" value="0" id="i'+val.id+'" >';

                          str+='<div class="am-form-group"><input class="bb" data="'+i+'" key="0" style="width:150px;margin-right: 10px;margin-left: 7px;height: 30px;font-size: 14px;" name="attr['+i+'][data][0][title]" type="text" value="" placeholder="Specification name" /></div>';
                          str+='<div class="am-form-group"><input class="bb" data="'+i+'" key="0" style="width:150px;height: 30px;font-size: 14px;" name="attr['+i+'][data][0][price]" type="text" value="" placeholder="price" /></div>';

                          str+='<div class="am-form-group"><i class="iconfont icon-jia " style="margin-left: 10px" onclick="add_attr('+val.id+')" ><img src="/canyin2/Public/Admin/img/+++.png" alt="" style="width: 30px;height:30px;margin-bottom: 10px "></i></div>';

                          str+='</div>'

                        })
                        
                        $('#attr_lists').html(str);
                          
                      }
                      
                    });

                  }

                })
            </script>


            <!-- 加 -->
        <script type="text/javascript">
          // alert(i);
          function add_attr(id){
            var iid="#i"+id;//拼接获取属性长度的名称
            var attri="#attrkey"+id; //属性分类的键值
            var i=parseInt($(iid).val());//获取当前商品属性长度

            var attrid="#attr"+id; //拼接属性分类的div id

            
            // alert(attri);
            var attrival=$(attri).val();
            // alert(attrival);
            var str="";
            str +='<div class="am-form-group div_all" style="margin-left: 87px;"><input class="bb" data="'+attrival+'" key="'+(i+1)+'" style="width:150px;margin-left:5px;margin-right: 10px;height: 30px;font-size: 14px;" name="attr['+attrival+'][data]['+(i+1)+'][title]" type="text" value="" placeholder="Specification name" /></div>';

            str+='<div class="am-form-group "><input class="cc" data="'+attrival+'" key="'+(i+1)+'" style="width:150px;margin-left:4px;height: 30px;font-size: 14px;" name="attr['+attrival+'][data]['+(i+1)+'][price] type="text" value="" placeholder="The price" /></div>';

            str+='<div  class="am-form-group"><i class="iconfont icon-icon-test " style="margin-left: 10px" onclick="sub_attr(this)" ><img src="/canyin2/Public/Admin/img/---.png" alt="" style="width: 30px;height:30px;margin-bottom: 10px "></i></div>';

            $(attrid).append(str);
            var iadd=i+1; //当前商品属性长度+1
            $(iid).val(iadd); 
          }
        </script>
        <!-- 减 -->
        <script type="text/javascript">
          // alert(i);
          function sub_attr(a){
            var price=$(a).parent().prev();

            price.prev().remove();
            // console.log()
            $(a).parent().prev().remove();
            $(a).parent().remove();
          }
        </script>



  
            <div class="am-form-group am-form-inline am-form-inline-4"    >
                <div class="am-form-group">
                  <label>Purchase Restriction(Noted: insert 0 for no restriction) </label>
                  <input type="text" name="max_buy" value="<?php echo ($goods["max_buy"]); ?>" style="width:150px;">
                </div>
            </div>


              <div class="am-form-group am-form-inline am-form-inline-2">
                <label>Product Image (307*260) </label>
                <div class="am-form-group">
                  <img src="" id="img_preview" onerror="this.src='<?php echo $goods[img]?:'/canyin2/Public/img/add.png'?>'">
                  <input type="file" name="img" value="" accept="image/jpg,image/jpeg,image/png">
                </div>

              </div>
            <div class="am-form-group am-form-inline am-form-inline-2">

                <label>Product Description</label>
                <textarea class="" NAME="content"  rows="5" id="doc-ta-1"><?php echo $goods[content];?></textarea>

            </div>
              <button type="submit" class="am-btn am-btn-success" id="form_submit" style="margin-bottom: 50px;">Save</button>
            </div>
          </form>
        </div>
        <footer class="admin-content-footer"><hr></footer>
        <script type="text/javascript">
            $("#img_preview").on('click',function(){
                $("input[name=img]").click();
            });
            $("input[name=img]").on('change', function() {
                var reader = new FileReader();
                reader.onload = function(e){
                    $('#img_preview').attr('src', e.target.result);
                }
                if(this.files[0]){
                    reader.readAsDataURL(this.files[0]);
                }else{
                    $('#img_preview').attr('src','');
                }
            });
        </script>


      </div>

    </div>



  </div>
          <!-- navbar -->
        <a href="admin-offcanvas" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"><!--<i class="fa fa-bars" aria-hidden="true"></i>--></a>
        
        <script type="text/javascript" src="/canyin2/Public/assets/js/amazeui.min.js"></script>
        <script type="text/javascript" src="/canyin2/Public/assets/js/blockUI.js" ></script>
        <script type="text/javascript" src="/canyin2/Public/assets/js/charts/echarts.min.js" ></script>
        <script type="text/javascript" src="/canyin2/Public/assets/js/charts/indexChart.js" ></script>




        <style>
    .gai_title{
        display: flex;
        justify-content: space-around;
        height: 45px;
        line-height: 45px;
        font-size: 16px;
    }
    .all_div{
        display: flex;

    }
    .first_di{
        width: 100px;
        text-align: right;
        margin-right: 30px;
    }
    .jj_gai{
        display: flex;
        background: #F37B1D;
    }
    .gai_span{
        width: 105px;
        line-height: 50px;
        margin-left: 5px;
        color: #fff;
    }
    .gai_input{
        width: 280px;
        height: 30px;
        border-radius: 10px;
        margin-top: 11px;
    }
/*  .am-btn{
        width: 60%;
        margin-left: 20%;
        color: #fff;
        margin-top: 20px;
    } */
</style>

<audio id="remind" src="/canyin2/Public/remind.mp3"></audio>
<script type="text/javascript">
var remind = document.getElementById("remind");
	self.setInterval(getOrder,10000);   //10秒
   	

    //预定订单
    function getOrder() {
        var url = "<?php echo U('Order/CheckNewOrder');?>"//路径
        $.get(url, function(data){
            console.log(data)
            if(data.status == 1){
                remind.currentTime = 0;
                remind.play();
                layer.closeAll('page'); //关闭所有页面层
                layer.open({
                title:['新的订单','background:#0e90d2;color:white;text-align:center;padding-left:76px;font-size:17px;'],
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['420px', '330px'], //宽高
                content: data.content
            });
            }
        },'json')
     //  

    }
    //layui-layer-ico layui-layer-close layui-layer-close1
    $('body').on('click', '.close_box', function() {

      layer.closeAll();
    });
</script>

  <script type="text/javascript">
      $(function(){
          // 重置密码
          $(".reset_link").on("click",function(){
              var id=$(this).attr('data-id');
              var name=$(this).attr("data-name");
              var bool = confirm("Confirm reset administrator's password?");
              if (bool) {
                  $("#float_id").val(id);
                  $("#float_name").html(name);
                  $("#shade_div").show();
                  $("#float_div").show();
              };
          });
          $("#btclose").on("click",function(){
              $("#shade_div").hide();
              $("#float_div").hide();
          });
          // 删除
          $(".del_link").on("click",function(){
              var name=$(this).attr("data-name");
              var the_link=$(this).attr("data-url");
              var bool = confirm("Confirm deleting the administrator?");
              if (bool) {
                  location.href = the_link;
              };
          });
      });
  </script>
  </body>


  </html>