Parcourir la source

新增手提袋烫金

zhuyiyi il y a 2 mois
Parent
commit
b0f83939d6

+ 13 - 2
src/main/java/lingtao/net/service/ProductService.java

@@ -1983,6 +1983,7 @@ public class ProductService {
             // 牛皮纸手提袋
             case "11":
                 List<Product> hanbagList = new ArrayList<Product>();
+                craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
                 // 没有尺寸,就是常规,查询数据库
                 if (StringUtils.isEmpty(size) && !dto.getK().equals("4")) {
                     // 各常规尺寸展开的长宽--用于计算重量
@@ -2097,9 +2098,11 @@ public class ProductService {
 
                         return priceList;
                     }
+                    double sizeLength = 0.0;
+                    double sizeWidth = 0.0;
                     // 厘米转成毫米
-                    length = length * 10;
-                    width = width * 10;
+                    sizeLength = length = length * 10;
+                    sizeWidth = width = width * 10;
                     height = height * 10;
                     length = (length + width) * 2 + 20;
                     height = (height + (width / 2 + 20)) + 40;
@@ -2163,6 +2166,14 @@ public class ProductService {
                         }
                     } else {
                         for (Product product : priceList) {
+                            double craft_price = 0.0;
+                            if (craft_list.contains("烫金")) {
+                                craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number), 200);
+                            }
+                            if (craft_list.contains("双面")) {
+                                craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number * 2), 200);
+                            }
+                            product.setPrice(Math.ceil(product.getPrice() + craft_price));
                             product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25));
                         }
                     }

+ 38 - 4
src/main/webapp/views/product/handBag.jsp

@@ -26,7 +26,7 @@
         <form class="layui-form">
             <div class="layui-input-block">
                 <input type="radio" name="k" class="k" lay-filter="k" value="0" title="常规牛皮纸">
-                <input type="radio" name="k" class="k" lay-filter="k" value="1" title="自定义尺寸">
+                <input type="radio" name="k" class="k" lay-filter="k" value="1" title="白卡纸手提袋">
                 <input type="radio" name="k" class="k" lay-filter="k" value="2" title="礼品袋 / 福袋">
                 <!-- <input type="radio" name="k" class="k" lay-filter="k" value="3" title="特价白卡手提袋"> -->
                 <input type="radio" name="k" class="k" lay-filter="k" value="4" title="牛皮纸手提袋">
@@ -74,7 +74,7 @@
                 <div class="layui-form-item npzd count">
                     <select name="count" class="select countCG" id="npzd_count">
                         <option value=""></option>
-<%--                        <option value="100">100</option>--%>
+                        <%--                        <option value="100">100</option>--%>
                         <option value="500">500</option>
                         <option value="1000">1000</option>
                         <option value="2000">2000</option>
@@ -123,6 +123,16 @@
                 <input type="text" placeholder="请输入客户旺旺号" autocomplete="off" name="wangwang" id="wangwang"
                        class="layui-input">
             </div>
+            <div id="craft_layout" style="display: none">
+                <p>工艺</p>
+                <input type="checkbox" name="craft" lay-filter="craft" value="烫金" title="烫金"/>
+                <div id="tang_type" class="layui-inline" style="display: none;width: 200px">
+                    <select name="craft" class="select" disabled>
+                        <option value="单面">单面</option>
+                        <option value="双面">双面</option>
+                    </select>
+                </div>
+            </div>
             <hr>
             <div class="layui-form-item">
                 <button class="layui-btn" lay-submit="" lay-filter="acount_btn" id="queryCondBtn">计算</button>
@@ -240,6 +250,15 @@
                     $("#price").val(expressPrice)
                 }
             });
+            form.on("checkbox(craft)", function (data) {
+                $("#tang_type").hide();
+                $("#tang_type select").prop("disabled", true);
+                if (data.value == "烫金" && data.elem.checked) {
+                    $("#tang_type").show();
+                    $("#tang_type select").prop("disabled", false);
+                }
+                form.render();
+            })
             form.on("select(expressFee)", function (selectedData) {
                 // 获取选中下拉框的价格(格式:首重,续重)
                 price = selectedData.value
@@ -352,7 +371,7 @@
             let spec = $("#spec").val();
             let kindValue = $(".npzd select[name='kindValue']").val();
             let count_html = `<option value=""></option>`;
-            if (spec <= 10  && kindValue == 0) {
+            if (spec <= 10 && kindValue == 0) {
                 // count_html +=
                 //     `<option value="100">100</option>`;
             }
@@ -439,9 +458,12 @@
                     }
                 }
             });
-
+            $("#tang_type").hide();
+            $("#tang_type select").prop("disabled", true);
             $("#bagForm")[0].reset();
             var level = data.value;//被点击的radio的value值
+            $("#craft_layout").hide();
+            $("#craft_layout").find(":input").attr("disabled", true);
             if (level == 0) {
                 $(".cg").show();
                 $(".zdy").hide();
@@ -462,6 +484,8 @@
                 $(".tj").find(":input").attr("disabled", true);
                 $(".dz").find(":input").attr("disabled", true);
                 $(".npzd").find(":input").attr("disabled", true);
+                $("#craft_layout").show();
+                $("#craft_layout").find(":input").attr("disabled", false);
             } else if (level == 2) {
                 $(".cg").hide();
                 $(".tj").hide();
@@ -568,6 +592,14 @@
                             layer.msg(result.msg, {offset: ['300px', '300px']}, {icon: 5, time: 1000});
                             return false;
                         }
+                        let arr = [];
+                        $("input:checkbox[name='craft']:checked").each(function (i) {
+                            if (!$(this).is(':disabled')) {
+                                if ($(this).val() == "烫金") {
+                                    arr.push($("#tang_type select option:selected").val() + $(this).val());
+                                }
+                            }
+                        });
                         var data = result.data.proList;
                         var number = $("#number").val();
                         if (level == 0) {
@@ -586,6 +618,7 @@
 
                             // textarea
                             var span_result = "手提袋- " + kind + ' - ' + kind2 + '\n';
+                            span_result += "工艺:" + arr.join(",") + '\n';
                             if (number > 1) {
                                 for (let i = 0; i < data.length; i++) {
                                     span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + '\n'
@@ -636,6 +669,7 @@
                             var count = $(".countZDY").val();
                             // textarea
                             var span_result = "手提袋--" + kind + '--' + size + 'CM\n';
+                            span_result += "工艺:" + arr.join(",") + '\n';
                             if (number > 1) {
                                 for (let i = 0; i < data.length; i++) {
                                     span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + '\n'

+ 0 - 1
src/main/webapp/views/product/specialCard2.jsp

@@ -216,7 +216,6 @@
                 <select name="maxian" class="select">
                     <option value="1" selected>1</option>
                     <option value="2">2</option>
-                    <option value="3">3</option>
                 </select>
             </div>
             <!--<input type="checkbox" name="craft" lay-filter="switch" value="烫金/" title="烫金" class="hasCraft ui_ls_craft">