<?php /* /www/wwwroot/default/sale/resources/views/Admin/you-look.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>
                <form class="form">
                    <div class="form-group m-4">
                        <label for="exampleInputName2" class="col-md-12"> 优惠券名称:　<?php echo e($you -> name); ?></label>
                    </div>
                </form>
                <form class="form">
                    <div class="form-group m-4">
                    <?php if($you -> vip): ?>
                        <label for="exampleInputName2" class="col-md-12">
                            总领取数量:<?php echo e(DB::table('user_you') -> where('youhui_id',$you -> id) -> count()); ?>

                        </label>
                        <?php else: ?>
                        <label for="exampleInputName2" class="col-md-12"> 已领取/名额:　
                            <?php echo e($you -> use_num); ?>

                            /
                            <?php if($you -> send_type == 1): ?>
                            无限制
                            <?php else: ?>
                            <?php echo e($you -> send_num); ?>

                            <?php endif; ?>
                        </label>
                    <?php endif; ?>
                    </div>
                </form>
                <form class="form">
                    <div class="form-group m-4">
                        <?php if($you -> vip): ?>
                        <label for="exampleInputName2" class="col-md-6"> 优惠券有效期:自领取后<?php echo e($you -> end_date); ?>天内有效</label>
                        <?php else: ?>
                        <label for="exampleInputName2" class="col-md-6"> 优惠券过期时间:　<?php echo e(date('Y年m月d日 H:i:s',$you -> end_date)); ?></label>
                        <?php endif; ?>
                    </div>
                </form>
                <div class="col-xs-3">
                    <button class="btn btn-danger back" 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>
                  </tr>
                  <?php $__currentLoopData = $uyou; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr style="text-align:center">
                    <td><?php echo e(DB::table('user') -> where('id',$val -> user_id) -> value('nickname')); ?></td>
                    <td><?php echo e(date('Y年m月d日 H:i',$val -> addtime)); ?></td>
                    <td>
                            <?php 
                            if($val -> status == 0) {
                              echo '<span style="color:orange">未使用</span>';
                            }elseif($val -> status == 1){
                              echo '<span style="color:green">已使用</span>';
                            }else{
                              echo '<span style="color:red">已过期</span>';
                            }
                            ?>
                    </td>
                    <td><a href="javascript:void(0);" onclick="back(<?php echo e($val -> user_id); ?>,<?php echo e($val -> youhui_id); ?>)">撤回</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 back(id,yhid)
    {
        if(!id || !yhid){
            layer.msg('参数不全');
            return false;
        }
        layer.confirm('确认撤回该用户的当前优惠券吗？', {
            btn: ['确认','取消'] //按钮
            }, function(){
                $.get('/admin/you/back',{id:id,yhid:yhid},function(res){
                    if(res.code == '1000'){
                        layer.msg(res.msg);
                        window.location.reload();
                    }else{
                        layer.msg(res.msg);
                    }
                })
        });
    }
    $('.back').click(function(){
        window.location.href="/admin/you/list";
    })
        
</script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('title','优惠券详情'); ?>
<?php $__env->startSection('youhui','menu-open'); ?>
<?php $__env->startSection('youhui2','active'); ?>
<?php $__env->startSection('youhui-list','active'); ?>
<?php echo $__env->make('Public.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>