From 9b51a95fa8bc9b3a86108c6900e17fc55f8db467 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 19 May 2025 17:02:07 +0800
Subject: [PATCH] refactor(vip): 优化积分和返佣计算逻辑

---
 src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html |  107 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 78 insertions(+), 29 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 e85810a..36a817c 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -103,21 +103,22 @@
                                             </div>
                                         </div>
 
-                                        <div class="layui-form-item febs-hide tc-set">
-                                            <label class="layui-form-label">静态倍数</label>
-                                            <div class="layui-input-block">
-                                                <input type="text" name="staticMulti" placeholder="请输入静态倍数" autocomplete="off" class="layui-input">
-                                                <div class="layui-form-mid layui-word-aux">支付后,赠送(购买金额*静态倍数)的赠送积分</div>
-                                            </div>
-                                        </div>
+<!--                                        <div class="layui-form-item">-->
+<!--                                            <label class="layui-form-label">推销员返积分比例(%)</label>-->
+<!--                                            <div class="layui-input-block">-->
+<!--                                                <input type="text" name="staticMulti" placeholder="请输入推销员返积分比例" autocomplete="off" class="layui-input">-->
+<!--                                            </div>-->
+<!--                                        </div>-->
 
-                                        <div class="layui-form-item febs-hide tc-set">
-                                            <label class="layui-form-label">静态占比(%)</label>
-                                            <div class="layui-input-block">
-                                                <input type="text" name="staticProp" placeholder="请输入静态占比" autocomplete="off" class="layui-input">
-                                                <div class="layui-form-mid layui-word-aux">所有套餐静态占比相加应等于100%</div>
-                                            </div>
-                                        </div>
+<!--                                        <div class="layui-form-item febs-hide tc-set">-->
+<!--                                            <label class="layui-form-label">积分折扣(%)</label>-->
+<!--                                            <div class="layui-input-block">-->
+<!--                                                <input type="text" name="staticProp" placeholder="请输入积分折扣" autocomplete="off" class="layui-input">-->
+<!--                                                <div class="layui-form-mid layui-word-aux">折扣积分=售价*积分折扣(%)*积分换算比例</div>-->
+<!--                                                <div class="layui-form-mid layui-word-aux">不允许使用积分设置成:0%</div>-->
+<!--                                                <div class="layui-form-mid layui-word-aux">全部使用积分设置成:大于等于100%</div>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
                                     </div>
 
                                     <div class="layui-tab-item">
@@ -170,14 +171,25 @@
                                             </div>
                                         </div>
 
+<!--                                        <div class="layui-form-item">-->
+<!--                                            <label class="layui-form-label febs-form-item-require">商品详情:</label>-->
+<!--                                            <div class="layui-input-block">-->
+<!--                                                <textarea id="goodsDetailEditAdd" lay-verify="content" name = "goodsDetails" class="layui-textarea"></textarea>-->
+<!--&lt;!&ndash;                                                <div style="border: 1px solid #ccc;">&ndash;&gt;-->
+<!--&lt;!&ndash;                                                    <div id="toolbar-container-good-add" style="border-bottom: 1px solid #ccc;"></div>&ndash;&gt;-->
+<!--&lt;!&ndash;                                                    <div id="editor-container-good-add" style="height: 450px;"></div>&ndash;&gt;-->
+<!--&lt;!&ndash;                                                </div>&ndash;&gt;-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+
                                         <div class="layui-form-item">
                                             <label class="layui-form-label febs-form-item-require">商品详情:</label>
                                             <div class="layui-input-block">
-                                                <textarea id="goodsDetailEditAdd" lay-verify="content" name = "goodsDetails" class="layui-textarea"></textarea>
-<!--                                                <div style="border: 1px solid #ccc;">-->
-<!--                                                    <div id="toolbar-container-good-add" style="border-bottom: 1px solid #ccc;"></div>-->
-<!--                                                    <div id="editor-container-good-add" style="height: 450px;"></div>-->
-<!--                                                </div>-->
+<!--                                                <textarea id="goodsDetailEditAdd" lay-verify="content" name = "goodsDetails" class="layui-textarea"></textarea>-->
+                                                <div style="border: 1px solid #ccc;">
+                                                    <div id="toolbar-container" class="toolbar"></div>
+                                                    <div id="text-container" class="text" style="height: 450px;"></div>
+                                                </div>
                                             </div>
                                         </div>
                                     </div>
@@ -228,6 +240,16 @@
                                                     <input type="text" name="costPrice" 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="staticProp" lay-verify="required" placeholder="请输入积分折扣" lay-reqText="请输入积分折扣" autocomplete="off" class="layui-input">
+                                                    <div class="layui-form-mid layui-word-aux">折扣积分=原价 * 积分折扣(%)* 积分换算比例</div>
+                                                    <div class="layui-form-mid layui-word-aux">不允许使用积分设置成:0%</div>
+                                                    <div class="layui-form-mid layui-word-aux">全部使用积分设置成:大于等于100%</div>
+                                                </div>
+                                            </div>
+
                                         </div>
                                         <blockquote class="layui-elem-quote blue-border">运费设置</blockquote>
                                         <div class="layui-form-item">
@@ -364,8 +386,34 @@
             upload = layui.upload,
             validate = layui.validate,
             element = layui.element;
-
+        // form.verify(validate);
         form.render();
+        const E = window.wangEditor;
+        const editor = new E('#toolbar-container', '#text-container'); // 传入两个元素
+        editor.config.showLinkImg = false;
+        editor.config.uploadFileName = 'file';
+        editor.config.customUploadImg = function (files, insertImgFn) {
+            // files 是 input 中选中的文件列表
+            // insertImgFn 是获取图片 url 后,插入到编辑器的方法
+            // 上传图片,返回结果,将图片插入到编辑器中
+            for (let i = 0; i < files.length; i++){
+                var form = new FormData();
+                form.append("file", files[0]);
+                $.ajax({
+                    url:'/admin/goods/uploadFileBase64',
+                    type: "post",
+                    processData: false,
+                    contentType: false,
+                    data: form,
+                    dataType: 'json',
+                    success(res) {
+                        // 上传代码返回结果之后,将图片插入到编辑器中
+                        insertImgFn(res.data.src, res.data.title, '')
+                    }
+                })
+            }
+        };
+        editor.create();
 
         // var E = window.wangEditor;
         // const editorConfig = { MENU_CONF: {} };
@@ -766,6 +814,7 @@
             // let content = layedit.getContent();
             // alert(content);
             // data.field.goodsDetails = content;
+            data.field.goodsDetails = editor.txt.html();
             $.ajax({
                 'url':ctx + 'admin/goods/addMallGoods',
                 'type':'post',
@@ -789,14 +838,14 @@
             return false;
         });
 
-        form.on('select(goods-type-select)', function(data){
-            $('.tc-set').each(function() {
-                if (data.value == 2) {
-                    $(this).show();
-                } else {
-                    $(this).hide();
-                }
-            })
-        });
+        // form.on('select(goods-type-select)', function(data){
+        //     $('.tc-set').each(function() {
+        //         if (data.value == 2) {
+        //             $(this).show();
+        //         } else {
+        //             $(this).hide();
+        //         }
+        //     })
+        // });
     });
 </script>
\ No newline at end of file

--
Gitblit v1.9.1