<!--
 *  作者：梦雨
 *  @ QQ50361804
-->
{include file="index/header"}
<body>
<div class="fly-panel fly-panel-user">
<div class="gz—admin">
<fieldset class="layui-elem-field layui-field-title">
<legend>修改</legend>
</fieldset>
<link rel="stylesheet" href="__ADMIN__/wangEditor/css/wangEditor.min.css">
<script type="text/javascript" src="__ADMIN__/wangEditor/js/wangEditor.min.js"></script>
<style type="text/css">
.gz_sels a{padding-right:15px;position:relative}
.gz_sels a{padding:0 20px 0 8px;color:#3B6268;background:#fff;border:1px #F8E06E solid;margin-right:5px;margin-bottom:5px;font-size:14px;/*height:26px;line-height:26px;*/display:block;float:left}
.gz_pres a.selected{padding:0 8px;color:#3B6268;background:#FFFFBA;border:1px #F8E06E solid;margin-right:5px;margin-bottom:5px;font-size:14px;/*height:26px;line-height:26px;*/display:block;float:left}
.gz_pres a{padding:0 8px;color:#fff;background:#5AC7A9;border:1px #5AC7A9 solid;margin-right:5px;margin-bottom:5px;font-size:14px;/*height:26px;line-height:26px;*/display:block;float:left}
.gz_sels a em{width: 12px;height: 12px;font-style: normal;display: block;position: absolute;top: 7px;right: 4px;z-index: 2;background: url(__ADMIN__/img/sx.png) no-repeat 0 0;}
.cl{zoom:1}
.cl:after{content:'\20';display:block;height:0;clear:both;visibility:hidden}
.wangEditor-menu-container .menu-item a {padding: 12px 0;}
.wangEditor-menu-container .menu-item {height: 37px;width: 37px;}
.wangEditor-menu-container .menu-group {padding: 0;}
.wangEditor-container {border: 1px solid #e6e6e6;}
.tpt-bar{display:flex;border:1px solid #e2e2e2;border-radius:2px;background:#f2f2f2;box-shadow:0 2px 5px 0 rgba(0,0,0,.1);flex-wrap:wrap;}
.tpt-bar label{display:block;padding:0 20px;height:38px;line-height:38px;cursor:pointer;order:1;}
.tpt-bar .tpt-bar-con{z-index:0;display:none;margin-top:-1px;padding:10px;width:100%;min-height:120px;border-top:1px solid #e2e2e2;background:#fff;order:99;}
.tpt-bar input[type=radio]{position:absolute;opacity:0;}
.tpt-bar input[type=radio]:checked+label{z-index:1;margin-right:-1px;margin-left:-1px;border-right:1px solid #e2e2e2;border-left:1px solid #e2e2e2;background:#fff;}
.tpt-bar input[type=radio]:checked+label+.tpt-bar-con{display:block;}
</style>
<link href="__ADMIN__/css/monokai_sublime.min.css" rel="external nofollow" rel="stylesheet"> 
<script src="__ADMIN__/js/highlight.min.js"></script> 
<script >hljs.initHighlightingOnLoad();</script>
  
<form class="layui-form">
    <input type="hidden" name="id" value="{$gzc.id}">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-block">
			  <select name="tid">
			  {volist name="gzcs" id="vo"key="k"}
              <option {if condition="$gzc['tid'] eq $vo['id']"}selected="selected"{/if} value="{$vo.id}"{if condition ="$vo['sidebar'] eq '0'"}disabled=""{/if}>{$vo.name}</option>
                {volist name="gjms" id="vs" key="k"}
                {if condition ="$vo.id eq $vs['tid']"}
                <option value="{$vs.id}"{if condition ="$vs['sidebar'] eq '0'"}disabled=""{/if}{if condition="$gzc['tid'] eq $vo['id']"}selected="selected"{/if}>------{$vs.name}</option>
                {/if}
                {/volist} 
              {/volist}
              </select>
            </div>
          </div>
        </div>
  <div class="layui-form-item">
    <label class="layui-form-label">标题</label>
    <div class="layui-input-block">
      <input type="text" name="title" required lay-verify="required" value="{$gzc.title}"placeholder="请输入内容" autocomplete="off" class="layui-input">
    </div>
  </div>

		<div class="layui-form-item">
          <label for="L_title" class="layui-form-label">价格积分</label> 
          <div class="layui-input-block">
            <input type="number" name="jifen" value="{$gzc.jifen}" autocomplete="off" class="layui-input" style="width: 100px;float: left;">
	       <span style="float: left;line-height: 38px;margin: 0 20px;">原价</span>
            <input type="number" name="jifens" value="{$gzc.jifens}" autocomplete="off" class="layui-input" style="width: 100px;float: left;">
	       <span style="float: left;line-height: 38px;margin: 0 20px;">库存</span>
            <input type="number" name="kucun" value="{$gzc.kucun}" autocomplete="off" class="layui-input" style="width: 100px;float: left;">
          </div>
        </div>
		<div class="gz_item">
		<input type="hidden" name="pic" value="{$gzc.pic}">
		<div id="gz_sel" class="gz_sels gz-none-750" style="margin-top: 20px;">

  <div class="layui-form-item">
    <label class="layui-form-label">封面</label>
    <div class="layui-input-block">
	  <input type="file" name="file" class="layui-upload-file" id="image" style="float: left;">
	  <input type="text" id="gz_input" name="pics" class="layui-input" style="position: absolute;left: 111px;top: 0px;width: 200px;">
      <button class="layui-btn" id="gz_btn" type="button" style="position: absolute;left: 311px;top: 0px;background: #FF5722;">必须点击确定</button>
    </div>
  </div>
			<span style="margin-bottom: 5px;float: left;margin-left:50px;">
                {if condition="$gzc['pic'] neq ''"}<?php $arr=explode(',', $gzc['pic']);foreach ($arr as $k=>$v){echo "<a href='javascript:;'><em></em><img src='$v' height='200' width='200'>";}?>{/if}
			</span>
		</div> 
  
 
          
			<div class="layui-form-item">
										<label for="L_title" class="layui-form-label">
											虚拟商品 
										</label>
										<div class="layui-input-block"> 
											<input type="radio" name="xn" lay-filter="linktype" value="0" title="否"{if condition ="$gzc['xn'] eq '0'"}checked/{/if}>
											<input type="radio" name="xn" lay-filter="linktype" value="1" title="是"{if condition ="$gzc['xn'] eq '1'"}checked/{/if}>

										</div>
									</div>
									<div class="layui-col-md3 ">
										<div class="layui-form-item" id="viewscore" {if condition ="$gzc['xn'] eq '0'"}style="display:none"{/if}>
 
    <label class="layui-form-label">源文件</label>
    <div class="layui-input-block">
      <input type="file" name="file" class="layui-upload-file" id="upfile" style="float: left;">
	  <input type="text" name="lianjie" value="{$gzc.lianjie}" class="layui-input" style="position: absolute;left: 111px;top: 0px;width: 500px;">
    </div>
 
                                          
										</div>
                                      
										<div class="layui-form-item" id="viewscores" {if condition ="$gzc['xn'] eq '1'"}style="display:none"{/if}>
		<div class="gz_item">
		<input type="hidden" name="guige" value="{$gzc.guige}">
		<div id="gz_selguige" class="gz_sels gz-none-750" style="margin-top: 20px;">
          <span style="margin-bottom: 5px;float: left;margin-left:50px;">
            {if condition="$gzc['guige'] neq ''"}<?php $arr=explode(',', $gzc['guige']);foreach ($arr as $k=>$v){echo "【'$v'】";}?>{/if}
			</span> 
  <div class="layui-form-item">
    <label class="layui-form-label">规格</label>
    <div class="layui-input-block">
	  <input type="text" id="gz_inputguige" placeholder="例如衣服的 （黑色S款）" class="layui-input" style="position: absolute;top: 0px;width: 200px;">
      <button class="layui-btn" id="gz_btnguige" type="button" style="position: absolute;left: 200px;top: 0px;background: #3a3edc;">添加规格</button>
    </div>
  </div>
			
		</div> 
                                          
                                          
										</div>
									</div>
				 
          
        <div class="layui-form-item layui-form-text">
          <div class="layui-input-block">
		  <textarea id="textarea" name="content" required lay-verify="required" style="height:400px;width: 100%;">{$gzc.content}</textarea>
          </div>
          <label for="L_content" class="layui-form-label" style="top: -2px;">内容</label>
        </div>

          
		<div class="gz_item">
		<input type="hidden" name="keywords" value="{$gzc.keywords}">
		<div id="gz_selkey" class="gz_sels gz-none-750" style="margin-top: 20px;">
          <span style="margin-bottom: 5px;float: left;margin-left:50px;">
             {if condition="$gzc['keywords'] neq ''"}<?php $arr=explode(',', $gzc['keywords']);foreach ($arr as $k=>$v){echo "【'$v'】";}?>{/if}
			</span>
          
  <div class="layui-form-item">
    <label class="layui-form-label">关键字</label>
    <div class="layui-input-block">
	  <input type="text" id="gz_inputkey" class="layui-input" style="position: absolute;top: 0px;width: 200px;">
      <button class="layui-btn" id="gz_btnkey" type="button" style="position: absolute;left: 200px;top: 0px;background: #097d0d;">添加标签</button>
    </div>
  </div>
			
		</div> 
          
          
  <div class="layui-form-item">
    <div class="layui-input-block">
	  <button class="layui-btn" lay-submit="" lay-filter="shops_edit">立即提交</button>
	   <br><a class="layui-btn layui-btn-primary" href="javascript:window.opener=null;window.close();">关闭窗口</a>
      <script>Response.Write("<script language=\"javascript\">window.opener=null;window.close();</script>
    </div>
  </div>

</form>
  
<script type="text/javascript">
$(function() {
	$("#gz_sel").on('click', 'a>em', function() {
		var name = "pic";
		var tag = $(this).parent().text();
		$(this).parent().remove();
		var tags = new Array();
		$("#gz_sel").find('a').each(function() {
			tags.push($(this).text());
		});
		$("input[name=" + name + "]").val(tags.join(","));
		$("#gz_pre a:contains('" + tag + "')").removeClass("selected");
	});
	$("#gz_btn").click(function() {
		var name = "pic";
		var tags = $.trim($("input[name=" + name + "]").val());
		if (tags !== "") {
			tags = tags.split(",");
		} else {
			tags = new Array();
		}
		var tag = $.trim($("#gz_input").val());
		if (tag !== '' && $.inArray(tag, tags) === -1) {
			tags.push(tag);
			$("#gz_pre a:contains('" + tag + "')").addClass("selected");
		}
		$("#gz_sel").children('span').empty();
		$.each(tags, function(k, v) {
			$("#gz_sel").children('span').append('<a href="javascript:;"><em></em><img src="' + v + '" height="200" width="200" /></a>');
		});
		$("input[name=" + name + "]").val(tags.join(","));
		$("#gz_inputkey").val('');
	});
  
  
	$("#gz_selkey").on('click', 'a>em', function() {
		var name = "keywords";
		var tag = $(this).parent().text();
		$(this).parent().remove();
		var tags = new Array();
		$("#gz_selkey").find('a').each(function() {
			tags.push($(this).text());
		});
		$("input[name=" + name + "]").val(tags.join(","));
		$("#gz_prekey a:contains('" + tag + "')").removeClass("selected");
	});
	$("#gz_btnkey").click(function() {
		var name = "keywords";
		var tags = $.trim($("input[name=" + name + "]").val());
		if (tags !== "") {
			tags = tags.split(",");
		} else {
			tags = new Array();
		}
		var tag = $.trim($("#gz_inputkey").val());
		if (tag !== '' && $.inArray(tag, tags) === -1) {
			tags.push(tag);
			$("#gz_prekey a:contains('" + tag + "')").addClass("selected");
		}
		$("#gz_selkey").children('span').empty();
		$.each(tags, function(k, v) {
			$("#gz_selkey").children('span').append('<a href="javascript:;">' + v + '<em></em></a>');
		});
		$("input[name=" + name + "]").val(tags.join(","));
		$("#gz_inputkey").val('');
	});
	$("#gz_selguige").on('click', 'a>em', function() {
		var name = "guige";
		var tag = $(this).parent().text();
		$(this).parent().remove();
		var tags = new Array();
		$("#gz_selguige").find('a').each(function() {
			tags.push($(this).text());
		});
		$("input[name=" + name + "]").val(tags.join(","));
		$("#gz_preguige a:contains('" + tag + "')").removeClass("selected");
	});
	$("#gz_btnguige").click(function() {
		var name = "guige";
		var tags = $.trim($("input[name=" + name + "]").val());
		if (tags !== "") {
			tags = tags.split(",");
		} else {
			tags = new Array();
		}
		var tag = $.trim($("#gz_inputguige").val());
		if (tag !== '' && $.inArray(tag, tags) === -1) {
			tags.push(tag);
			$("#gz_preguige a:contains('" + tag + "')").addClass("selected");
		}
		$("#gz_selguige").children('span').empty();
		$.each(tags, function(k, v) {
			$("#gz_selguige").children('span').append('<a href="javascript:;">' + v + '<em></em></a>');
		});
		$("input[name=" + name + "]").val(tags.join(","));
		$("#gz_inputguige").val('');
	});
 
});
</script>
  
  
<script type="text/javascript">
    var editor = new wangEditor('textarea');
	editor.config.uploadImgUrl = '{:url("shops/doUploadPic")}';
	editor.config.uploadImgFileName = 'FileName';
// 取消粘贴过滤
{if condition="config('set.gl') eq '1'"}editor.config.pasteFilter = false;{else/}{/if}
    editor.create();
</script>
<script>
layui.use(['form', 'upload'],function(){
  var form = layui.form()
  ,jq = layui.jquery;
		form.on('radio(linktype)',
		function(data) {
			if (data.value == 1) {
				$("#viewscore").show();
			} else {
				$("#viewscore").hide();
			} //被点击的radio的value值 
          
			if (data.value == 0) {
				$("#viewscores").show();
			} else {
				$("#viewscores").hide();
			} //被点击的radio的value值 
          
		});
  layui.upload({
    url: '{:url("upload/upimage")}'
    ,elem:'#image'
    ,before: function(input){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
    }
    ,success: function(res){
      layer.close(loading);
      jq('input[name=pics]').val(res.path);
      layer.msg(res.msg, {icon: 1, time: 1000});
    }
  }); 
  layui.upload({
    url: '{:url("upload/upfile")}'
     ,elem:'#upfile'
     ,title: '上传附件'
     ,type: 'file'
    ,before: function(input){
      loading = layer.load(1, {
        shade: [0.20,'#000']
      });
    }

    ,success: function(res){
      layer.close(loading);
      jq('input[name=lianjie]').val(res.path);
      layer.msg(res.msg, {icon: 1, time: 1000});
    }
  });
  form.on('submit(shops_edit)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("shops/edit")}',param,function(data){
      if(data.code == 200){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          //  location.reload();
            location.href = '{:url("index/url")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });

})
</script>
</div>
</div>
{include file="index_footer"}
</body>
</html>