diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 13459bb..b302c61 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -3009,6 +3009,11 @@ public class ProductService { */ } } + if ("直角卡片".equals(dto.getKind()) && ((width > 42 && length > 28.5) || (width > 28.5 && length > 42))) { + for (Product product : priceList) { + product.setPrice(Math.max(Math.ceil(product.getPrice() * 0.85), fixPrice + designFee)); + } + } if ("1".equals(dto.getKindValue())) { // 给产品加上重量 扣除出血的4毫米 for (Product product : priceList) { @@ -4747,12 +4752,108 @@ public class ProductService { return getTakeoutBoxPrice(dto, width, length); case "方巾纸": return getHandkerPrice(dto, width, length); + case "鼠标垫": + return getMousePadPrice(dto, width, length); default: break; } return null; } + private List getMousePadPrice(Product dto, Double width, Double length) { + List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + int count = dto.getCount(); + int number = dto.getNumber(); + double miniPrice = 55; + double rate = 1; + + String kind = dto.getKind(); + int[] counts = {5, 10, 20, 30, 50, 100, 200}; + double[] areas = {100, 400, 900, 1600, 2500, 3600, 4900, 6400, 8100, 10000, 20000, 30000, 45000}; + double[][] prices = { + {10, 10, 10, 16, 24, 35, 47, 61, 70, 90, 180, 280, 400}, + {4.7, 5, 8.75, 15, 23, 32, 44, 57.5, 71, 89, 175, 260, 350}, + {2.35, 3.7, 7.8, 13, 21, 29, 40, 52, 65, 81, 160, 240, 340}, + {1.5, 3.2, 6.8, 11, 18, 26, 35, 46, 55, 71, 142, 212, 317}, + {0.8, 2.8, 6.06, 10.5, 16, 23, 31, 40, 50, 60, 126, 188, 280}, + {0.7, 2.5, 5.44, 9.5, 14, 20, 28.3, 36.8, 46, 58, 113, 169, 254}, + {0.63, 2.27, 4.9, 8.6, 13, 18, 25, 33, 40, 52, 100, 150, 230}, + }; + if ("3".equals(kind)) { + prices = new double[][]{ + {11, 11, 11, 17.6, 26.4, 38.5, 51.7, 67.1, 77, 99, 198, 308, 440}, + {5.17, 5.5, 9.625, 16.5, 25.3, 35.2, 48.4, 63.25, 78.1, 97.9, 192.5, 286, 385}, + {2.585, 4.07, 8.58, 14.3, 23.1, 31.9, 44, 57.2, 71.5, 89.1, 176, 264, 374}, + {1.65, 3.52, 7.48, 12.1, 19.8, 28.6, 38.5, 50.6, 60.5, 78.1, 156.2, 233.2, 348.7}, + {0.88, 3.08, 6.666, 11.55, 17.6, 25.3, 34.1, 44, 55, 66, 138.6, 206.8, 308}, + {0.77, 2.75, 5.984, 10.45, 15.4, 22, 31.13, 40.48, 50.6, 63.8, 124.3, 185.9, 279.4}, + {0.693, 2.497, 5.39, 9.46, 14.3, 19.8, 27.5, 36.3, 44, 57.2, 110, 165, 253}, + }; + } + if ("4".equals(kind)) { + prices = new double[][]{ + {12.1, 12.1, 12.1, 19.36, 29.04, 42.35, 56.87, 73.81, 84.7, 108.9, 217.8, 338.8, 484}, + {5.687, 6.05, 10.5875, 18.15, 27.83, 38.72, 53.24, 69.575, 85.91, 107.69, 211.75, 314.6, 423.5}, + {2.8435, 4.477, 9.438, 15.73, 25.41, 35.09, 48.4, 62.92, 78.65, 98.01, 193.6, 290.4, 411.4}, + {1.815, 3.872, 8.228, 13.31, 21.78, 31.46, 42.35, 55.66, 66.55, 85.91, 171.82, 256.52, 383.57}, + {0.968, 3.388, 7.3326, 12.705, 19.36, 27.83, 37.51, 48.4, 60.5, 72.6, 152.46, 227.48, 338.8}, + {0.847, 3.025, 6.5824, 11.495, 16.94, 24.2, 34.243, 44.528, 55.66, 70.18, 136.73, 204.49, 307.34}, + {0.7623, 2.7467, 5.929, 10.406, 15.73, 21.78, 30.25, 39.93, 48.4, 62.92, 121, 181.5, 278.3}, + }; + } + if ("5".equals(kind)) { + prices = new double[][]{ + {13.2, 13.2, 13.2, 20.9, 31.9, 46.2, 62.7, 81.4, 93.5, 119.9, 239.8, 372.9, 532.4}, + {6.05, 6.6, 12.1, 19.8, 30.8, 42.9, 58.3, 77, 94.6, 118.8, 233.2, 346.5, 466.4}, + {3.08, 4.4, 9.9, 17.6, 27.5, 38.5, 52.8, 69.3, 86.9, 107.8, 213.4, 319, 452.1}, + {1.98, 4.4, 8.8, 14.3, 24.2, 34.1, 46.2, 61.6, 73.7, 94.6, 189.2, 282.7, 422.4}, + {0.99, 3.3, 7.7, 14.3, 20.9, 30.8, 41.8, 52.8, 67.1, 80.3, 167.2, 249.7, 372.9}, + {0.88, 3.3, 7.7, 12.1, 18.7, 26.4, 37.4, 49.5, 61.6, 77, 150.7, 224.4, 337.7}, + {0.88, 3.3, 6.6, 11, 17.6, 24.2, 33, 44, 52.8, 69.3, 133.1, 200.2, 305.8}, + }; + } + //不锁边97折 + if (craft_list.contains("不锁边")) { + rate = 0.97; + } + if (craft_list.contains("异形模切")) { + rate = 1.35; + } + double unitPrice = 0; + Product pro = new Product(); + for (int i = 0; i < counts.length; i++) { + int itemCount = counts[i]; + unitPrice = PriceUtils.TableDoublePrice(width * length, prices[i], areas); + if (itemCount < count) { + continue; + } + if (priceList.size() > 2) { + break; + } + if (priceList.size() == 0 && itemCount != count) { + pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice)); + pro.setNumber(number); + priceList.add(pro); + } + pro = new Product(); + pro.setCount(itemCount); + pro.setPrice(Math.max(Math.ceil(unitPrice * itemCount * rate), miniPrice)); + pro.setNumber(number); + priceList.add(pro); + } + if (priceList.size() == 0) { + pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice)); + pro.setNumber(number); + priceList.add(pro); + } + return priceList; + } + private List getHandkerPrice(Product dto, Double width, Double length) { List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); @@ -4772,6 +4873,13 @@ public class ProductService { {0, 0, 340, 450, 570, 684, 798, 912, 1026, 1040}, {0, 0, 350, 460, 810, 972, 1134, 1296, 1458, 1780}, }; + if ("双色".equals(dto.getShen_color())) { + prices = new double[][]{ + {0, 0, 0, 0, 625, 720, 840, 960, 1080, 1200}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 875, 1020, 1190, 1280, 1350, 1450}, + }; + } Product pro = new Product(); for (int i = 0; i < counts.length; i++) { diff --git a/src/main/java/lingtao/net/util/PriceUtils.java b/src/main/java/lingtao/net/util/PriceUtils.java index b97030e..6b8b1fd 100644 --- a/src/main/java/lingtao/net/util/PriceUtils.java +++ b/src/main/java/lingtao/net/util/PriceUtils.java @@ -3631,6 +3631,26 @@ public class PriceUtils { return price; } + public static double TableDoublePrice(double area, double[] price_list, double[] areas) { + double price = 0; + int startIndex = 0; + int endIndex = 0; + for (int i = 0; i < areas.length; i++) { + if (area > areas[i]) { + startIndex = endIndex; + endIndex = Math.min(i + 1, areas.length - 1); + } + } + if (startIndex == endIndex && startIndex == 0) { + price = price_list[endIndex]; + } else if (startIndex == endIndex) { + price = (price_list[endIndex] / areas[endIndex]) * area; + } else { + price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex]; + } + return price; + } + public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) { double price = 0; int startIndex = 0; diff --git a/src/main/webapp/views/product/coupon.jsp b/src/main/webapp/views/product/coupon.jsp index e0f42c8..4412b40 100644 --- a/src/main/webapp/views/product/coupon.jsp +++ b/src/main/webapp/views/product/coupon.jsp @@ -3403,7 +3403,7 @@ }); return false; } - if (type == 1) { + if (!switchz3Size && type == 1) { if (arr.indexOf("圆角") == -1 && arr.indexOf("直角") == -1) { layer.msg("圆角,直角必选 无法报价", {offset: ['300px', '300px']}, function () { }); diff --git a/src/main/webapp/views/product/handkerchiefPaper.jsp b/src/main/webapp/views/product/handkerchiefPaper.jsp index 9455eb5..264a2c8 100644 --- a/src/main/webapp/views/product/handkerchiefPaper.jsp +++ b/src/main/webapp/views/product/handkerchiefPaper.jsp @@ -38,6 +38,12 @@ +
+ + + + +

印刷颜色

@@ -52,6 +58,20 @@ + + + +

数量(箱) @@ -166,15 +186,25 @@ } }); form.on('select(pcount_filter)', function (data) { - if (data.value == 1) { - $("#size").val("12.8*10.5*6.5") + $("input[name='shen_color'][value='单色']").click(); + $("input[name='shen_color'][value='双色']").parent().show(); + $("input[name='shen_color'][value='双色']").attr("disabled", false); + $("#colorT").parent().hide(); + $("#colorT").attr("disabled", true) + if (data.value == '23*23') { + $("input[name='shen_color'][value='双色']").parent().hide(); + $("input[name='shen_color'][value='双色']").attr("disabled", true); } - if (data.value == 3) { - $("#size").val("21.5*16*6.5") - } - if (data.value == 5) { - $("#size").val("16.5*13.5*5") + form.render(); + }) + form.on("radio(colorType)", function (data) { + $("#colorT").parent().hide(); + $("#colorT").attr("disabled", true) + if (data.value == '双色') { + $("#colorT").parent().show(); + $("#colorT").attr("disabled", false) } + form.render(); }) form.on('checkbox(ui_craft)', function (data) { let craft_list = []; @@ -204,7 +234,13 @@ }); return false; } - craft.push($("select[name='craft'] option:selected").val()); + $("select[name='craft']").each(function (i) { + // 没有被禁用的工艺加到arr中 + if (!$(this).is(':disabled')) { + craft.push($(this).find("option:selected").val()); + + } + }); $("input:checkbox[name='craft']:checked").each(function (i) { // 没有被禁用的工艺加到arr中 if (!$(this).is(':disabled')) { @@ -220,12 +256,25 @@ return false; } if (size == "23*23" || size == "27*27") { - if(count < 3){ + if (count < 3) { layer.msg("23*23、27*27尺寸3箱起做", {offset: ['300px', '300px']}, function () { }); return false; } } + let colorType = $("input[name='shen_color']:checked").val(); + if (size == "23*23" || size == "27*27") { + if (count < 3) { + layer.msg("23*23、27*27尺寸3箱起做", {offset: ['300px', '300px']}, function () { + }); + return false; + } + } + if (colorType == "双色" && count < 5) { + layer.msg("双色5箱起做", {offset: ['300px', '300px']}, function () { + }); + return false; + } $.ajax({ url: "${path}/getThanSum", diff --git a/src/main/webapp/views/product/mousePad.jsp b/src/main/webapp/views/product/mousePad.jsp new file mode 100644 index 0000000..3708081 --- /dev/null +++ b/src/main/webapp/views/product/mousePad.jsp @@ -0,0 +1,373 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + +

+
+

鼠标垫

+
+
+ +

+ 材质 +

+
+ +
+

+ 尺寸(CM/厘米) 输入格式: 长 * 宽 +

+
+ +
+ + +

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+

+ 工艺 +

+
+
+ 印面工艺: + +
+
+ 裁切工艺: + + +
+ +
+ 锁边工艺: + + + + +
+
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file