<?php /* D:\phpStudy\PHPTutorial\WWW\liangshan\resources\views/Admin/order-list.blade.php */ ?>
<?php $__env->startSection('admin'); ?>
<div class="content-wrapper" style="min-height: 810px;">
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h4>商品订单列表</h4>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/admin/index">首页</a></li>
              <li class="breadcrumb-item active">订单管理</li>
              <li class="breadcrumb-item active">商品订单列表</li>
            </ol>
          </div>
        </div>
      </div>
    </section>
    <!-- <div class="col-xs-3">
        <button class="btn btn-primary add" style="margin-left:17px;margin-bottom:15px">添加文章 +</button>
    </div> -->

    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-12">

            <div class="card">
              <div class="card-body p-0">
                <table class="table table-condensed">
                  <tbody>
               
                  <tr style="text-align:center">
                    <th>用户</th>
                    <th>订单号</th>
                    <th>金额</th>
                    <th>时间</th>
                    <th>自取/配送时间</th>
                    <th>商品</th>
                    <th>状态</th>
                    <th style="width: 100px">操作</th>
                  </tr>
                  <?php $__currentLoopData = $order; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr style="text-align:center">
                    <td><img src="<?php echo e($val['header']); ?>" style="height:50px;width:50px" alt="用户头像"><br><?php echo e($val['nickname']); ?></td>
                    <td><?php echo e($val['order_id']); ?></td>
                    <td>￥<?php echo e($val['price']); ?></td>
                    <td><?php echo e($val['date']); ?></td>
                    <td><?php echo e($val['goods_date']); ?><br>电话:<?php echo e($val['phone']); ?></td>
                    <td><?php echo e($val['goods_name']); ?></td>
                    <td>
                        <?php if($val['status'] == 0): ?>
                        <a href="javascript:layer.alert('订单未付款')"><span class="badge bg-danger">未付款</span></a>
                        <?php elseif($val['status'] == 1): ?>
                        <a href="javascript:void(0)" onclick="status(<?php echo e($val['id']); ?>,'dqr',<?php echo e($val['status']); ?>)"><span class="badge bg-warning" style="color:white !important">待确认</span></a>
                        <?php elseif($val['status'] == 2): ?>
                            <?php if($val['order_type'] == 'peisong'): ?>
                            <a href="javascript:void(0)" onclick="status(<?php echo e($val['id']); ?>,'dqh',<?php echo e($val['status']); ?>)"><span class="badge bg-info" style="color:white !important">待取货</span></a>
                            <?php else: ?>
                            <a href="javascript:void(0)" onclick="status(<?php echo e($val['id']); ?>,'dfh',<?php echo e($val['status']); ?>)"><span class="badge bg-success" style="color:white !important">待发货</span></a>
                            <?php endif; ?>
                        <?php elseif($val['status'] == 3): ?>
                        <a href="javascript:void(0)" onclick="status(<?php echo e($val['id']); ?>,'dsd',<?php echo e($val['status']); ?>)"><span class="badge bg-success" style="color:white !important">待送达</span></a>
                        <?php elseif($val['status'] == 4): ?>
                        <a href="javascript:layer.alert('订单已完成')"><span class="badge bg-success" style="color:white !important">已完成</span></a>
                        <?php endif; ?>
                    </td>
                    <td>
                        <a href="javascript:void(0)" onclick="edit(<?php echo e($val['order_id']); ?>)"><i class="fa fa-edit" style="font-size: 16px;" title="修改"></i></a>
                    </td>
                  </tr>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody></table>
              </div>
            </div>
          </div>
        </div>
    </section>
  </div>
<script src="/admin/plugins/jquery/jquery.min.js"></script>
<script src="/admin/layer-v3.1.1/layer/layer.js"></script>
<script>
    function status(id,status,order_status)
    {
        if(!id || !status || !order_status){
            layer.alert('参数错误');
            return false;
        }
        var status_text = '操作';
        if(status == 'dqr') {
            status_text = '接收本笔订单';
        }else if(status == 'dqh') {
            status_text = '客户已取货';
        }else if(status == 'dfh') {
            status_text = '发货';
        }else if(status == 'dsd') {
            status_text = '已完成';
        }
        layer.confirm('确认'+ status_text +'吗？', {
            btn: ['确认','取消'] //按钮
            }, function(){
                $.get('/admin/order/status',{id:id,status:order_status},function(res){
                    console.log(res);
                    if(res.code == '1000'){
                        layer.msg(res.result);
                        window.location.reload();
                    }else{
                        layer.msg(res.result);
                    }
                })
        });  
    }
    function edit(id)
    {
        // layer.alert('订单修改将尽快完成');
      if(!id){
        layer.alert('参数错误');
        return false;
      }
      window.location.href="/admin/goodscate/order_goods/"+ id;
    }
</script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('title','商品订单列表'); ?>
<?php $__env->startSection('order','menu-open'); ?>
<?php $__env->startSection('order2','active'); ?>
<?php $__env->startSection('list','active'); ?>
<?php echo $__env->make('Public.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>