edit.html 2.3 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="$detail.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="请输入排序,数字" autocomplete="off" class="layui-input" value="{$detail.sort}">
  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="请输入分类名称" lay-reqText="请输入分类名称" class="layui-input" value="{$detail.title}">
  28. </td>
  29. <td class="layui-td-gray">关键词</td>
  30. <td>
  31. <input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="{$detail.keywords}">
  32. </td>
  33. </tr>
  34. <tr>
  35. <td class="layui-td-gray">描述</td>
  36. <td colspan="3"><textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{$detail.desc}</textarea></td>
  37. </tr>
  38. </table>
  39. <div class="pt-3">
  40. <input type="hidden" name="id" value="{$detail.id}"/>
  41. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  42. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  43. </div>
  44. </form>
  45. {/block}
  46. <!-- /主体 -->
  47. <!-- 脚本 -->
  48. {block name="script"}
  49. <script>
  50. var moduleInit = ['tool'];
  51. function gouguInit() {
  52. var form = layui.form, tool = layui.tool;
  53. //监听提交
  54. form.on('submit(webform)', function (data) {
  55. let callback = function (e) {
  56. layer.msg(e.msg);
  57. if (e.code == 0) {
  58. setTimeout(function () {
  59. parent.location.reload();
  60. }, 1000);
  61. }
  62. }
  63. tool.post("/admin/goods_cate/edit", data.field, callback);
  64. return false;
  65. });
  66. }
  67. </script>
  68. {/block}
  69. <!-- /脚本 -->