From 0ef2ea54b85d11f537a761e2028a40ec1ec1df1b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 13 Feb 2023 15:55:31 +0800
Subject: [PATCH] 订单发货设置

---
 src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html |  122 ++++++++++++++++++++++++++++++++++------
 1 files changed, 102 insertions(+), 20 deletions(-)

diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
index d91bcd3..393bbf6 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -57,6 +57,12 @@
                                                            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">
@@ -216,18 +222,31 @@
                                             </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>
 
@@ -250,10 +269,16 @@
                                                                class="layui-input" id="attrName">
                                                     </div>
                                                 </div>
-                                                <div class="layui-col-lg6">
+                                                <div class="layui-col-lg3">
                                                     <button type="button"
                                                             class="layui-btn layui-btn-normal layui-btn" id="test3">
                                                         添加
+                                                    </button>
+                                                </div>
+                                                <div class="layui-col-lg3">
+                                                    <button type="button"
+                                                            class="layui-btn layui-btn-normal layui-btn" id="test4">
+                                                        新增样品
                                                     </button>
                                                 </div>
                                             </div>
@@ -380,6 +405,35 @@
                 autoRow: true,
             });
 
+            // initValue();
+        })
+
+        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,
+            });
+
             initValue();
         })
 
@@ -391,18 +445,20 @@
             , defaultToolbar: []
             , cols: [[ //表头
                 {type: 'checkbox'}
-                , {field: 'index', title: '序号', width: 70}
-                , {field: 'styleName', title: '样式', edit: 'text'}
-                , {field: 'skuName', title: '规格', edit: 'text'}
-                , {field: 'presentPrice', title: '现价', edit: 'text'}
-                , {field: 'originalPrice', title: '原价', edit: 'text'}
-                , {field: 'costPrice', title: '成本价', edit: 'text'}
-                , {templet: '#tableImgUpload', title: '缩略图', width: 150}
-                , {field: 'stock', title: '库存', edit: 'text'}
-                , {field: 'skuVolume', title: '销量', edit: 'text'}
-                , {field: 'skuImage', title: '缩略图地址', hide: true}
-                , {field: 'id', title: 'skuId', hide: true}
-                , {field: 'styleId', title: 'styleId', hide: true}
+                ,{field: 'index', title: '序号', width: 70}
+                ,{field: 'styleName', title: '样式', edit:'text', width:200}
+                ,{field: 'skuName', title: '规格', edit:'text', width:200}
+                ,{field: 'sample', title:'样品', width:100}
+                ,{field: 'goodsWeight', title: '重量', edit:'text', width:100}
+                ,{field: 'presentPrice', title: '现价', edit:'text', width:100}
+                ,{field: 'originalPrice', title: '原价', edit:'text', width:100}
+                ,{field: 'costPrice', title: '成本价', edit:'text', width:100}
+                ,{templet: '#tableImgUpload', title: '缩略图', width:150}
+                ,{field: 'stock', title: '库存', edit:'text', width:100}
+                ,{field: 'skuVolume', title: '销量', edit:'text', width:100}
+                ,{field: 'skuImage', title: '缩略图地址', hide: true}
+                ,{field: 'id', title: 'skuId', hide: true}
+                ,{field: 'styleId', title: 'styleId', hide: true}
             ]]
             , data: []
         });
@@ -455,8 +511,11 @@
         form.on('radio(hasCarriage)', function(data){
             if (data.value == 2) {
                 $('.carriage-input').hide();
+                $('.carriage-rule').show();
             } else {
                 $('.carriage-input').show();
+                $('.carriage-rule').hide();
+                document.getElementById('carriageAmountDefault').value = 0;
             }
         });
 
@@ -505,6 +564,12 @@
 
             var data = {};
             data.styleName = attrNameVal;
+            addTableDate(data);
+        });
+
+        $('#test4').on('click', function () {
+            var data = {};
+            data.sample = "样品";
             addTableDate(data);
         });
 
@@ -652,6 +717,9 @@
                 "costPrice": goodsInfo.costPrice,
                 "isSku": goodsInfo.isSku,
                 "thumb": goodsInfo.thumb,
+                "carriageType": goodsInfo.carriageType,
+                "carriageAmount": goodsInfo.carriageAmount,
+                "goodsWeight": goodsInfo.goodsWeight,
                 "thumbs": thumbs
             });
 
@@ -659,8 +727,21 @@
             arr.push(goodsInfo.categoryId)
             category.setValue(arr);
 
+            var arrCarriageRule = [];
+            arrCarriageRule.push(goodsInfo.carriageRuleId)
+            carriageRule.setValue(arrCarriageRule);
+
             if (goodsInfo.isNormal == 2) {
                 $(".tc-set").show();
+            }
+
+            if (goodsInfo.carriageType == 2) {
+                $('.carriage-input').hide();
+                $('.carriage-rule').show();
+            } else {
+                $('.carriage-input').show();
+                $('.carriage-rule').hide();
+                document.getElementById('carriageAmountDefault').value = goodsInfo.carriageAmount;
             }
 
             if (goodsInfo.isSku == 1) {
@@ -706,6 +787,7 @@
             data.field.mailGoodsSkuDto = tableSkuData;
             data.field.delSkuId=delSku;
             data.field.categoryId = category.getValue('valueStr');
+            data.field.carriageRuleId = carriageRule.getValue('valueStr');
             data.field.goodsDetails = editor.getHtml();
             $.ajax({
                 'url': ctx + 'admin/goods/updateMallGoods',

--
Gitblit v1.9.1