From 17def0dd1f9e64addffcc13824af76fb59d2719f Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Thu, 19 Jun 2025 11:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BE=8E=E7=BA=B9=E7=BA=B8?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=83=AB=E7=94=BB?= =?UTF-8?q?=E5=90=91=E4=B8=8B=E5=8F=96=E5=B9=B6=E5=8A=A0=E4=B8=8A=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E8=B4=B9=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AE=A3=E4=BC=A0?= =?UTF-8?q?=E5=8D=95=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lingtao/net/service/ProductService.java | 15 +++-- .../java/lingtao/net/util/PriceUtils.java | 66 +++++++++---------- src/main/webapp/views/product/flyer.jsp | 4 +- src/main/webapp/views/product/metal.jsp | 4 -- src/main/webapp/views/product/stickers.jsp | 38 +++++++++-- 5 files changed, 72 insertions(+), 55 deletions(-) diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 37b31bd..79e3615 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -2503,7 +2503,7 @@ public class ProductService { if (dto.getCraft() != null && craft_list.size() > 0 && (craft_list.contains("冷转印") || craft_list.contains("烫画"))) { int[] quantitySteps = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000}; double paperLength = 0, paperWidth = 0; - + double chu = 0.6; if (craft_list.contains("冷转印")) { paperLength = 20; @@ -2512,22 +2512,23 @@ public class ProductService { if (craft_list.contains("烫画")) { paperLength = 100; paperWidth = 57; + chu = 1; } if (length == paperLength || length == paperWidth) { } else { - length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(0.6)).doubleValue(); + length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(chu)).doubleValue(); } if (width == paperLength || width == paperWidth) { } else { - width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(0.6)).doubleValue(); + width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(chu)).doubleValue(); } //一张大纸能放几个 double num = Math.max(Math.min(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)), 1); if (craft_list.contains("烫画")) { - num = Math.max(Math.ceil(paperLength / length) * Math.ceil(paperWidth / width), Math.ceil(paperLength / width) * Math.ceil(paperWidth / length)); + num = Math.max(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)); } @@ -2562,9 +2563,9 @@ public class ProductService { priceList.add(pro); } -// for (Product product : priceList) { -// product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5)); -// } + for (Product product : priceList) { + product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5)); + } return priceList; } diff --git a/src/main/java/lingtao/net/util/PriceUtils.java b/src/main/java/lingtao/net/util/PriceUtils.java index f073e35..8844c12 100644 --- a/src/main/java/lingtao/net/util/PriceUtils.java +++ b/src/main/java/lingtao/net/util/PriceUtils.java @@ -387,43 +387,39 @@ public class PriceUtils { // 不干胶常规数量美纹纸价格计算 public List getMeiWenZhiPrice(Double length, Double width, int count, Integer number, String craftMo) { - double l = 420; - double w = 285; - Product pro = new Product(); - List list = new ArrayList(); - // 成本价 元/张 - double danjia = 1.8; - if ("模切".equals(craftMo)) { - danjia = 2.2; - } - // 换成毫米每边+2 - length = length * 10 + 4; - width = width * 10 + 4; - if ((length > l || width > w) && (length > w || width > l)) - return null; - // 一张大纸能做多少个此类尺寸的不干胶 - double max = Math.max(Math.floor(l / length) * Math.floor(w / width), - Math.floor(l / width) * Math.floor(w / length)); - - for (int i = 0; i < countArr.length; i++) { - if (countArr[i] < count || list.size() > 3) { + List priceList = new ArrayList<>(); + int[][] prices = new int[][]{ + {79, 107, 134, 272, 343, 685, 1030, 1374, 1787, 2322, 2748, 3302, 4351}, + {84, 112, 139, 277, 348, 690, 1035, 1379, 1792, 2327, 2753, 3307, 4356}, + {161, 222, 278, 553, 690, 1377, 2065, 2748, 3584, 4653, 5505, 6614, 8712}, + {318, 443, 552, 1101, 1377, 2753, 4119, 5475, 7128, 9108, 10613, 12435, 13068}, + {475, 661, 828, 1652, 2066, 4129, 6178, 8213, 10692, 13662, 15920, 18652, 19602}, + {788, 1099, 1380, 2743, 3430, 6856, 10272, 13613, 17721, 22275, 25542, 29700, 32670}, + {1575, 2188, 2747, 5485, 6859, 13712, 20543, 27225, 35442, 44550, 51084, 59400, 65340}, + {3150, 4355, 5494, 10930, 13662, 27324, 40887, 54054, 69894, 87120, 99000, 114444, 121968}, + }; + int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000, 20000}; + double[] areas = new double[]{26, 37, 49.6, 82, 127, 171, 231, 295, 361, 451, 600.5, 902, 1199}; + double area = length * width; + for (int i = 0; i < count_list.length; i++) { + int count_item = count_list[i]; + if (priceList.size() > 2) { + break; + } + if (count > count_item) { continue; } - pro = new Product(); - // 报的数量需要多少张大纸 - int num = (int) Math.ceil(countArr[i] / max); - pro.setCount(countArr[i]); - pro.setPrice(Math.ceil(num * danjia * 2.5 > 83 ? num * danjia * 2.5 : 83)); - list.add(pro); + int count_index = Arrays.binarySearch(count_list, count_item); + double price = 0; + if (count_index >= 0) { + price = new PriceUtils().TablePrice(area, prices[count_index], areas); + } + Product product = new Product(); + product.setCount(count_item); + product.setPrice(Math.ceil(price * number)); + priceList.add(product); } - - /*if(number > 1) { - for (Product product : list) { - product.setPrice(Math.ceil(product.getPrice() * number)); - } - }*/ - - return list; + return priceList; } /** @@ -3433,7 +3429,7 @@ public class PriceUtils { } } if (startIndex == endIndex) { - price = (price_list[endIndex] / areas[endIndex]) * area; + price = price_list[endIndex]; } else { price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex]; } diff --git a/src/main/webapp/views/product/flyer.jsp b/src/main/webapp/views/product/flyer.jsp index 492ca53..e6800ac 100644 --- a/src/main/webapp/views/product/flyer.jsp +++ b/src/main/webapp/views/product/flyer.jsp @@ -246,8 +246,8 @@ var kind2 = kind2Data[$("#kind2Value").val()]; var number = $("#number").val(); var size = $("#size").val(); - if ((size.split("*")[0] > 140 || size.split("*")[1] > 110) && (size.split("*")[0] > 110 || size.split("*")[1] > 140)) { - layer.msg("宣传单尺寸不能超过140*110 cm", {offset: ['300px', '300px']}, function () { + if ((size.split("*")[0] > 110 || size.split("*")[1] > 110) && (size.split("*")[0] > 110 || size.split("*")[1] > 110)) { + layer.msg("宣传单尺寸不能超过110*110 cm", {offset: ['300px', '300px']}, function () { }); return false; } diff --git a/src/main/webapp/views/product/metal.jsp b/src/main/webapp/views/product/metal.jsp index 3ca3032..f752b8d 100644 --- a/src/main/webapp/views/product/metal.jsp +++ b/src/main/webapp/views/product/metal.jsp @@ -184,10 +184,6 @@ - - - - diff --git a/src/main/webapp/views/product/stickers.jsp b/src/main/webapp/views/product/stickers.jsp index 3151aaf..b1ee941 100644 --- a/src/main/webapp/views/product/stickers.jsp +++ b/src/main/webapp/views/product/stickers.jsp @@ -471,11 +471,11 @@ } } if ($("#kindValue1").val() == "美纹纸" && (stickerKind == '' || stickerKind != '专版打印')) { - if ((size.split("*")[0] > 9 || size.split("*")[1] > 5.4) && (size.split("*")[0] > 5.4 || size.split("*")[1] > 9)) { - $(".meiwenzhiQie").show(); - } else { - $(".meiwenzhiQie").hide(); - } + // if ((size.split("*")[0] > 9 || size.split("*")[1] > 5.4) && (size.split("*")[0] > 5.4 || size.split("*")[1] > 9)) { + // $(".meiwenzhiQie").show(); + // } else { + // $(".meiwenzhiQie").hide(); + // } } }); $("#number").on("input", function (e) { @@ -868,6 +868,21 @@ $(".n_mq").hide(); $('.pf input').prop("checked", false); $('.n_mq input').prop("disabled", true); + let count_html = ` + + + + + + + + + + + + + + `; // A级、PVC、透明 if (data.value == 0 || data.value == 1 || data.value == 2) { $(".tj").show(); @@ -989,9 +1004,17 @@ $(".caiqie").show(); } if (data.value == "美纹纸") { - $(".meiwenzhiQie").show(); + // $(".meiwenzhiQie").show(); + count_html = ` + + + + + + + `; } else { - $(".meiwenzhiQie").hide(); + // $(".meiwenzhiQie").hide(); // 切换按钮工艺恢复 $("#craftForm")[0].reset(); } @@ -1024,6 +1047,7 @@ $(".n_mq").hide(); $('.n_mq input').prop("disabled", true); } + $("#ui_normal #count").empty().append(count_html); form.render();//必须写 var content = getContent(kindvalue);