add.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">新建商品分类</h3>
  6. <table class="layui-table layui-table-form">
  7. <tr>
  8. <td class="layui-td-gray">父级分类<font>*</font>
  9. </td>
  10. <td>
  11. <select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
  12. <option value="0">作为顶级分类</option>
  13. {volist name=":set_recursion(get_goods_cate())" id="v"}
  14. <option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
  15. {/volist}
  16. </select>
  17. </td>
  18. <td class="layui-td-gray">排序</td>
  19. <td>
  20. <input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input">
  21. </td>
  22. </tr>
  23. <tr>
  24. <td class="layui-td-gray">分类名称<font>*</font>
  25. </td>
  26. <td>
  27. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" value="" class="layui-input">
  28. </td>
  29. <td class="layui-td-gray">关键词</td>
  30. <td>
  31. <input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="">
  32. </td>
  33. </tr>
  34. <tr>
  35. <td class="layui-td-gray">描述</td>
  36. <td colspan="3"><textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea"></textarea></td>
  37. </tr>
  38. </table>
  39. <div class="pt-3">
  40. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  41. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  42. </div>
  43. </form>
  44. {/block}
  45. <!-- /主体 -->
  46. <!-- 脚本 -->
  47. {block name="script"}
  48. <script>
  49. var moduleInit = ['tool'];
  50. function gouguInit() {
  51. var form = layui.form, tool = layui.tool;
  52. //监听提交
  53. form.on('submit(webform)', function (data) {
  54. let callback = function (e) {
  55. layer.msg(e.msg);
  56. if (e.code == 0) {
  57. setTimeout(function () {
  58. parent.location.reload();
  59. }, 1000);
  60. }
  61. }
  62. tool.post("/admin/goods_cate/add", data.field, callback);
  63. return false;
  64. });
  65. }
  66. </script>
  67. {/block}
  68. <!-- /脚本 -->