<?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">
      a.am-text-secondary:visited{color:#3bb4f2;}
      a.am-text-danger:visited{color:#dd514c;}
      .am-btn-default {background-color: #fff;}
      th {text-align:center;}
      tr td{text-align:center;}
      select{padding: 4px;border: 1px solid #ccc;}
      .am-popup-bd {background:#fff;}
      .am-popup-bd img {max-width: 100%}
      .am-table>tbody>tr>td.user-info {padding: 1px;text-align: left;}
      .am-table>tbody>tr>td.user-info img{height: 42px}
      myred{color:#dd514c;}
      mygreen {color:#1aad19;}
      mygery {color:#999;}
      .wxgreen {color:#1aad19;}
      .search-div.am-input-group .am-form-field{width:120px;float: right;}
      .search-div select {float: right;}
      .ttt-switch {margin: 0 auto;}
      .am-form select{
        font-size: 1.2rem;
        border-color: #e6e6e6;
        width: unset;
        padding: .5em 2em .5em 1em;
        margin: 0 auto;
      }
      .am-table>tbody>tr>td.td-img {
        padding: 1px;
        text-align: left;
        padding-left: 10px;
      }
      .am-table>tbody>tr>td.td-img img {
        height: 40px;width: 40px;
      }
      .am-table>tbody>tr>td.td-img a {
        display: inline-block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 13vw;
        cursor: pointer;
      }
      .am-table>thead>tr>th {
        border-bottom: 0;
      }
      .am-table>tbody>tr:first-child>td {
        border-top: 0;
      }
      .am-table>thead.am-thead-hide>tr>th {
        border-left: 0;
        background-color: #f5f5f5;
      }
      p {
        margin: 0;
      }
      .am-table>tbody>tr>td {
        vertical-align: middle;
        font-size: 1.4rem;
        line-height: 1.6rem;
        color: #444;
        background-color: #fdfdfd;
      }
      .format-price>p {
        display: table;
        width: 100%;
        text-align: right;
      }
      .format-price>p>span {
        display: table-cell;
        width: 50%;
        text-align: right;
      }
      .am-filter>.am-input-group:not(:first-child) {
        padding-top: 1.25rem;
      }
      .am-input-group-label.toumin {
        background-color: rgba(0,0,0,0);
        border: 0;
      }
      input[type=datetime-local].am-form-field {
        height: 33px;
      }
      .am-btn {
        font-size: 1.4rem;
      }
      .tr {
        text-align: right;
      }
      .tl {
        float: left !important;
      }
    </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">
        <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">Order Management</strong> /
              <small>Order Detail</small>
            </div>
          </div>

          <hr style="margin-top:0px;">


          <div class="am-g">
            <div class="am-panel am-panel-default" style="margin:0 1.5rem 1.5rem;">
              <div class="am-panel-hd">
                Order Detail 
                &nbsp; &nbsp; &nbsp;
                <?php if ($order['status'] == 2) : ?>
                  <a href="javascript:;" class="am-btn am-btn-primary" id="sure_complete" data-order_sn="<?php echo ($order["order_sn"]); ?>">Confirm completed</a>
                <?php endif;?>
                 &nbsp;
                <?php if ($order['status'] == 2 || $order['status'] == 3) : ?>
                  <a href="javascript:;" class="am-btn am-btn-primary" id="refund" data-order_sn="<?php echo ($order["order_sn"]); ?>">refund</a>
                <?php endif;?>
                 &nbsp;
                <?php if ($order['is_dada'] == 1 && empty( $order['dada_order'])) : ?>
                  <a href="javascript:;" class="am-btn am-btn-primary" id="addOrder" data-order_sn="<?php echo ($order["order_sn"]); ?>">Delivery order not issued, click resend</a>
                <?php endif;?>

                <?php if ($order['is_dada'] == 1 && !empty( $order['dada_order'])) : ?>
                  <a href="javascript:;" class="am-btn am-btn-primary" id="formalCancel" data-order_sn="<?php echo ($order["order_sn"]); ?>">Cancel delivery order</a>
                <?php endif;?>

                <?php if ($order['is_dada'] == 1 && !empty( $order['dada_order'])) : ?>
                  <a href="javascript:;" class="am-btn am-btn-primary" id="complaintDada" data-order_sn="<?php echo ($order["order_sn"]); ?>">Complaints dada</a>
                <?php endif;?>
              </div>

             <!-- <div class="am-panel-bd">
                <div class="am-g">
                  <div class="am-u-md-3 tr">订单号：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['order_sn'])) : ?>
                      <?php echo ($order["order_sn"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                 </div>
                  
                  <div class="am-u-md-3 tr">用户：</div>
                  <div class="am-u-md-9">
                    <a href="<?php echo U('./Users');?>?uid=<?php echo ($goods_user["uid"]); ?>" target="_blank">
                    <?php if (!empty($goods_user['nickname'])) : ?>
                      <?php echo ($goods_user["nickname"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                    </a>
                  </div>

                  <div class="am-u-md-3 tr">订单总金额：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['total_price'])) : ?>
                      ￥<?php echo ($order["total_price"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">优惠金额：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['pre_money'])) : ?>
                     优惠券抵消￥<?php echo ($order["pre_money"]); ?>
                    <?php else : ?>
                      优惠券抵消￥0.00
                    <?php endif;?>
                  </div>

                  <?php if ($order['order_type'] == 1) : ?>
                    <div class="am-u-md-3 tr">餐盒费</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['boxes'])) : ?>
                       ￥<?php echo ($order["boxes"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div>

                    <div class="am-u-md-3 tr">配送费</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['delivery'])) : ?>
                       ￥<?php echo ($order["delivery"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div>
                  <?php endif;?>

                  <div class="am-u-md-3 tr">支付金额：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['price'])) : ?>
                      ￥<?php echo ($order["price"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">订单状态：</div>
                  <div class="am-u-md-9">
                    <?php
 switch ($order['status']) { case 1: echo '<span class="am-badge am-badge-primary">待付款</span>'; break; case 2: echo '<span class="am-badge am-badge-warning">已下单</span>'; break; case 3: echo '<span class="am-badge am-badge-success">已完成</span>'; break; case 4: echo '<span class="am-badge am-badge-primary">已退款</span>'; break; case 5: echo '<span class="am-badge am-badge-primary">已取消</span>'; break; default: break; } ?>
                  </div>
                  
            		  <div class="am-u-md-3 tr">订单类型：</div>
                  <div class="am-u-md-9">
            		  <?php if ($order['order_type'] == 1) : ?>
            		    	<span class="am-badge am-badge-primary">外卖订单</span>
            		  <?php elseif ($order['order_type'] == 2) : ?>	    
            			    <span class="am-badge am-badge-primary">食堂订单</span>
            		  <?php else : ?>
            			    -
            		  <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">支付类型：</div>
                  <div class="am-u-md-9">
                  <?php if ($order['pay_type'] == 1) : ?>
                      <span class="am-badge am-badge-primary">微信支付</span>
                  <?php elseif ($order['pay_type'] == 2) : ?>     
                      <span class="am-badge am-badge-primary">余额支付</span>
                  <?php else : ?>
                      -
                  <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">座位号：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['seat'])) : ?>
                      <?php echo ($order["seat"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">备注：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['mark'])) : ?>
                      <?php echo ($order["mark"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <?php if($order['status'] >= 2): ?><div class="am-u-md-3 tr">支付时间：</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['pay_time'])) : ?>
                        <?php echo cdate(0,$order['pay_time']);?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div><?php endif; ?>

                  <?php if($order['status'] >= 3): ?><div class="am-u-md-3 tr">发货时间：</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['fachu_time'])) : ?>
                        <?php echo cdate(0,$order['fachu_time']);?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div><?php endif; ?>

                  <?php if($order['order_type'] == 1): ?><div class="am-u-md-3 tr">区域：</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['address_area'])) : ?>
                        <?php echo ($order["address_area"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div>

                    <div class="am-u-md-3 tr">详细地址：</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['address_info'])) : ?>
                        <?php echo ($order["address_info"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div><?php endif; ?>

		              <div class="am-u-md-3 tr">下单时间：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['create_time'])) : ?>
                        <?php echo cdate(0,$order['create_time']);?>
                    <?php else : ?>
                        -
                    <?php endif;?>
                  </div>

                  <?php if ($order['is_dada'] == 1 && !empty( $order['dada_order'])) : ?>
                  <!-- 达达配送信息 -->
                  <!--<div class="am-u-md-3 tr">---达达配送信---</div>
                  <div class="am-u-md-9">---达达配送信息---</div>
                  <div class="am-u-md-3 tr">配送状态：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['statusMsg'])) : ?>
                      <span class="am-badge am-badge-primary"><?php echo ($order["dada_order"]["statusMsg"]); ?></span>
                      <?php if ($order['dada_order']['statusCode'] == 5 || $order['dada_order']['statusCode'] == 7 || $order['dada_order']['statusCode'] == 1000) : ?>
                        <span class="am-badge am-badge-primary" id="reAddOrder" style="cursor:pointer;">点击重发</span>
                      <?php endif;?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">骑手姓名：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['transporterName'])) : ?>
                      <?php echo ($order["dada_order"]["transporterName"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">骑手电话：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['transporterPhone'])) : ?>
                      <?php echo ($order["dada_order"]["transporterPhone"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">骑手经度：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['transporterLng'])) : ?>
                      <?php echo ($order["dada_order"]["transporterLng"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">骑手纬度：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['transporterLat'])) : ?>
                      <?php echo ($order["dada_order"]["transporterLat"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">配送费：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['deliveryFee'])) : ?>
                      ￥<?php echo ($order["dada_order"]["deliveryFee"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">小费：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['tips'])) : ?>
                      ￥<?php echo ($order["dada_order"]["tips"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">优惠券费用：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['couponFee'])) : ?>
                      ￥<?php echo ($order["dada_order"]["couponFee"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">实际支付费用：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['transpoactualFeerterName'])) : ?>
                      ￥<?php echo ($order["dada_order"]["actualFee"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">配送距离：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['distance'])) : ?>
                      <?php echo($order['dada_order']['distance']/1000);?>km
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">发单时间：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['createTime'])) : ?>
                      <?php echo ($order["dada_order"]["createTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">接单时间：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['acceptTime'])) : ?>
                      <?php echo ($order["dada_order"]["acceptTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">取货时间：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['fetchTime'])) : ?>
                      <?php echo ($order["dada_order"]["fetchTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">送达时间：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['finishTime'])) : ?>
                      <?php echo ($order["dada_order"]["finishTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>

                  <div class="am-u-md-3 tr">取消时间：</div>
                  <div class="am-u-md-9">
                    <?php if (!empty($order['dada_order']['cancelTime'])) : ?>
                      <?php echo ($order["dada_order"]["cancelTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                  </div>
                  <?php endif;?>
                </div>
              </div>
            </div>-->
            <div class="am-panel-bd">
                <div class="am-g">
                  <div class="am-u-md-3 tr">Order No.
<?php if (!empty($order['order_sn'])) : ?>
                      <?php echo ($order["order_sn"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                 </div>-->
                  
                  <div class="am-u-md-3 tr">Customer:<a href="<?php echo U('./Users');?>?uid=<?php echo ($goods_user["uid"]); ?>" target="_blank">
                    <?php if (!empty($goods_user['nickname'])) : ?>
                      <?php echo ($goods_user["nickname"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?>
                    </a></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Total Amount: <?php if (!empty($order['total_price'])) : ?>
                      RM<?php echo ($order["total_price"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!-- <div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Discount Amount:<?php if (!empty($order['pre_money'])) : ?>
                     Voucher Cancellation<?php echo ($order["pre_money"]); ?>
                    <?php else : ?>
                      Voucher Cancellation0.00
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <?php if ($order['order_type'] == 1) : ?>
                    <div class="am-u-md-3 tr">Meals fee:<?php if (!empty($order['boxes'])) : ?>
                       RM<?php echo ($order["boxes"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?></div>
                    <!--<div class="am-u-md-9">
                      
                    </div>-->

                    <div class="am-u-md-3 tr">Shipping fee: <?php if (!empty($order['delivery'])) : ?>
                       RM<?php echo ($order["delivery"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?></div>
                    <!--<div class="am-u-md-9">
                     
                    </div>-->
                  <?php endif;?>

                  <div class="am-u-md-3 tr">Paid Amount:<?php if (!empty($order['price'])) : ?>
                      <?php echo ($order["price"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Order Status:<?php
 switch ($order['status']) { case 1: echo '<span class="am-badge am-badge-primary">For the payment</span>'; break; case 2: echo '<span class="am-badge am-badge-warning">Have order</span>'; break; case 3: echo '<span class="am-badge am-badge-success">Has been completed</span>'; break; case 4: echo '<span class="am-badge am-badge-primary">Have a refund</span>'; break; case 5: echo '<span class="am-badge am-badge-primary">Has been cancelled</span>'; break; default: break; } ?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->
                  
                  <div class="am-u-md-3 tr">Order Type:<?php if ($order['order_type'] == 1) : ?>
                      <span class="am-badge am-badge-primary">Delivery orders</span>
                  <?php elseif ($order['order_type'] == 2) : ?>     
                      <span class="am-badge am-badge-primary">The dining room order</span>
                  <?php else : ?>
                      -
                  <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                  
                  </div>-->

                  <div class="am-u-md-3 tr">Payment Type:<?php if ($order['pay_type'] == 1) : ?>
                      <span class="am-badge am-badge-primary">WeChat Pay</span>
                  <?php elseif ($order['pay_type'] == 2) : ?>     
                      <span class="am-badge am-badge-primary">balance payment</span>
                  <?php else : ?>
                      -
                  <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                  
                  </div>-->

                  <div class="am-u-md-3 tr">Table No.:<?php if (!empty($order['seat'])) : ?>
                      <?php echo ($order["seat"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Remark:<?php if (!empty($order['mark'])) : ?>
                      <?php echo ($order["mark"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!-- <div class="am-u-md-9">
                    
                  </div>-->

                  <?php if($order['status'] >= 2): ?><div class="am-u-md-3 tr">Payment Time: <?php if (!empty($order['pay_time'])) : ?>
                        <?php echo cdate(0,$order['pay_time']);?>
                      <?php else : ?>
                        -
                      <?php endif;?></div>
                    <!--<div class="am-u-md-9">
                     
                    </div>--><?php endif; ?>

                  <?php if($order['status'] >= 3): ?><div class="am-u-md-3 tr">Delivery time:<?php if (!empty($order['fachu_time'])) : ?>
                        <?php echo cdate(0,$order['fachu_time']);?>
                      <?php else : ?>
                        -
                      <?php endif;?></div>
                   <!-- <div class="am-u-md-9">
                      
                    </div>--><?php endif; ?>

                  <?php if($order['order_type'] == 1): ?><div class="am-u-md-3 tr">Region:<?php if (!empty($order['address_area'])) : ?>
                        <?php echo ($order["address_area"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?></div>
                    <!--<div class="am-u-md-9">
                      
                    </div>-->

                    <div class="am-u-md-3 tr">Detailed Address:</div>
                    <div class="am-u-md-9">
                      <?php if (!empty($order['address_info'])) : ?>
                        <?php echo ($order["address_info"]); ?>
                      <?php else : ?>
                        -
                      <?php endif;?>
                    </div><?php endif; ?>

                  <div class="am-u-md-3 tr">Order Time:<?php if (!empty($order['create_time'])) : ?>
                        <?php echo cdate(0,$order['create_time']);?>
                    <?php else : ?>
                        -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                   
                  </div>-->

                  <?php if ($order['is_dada'] == 1 && !empty( $order['dada_order'])) : ?>
                  <!-- 达达配送信息 -->
                  <div class="am-u-md-3 tr">---Dada delivery letter---</div>
                  <!--<div class="am-u-md-9">---达达配送信息---</div>-->
                  <div class="am-u-md-3 tr">Shipment Status:<?php if (!empty($order['dada_order']['statusMsg'])) : ?>
                      <span class="am-badge am-badge-primary"><?php echo ($order["dada_order"]["statusMsg"]); ?></span>
                      <?php if ($order['dada_order']['statusCode'] == 5 || $order['dada_order']['statusCode'] == 7 || $order['dada_order']['statusCode'] == 1000) : ?>
                        <span class="am-badge am-badge-primary" id="reAddOrder" style="cursor:pointer;">Click resend</span>
                      <?php endif;?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">The rider's name:<?php if (!empty($order['dada_order']['transporterName'])) : ?>
                      <?php echo ($order["dada_order"]["transporterName"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">The rider phone:<?php if (!empty($order['dada_order']['transporterPhone'])) : ?>
                      <?php echo ($order["dada_order"]["transporterPhone"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!-- <div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">The rider longitude:<?php if (!empty($order['dada_order']['transporterLng'])) : ?>
                      <?php echo ($order["dada_order"]["transporterLng"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">The rider latitude: <?php if (!empty($order['dada_order']['transporterLat'])) : ?>
                      <?php echo ($order["dada_order"]["transporterLat"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                   
                  </div>-->

                  <div class="am-u-md-3 tr">Shipping fee:<?php if (!empty($order['dada_order']['deliveryFee'])) : ?>
                      RM<?php echo ($order["dada_order"]["deliveryFee"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                   
                  </div>-->

                  <div class="am-u-md-3 tr">A tip:<?php if (!empty($order['dada_order']['tips'])) : ?>
                      RM<?php echo ($order["dada_order"]["tips"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!-- <div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Coupon fee: <?php if (!empty($order['dada_order']['couponFee'])) : ?>
                      RM<?php echo ($order["dada_order"]["couponFee"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                   
                  </div>-->

                  <div class="am-u-md-3 tr">Actual payment：<?php if (!empty($order['dada_order']['transpoactualFeerterName'])) : ?>
                      RM<?php echo ($order["dada_order"]["actualFee"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!-- <div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Distribution distance：<?php if (!empty($order['dada_order']['distance'])) : ?>
                      <?php echo($order['dada_order']['distance']/1000);?>km
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Issuance of time:<?php if (!empty($order['dada_order']['createTime'])) : ?>
                      <?php echo ($order["dada_order"]["createTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Order Time:<?php if (!empty($order['dada_order']['acceptTime'])) : ?>
                      <?php echo ($order["dada_order"]["acceptTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Pickup time:<?php if (!empty($order['dada_order']['fetchTime'])) : ?>
                      <?php echo ($order["dada_order"]["fetchTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Delivery Time:<?php if (!empty($order['dada_order']['finishTime'])) : ?>
                      <?php echo ($order["dada_order"]["finishTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                  <!--<div class="am-u-md-9">
                    
                  </div>-->

                  <div class="am-u-md-3 tr">Cancel the time:<?php if (!empty($order['dada_order']['cancelTime'])) : ?>
                      <?php echo ($order["dada_order"]["cancelTime"]); ?>
                    <?php else : ?>
                      -
                    <?php endif;?></div>
                 <!-- <div class="am-u-md-9">
                    
                  </div>-->
                  <?php endif;?>
                </div>
              </div>
            </div>
            <div class="am-panel am-panel-default" style="margin:0 1.5rem 1.5rem;">
              <div class="am-panel-bd" style="padding: 0;">
                <div class="am-scrollable-horizontal">
                  <table class="am-table am-text-nowrap" style="margin: 0;">
                    <thead class="am-thead-hide">
                    <tr>
                      <th width="5%">ID</th>
                      <th width="10%">Product Name</th>
                      <th width="10%">QTY</th>
                      <th width="10%">Amount</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if(is_array($car_content)): foreach($car_content as $key=>$vo): ?><tr>
                        <td><?php echo ($vo["goods_id"]); ?></td>
                        <td class="td-img" style="text-align: center;">
                          <img src="/canyin2/Uploads/<?php echo ($vo["img"]); ?>">
                          <a href="<?php echo U('Goods/goods');?>?id=<?php echo ($vo["goods_id"]); ?>" target="_blank"><?php echo ($vo["title"]); ?>
                            <?php if ($vo['attr_title']) : ?>
                                  【<?php echo ($vo["attr_title"]); ?>】
                        
                                <?php endif;?>

                          </a>
                        </td>
                        <td><?php echo ($vo["goods_num"]); ?></td>
                        <td>RM<?php echo cmoney($vo['sum_price']);?></td>
                      </tr><?php endforeach; endif; ?>
                    </tbody>
                  </table>

                </div>
              </div>
            </div>
          </div>
        </div>
<?php if ($order['is_dada'] == 1 ) : ?>
<pre>tips:
 1. The rider information will be available only when the order is received, and real-time coordinate information of the rider can be inquired in the pending pickup and delivery.
 2. This interface can be called to cancel the order if the order is to be received or retrieved. Note: the order will be cancelled within 1-15 minutes after the order is received, and the freight will be returned. At the same time deduct 2 yuan as the penalty for delivery personnel, and the full amount is returned to the user.
 3. The total amount of orders for takeout orders does not include delivery fee.</pre>
<?php endif;?>
        <footer class="admin-content-footer"><hr></footer>
      </div>
    </div>
  </div>

  <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
    <div class="am-modal-dialog">
      <div class="am-modal-hd">Cancel the reason</div>
      <div class="am-modal-bd">
        <select data-am-selected id="cancle_reason" name="reason_id"></select>
        <input type="text" class="am-modal-prompt-input" name="other_reason" placeholder="其他取消原因，当选择其他原因此处必填">
      </div>
      <div class="am-modal-footer">
        <span class="am-modal-btn" data-am-modal-cancel>Cancel</span>
        <span class="am-modal-btn" data-am-modal-confirm>Submit</span>
      </div>
    </div>
  </div>

  <div class="am-modal am-modal-prompt" tabindex="-1" id="complaint">
    <div class="am-modal-dialog">
      <div class="am-modal-hd">Complaints reasons</div>
      <div class="am-modal-bd">
        <select data-am-selected id="complaint_reason" name="reason_id"></select>
      </div>
      <div class="am-modal-footer">
        <span class="am-modal-btn" data-am-modal-cancel>Cancel</span>
        <span class="am-modal-btn" data-am-modal-confirm>Submit</span>
      </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>

  </body>
  <script type="text/javascript">
    $(function(){
      // 退款
      $('#refund').click(function(){
        if (confirm('Are you sure you want a refund?')) {
          $.post('<?php echo U("/Smi/Order/refund");?>', {order_sn: $('#refund').attr('data-order_sn')}, function(res) {
            if (res.status == 1) {
              alert(res.info);
              location.reload();
            } else {
              alert(res.info);
            }
          });
        } else {
          return false;
        }
      });

      // 确认完成
      $('#sure_complete').click(function(){
        if (confirm('Need to confirm the order has been completed?')) {
          $.post('<?php echo U("/Smi/Order/sure_order_complete");?>', {order_sn: $('#sure_complete').attr('data-order_sn')}, function(res) {
            if (res.status == 1) {
              alert(res.info);
              location.reload();
            } else {
              alert(res.info);
            }
          });
        } else {
          return false;
        }
      });

      // 重发配送订单
      $('#reAddOrder').click(function(){
        if (confirm('Do you need to resend the order?')) {
          $.post('<?php echo U("/Smi/Order/reAddOrder");?>', {order_sn: $('#sure_complete').attr('data-order_sn')}, function(res) {
            if (res.status == 1) {
              alert(res.info);
              location.reload();
            } else {
              alert(res.info);
            }
          });
        } else {
          return false;
        }
      });

      // 重发配送订单
      $('#addOrder').click(function(){
        if (confirm('Do you need to resend the order?')) {
          $.post('<?php echo U("/Smi/Order/addOrder");?>', {order_sn: $('#addOrder').attr('data-order_sn')}, function(res) {
            if (res.status == 1) {
              alert(res.info);
              location.reload();
            } else {
              alert(res.info);
            }
          });
        } else {
          return false;
        }
      });

      // 取消配送订单
      $('#formalCancel').on('click', function() {
        $.get('<?php echo U("/Smi/Order/cancelReasons");?>', {}, function(res){
          if (res.status == 1) {
            $('.remove').remove()
            for (var i = 0; i < res.data.length; i++) {
              $('#cancle_reason').append('<option class="remove" value="'+res.data[i].id+'">'+res.data[i].reason+'</option>');
            }
            $('#my-prompt').modal({
              relatedTarget: this,
              onConfirm: function(e) {
                $.post('<?php echo U("/Smi/Order/formalCancel");?>', {order_sn: $('#formalCancel').attr('data-order_sn'), cancel_reason_id: $('#cancle_reason').val(), cancel_reason: $('input[name="other_reason"]').val()}, function(res) {
                  if (res.status == 1) {
                    alert(res.info);
                    location.reload();
                  } else {
                    alert(res.info);
                  }
                });
              },
              onCancel: function(e) {
                alert('Do not cancel delivery orders!');
              }
            });

          } else {
            alert(res.info);return false;
          }
        });
      });

      // 投诉达达
      $('#complaintDada').on('click', function() {
        $.get('<?php echo U("/Smi/Order/complaintReason");?>', {}, function(res){
          if (res.status == 1) {
            $('.remove').remove()
            for (var i = 0; i < res.data.length; i++) {
              $('#complaint_reason').append('<option class="remove" value="'+res.data[i].id+'">'+res.data[i].reason+'</option>');
            }

            $('#complaint').modal({
              relatedTarget: this,
              onConfirm: function(e) {
                $.post('<?php echo U("/Smi/Order/complaintDada");?>', {order_sn: $('#complaintDada').attr('data-order_sn'), reason_id: $('#complaint_reason').val()}, function(res) {
                  if (res.status == 1) {
                    alert(res.info);
                    location.reload();
                  } else {
                    alert(res.info);
                  }
                });
              },
              onCancel: function(e) {
                alert("Don't complain!");
              }
            });
          } else {
            alert(res.info);return false;
          }
        });
      });
    });
  </script>
  </html>