From 45924fd6aefe68b6703120ee8018a202cb5a46a8 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 17 May 2022 17:26:59 +0800 Subject: [PATCH] fix goodsInfo edit --- src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html | 62 +++++++++++++++++++++--------- 1 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html index e957b9a..18b2c15 100644 --- a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html +++ b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html @@ -1,8 +1,8 @@ -<div class="layui-fluid layui-anim febs-anim" id="febs-goods" lay-title="新增商品"> +<div class="layui-fluid layui-anim febs-anim" id="febs-goods-add" lay-title="新增商品"> <div class="layui-row febs-container"> <div class="layui-col-md12"> - <div class="layui-card"> - <div class="layui-card-body febs-table-full"> +<!-- <div class="layui-card">--> +<!-- <div class="layui-card-body febs-table-full">--> <div class="layui-fluid" id="goods-add"> <form class="layui-form" action="" lay-filter="goods-add-form"> <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> @@ -32,9 +32,10 @@ <div class="layui-col-lg6"> <label class="layui-form-label febs-form-item-require">商品分类:</label> <div class="layui-input-block"> - <select name="categoryId" class="categary-addPeoduct" > - <option value="">请选择</option> - </select> +<!-- <select name="categoryId" class="categary-addPeoduct" >--> +<!-- <option value="">请选择</option>--> +<!-- </select>--> + <div id="goods-category"></div> </div> </div> </div> @@ -141,7 +142,7 @@ <div class="layui-form-item"> <label class="layui-form-label febs-form-item-require">商品详情:</label> <div class="layui-input-block"> - <textarea id="lay_edit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea> + <textarea id="goodsDetailEdit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea> </div> </div> </div> @@ -201,16 +202,16 @@ </div> - <div class="layui-form-item" style="text-align:center"> + <div class="layui-form-item febs-hide"> <button class="layui-btn" lay-submit="" lay-filter="goods-add-form-submit" id="submit">保存</button> - <button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="goods-add-form-cancel" id="cancel">取消</button> +<!-- <button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="goods-add-form-cancel" id="cancel">取消</button>--> </div> </form> </div> </div> - </div> - </div> +<!-- </div>--> +<!-- </div>--> </div> </div> <style> @@ -236,7 +237,7 @@ </script> <!-- 表格操作栏 end --> <script data-th-inline="javascript"> - layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate','layedit','upload', 'element', 'table'], function () { + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { var $ = layui.jquery, febs = layui.febs, layer = layui.layer, @@ -258,6 +259,30 @@ }); formSelects.render(); + + var category = xmSelect.render({ + el: '#goods-category', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/goodsCategory/categoryTree', null, function(res) { + category.update({ + data : res.data, + autoRow: true, + }); + }) var tableSkuData=[]; var tableIns = table.render({ @@ -448,9 +473,7 @@ } }); //创建一个编辑器 - var index = layedit.build('lay_edit',{ - height: 300 - }); + var index = layedit.build('goodsDetailEdit', { height: '300px', }); //提交时把值同步到文本域中 form.verify({ //content富文本域中的lay-verify值 @@ -471,8 +494,9 @@ }); form.on('submit(goods-add-form-submit)', function (data) { - console.log(tableSkuData); + data.field.goodsType = 1; data.field.addMallGoodsSkuDtos = tableSkuData; + data.field.categoryId = category.getValue('valueStr'); $.ajax({ 'url':ctx + 'admin/goods/addMallGoods', 'type':'post', @@ -481,10 +505,10 @@ 'traditional': true,//ajax传递数组必须添加属性 'data':JSON.stringify(data.field), 'success':function (data) { - if(data.code==0){ + if(data.code==200){ + layer.closeAll(); febs.alert.success(data.message); - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); + $('#febs-goods').find('#reset').click(); }else{ febs.alert.warn(data.message); } -- Gitblit v1.9.1