diff --git a/src/main/java/lingtao/net/bean/Product.java b/src/main/java/lingtao/net/bean/Product.java index 5382c25..778f1e0 100644 --- a/src/main/java/lingtao/net/bean/Product.java +++ b/src/main/java/lingtao/net/bean/Product.java @@ -168,4 +168,6 @@ public class Product { private Integer co_number; private Integer shen_type; private String shen_color; + private String[] jtcolor;//击凸颜色 + private String tcolor;//烫金颜色 } \ No newline at end of file diff --git a/src/main/java/lingtao/net/controller/ProductController.java b/src/main/java/lingtao/net/controller/ProductController.java index dc6611e..f6ce1ae 100644 --- a/src/main/java/lingtao/net/controller/ProductController.java +++ b/src/main/java/lingtao/net/controller/ProductController.java @@ -112,11 +112,11 @@ public class ProductController { } } else { if (product.getNumber() != null && product.getNumber() > 1) { - if ("专版打印".equals(product.getStickerKind()) || "少数量".equals(product.getCouponKind())) { +// if ("专版打印".equals(product.getStickerKind()) || "少数量".equals(product.getCouponKind())) { if (request.getParameter("desType") != null && !"".equals(request.getParameter("desType"))) { product.setP(Integer.valueOf(request.getParameter("desType"))); } - } +// } } } List proList = productService.getThanPrice(product, user.getRole()); diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 023330b..68d0903 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -549,7 +549,7 @@ public class ProductService { case "2": // 单个产品的面积 area = (length + 0.3) * (width + 0.3) / 10000; - priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai()); + priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000)); // 根据款数重新算价格/计算重量 for (Product product : priceList) { product.setPrice(Math.floor(product.getPrice() * number)); @@ -2822,7 +2822,7 @@ public class ProductService { if ("0".equals(kind)) { priceList = new PosterPrice().acountPrice00(kind2, area, count, number); } else if ("1".equals(kind)) {// 室内写真 - priceList = new PosterPrice().acountPrice01(kind2, area, count, number); + priceList = new PosterPrice().acountPrice01(kind2, area, count, number, width * 100, length * 100); } else if ("2".equals(kind)) {// 户外写真 if ("24".equals(kind2)) { double base_price = 0; @@ -2900,14 +2900,12 @@ public class ProductService { } else { - priceList = new PosterPrice().acountPrice02(kind2, area, count, number); + priceList = new PosterPrice().acountPrice02(kind2, area, count, number, width * 100, length * 100); } } else if ("3".equals(kind)) {// 布 if (kind2.equals("11") || kind2.equals("12") || kind2.equals("13")) { - priceList = new PriceUtils().getDbPrice(kind2, width, length, count, priceList); - for (Product product : priceList) { - product.setPrice(Math.ceil(product.getPrice() * number)); - } + priceList = new PriceUtils().getDbPrice(kind2, width * 100, length * 100, count, priceList, number); + } else if (kind2.equals("10")) { length *= 100; width *= 100; @@ -2927,12 +2925,13 @@ public class ProductService { product.setWeight(df.format(0.075 * length * width * product.getCount() / 10000 * number)); } } else { - priceList = new PosterPrice().acountPrice03(kind2, length, width, area, count, number, dto.getCraftBu()); + priceList = new PosterPrice().acountPrice03(kind2, length * 100, width * 100, area, count, number, dto.getCraftBu()); } // 7.27 海报、合版封套 *1.15 // 除550灯布/双喷布 - if (!"1".equals(kind2) && !"7".equals(kind2) && !"11".equals(kind2) && !"12".equals(kind2) && !"10".equals(kind2) && !"6".equals(kind2) && !"13".equals(kind2)) { + List kind2_list = Arrays.asList("1", "2", "6", "7", "8", "10", "11", "12", "13"); + if (!kind2_list.contains(kind2)) { for (Product product : priceList) { product.setPrice(Math.ceil(product.getPrice() * 1.15)); } @@ -2956,9 +2955,6 @@ public class ProductService { product.setWeight(df.format(wei * product.getCount() * number)); } } - if ("1".equals(kind) || "2".equals(kind) || "3".equals(kind)) { - //priceList = new PriceUtils().getFbPrice(dto, number, width, length, count, priceList); - } } return priceList; // 扇子 @@ -3509,6 +3505,50 @@ public class ProductService { for (Product product : priceList) { product.setPrice(Math.floor(product.getPrice() * 1.3)); } + } else if ("10".equals(kind) || "11".equals(kind)) { + int[] count_list = {50, 100, 200, 500, 1000}; + double[] jitu = {}; + double[] jitu_add = {}; + double[] tang = {}; + double[] yaao = {}; + if ("10".equals(kind)) { + jitu = new double[]{267, 317, 450, 733, 1200}; + jitu_add = new double[]{190, 210, 250, 320, 440}; + tang = new double[]{250, 283, 383, 650, 980}; + yaao = new double[]{250, 267, 383, 617, 950}; + } else if ("11".equals(kind)) { + jitu = new double[]{267, 317, 417, 667, 1080}; + jitu_add = new double[]{95, 105, 125, 160, 220}; + tang = new double[]{250, 300, 350, 583, 930}; + yaao = new double[]{250, 283, 317, 533, 900}; + } + craft_list = Arrays.asList(dto.getCraft()); + for (int i = 0; i < count_list.length; i++) { + if (priceList.size() > 2) { + break; + } + int count_item = count_list[i]; + if (count > count_item) { + continue; + } + Product product = new Product(); + product.setCount(count_item); + if (craft_list.contains("击凸")) { + product.setPrice(jitu[i]); + if (dto.getJtcolor() != null && dto.getJtcolor().length > 1) { + product.setPrice(jitu[i] + jitu_add[i]); + } + } + if (craft_list.contains("烫金")) { + product.setPrice(tang[i]); + } + if (craft_list.contains("无色压凹")) { + product.setPrice(yaao[i]); + } + + priceList.add(product); + } + } else { priceList = new PriceUtils().tags600Price(dto, kind, kind2, area, count); // 服装吊牌里面的900克吊牌把价格*1.3倍 @@ -4105,6 +4145,39 @@ public class ProductService { pro.setWeight(df.format(Math.ceil(zhongliang * dto.getCount() * number))); priceList.add(pro); return priceList; + case "防伪标": + int[][] prices = { + {176, 176, 176, 176, 176, 176, 176, 176, 180, 184, 192, 192, 202, 228, 228}, + {180, 180, 182, 184, 186, 188, 196, 206, 240, 260, 274, 286, 306, 344, 360}, + {184, 184, 184, 194, 214, 228, 264, 290, 358, 408, 434, 466, 506, 572, 650}, + {190, 202, 210, 224, 256, 282, 332, 374, 478, 554, 590, 660, 716, 814, 942}, + {200, 232, 254, 290, 338, 392, 468, 544, 728, 864, 920, 1046, 1138, 1298, 1520}, + {226, 312, 368, 452, 550, 672, 814, 980, 1358, 1636, 1746, 2008, 2190, 2502, 2970}, + {274, 470, 594, 784, 988, 1250, 1518, 1854, 2614, 3184, 3398, 3936, 4298, 4916, 5872}, + }; + int[] count_list = {500, 1000, 2000, 3000, 5000, 10000, 20000}; + double[] areas = {1, 4, 6, 9, 12, 16, 20, 25, 36, 45, 48.6, 54, 60, 72, 81}; + + 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; + } + int count_index = Arrays.binarySearch(count_list, count_item); + 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); + } + return priceList; default: break; } diff --git a/src/main/java/lingtao/net/util/PosterPrice.java b/src/main/java/lingtao/net/util/PosterPrice.java index 5754aee..8d36d51 100644 --- a/src/main/java/lingtao/net/util/PosterPrice.java +++ b/src/main/java/lingtao/net/util/PosterPrice.java @@ -133,238 +133,183 @@ public class PosterPrice { * @param number * @return */ - public List acountPrice01(String kind2, Double area, int count, Integer number) { + public List acountPrice01(String kind2, Double area, int count, Integer number, double width, double length) { // 最低收费 double price = 0.0; // 单价 double danjia = 0.0; String weight = "0"; DecimalFormat DecimalFormat = new DecimalFormat("#.#####"); + double[] areas = {}; + double[] prices = {}; + double last_price = 0; + double min_price = 0; switch (kind2) { // 高精室内写真 case "2": + areas = new double[]{2, 5, 10, 20, 50}; + prices = new double[]{50, 45, 32, 28, 25}; + last_price = 23; + min_price = 50; // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 50; - } else if (area > 2 && area <= 5) { - danjia = 45; - } else if (area > 5 && area <= 10) { - danjia = 32; - } else if (area > 10 && area <= 20) { - danjia = 28; - } else if (area > 20 && area <= 50) { - danjia = 25; - } else { - danjia = 23; - } - price = area * danjia > 50 ? area * danjia : 50; break; // pp纸(室内) case "3": - // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 62; - } else if (area > 2 && area <= 5) { - danjia = 45; - } else if (area > 5 && area <= 10) { - danjia = 35; - } else { - danjia = 28; - } - price = area * danjia > 70 ? area * danjia : 70; + areas = new double[]{2, 5, 10}; + prices = new double[]{62, 45, 35}; + last_price = 28; + min_price = 70; + weight = String.valueOf(DecimalFormat.format(area * 0.113 * number)); break; // 直喷PVC case "5": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 70; - } else if (area > 2 && area <= 5) { - danjia = 55; - } else if (area > 5 && area <= 10) { - danjia = 45; - } else { - danjia = 40; - } - price = area * danjia > 100 ? area * danjia : 100; + areas = new double[]{2, 5, 10}; + prices = new double[]{70, 55, 45}; + last_price = 40; + min_price = 100; weight = String.valueOf(DecimalFormat.format(area * 0.113 * number)); break; // 高精室内相纸 case "6": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 70; - } else if (area > 2 && area <= 5) { - danjia = 60; - } else if (area > 5 && area <= 10) { - danjia = 45; - } else { - danjia = 40; - } - price = area * danjia > 90 ? area * danjia : 90; + areas = new double[]{2, 5, 10}; + prices = new double[]{70, 60, 45}; + last_price = 40; + min_price = 90; break; // 单透 case "7": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 75; - } else if (area > 2 && area <= 5) { - danjia = 65; - } else if (area > 5 && area <= 10) { - danjia = 55; - } else { - danjia = 45; - } - price = area * danjia > 100 ? area * danjia : 100; + areas = new double[]{2, 5, 10}; + prices = new double[]{75, 65, 55}; + last_price = 45; + min_price = 100; break; // 静电贴 case "8": // 根据面积得到单价 - if (area > 0 && area <= 1) { - danjia = 70; - } else if (area > 1 && area <= 2) { - danjia = 68; - } else if (area > 2 && area <= 5) { - danjia = 65; - } else if (area > 5 && area <= 10) { - danjia = 63; - } else { - danjia = 60; - } - price = area * danjia > 50 ? area * danjia : 50; + areas = new double[]{1, 2, 5, 10}; + prices = new double[]{70, 68, 65, 63}; + last_price = 60; + min_price = 50; break; // 软膜 case "14": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 70; - } else if (area > 5 && area <= 10) { - danjia = 65; - } else { - danjia = 60; - } - price = area * danjia > 100 ? area * danjia : 100; + areas = new double[]{5, 10}; + prices = new double[]{70, 65}; + last_price = 60; + min_price = 100; weight = String.valueOf(DecimalFormat.format(area * 0.113 * number)); break; // 地贴(复防滑膜) case "15": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 75; - } else if (area > 5 && area <= 10) { - danjia = 65; - } else { - danjia = 55; - } - price = area * danjia > 100 ? area * danjia : 100; + areas = new double[]{5, 10}; + prices = new double[]{75, 65}; + last_price = 55; + min_price = 100; + weight = String.valueOf(DecimalFormat.format(area * 0.113 * number)); break; // UV高透车贴(含白墨) case "16": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 160; - } else if (area > 5 && area <= 10) { - danjia = 150; - } else { - danjia = 140; - } - price = area * danjia > 160 ? area * danjia : 160; + areas = new double[]{5, 10}; + prices = new double[]{160, 150}; + last_price = 140; + min_price = 160; + break; // UV高透车贴(不含白墨) case "17": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 150; - } else if (area > 5 && area <= 10) { - danjia = 140; - } else { - danjia = 130; - } - price = area * danjia > 160 ? area * danjia : 160; + areas = new double[]{5, 10}; + prices = new double[]{150, 140}; + last_price = 130; + min_price = 160; + break; // 高透贴 case "18": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 110; - } else if (area > 5 && area <= 10) { - danjia = 100; - } else { - danjia = 90; - } - price = area * danjia > 130 ? area * danjia : 130; + areas = new double[]{5, 10}; + prices = new double[]{110, 100}; + last_price = 90; + min_price = 130; + break; // 防撞条腰线UV透明喷膜(含白墨) case "19": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 130; - } else if (area > 5 && area <= 10) { - danjia = 130; - } else { - danjia = 110; - } - price = area * danjia > 80 ? area * danjia : 80; + areas = new double[]{5, 10}; + prices = new double[]{130, 130}; + last_price = 110; + min_price = 80; + break; // 防撞条腰线UV磨砂贴(含白墨) case "20": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 140; - } else if (area > 5 && area <= 10) { - danjia = 130; - } else { - danjia = 120; - } - price = area * danjia > 80 ? area * danjia : 80; + areas = new double[]{5, 10}; + prices = new double[]{140, 130}; + last_price = 120; + min_price = 80; + break; // 防撞条腰线粗哑膜磨砂贴(不含白墨) case "21": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 115; - } else if (area > 5 && area <= 10) { - danjia = 105; - } else { - danjia = 100; - } - price = area * danjia > 80 ? area * danjia : 80; + areas = new double[]{5, 10}; + prices = new double[]{115, 105}; + last_price = 100; + min_price = 80; + break; // 防撞条腰线磨砂镂空(粗哑膜刻字) case "22": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 150; - } else if (area > 5 && area <= 10) { - danjia = 140; - } else { - danjia = 130; - } - price = area * danjia > 100 ? area * danjia : 100; + areas = new double[]{5, 10}; + prices = new double[]{150, 140}; + last_price = 130; + min_price = 100; + break; // 防撞条腰线即时贴刻字 case "23": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 120; - } else if (area > 5 && area <= 10) { - danjia = 110; - } else { - danjia = 100; - } - price = area * danjia > 70 ? area * danjia : 70; + areas = new double[]{5, 10}; + prices = new double[]{120, 110}; + last_price = 100; + min_price = 70; + break; case "24": price = area * 380 > 380 ? area * 380 : 380; break; } + if (!"24".equals(kind2)) { + if (width * length < 40 * 50) { + price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price); + } else { + danjia = last_price; + for (int i = 0; i < areas.length; i++) { + if (area <= areas[i]) { + danjia = prices[i]; + break; + } + } + price = Math.max(area * danjia, min_price); + } + } Product pro = new Product(); List list = new ArrayList(); pro.setCount(count); // 价格 = 面积 * 单价 + (款数-1) * 40 - if (number > 1) { + if (number > 1 && width * length >= 40 * 50) { pro.setPrice(Math.ceil(price * number)); } else { pro.setPrice(Math.ceil(price)); @@ -383,115 +328,96 @@ public class PosterPrice { * @param number * @return */ - public List acountPrice02(String kind2, Double area, int count, Integer number) { + public List acountPrice02(String kind2, Double area, int count, Integer number, double width, double length) { double price = 0.0; double danjia = 0.0; String weight = "0"; DecimalFormat DecimalFormat = new DecimalFormat("#.#####"); + double[] areas = {}; + double[] prices = {}; + double last_price = 0; + double min_price = 0; + switch (kind2) { // 户外写真白胶(国产) case "0": + areas = new double[]{2, 5, 7, 8, 10, 20, 50}; + prices = new double[]{55, 45, 40, 37, 31, 29, 27}; + last_price = 26; + min_price = 50; // 根据面积得到单价 - if (area <= 2) { - danjia = 55; - } else if (area <= 5) { - danjia = 45; - } else if (area <= 7) { - danjia = 40; - } else if (area <= 8) { - danjia = 37; - } else if (area <= 10) { - danjia = 31; - } else if (area <= 20) { - danjia = 29; - } else if (area <= 50) { - danjia = 27; - } else { - danjia = 26; - } - price = area * danjia > 50 ? area * danjia : 50; weight = String.valueOf(DecimalFormat.format(area * 0.24 * number)); break; // 户外写真黑胶(国产) case "1": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 56; - } else if (area > 2 && area <= 5) { - danjia = 45; - } else if (area > 5 && area <= 10) { - danjia = 36; - } else { - danjia = 30; - } - price = area * danjia > 50 ? area * danjia : 50; + areas = new double[]{2, 5, 7, 8, 10, 20, 50}; + prices = new double[]{55, 45, 40, 37, 31, 29, 27}; + last_price = 26; + min_price = 50; weight = String.valueOf(DecimalFormat.format(area * 0.25 * number)); break; // 户外写真可移白胶、黑胶 case "2": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 60; - } else if (area > 2 && area <= 5) { - danjia = 55; - } else if (area > 5 && area <= 10) { - danjia = 50; - } else { - danjia = 35; - } - price = area * danjia > 85 ? area * danjia : 85; + areas = new double[]{2, 5, 10,}; + prices = new double[]{60, 55, 50}; + last_price = 35; + min_price = 50; + weight = String.valueOf(DecimalFormat.format(area * 0.14 * number)); break; // 户外写真喷膜 case "3": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 65; - } else if (area > 2 && area <= 5) { - danjia = 50; - } else if (area > 5 && area <= 10) { - danjia = 45; - } else { - danjia = 35; - } - price = area * danjia > 80 ? area * danjia : 80; + areas = new double[]{2, 5, 10,}; + prices = new double[]{65, 50, 45}; + last_price = 35; + min_price = 80; + break; // 户外写真灯片 case "5": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 68; - } else if (area > 2 && area <= 5) { - danjia = 50; - } else if (area > 5 && area <= 10) { - danjia = 40; - } else { - danjia = 30; - } - price = area * danjia > 90 ? area * danjia : 90; + areas = new double[]{2, 5, 10,}; + prices = new double[]{68, 50, 40}; + last_price = 30; + min_price = 90; + + break; // 车贴(白胶) case "6": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 50; - } else if (area > 2 && area <= 5) { - danjia = 40; - } else if (area > 5 && area <= 10) { - danjia = 30; - } else { - danjia = 25; - } - price = area * danjia > 80 ? area * danjia : 80; + areas = new double[]{2, 5, 10,}; + prices = new double[]{50, 40, 30}; + last_price = 25; + min_price = 80; + weight = String.valueOf(DecimalFormat.format(area * 0.24 * number)); break; } - + if (width * length < 40 * 50) { + price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price); + } else { + danjia = last_price; + for (int i = 0; i < areas.length; i++) { + if (area <= areas[i]) { + danjia = prices[i]; + break; + } + } + price = Math.max(area * danjia, min_price); + } Product pro = new Product(); List list = new ArrayList(); pro.setCount(count); // 价格 = 面积 * 单价 + (款数-1) * 40 - pro.setPrice(Math.ceil(price * number)); + if (number > 1 && width * length >= 40 * 50) { + pro.setPrice(Math.ceil(price * number)); + } else { + pro.setPrice(Math.ceil(price)); + } pro.setWeight(weight); list.add(pro); return list; @@ -513,45 +439,38 @@ public class PosterPrice { Integer number, String craftBu) { double price = 0.0; double danjia = 0.0; + double[] areas = {}; + double[] prices = {}; + double last_price = 0; + double min_price = 0; switch (kind2) { // 550灯布 case "1": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 30; - } else if (area > 5 && area <= 10) { - danjia = 28; - } else { - danjia = 25; - } - price = area * danjia > 60 ? area * danjia : 60; + areas = new double[]{5, 10,}; + prices = new double[]{30, 28}; + last_price = 25; + min_price = 60; + break; // 黑底布 case "2": // 根据面积得到单价 - if (area > 0 && area <= 5) { - danjia = 40; - } else if (area > 5 && area <= 10) { - danjia = 34; - } else { - danjia = 30; - } - price = area * danjia > 70 ? area * danjia : 70; + areas = new double[]{5, 10,}; + prices = new double[]{40, 34}; + last_price = 30; + min_price = 70; + break; // 写真布 case "6": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 30; - } else if (area > 2 && area <= 5) { - danjia = 28; - } else if (area > 5 && area <= 10) { - danjia = 25; - } else { - danjia = 23; - } - price = area * danjia > 50 ? area * danjia : 50; + areas = new double[]{2, 5, 10,}; + prices = new double[]{30, 28, 25}; + last_price = 23; + min_price = 50; + break; // 双喷布 case "7": @@ -588,30 +507,20 @@ public class PosterPrice { // 油画布 case "8": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 80; - } else if (area > 2 && area <= 5) { - danjia = 75; - } else if (area > 5 && area <= 10) { - danjia = 60; - } else { - danjia = 35; - } - price = area * danjia > 130 ? area * danjia : 130; + areas = new double[]{2, 5, 10,}; + prices = new double[]{80, 75, 60}; + last_price = 35; + min_price = 130; + break; // 墙纸 case "9": // 根据面积得到单价 - if (area > 0 && area <= 2) { - danjia = 70; - } else if (area > 2 && area <= 5) { - danjia = 60; - } else if (area > 5 && area <= 10) { - danjia = 50; - } else { - danjia = 35; - } - price = area * danjia > 105 ? area * danjia : 105; + areas = new double[]{2, 5, 10,}; + prices = new double[]{70, 60, 50}; + last_price = 35; + min_price = 105; + break; // 旗帜布 case "10": @@ -671,10 +580,35 @@ public class PosterPrice { break; } + if (!"7".equals(kind2) && !"10".equals(kind2)) { + if (width * length < 40 * 50) { + price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price); + } else { + danjia = last_price; + for (int i = 0; i < areas.length; i++) { + if (area <= areas[i]) { + danjia = prices[i]; + break; + } + } + price = Math.max(area * danjia, min_price); + } + } + + Product pro = new Product(); List list = new ArrayList(); pro.setCount(count); - pro.setPrice(Math.ceil(price * number)); + if (!"7".equals(kind2) && !"10".equals(kind2)) { + if (number > 1 && width * length >= 40 * 50) { + pro.setPrice(Math.ceil(price * number)); + } else { + pro.setPrice(Math.ceil(price)); + } + } else { + pro.setPrice(Math.ceil(price * number)); + } + list.add(pro); return list; } diff --git a/src/main/java/lingtao/net/util/PriceUtils.java b/src/main/java/lingtao/net/util/PriceUtils.java index df54512..63fb258 100644 --- a/src/main/java/lingtao/net/util/PriceUtils.java +++ b/src/main/java/lingtao/net/util/PriceUtils.java @@ -21,10 +21,11 @@ public class PriceUtils { * @param area * @param count * @param craft + * @param tang * @param yinbai * @return */ - public List rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai) { + public List rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices) { List list = new ArrayList(); Product pro = new Product(); // 最低收费 @@ -151,19 +152,30 @@ public class PriceUtils { if (!StringUtils.isEmpty(craft)) { if ("大雪花镭射膜".equals(craft[0])) { danjia = danjia + 1; + } else if ("覆哑膜".equals(craft[0])) { + danjia = danjia + 0.8; } else { danjia = danjia + 0.6; } } - price = Math - .ceil(area * danjia + yinrPrice + count * 0.01 > lowerPrice ? area * danjia + yinrPrice + count * 0.01 - : lowerPrice); + price = Math.ceil(Math.max(area * danjia + yinrPrice + count * 0.01, lowerPrice)); // 如果有印白工艺:2元一平方,最低收费200元 if (!StringUtils.isEmpty(yinbai)) { price = price + (area * 2 > 200 ? area * 2 : 200); } + double tang_price = 0; + + if (!StringUtils.isEmpty(tang) && "烫金".equals(tang)) { + int[] bigCountArr = {500, 1000, 2000, 3000, 5000, 10000}; + + for (int i = 0; i < bigCountArr.length; i++) { + if (count >= bigCountArr[i]) { + tang_price = price + tangPrices[i]; + } + } + } pro.setCount(count); - pro.setPrice(price); + pro.setPrice(Math.max(tang_price, price)); list.add(pro); /* @@ -3008,6 +3020,60 @@ public class PriceUtils { return price; } + public double getTestPrice(double length, double width, int count, int number, + double[] areas, double[] prices, double minPrice, double lastPrice) { + final int total = count * number; + + for (int i = 1; i <= total; i++) { + double currentPrice = new PriceUtils().getOptimizedPrice( + length, + width, + i, // 当前数量 + 1, // number 参数固定为1 + areas, + prices, + minPrice, + lastPrice + ); + + if (currentPrice > minPrice) { + // 计算累加价格:基础价 + 剩余项*6 + return minPrice + (total - i + 1) * 6; + } + } + // 未触发条件时返回基础最低价 + return minPrice; + } + + public double getOptimizedPrice(double length, double width, int count, int number, + double[] areas, double[] prices, double minPrice, double lastPrice) { + final double area = length * width * count / 10000; + final boolean isSmallArea = area <= 0.2; + + // 计算调整后的面积值 + final double adjustedArea = isSmallArea ? area * number : area; + + // 确定单价基准 + double unitPrice = isSmallArea ? minPrice : lastPrice; + if (!isSmallArea) { + for (int i = 0; i < areas.length; i++) { + if (adjustedArea <= areas[i]) { + unitPrice = prices[i]; + break; + } + } + } + + // 计算基础价格 + double basePrice = isSmallArea ? minPrice : adjustedArea * unitPrice; + + // 应用数量系数 + double finalPrice = (area > 0.2) ? basePrice * number : basePrice; + + // 确保最低价格并取整 + return Math.ceil(Math.max(finalPrice, minPrice)); + } + /** * 亚克力计算 * @@ -3124,50 +3190,54 @@ public class PriceUtils { * @param list * @return */ - public List getDbPrice(String kind, Double width, Double length, int count, List list) { + public List getDbPrice(String kind, Double width, Double length, int count, List list, int number) { //11-550灯布 12-520灯布 13-550黑底灯布 Product pro = new Product(); double price = 0, dj = 0; - double area = length * width * count; - if (kind.equals("11")) { - if (area <= 5) { - dj = 20; - } else if (area <= 10) { - dj = 18; - } else if (area > 10) { - dj = 17; - } - } else if (kind.equals("12")) { - if (area <= 5) { - dj = 16; - } else if (area <= 10) { - dj = 12; - } else if (area > 10) { - dj = 10; - } + double area = length * width * count / 10000; + double[] areas = {}; + double[] prices = {}; + double last_price = 0; + double min_price = 0; + + if ("11".equals(kind)) { + areas = new double[]{5, 10,}; + prices = new double[]{20, 18}; + last_price = 17; + min_price = 55; + + } else if ("12".equals(kind)) { + areas = new double[]{5, 10,}; + prices = new double[]{16, 12}; + last_price = 10; + min_price = 50; + } else { - if (area <= 5) { - dj = 24; - } else if (area <= 10) { - dj = 20; - } else if (area > 10) { - dj = 18; - } + areas = new double[]{5, 10,}; + prices = new double[]{24, 20}; + last_price = 18; + min_price = 60; + } - - price = area * dj; - if (area >= 7 && area <= 10) { - price = price * 0.9; - } - if (kind.equals("11")) { - price = Math.ceil(price > 55 ? price : 55); - } else if (kind.equals("12")) { - price = Math.ceil(price > 50 ? price : 50); + if (width * length < 40 * 50) { + price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price); } else { - price = Math.ceil(price > 60 ? price : 60); + dj = last_price; + for (int i = 0; i < areas.length; i++) { + if (area <= areas[i]) { + dj = prices[i]; + break; + } + } + price = Math.max(area * dj, min_price); + } + + if (number > 1 && width * length >= 40 * 50) { + pro.setPrice(Math.ceil(price * number)); + } else { + pro.setPrice(Math.ceil(price)); } - pro.setPrice(price); pro.setCount(count); list.add(pro); diff --git a/src/main/java/lingtao/net/util/ZsPrice.java b/src/main/java/lingtao/net/util/ZsPrice.java index fbf7323..8d3c92f 100644 --- a/src/main/java/lingtao/net/util/ZsPrice.java +++ b/src/main/java/lingtao/net/util/ZsPrice.java @@ -62,8 +62,19 @@ public class ZsPrice { price += num * 10; } + if (number > 1) { - price += 10 * number; + double desFee = 0; + if (dto.getP() == 1 || dto.getP() == 2 || dto.getP() == 3) { + desFee = 3; + } else if (dto.getP() == 4) { + desFee = 5; + } else if (dto.getP() == 5) { + desFee = 6; + } else { + desFee = 8; + } + price += desFee * (number - 1); } Product pro = new Product(); diff --git a/src/main/webapp/views/product/antifake.jsp b/src/main/webapp/views/product/antifake.jsp new file mode 100644 index 0000000..fbb03de --- /dev/null +++ b/src/main/webapp/views/product/antifake.jsp @@ -0,0 +1,269 @@ +<%@ 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 diff --git a/src/main/webapp/views/product/coaster.jsp b/src/main/webapp/views/product/coaster.jsp index de7a8c8..f32bc0b 100644 --- a/src/main/webapp/views/product/coaster.jsp +++ b/src/main/webapp/views/product/coaster.jsp @@ -36,7 +36,9 @@
- + + +

@@ -49,7 +51,7 @@

数量(张)

-
+
+

款数

-

- 工艺 -

-
- - |    - +
+

+ 工艺 +

+
+ + |    + - + - |    - - - - - + |    + + + + +
+
+

@@ -109,10 +157,6 @@ <%@include file="../acountExpressFee.jsp" %>
-
@@ -134,48 +178,78 @@ var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功 var table = layui.table; - /*form.on('checkbox(switch)', function(data) { - // 压痕压点线只能选一个 - var tangLen = $(".tang:checked").length; - if (tangLen > 1) { - $(data.elem).next().attr("class","layui-unselect layui-form-checkbox"); - $(data.elem).prop("checked", false); - layer.msg('[单面 - 双面]不能同时选择!', {offset : [ '300px', '300px' ]}, {icon : 5}); - return false; - } - }) */ - form.on('radio(kindValue)', function (kindValueData) { - if (kindValueData.value == '3') { - $(".ui_gy_1").show(); - $(".ui_gy_2").hide(); + $(".diycount").hide(); + $(".diycount").find(":input").attr("disabled", true); + $(".diycount").find("select").attr("disabled", true); + $(".fixcount").hide(); + $(".fixcount").find(":input").attr("disabled", true); + $(".fixcount").find("select").attr("disabled", true); + $("#jtcolor").hide(); + $("#tangcolor").hide(); + $("#yaao").prop("checked", true); + $("#size").val("").prop("readonly", false); + if (kindValueData.value == 10 || kindValueData.value == 11) { + $(".fixcount").show(); + $(".fixcount").find(":input").attr("disabled", false); + $(".fixcount").find("select").attr("disabled", false); + $("#size").val("9*9").prop("readonly", true); } else { - $(".ui_gy_1").hide(); - $(".ui_gy_2").show(); + $(".diycount").show(); + $(".diycount").find(":input").attr("disabled", false); + $(".diycount").find("select").attr("disabled", false); + if (kindValueData.value == '3') { + $(".ui_gy_1").show(); + $(".ui_gy_2").hide(); + } else { + $(".ui_gy_1").hide(); + $(".ui_gy_2").show(); - if (kindValueData.value == '4') { - $('#double').prop('checked', false); - $('#non').prop('checked', true); - $("#double").parent('span').hide(); - $('#non').parent('span').show(); - } - if (kindValueData.value == '6') { - $('#double').prop('checked', true); - $('#non').prop('checked', false); - $('#non').parent('span').hide(); - $("#double").parent('span').show(); + if (kindValueData.value == '4') { + $('#double').prop('checked', false); + $('#non').prop('checked', true); + $("#double").parent('span').hide(); + $('#non').parent('span').show(); + } + if (kindValueData.value == '6') { + $('#double').prop('checked', true); + $('#non').prop('checked', false); + $('#non').parent('span').hide(); + $("#double").parent('span').show(); + } } } + form.render(); }) + form.on("radio(switch)", function (data) { + $("#jtcolor").hide(); + $("#jtcolor").find(":input").attr("disabled", true); + $("#tangcolor").hide(); + $("#tangcolor").find(":input").attr("disabled", true); + if ($(data.elem).is(":checked") && data.value == "击凸") { + $("#jtcolor").show(); + $("#jtcolor").find(":input").attr("disabled", false); + } + if ($(data.elem).is(":checked") && data.value == "烫金") { + $("#tangcolor").show(); + $("#tangcolor").find(":input").attr("disabled", false); + } + form.render(); + }); + form.on("checkbox(color)", function (data) { + if ($("input[name='jtcolor']:checked").length > 2) { + $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox"); + $(data.elem).prop("checked", false); + layer.msg('击凸颜色最多选择两个!', {offset: ['300px', '300px']}, {icon: 5}); + return false; + } + }); + // 点击计算,计算价格 form.on('submit(acount_btn)', function (data) { - /* var wangwang = $("#wangwang").val(); - if(wangwang == ""){ - layer.msg("请填写客户旺旺号!",{offset:['300px','300px']},function(){}); - return false; - } */ + // 选中‘自定义数量’ var kindValue = $('input[name="kindValue"]:checked').val(); var craftQie = $('input[name="craftQie"]:checked').val(); @@ -222,12 +296,19 @@ } } } - + let craft = $("input[name='craft']:checked").val(); + if (craft == "击凸" && $("input[name='jtcolor']:checked").length == 0) { + layer.msg("【击凸】颜色必须选一个!", {offset: ['300px', '300px']}, function () { + }); + return false; + } var number = $("#number").val(); kindValueData = { 3: "350克铜版纸", 6: "600克铜版纸", - 4: "900克双胶纸" + 4: "900克双胶纸", + 10: "轻羽", + 11: "简单" }; $.ajax({ url: "${path}/getThanSum", @@ -241,7 +322,26 @@ } var data = result.data.proList; - var span_result = '杯垫 - ' + kindValueData[kindValue] + ' - ' + size + '厘米\n' + "工艺: " + craftQie + ', ' + arr + "\n"; + var span_result = '杯垫 - ' + kindValueData[kindValue] + ' - ' + size + '厘米\n' + if (kindValue == "3" || kindValue == "4" || kindValue == "6") { + span_result += "工艺: " + craftQie + ', ' + arr + "\n"; + } else { + let aotu = $("input[name='aotu']:checked").val(); + let craft = $("input[name='craft']:checked").val(); + let craft_list = [aotu, craft]; + + if (craft == "击凸") { + let ys = $("input[name='jtcolor']:checked"); + ys.each(item => { + craft_list.push($(ys[item]).val()); + }) + } + if (craft == "烫金") { + let ys = $("input[name='tcolor']:checked").val(); + craft_list.push(ys); + } + span_result += "工艺: " + craft_list.join(",") + "\n"; + } if (number > 1) { for (let i = 0; i < data.length; i++) { span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + '\n' diff --git a/src/main/webapp/views/product/deskSticker.jsp b/src/main/webapp/views/product/deskSticker.jsp index 28f262f..13cf0f5 100644 --- a/src/main/webapp/views/product/deskSticker.jsp +++ b/src/main/webapp/views/product/deskSticker.jsp @@ -1,311 +1,334 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> + pageEncoding="UTF-8" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - -Insert title here - <%@include file="/views/common.jsp"%> + + Insert title here + <%@include file="/views/common.jsp" %> -
-
-

桌贴

-
-
- -

- 材质 -

-
-
- - - - -
-
-

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

-
- -
- -

- 数量(张) -

-
- -
- - -

- 款数 -

-
- -
-

- 客户旺旺 -

-
- -
-

工艺

- - - +
+
+

桌贴

+
+ + +

+ 材质 +

+
+
+ + + + +
+
+

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

+
+ +
+ +

+ 数量(张) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+ +

工艺

+ + + -
- - - -
-
-
- - -
-

计算结果-

-
- - <%@include file="../acountExpressFee.jsp"%> -
- -
-
-
- -
-
- -
-
+
+ + + +
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+ +
+
+ +
+
-<%@include file="/views/copyResult.jsp"%> +<%@include file="/views/copyResult.jsp" %> \ No newline at end of file diff --git a/src/main/webapp/views/product/poster.jsp b/src/main/webapp/views/product/poster.jsp index ab718df..11a68e6 100644 --- a/src/main/webapp/views/product/poster.jsp +++ b/src/main/webapp/views/product/poster.jsp @@ -1256,12 +1256,6 @@ }); } } - } else if (value == 1 && $("#kind2Value option:checked").val() == 8) { - if ($("#size").val().split("*")[0] < 1.5 || $("#size").val().split("*")[1] < 1.5) { - layer.msg('静电贴最小尺寸1.5*1.5cm!', {offset: ['300px', '300px']}, function () { - }); - return false; - } } } if (value == 5) { @@ -1334,9 +1328,20 @@ } } if (value == 1) { - if ($("select[name='kind2Value'] option:selected").val() != 24) { + if ($("select[name='kind2Value'] option:selected").val() == 8) { + if ($("#size").val().split("*")[0] < 4 || $("#size").val().split("*")[1] < 4) { + layer.msg('静电贴最小尺寸4*4cm!', {offset: ['300px', '300px']}, function () { + }); + return false; + } + if (($("#size").val().split("*")[0] > 500 || $("#size").val().split("*")[1] > 58) && $("#size").val().split("*")[0] > 58 || $("#size").val().split("*")[1] > 500) { + layer.msg('静电贴最大尺寸500*58cm!', {offset: ['300px', '300px']}, function () { + }); + return false; + } + } else if ($("select[name='kind2Value'] option:selected").val() != 24) { if (size.split("*")[1] < 10 || size.split("*")[0] < 10) { - layer.msg($("select[name='kind2Value'] option:selected").html() + "最小尺寸10*10CM!", {offset: ['300px', '300px']}, function () { + layer.msg($("select[name='kind2Value'] option:selected").html() + "最小尺寸20*20CM!", {offset: ['300px', '300px']}, function () { }); return false; } @@ -1347,8 +1352,8 @@ } } if (value == 2) { - if (size.split("*")[1] < 10 || size.split("*")[0] < 10) { - layer.msg($("select[name='kind2Value'] option:selected").html() + "最小尺寸10*10CM!", {offset: ['300px', '300px']}, function () { + if (size.split("*")[1] < 20 || size.split("*")[0] < 20) { + layer.msg($("select[name='kind2Value'] option:selected").html() + "最小尺寸20*20CM!", {offset: ['300px', '300px']}, function () { }); return false; } diff --git a/src/main/webapp/views/product/pvcfigure.jsp b/src/main/webapp/views/product/pvcfigure.jsp index 052091f..e77e204 100644 --- a/src/main/webapp/views/product/pvcfigure.jsp +++ b/src/main/webapp/views/product/pvcfigure.jsp @@ -66,6 +66,20 @@
+

工艺

@@ -199,7 +213,14 @@ } }) }) - + $("#number").on("input", function (e) { + var number = e.delegateTarget.value; + if (number > 1) { + $("#ui_des").show(); + } else { + $("#ui_des").hide(); + } + }); // 点击计算,计算价格 form.on('submit(acount_btn)', function (data) { var kindValue = $("#kindValue option:checked").text(); diff --git a/src/main/webapp/views/product/rollLabel.jsp b/src/main/webapp/views/product/rollLabel.jsp index 41c365c..741ca20 100644 --- a/src/main/webapp/views/product/rollLabel.jsp +++ b/src/main/webapp/views/product/rollLabel.jsp @@ -76,7 +76,7 @@
覆膜 : - +
@@ -84,6 +84,10 @@ 白墨 :
+
+ 烫金 : + +
卷芯 : 0){ + span_result += "工艺:" + craft_list.join(",") + '\n'; + } if (number > 1) { for (let i = 0; i < data.length; i++) { span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + '\n'