
 <!doctype html>
  <html class="no-js">
  <head>

    <include file="Common/head" />
    <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;
      }
    </style>
  </head>
  <body>
  <include file="Common/header" />

  <div class="am-cf admin">

    <include file="Common/sidebar" nav="int" navv="int"/>
    <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">积分商城</strong> /
              <small>添加积分商品</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="{$goods.id}" />
              <div class="am-form-group am-form-inline">
                
                <div class="am-form-group">
                  <label>排序<span>（数字越大排序越靠前）</span></label>
                  <input type="text" name="sort" data-type="zs" value="{$goods.sort}">
                </div>

                <div class="am-form-group" style="margin-left:10px;">
                  <label >上下架</label>
                  <div class="tttt-switch" style="margin:4px 14px;">
                    <input type="checkbox" name="status" <?php if($goods[status] == 1) echo "checked";?>>
                    <span class="tttt-switch-btn"></span>
                  </div>
                  <input type="hidden" name="old_status" value="<?php echo $goods[status]?:0;?>">
                </div>
              </div>

                <div class="am-form-group" style="width:220px;">
                  <label>商品名称 <p>*</p></label>
                  <input type="text" name="name" value="{$goods.name}">
                </div>

                <div class="am-form-group" >
                  <label>积分<p>*</p></label>
                  <input type="text" name="int" data-type="xs" value="{$goods.int}" style="width: 220px"  required="required" >
                </div>

                <label>商品图片 </label>
                <div class="am-form-group">
                  <img src="" id="img_preview" onerror="this.src='<?php echo $goods[img]?:'__PUBLIC__/img/add.png'?>'">
                  <input type="file" name="img" value="" accept="image/jpg,image/jpeg,image/png" >
                </div>

              <button type="submit" class="am-btn am-btn-success" id="form_submit" style="margin-bottom: 50px;">保存</button>

          </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>
  <include file="Common/footer" />
  </body>
  </html>