Ver Fonte

新增冰箱贴背卡工艺

zhuyiyi há 1 mês atrás
pai
commit
23465fcf3b

+ 66 - 3
src/main/java/lingtao/net/service/ProductService.java

@@ -4747,7 +4747,7 @@ public class ProductService {
             case "金属微章":
                 return getbadgePrice(dto, width, length);
             case "冰箱贴":
-                return getfridgePrice(dto, width, length);
+                return getfridgePrice(dto, width, length, role);
             case "帆布袋":
                 return getCanvasBagPrice(dto, width, length);
             case "外卖盒":
@@ -5130,7 +5130,7 @@ public class ProductService {
         return priceList;
     }
 
-    private List<Product> getfridgePrice(Product dto, Double width, Double length) {
+    private List<Product> getfridgePrice(Product dto, Double width, Double length, String role) {
         List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
         List<Product> priceList = new ArrayList<>();
         String cailiao = dto.getCailiao();
@@ -5152,11 +5152,74 @@ public class ProductService {
             last_price = 1100;
         }
         double price = PriceUtils.TableUnitPrice(area, prices, areas, last_price);
+        double card_price = 0;
+        if (carft_list.contains("背卡")) {
+            String card_size = dto.getSize1();
+            int card_count = dto.getShuliang();
+            int card_number = dto.getPinzhong();
+            double card_width = Double.parseDouble(card_size.split("\\*")[0]);
+            double card_length = Double.parseDouble(card_size.split("\\*")[1]);
+            // 出血(一边2毫米)
+            card_length = card_length * 10 + 4;
+            card_width = card_width * 10 + 4;
+            double fixPrice = 30.0;
+
+            double zhang = 6;
+            if (carft_list.contains("背卡异形模切")) {
+                fixPrice = 32.0;
+                zhang = 8;
+            }
+
+            double l = 420;
+            double w = 285;
+            double designFee = 0;
+            if ((card_length - 4 <= 90 && card_width - 4 <= 54) || (card_length - 4 <= 54 && card_width - 4 <= 90)) {
+                designFee = 8;
+            } else if ((card_length - 4 <= 210 && card_width - 4 <= 140) || (card_length - 4 <= 140 && card_width - 4 <= 210)) {
+                designFee = 15;
+            } else if ((card_length - 4 <= 285 && card_width - 4 - 4 <= 210) || (card_length - 4 <= 210 && card_width - 4 <= 285)) {
+                designFee = 35;
+            } else if ((card_length - 4 <= 420 && card_width - 4 <= 285) || (card_length - 4 <= 285 && card_width - 4 <= 420)) {
+                designFee = 50;
+            } else {
+                designFee = 80;
+            }
+            double max = 1;
+            if (card_length == 424 || card_length == 289 || card_width == 424 || card_width == 289) {
+                max = Math.max(Math.floor(l / (card_length - 4)) * Math.floor(w / (card_width - 4)), Math.floor(l / (card_width - 4)) * Math.floor(w / (card_length - 4)));
+            } else {
+                max = Math.max(Math.floor(l / card_length) * Math.floor(w / card_width), Math.floor(l / card_width) * Math.floor(w / card_length));
+            }
+            max = Math.max(max, 1);
+            // 报的数量需要多少张大纸
+            // 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
+            int num = (int) Math.ceil(card_count * card_number / max);
+            card_price = fixPrice + (num - 1) * zhang + designFee + 0.2 * card_number * card_count;
+            if (((card_width > 42 && card_length > 28.5) || (card_width > 28.5 && card_length > 42))) {
+                card_price = Math.max(Math.ceil(card_price * 0.85), fixPrice + designFee);
+            }
+            double desFee = 0;
+            if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) {
+                if (card_number > 1) {
+                    desFee = 5.5 * (card_number - 1);
+
+                }
+            } else {
+                //第二款开始的设计费按照式设计内容
+                if (card_number > 1) {
+                    desFee = 5.5;
+                }
+            }
+            card_price += desFee;
+
+        }
+
+
         Product pro = new Product();
         pro.setCount(dto.getCount());
         pro.setNumber(dto.getNumber());
         pro.setWeight(df.format(width * length * 4.17 * dto.getCount() * 0.1 / 1000 * Double.parseDouble(cailiao)));
-        pro.setPrice(Math.ceil(Math.max(price, min_price) + ((dto.getNumber() - 1) * 8)));
+        pro.setPrice(Math.ceil(Math.max(price, min_price) + ((dto.getNumber() - 1) * 8) + card_price));
         priceList.add(pro);
 
         return priceList;

+ 2 - 0
src/main/webapp/views/product/aromatherapyCard.jsp

@@ -116,6 +116,8 @@
 
                 <div class="layui-input-block">
                     配件:
+                    <input type="checkbox" class="peijian" name="craft" lay-filter="peijian" value="别针"
+                           title="别针">
                     <input type="checkbox" class="peijian" name="craft" lay-filter="peijian" value="配涤纶丝带"
                            title="配涤纶丝带">
                     <input type="checkbox" class="peijian" name="craft" lay-filter="peijian" value="配吊牌绳"

+ 1 - 1
src/main/webapp/views/product/coupon.jsp

@@ -736,7 +736,7 @@
                         <input type="radio" name="ui_sdk_craft" value="丝带" title="丝带" lay-filter="ui_sdk_craft">
                         <br/>
                         <span class="ui_sd" style="display: none;margin-left:180px;">
-								<input type="radio" name="sd" value="蓝色" title="蓝色" checked="checked">
+								<input type="radio" name="sd" value="绿色" title="绿色" checked="checked">
 								<input type="radio" name="sd" value="红色" title="红色">
 							</span>
                     </div>

+ 75 - 2
src/main/webapp/views/product/fridgeMagnet.jsp

@@ -77,6 +77,35 @@
                     <input type="checkbox" name="craft" lay-filter="ui_craft" value="激光" title="激光" checked>
                     <input type="checkbox" name="craft" lay-filter="ui_craft" value="CNC" title="CNC">
                 </div>
+                <div class="layui-input-block">
+                    背纸工艺:
+                    <input type="checkbox" name="craft" lay-filter="ui_craft" value="背卡" title="背卡">
+                </div>
+                <div class="layui-input-block beika" style="display: none">
+                    背纸尺寸:
+                    <span class="layui-inline" style="width: 200px;">
+                        <input name="size1" id="size1" type="text" class="layui-input" disabled/>
+                    </span>
+                    <span style="font-size: 14px; color: red">默认300克铜版纸</span>
+                </div>
+                <div class="layui-input-block beika" style="display: none">
+                    背纸数量:
+                    <span class="layui-inline" style="width: 200px;">
+                        <input name="shuliang" id="shuliang" type="text" class="layui-input" disabled/>
+                    </span>
+                </div>
+                <div class="layui-input-block beika" style="display: none">
+                    背纸款数:
+                    <span class="layui-inline" style="width: 200px;">
+                        <input name="pinzhong" id="pinzhong" type="text" class="layui-input" value="1" disabled/>
+                    </span>
+                </div>
+                <div class="layui-input-block beika" style="display: none">
+                    背纸裁切工艺:
+                    <input type="checkbox" name="craft" lay-filter="ui_craft" value="背卡直角裁切" title="直角裁切" checked
+                           disabled>
+                    <input type="checkbox" name="craft" lay-filter="ui_craft" value="背卡异形模切" title="异形模切" disabled>
+                </div>
             </div>
             <hr>
             <div class="layui-form-item">
@@ -113,12 +142,18 @@
         var carousel = layui.carousel;
         var table = layui.table;
 
-
+        $("#number").on("input", function (data) {
+            $("#pinzhong").val($(this).val())
+        })
+        $("#count").on("input", function (data) {
+            $("#shuliang").val($(this).val())
+        })
         //建造实例
         ins = carousel.render({});
         var html = " ";
         var remark = " ";
         const carft_list1 = ["激光", "CNC"];
+        const carft_list2 = ["背卡直角裁切", "背卡异形模切"];
 
         // 清空轮播图
         $("#carousel").empty();
@@ -181,6 +216,23 @@
                 form.render();
                 return false;
             }
+            const carft2 = carft_list2.filter(craft => craft_list.includes(craft));
+            if (carft2.length > 1) {
+                $(data.elem).prop("checked", false);
+                layer.msg("背卡裁切工艺不能同时选择", {offset: ['300px', '300px']}, function () {
+                });
+                form.render();
+                return false;
+            }
+            if (data.value == "背卡") {
+                $(".beika").hide();
+                $(".beika").find("input").prop("disabled", true)
+                if (data.elem.checked) {
+                    $(".beika").show();
+                    $(".beika").find("input").prop("disabled", false)
+                }
+            }
+            form.render();
         })
 
         // 点击计算,计算价格
