From 8d120580505ba97dd9c7bdef9122bf80559a558d Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 09 Feb 2023 18:09:15 +0800
Subject: [PATCH] 后台商品匹配运费模板 规格增加重量

---
 src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html |   67 +++++++++++++++++++++++++++++----
 1 files changed, 59 insertions(+), 8 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 5208f25..7c7b589 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -52,6 +52,12 @@
                                                     <input type="text" name="unit"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                                 </div>
                                             </div>
+                                            <div class="layui-col-lg6">
+                                                <label class="layui-form-label febs-form-item-require">重量:</label>
+                                                <div class="layui-input-block">
+                                                    <input type="text" name="goodsWeight"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
+                                                </div>
+                                            </div>
                                         </div>
                                         <div class="layui-form-item">
                                             <div class="layui-col-lg6">
@@ -190,19 +196,31 @@
                                                 <input type="text" name="costPrice" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                             </div>
                                         </div>
-
+                                        <blockquote class="layui-elem-quote blue-border">运费设置</blockquote>
                                         <div class="layui-form-item">
-                                            <label class="layui-form-label">设置运费:</label>
+                                            <label class="layui-form-label">运费:</label>
                                             <div class="layui-input-block">
-                                                <input type="radio" name="hasCarriage" value="1" title="开启" lay-filter="hasCarriage" />
-                                                <input type="radio" name="hasCarriage" value="2" title="关闭" lay-filter="hasCarriage" checked />
+                                                <input type="radio" name="carriageType" value="1" title="固定运费" lay-filter="hasCarriage" />
+                                                <input type="radio" name="carriageType" value="2" title="使用邮费模板" lay-filter="hasCarriage" checked/>
                                             </div>
                                         </div>
 
-                                        <div class="layui-form-item carriage-input febs-hide">
-                                            <label class="layui-form-label">运费:</label>
-                                            <div class="layui-input-block">
-                                                <input type="text" name="carriage" placeholder="" autocomplete="off" class="layui-input">
+                                        <div class="layui-form-item carriage-input  febs-hide">
+                                            <div class="layui-col-lg6">
+                                                <label class="layui-form-label">固定运费:</label>
+                                                <div class="layui-input-block">
+                                                    <input id="carriageAmountDefault" type="text" name="carriageAmount" placeholder="" autocomplete="off" class="layui-input">
+                                                    <div class="layui-form-mid layui-word-aux">远费设置为0元,前台商品将显示为免运费。</div>
+                                                </div>
+                                            </div>
+                                        </div>
+
+                                        <div class="layui-form-item carriage-rule">
+                                            <div class="layui-col-lg6">
+                                                <label class="layui-form-label febs-form-item-require">邮费模板:</label>
+                                                <div class="layui-input-block">
+                                                    <div id="carriage-rule"></div>
+                                                </div>
                                             </div>
                                         </div>
 
@@ -352,6 +370,33 @@
             });
         })
 
+        var carriageRule = xmSelect.render({
+            el: '#carriage-rule',
+            language: 'zn',
+            prop : {
+                value : 'id',
+                children : 'child'
+            },
+            iconfont: {
+                parent: 'hidden',
+            },
+            radio: true,
+            clickClose: true,
+            tree: {
+                show: true,
+                //非严格模式
+                strict: false,
+            },
+            data: []
+        })
+
+        febs.get(ctx + 'admin/goods/carriageRuleTree', null, function(res) {
+            carriageRule.update({
+                data : res.data,
+                autoRow: true,
+            });
+        })
+
         var tableSkuData=[];
         var tableIns = table.render({
             elem: '#multiSku'
@@ -363,6 +408,7 @@
                 ,{field: 'index', title: '序号', width:70}
                 ,{field: 'styleName', title: '样式', edit:'text'}
                 ,{field: 'skuName', title: '规格', edit:'text'}
+                ,{field: 'goodsWeight', title: '重量', edit:'text'}
                 ,{field: 'presentPrice', title: '现价', edit:'text'}
                 ,{field: 'originalPrice', title: '原价', edit:'text'}
                 ,{field: 'costPrice', title: '成本价', edit:'text'}
@@ -416,8 +462,12 @@
         form.on('radio(hasCarriage)', function(data){
             if (data.value == 2) {
                 $('.carriage-input').hide();
+                $('.carriage-rule').show();
+                // document.getElementById('carriageAmountDefault').value = 0;
             } else {
                 $('.carriage-input').show();
+                $('.carriage-rule').hide();
+                // document.getElementById('carriageAmountDefault').value = 0;
             }
         });
 
@@ -597,6 +647,7 @@
             data.field.goodsType = 1;
             data.field.addMallGoodsSkuDtos = tableSkuData;
             data.field.categoryId = category.getValue('valueStr');
+            data.field.carriageRuleId = carriageRule.getValue('valueStr');
             data.field.goodsDetails = editor.getHtml();
             $.ajax({
                 'url':ctx + 'admin/goods/addMallGoods',

--
Gitblit v1.9.1