<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
  		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
                <title><!--{$config.system_title}--><!--{if $config.is_code !='1'}-->-<!--{$copyright_header}--><!--{/if}--></title>
                <meta name="description" content="<!--{$config.system_desc}-->" />
                <meta name="keywords" content="<!--{$config.system_keyword}-->" />
		<link rel="stylesheet" type="text/css" href="<!--{$salepath}-->/static/layui/css/layui.css"/>
		<link rel="stylesheet" type="text/css" href="<!--{$salepath}-->/static/css/admin.css"/>
	</head>
	<body>
		<form class="layui-form column-content-detail">
					<div class="layui-tab">
						
						<div class="layui-tab-content">
							<div class="layui-tab-item layui-show">
 								<div class="layui-form-item">
									<label class="layui-form-label">编号：</label>
									<div class="layui-input-block">
										<input type="text" name="productsn" required lay-verify="required" placeholder="请输入编号" autocomplete="off" class="layui-input" value="SN<!--{$timeline}-->">
									</div>
								</div>                                                           
								<div class="layui-form-item">
									<label class="layui-form-label">产品名称：</label>
									<div class="layui-input-block">
										<input type="text" name="productname" required lay-verify="required" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">产品分类：</label>
									<div class="layui-input-block">
										<select name="catid" lay-verify="required">
											<option value="">请选择产品分类</option>
											    <!--{assign var='productcategory' value=vo_category("type={treecat} rootid={2}")}-->
                                                <!--{foreach $productcategory as $parent}-->
                                                    <option value="<!--{$parent.catid}-->"><!--{$parent.catname}--></option>
                                                <!--{/foreach}-->
										</select>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">售价：</label>
									<div class="layui-input-block">
										<input type="number" name="bprice" required lay-verify="required" placeholder="请输入价格" autocomplete="off" class="layui-input" value="">
									</div>
								</div>
                                                                                								<div class="layui-form-item">
									<label class="layui-form-label">默认库存：</label>
									<div class="layui-input-block">
										<input type="number" name="stock" required lay-verify="required" placeholder="请输入库存" autocomplete="off" class="layui-input" value="0">
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="layui-form-item" style="padding-left: 10px;">
						<div class="layui-input-block">
							<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">立即提交</button>&nbsp;&nbsp;&nbsp;
							<a href="javascript:history.back(-1)"><button type="button" class="layui-btn layui-btn-primary">返回</button></a>
						</div>
					</div>
				</form>
	
		
		<script src="<!--{$salepath}-->static/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script src="<!--{$salepath}-->static/js/common.js" type="text/javascript" charset="utf-8"></script>
                <script src="<!--{$salepath}-->static/js/jquery-3.2.1.js" type="text/javascript" charset="utf-8"></script>
                 <script type="text/javascript">
                  			layui.use(['form', 'layedit', 'laydate'], function() {
				var form = layui.form(),
					layer = layui.layer;
				form.on('submit(formDemo)', function(data) {   
                                            $.ajax({
                                                type: 'POST',
                                                url:"sale.php?c=Product&a=saveadd",
                                                async:true,
                                                data:data.field,
                                                dataType : "json",
                                                success:function(data){
                                                      if(data.code=='1'){                                                           
                                                            layer.msg(data.msg);
                                                            setTimeout(function(){
                                                                    parent.location.reload(true);
                                                                    layer.closeAll();
                                                              //  document.frames("iframe7").location.reload(true); 
                                                              //  parent.location.reload(true);
                                                               // window.frames["iframe7"].location.reload();
                                                              //     layer.closeAll();
                                                            }, 1500);
                                                      }
                                                      return false;
                                                },
                                                error:function(e){
                                                       return false;
                                                }
                                            });
                                          
					return false;
				});

			});
			
		</script>
	</body>
</html>
