<?php /* /www/wwwroot/default/sale/resources/views/Admin/order_goods.blade.php */ ?>
<?php $__env->startSection('admin'); ?>
<script src="/admin/plugins/jquery/jquery.min.js"></script>
<script src="/admin/layer-v3.1.1/layer/layer.js"></script>
<!-- 图片裁剪 -->
<!-- <link rel="stylesheet" type="text/css" href="/img_cate/ycbootstrap.css"> -->
<link rel="stylesheet" type="text/css" href="/img_cate/reset.css">
<script src="/img_cate/jquery-1.10.2.js"></script>
<!-- <script src="/img_cate/jquery.min.js"></script> -->
<script src="/img_cate/iscroll-zoom.js" type="text/javascript" charset="utf-8"></script>
<script src="/img_cate/hammer.js" type="text/javascript" charset="utf-8"></script>
<script src="/img_cate/lrz.all.bundle.js" type="text/javascript" charset="utf-8"></script>
<script src="/img_cate/jquery.photoClip.min.js" type="text/javascript" charset="utf-8"></script>
<style>
  img {
    max-width: 100%;
  }
</style>
<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>
              <li class="breadcrumb-item active">订单详情</li>
            </ol>
          </div>
        </div>
      </div>
    </section>
    <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">
                <!-- 表单 -->

                <input type="hidden" value="" id="goodsid">
                <form class="form">
                    <div class="form-group m-4">
                        <label for="exampleInputName2" class="col-md-4"><span style="color:red">*</span> 收货人详细</label>
                        <div>
                            姓名：<?php echo e($orderdetail['name']); ?><br>
                            收货地址：<?php echo e($orderdetail['address']); ?>—<?php echo e($orderdetail['menpai']); ?><br>
                            联系方式：<?php echo e($orderdetail['phone']); ?><br>
                            结算总金额：<?php echo e($orderdetail['price'] / 100); ?>元<br>
                        </div>
                        
                    </div>
                </form>

                <form class="form">
                    <div class="form-group m-4">
                        <label for="exampleInputName2" class="col-md-4"><span style="color:red">*</span> 购买商品</label>
                        <div>
                            <?php $__currentLoopData = $goods; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div>
                                    商品<?php echo e($key+1); ?>:<br>
                                    商品名称：<?php echo e($val ->goods_name); ?><br>
                                    商品价格：<?php echo e($val -> guige_price); ?>元<br>
                                    商品规格：<?php echo e($val -> guige_name); ?><br>
                                    商品数量：<?php echo e($val -> goods_num); ?><br>
                                    商品备注：<?php echo e($val -> beizhu); ?><br><br>
                                </div>
                            
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                        
                            
                            
                            
                        
                    </div>
                </form>

                
                    
                        
                        
                          
                            
                            
                        
                    
                

				
                    
                        
                        
                    
                
                  
                      
                          
                          
                      
                  

                
                    
                        
                        
                        
                    
                

                
                    
                        
                        
                        
                        
                        
                    
                

                <!-- 图片裁剪代码 -->
                
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  

                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  

                  

            
             
             
                  
                    
                    
                        
                    
                  
                
                

                
                    
                        
                    
                
                <!-- 表单结束 -->

              </div>
            </div>
          </div>
        </div>
    </section>
  </div>

<script>
$('.back').click(function(){
    window.location.href="/admin/goodscate/goods";
})
//添加规格
$('.ggbtn').click(function(){
    $('.guige_form:last').after('<div class="form-inline guige_form"><input type="text" class="form-control guige_name" placeholder="规则名称">&nbsp;<input type="number" class="form-control  guige_price" placeholder="价格"><a href="javascript:void(0)" onclick="jian(this)" style="font-size:30px;margin-left:20px"> - </a></div>');

})
function jian(obj)
{
  $(obj).parent().remove();
}
//选择门店联动
$('#md').change(function(){
    let id = $('#md option:selected').val();
    if(!id){
      layer.alert('参数不全');
      return false;
    }
    ajax(id);
})
function ajax(id)
{
  $.get('/admin/goodscate/goodsGetCate',{id:id},function(res){
        if(res.length){
          //干掉旧的数据
          $('#goodsCate').html('');
          for( x in res ){
            $('#goodsCate').append('<option value='+res[x].id+'>'+res[x].cate_name+'</option>');
          }
        }
    })
}
  var clipArea = new bjj.PhotoClip("#clipArea", {
      size: [150, 150],// 截取框的宽和高组成的数组。默认值为[260,260]
      outputSize: [0, 0], // 输出图像的宽和高组成的数组。默认值为[0,0]，表示输出图像原始大小
      //outputType: "jpg", // 指定输出图片的类型，可选 "jpg" 和 "png" 两种种类型，默认为 "jpg"
      file: "#file", // 上传图片的<input type="file">控件的选择器或者DOM对象
      view: "#view", // 显示截取后图像的容器的选择器或者DOM对象
      ok: "#clipBtn", // 确认截图按钮的选择器或者DOM对象
      loadStart: function() {
        $('.cover-wrap').fadeIn();
        console.log("照片读取中");
      },
      loadComplete: function() {
        console.log("照片读取完成");
      },
      clipFinish: function(dataURL) {
        $('.cover-wrap').fadeOut();
        $('#view').css('background-size','100% 100%');
        if(dataURL){
          $('#imgURL').val(dataURL);
        }
      }
    });
$('.ok').click(function(){
  var guige = [];  //商品规格
  $('.guige_form').each(function(k,v){
    if(k != 0){   //因为0是lable
      var guige_item = [];
      var name = $('.guige_name',v).val();
      var jiage = $('.guige_price',v).val();
      if(name && jiage) {
        guige_item.push(name,jiage);
        guige.push(guige_item);
      }
      guige_item = [];
    }
  })
  var id = $('#goodsid').val();
  var imgURL = $('#imgURL').val();
  var goodsName = $('#goodsName').val();
  var goodsCate = $('#goodsCate').val();
  var goodsPrice = $('#goodsPrice').val();
  var md_id = $('#md').val();
  var keywords = $('.keywords').val();
  var xuhao = $('#xuhao').val();
  var beizhu = $('#beizhu').val();
  var goodsDescription = ue.getContent();
  if(!guige.length && !goodsPrice){
    layer.alert('不添规格的时候必须填价格');
  }
  if(!goodsName || !goodsCate) {
    layer.alert('请填写必填信息');
    return false;
  }
  $.post('/admin/goodscate/goodsUpdate',{xuhao:xuhao,beizhu:beizhu,guige:guige,keywords:keywords,md_id:md_id,id:id,imgURL:imgURL,goodsName:goodsName,goodsCate:goodsCate,goodsPrice:goodsPrice,goodsDescription:goodsDescription},function(res){
          if(res.code == '1000'){
                layer.msg(res.msg);
                window.location.reload();
            }else{
                layer.alert(res.msg);
            }
  })
})
</script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('title','商品添加'); ?>
<?php $__env->startSection('goods','menu-open'); ?>
<?php $__env->startSection('goods2','active'); ?>
<?php $__env->startSection('goodslist','active'); ?>
<?php echo $__env->make('Public.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>