You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
8.0 KiB

7 years ago
  1. <!DOCTYPE html><html><head><title>添加商品信息_后台管理</title>{include file="common/header"/}
  2. <div class="container-fluid">
  3. <div class="row">
  4. <!-- 左边开始 --><div class="col-sm-3 col-md-2 sidebar">{include file="common/leftmenu"/}</div><!-- 左边结束 -->
  5. <!-- 右边开始 --><div class="col-sm-9 col-md-10 rightbox"><div id="mainbox">
  6. <h5 class="sub-header"><a href="/fladmin/Product">商品列表</a> > 添加商品</h5>
  7. <form id="addarc" method="post" action="/fladmin/Product/doadd" role="form" enctype="multipart/form-data" class="table-responsive">
  8. <table class="table table-striped table-bordered">
  9. <tbody>
  10. <tr>
  11. <td align="right">商品标题:</td>
  12. <td><input name="title" type="text" id="title" value="" class="required" style="width:60%" placeholder="在此输入标题"></td>
  13. </tr>
  14. <tr>
  15. <td align="right">货号:</td>
  16. <td colspan="2"><input name="serial_no" type="text" id="serial_no" style="width:180px" value="">&nbsp;&nbsp; 运费:<input name="delivery_fee" type="text" id="delivery_fee" style="width:100px" value="">&nbsp;&nbsp; 销量:<input name="sales" type="text" id="sales" style="width:60px" value=""></td>
  17. </tr>
  18. <tr>
  19. <td align="right">商品价格:</td>
  20. <td colspan="2"><input name="price" type="text" id="price" style="width:100px" value="">&nbsp;&nbsp; 原价:<input name="origin_price" type="text" id="origin_price" style="width:100px" value="">&nbsp;&nbsp; 库存:<input name="inventory" type="text" id="inventory" style="width:60px" value="">&nbsp;&nbsp; 浏览次数:<input type="text" name="click" id="click" value="" style="width:60px;"></td>
  21. </tr>
  22. <tr>
  23. <td align="right">上架:</td>
  24. <td>
  25. <input type="radio" value='0' name="status" checked />&nbsp;&nbsp;&nbsp;
  26. <input type="radio" value='1' name="status" />&nbsp;
  27. </td>
  28. </tr>
  29. <tr>
  30. <td align="right">推荐:</td>
  31. <td>
  32. <select name="tuijian" id="tuijian">
  33. <?php $tuijian = config('tuijian');
  34. for($i=0;$i<count($tuijian);$i++){ ?><option value="<?php echo $i; ?>"><?php echo $tuijian[$i]; ?></option><?php } ?>
  35. </select>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td align="right">seoTitle:</td>
  40. <td><input name="seotitle" type="text" id="seotitle" value="" style="width:60%"></td>
  41. </tr>
  42. <tr>
  43. <td align="right" style="vertical-align:middle;">缩略图:</td>
  44. <td style="vertical-align:middle;"><button type="button" onclick="upImage();">选择图片</button> <input name="litpic" type="text" id="litpic" value="" style="width:40%"> <img style="margin-left:20px;display:none;" src="" width="120" height="80" id="picview"></td>
  45. </tr>
  46. <script type="text/javascript">
  47. var _editor;
  48. $(function() {
  49. //重新实例化一个编辑器,防止在上面的editor编辑器中显示上传的图片或者文件
  50. _editor = UE.getEditor('ueditorimg');
  51. _editor.ready(function () {
  52. //设置编辑器不可用
  53. _editor.setDisabled('insertimage');
  54. //隐藏编辑器,因为不会用到这个编辑器实例,所以要隐藏
  55. _editor.hide();
  56. //侦听图片上传
  57. _editor.addListener('beforeInsertImage', function (t, arg) {
  58. //将地址赋值给相应的input,只取第一张图片的路径
  59. $('#litpic').val(arg[0].src);
  60. //图片预览
  61. $('#picview').attr("src",arg[0].src).css("display","inline-block");
  62. })
  63. });
  64. });
  65. //弹出图片上传的对话框
  66. function upImage()
  67. {
  68. var myImage = _editor.getDialog("insertimage");
  69. myImage.render();
  70. myImage.open();
  71. }
  72. </script>
  73. <script type="text/plain" id="ueditorimg"></script>
  74. <tr>
  75. <td align="right">商品类目:</td>
  76. <td>
  77. <select name="typeid" id="typeid">
  78. <?php $catlist = tree(get_category('product_type',0));foreach($catlist as $row){
  79. if($row["id"]==$catid){ ?>
  80. <option selected="selected" value="<?php echo $row["id"]; ?>"><?php for($i=0;$i<$row["deep"];$i++){echo "";}echo $row["typename"]; ?></option>
  81. <?php }else{ ?>
  82. <option value="<?php echo $row["id"]; ?>"><?php for($i=0;$i<$row["deep"];$i++){echo "";}echo $row["typename"]; ?></option>
  83. <?php }} ?>
  84. </select>
  85. </td>
  86. </tr>
  87. <tr>
  88. <td align="right">关键词:</td>
  89. <td><input type="text" name="keywords" id="keywords" style="width:50%" value=""> (多个用","分开)</td>
  90. </tr>
  91. <tr>
  92. <td align="right" style="vertical-align:middle;">内容摘要:</td>
  93. <td><textarea name="description" rows="5" id="description" style="width:60%;height:70px;vertical-align:middle;"></textarea></td>
  94. </tr>
  95. <tr>
  96. <td colspan="2"><strong>图文描述:</strong></td>
  97. </tr>
  98. <tr>
  99. <td colspan="2">
  100. <!-- 加载编辑器的容器 --><script id="container" name="body" type="text/plain"></script>
  101. <!-- 配置文件 --><script type="text/javascript" src="/other/flueditor/ueditor.config.js"></script>
  102. <!-- 编辑器源码文件 --><script type="text/javascript" src="/other/flueditor/ueditor.all.js"></script>
  103. <!-- 实例化编辑器 --><script type="text/javascript">var ue = UE.getEditor('container',{maximumWords:100000,initialFrameHeight:320,enableAutoSave:false});</script></td>
  104. </tr>
  105. <tr>
  106. <td colspan="2"><button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button>&nbsp;&nbsp;<button type="reset" class="btn btn-default" value="Reset">重置(Reset)</button><input type="hidden"></input></td>
  107. </tr>
  108. </tbody></table></form><!-- 表单结束 -->
  109. </div></div><!-- 右边结束 --></div></div>
  110. <script>
  111. $(function(){
  112. $(".required").blur(function(){
  113. var $parent = $(this).parent();
  114. $parent.find(".formtips").remove();
  115. if(this.value=="")
  116. {
  117. $parent.append(' <small class="formtips onError"><font color="red">不能为空!</font></small>');
  118. }
  119. else
  120. {
  121. $parent.append(' <small class="formtips onSuccess"><font color="green">OK</font></small>');
  122. }
  123. });
  124. //重置
  125. $('#addarc input[type="reset"]').click(function(){
  126. $(".formtips").remove();
  127. });
  128. $("#addarc").submit(function(){
  129. $(".required").trigger('blur');
  130. var numError = $('#addarc .onError').length;
  131. if(numError){return false;}
  132. //$("#contents").val = ue.getContent();
  133. //var datas = $('#addarc').serialize();//#form要在form里面
  134. //var content = ue.getContent();
  135. //var title = $("#title").val();
  136. //var seotitle = $("#seotitle").val();
  137. //var keywords = $("#keywords").val();
  138. //var description = $("#description").val();
  139. /*$.ajax({
  140. url: "/fladmin/Product/doedit",
  141. type: "POST",
  142. dataType: "json",
  143. cache: false,
  144. data: {
  145. "id":$("#id").val(),
  146. "typeid":$("#typeid").val(),
  147. "tuijian":$("#tuijian").val(),
  148. "click":$("#click").val(),
  149. "writer":$("#writer").val(),
  150. "source":$("#source").val(),
  151. "litpic":$("#litpic").val(),
  152. "title":$("#title").val(),
  153. "seotitle":$("#seotitle").val(),
  154. "keywords":$("#keywords").val(),
  155. "description":$("#description").val(),
  156. "contents":content
  157. //"title":title.replace("'", "&#039;"),
  158. //"seotitle":seotitle.replace("'", "&#039;"),
  159. //"keywords":keywords.replace("'", "&#039;"),
  160. //"description":description.replace("'", "&#039;"),
  161. //"contents":content.replace("'", "&#039;")
  162. },
  163. success: function(data){
  164. if(data.code==200)
  165. {
  166. //alert(data.info);
  167. window.location.replace("/fladmin/Product");
  168. }
  169. }
  170. }); */
  171. });
  172. });
  173. </script>
  174. </body></html>