@@ -189,6 +241,9 @@
             var size = $("#size").val();
             var count = $("#count").val();
             var kind = $("select[name='kind'] option:selected").text();
+            let size1 = $("#size1").val();
+            let shuliang = $("#shuliang").val();
+            let pinzhong = $("#pinzhong").val();
             var craft = [];
             if (size == "") {
                 layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () {
@@ -209,7 +264,14 @@
             $("input:checkbox[name='craft']:checked").each(function (i) {
                 // 没有被禁用的工艺加到arr中
                 if (!$(this).is(':disabled')) {
-                    craft.push($(this).val());
+                    if ($(this).val() == "背卡直角裁切" || $(this).val() == "背卡异形模切") {
+                        craft.push($(this).val().replace("背卡", ""));
+                    } else {
+                        craft.push($(this).val());
+                    }
+                    if ($(this).val() == "背卡") {
+                        craft.push(size1 + "CM背卡数量" + shuliang + "款数" + pinzhong)
+                    }
                 }
             });
             if (!craft.includes("单面")) {
@@ -224,6 +286,17 @@
                 return false;
             }
             craft = craft.filter(item => item != "单面")
+
+            if (craft.includes("背卡") && size1 == "") {
+                layer.msg("请填写背卡尺寸", {offset: ['300px', '300px']}, function () {
+                });
+                return false;
+            }
+            if (craft.includes("背卡") && (size1.split("*")[0] > 42 || size1.split("*")[1] > 28.5) && (size1.split("*")[1] > 42 || size1.split("*")[0] > 28.5)) {
+                layer.msg('最大尺寸42*28.5cm!', {offset: ['300px', '300px']}, function () {
+                });
+                return false;
+            }
             $.ajax({
                 url: "${path}/getThanSum",
                 type: "GET",

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

@@ -622,12 +622,7 @@
             if (kindValueSelect == '素芸') {
                 size = $("input[name='size']").val();
             }
-            $("input[name='craft']:checked").each(function () {
-                    if (!$(this).is(':disabled')) {
-                        craft_list.push($(this).val());
-                    }
-                }
-            );
+
             let craft_list = [];
             $("input[name='craft']:checked").each(function () {
                     if (!$(this).is(':disabled')) {

+ 2 - 2
src/main/webapp/views/product/wristBand.jsp

@@ -35,7 +35,7 @@
             <div class="layui-form-item" id="ui_size">
                 <select name="size" id="size" class="layui-form-select">
                     <option value="19*200">19*200MM</option>
-                    <option value="25*250">25*250MM</option>
+                    <option value="19*250">19*250MM</option>
                 </select>
             </div>
             <p>
@@ -199,7 +199,7 @@
         })
         form.on('select(kind)', function (data) {
             let html = `<option value="19*200">19*200MM</option>
-                        <option value="25*250">25*250MM</option>
+                        <option value="19*250">19*250MM</option>
                         `;
             if (data.value == "2") {
                 html = `<option value="19*200">19*200MM</option>