diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 77a89c3..6b12609 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4882,12 +4882,57 @@ public class ProductService { return getWallPaintingPrice(dto, width, length); case "电线胶": return getWireTapePrice(dto, width, length); + case "包装纸": + return getWrappingPaper(dto, width, length); default: break; } return null; } + private List getWrappingPaper(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(); + int min_count = 5; + int[] prices = {60, 100, 190, 500, 800}; + int[] counts = {5, 10, 20, 50, 100}; + if ("1".equals(dto.getKind()) && (width == 490 || length == 490)) { + prices = new int[]{50, 80, 140, 300, 450}; + } + if ("2".equals(dto.getKind())) { + prices = new int[]{50, 80, 140, 300, 450}; + } + if ("3".equals(dto.getKind())) { + prices = new int[]{50, 80, 140, 300, 450}; + } + double craft_price = 0; + if (craft_list.contains("双面胶")) { + craft_price += Math.max(dto.getMaxian(), 1) * 1.5; + } + if (craft_list.contains("丝带")) { + craft_price += Math.max(dto.getPcount(), 1) * 1.5; + } + for (int i = 0; i < counts.length; i++) { + int countItem = counts[i]; + if (count >= countItem) { + continue; + } + if (priceList.size() > 2) { + break; + } + Boolean isFirst = priceList.size() == 0; + int base_price = prices[isFirst ? Math.max(i - 1, 0) : i]; + Product pro = new Product(); + pro.setCount(isFirst ? count : countItem); + pro.setNumber(number); + pro.setPrice(Math.ceil((double) base_price / counts[isFirst ? Math.max(i - 1, 0) : i] * Math.max(min_count, isFirst ? count : countItem) + craft_price)); + priceList.add(pro); + } + return priceList; + } + private List getWireTapePrice(Product dto, Double width, Double length) { List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); @@ -5734,13 +5779,13 @@ public class ProductService { if ("2".equals(dto.getKind())) { max_width = 420; max_length = 310; - base_price = 35; + base_price = 45; min_price = 60; } if ("3".equals(dto.getKind())) { max_width = 420; max_length = 310; - base_price = 40; + base_price = 48; min_price = 60; } width = width * 10 + 4; @@ -5953,7 +5998,7 @@ public class ProductService { double[] lengths = {1.2, 1.5, 1.8, 2, 2.4}; if ("2".equals(dto.getKind())) { prices = new double[][]{ - {110, 236, 290, 587}, + {110, 210, 290, 587}, {119, 240, 298, 587}, {125, 240, 308, 587}, {137, 240, 316, 630}, diff --git a/src/main/webapp/views/product/wrappingPaper.jsp b/src/main/webapp/views/product/wrappingPaper.jsp index 7813940..954bd51 100644 --- a/src/main/webapp/views/product/wrappingPaper.jsp +++ b/src/main/webapp/views/product/wrappingPaper.jsp @@ -16,16 +16,18 @@
-

方巾

+

包装纸


- +

材质

- + + +

@@ -33,48 +35,12 @@

-
-
- - - - -
-

- 印刷颜色 -

-
- - - -
-

- 数量(箱) + 数量

@@ -103,7 +69,23 @@
裁切工艺: - + +
+
+ 覆膜工艺: + + +
+
+ 配件: + + + +

@@ -146,7 +128,7 @@ ins = carousel.render({}); var html = " "; var remark = " "; - const carft_list1 = ["单面", "双面"]; + const carft_list1 = ["哑膜", "亮膜"]; // 清空轮播图 $("#carousel").empty(); @@ -185,41 +167,51 @@ } } }); - form.on('select(pcount_filter)', function (data) { - $("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); - } - 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.on("select(kind_filter)", function (data) { + let html = ` + `; + $(".fumo").show(); + $(".fumo").find(":input").attr("disabled", false); + + if (data.value != '1') { + html = ` `; + $(".fumo").hide(); + $(".fumo").find(":input").attr("disabled", true); } + $("select[name='size']").empty(); + $("select[name='size']").append(html); form.render(); }) + form.on('checkbox(ui_craft)', function (data) { let craft_list = []; - $(data.elem).prop("checked", true); - layer.msg("工艺不能取消", {offset: ['300px', '300px']}, function () { - }); - form.render(); - return false; - craft_list.push($("select[name='craft'] option:selected").val()); + $("input[name='craft']:checked").each(function () { if (!$(this).is(':disabled')) { craft_list.push($(this).val()); } } ); + const carft1 = carft_list1.filter(craft => craft_list.includes(craft)); + if (carft1.length > 1) { + $(data.elem).prop("checked", false); + layer.msg("覆膜工艺不能同时选择", {offset: ['300px', '300px']}, function () { + }); + form.render(); + return false; + } + if (craft_list.includes("双面胶")) { + $(".shuang").show(); + } else { + $(".shuang").hide(); + } + if (craft_list.includes("丝带")) { + $(".sidai").show(); + } else { + $(".sidai").hide(); + } + form.render(); }) // 点击计算,计算价格 @@ -229,54 +221,20 @@ var count = $("#count").val(); var kind = $("select[name='kind'] option:selected").text(); var craft = []; - if (size == "") { - layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () { - }); - return false; - } - $("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')) { - - craft.push($(this).val()); + if ($(this).val() == "双面胶") { + craft.push($("input[name='maxian']").val() + "个" + $(this).val()); + } else if ($(this).val() == "丝带") { + craft.push($("input[name='pcount']").val() + "个" + $(this).val()); + } else { + craft.push($(this).val()); + } } }); - const carft1 = carft_list1.filter(item => craft.includes(item)); - if (carft1.length == 0) { - layer.msg("请选择印面工艺", {offset: ['300px', '300px']}, function () { - }); - return false; - } - if (size == "23*23") { - if (count < 3) { - layer.msg("23*23尺寸3箱起做", {offset: ['300px', '300px']}, function () { - }); - return false; - } - } - if (size == "27*27") { - if (count < 5) { - layer.msg("23*23尺寸5箱起做", {offset: ['300px', '300px']}, function () { - }); - return false; - } - } - let colorType = $("input[name='shen_color']:checked").val(); - - if (colorType == "双色" && count < 5) { - layer.msg("双色5箱起做", {offset: ['300px', '300px']}, function () { - }); - return false; - } - $.ajax({ url: "${path}/getThanSum", type: "GET", @@ -289,18 +247,18 @@ } var data = result.data.proList; - var span_result = '方巾 - ' + kind + ' - ' + size + ' CM (同款内容)\n'; + var span_result = '包装纸 - ' + kind + ' - ' + size + ' CM (同款内容)\n'; span_result += `工艺:` + craft.join(",") + '\n'; if (number > 1) { for (let i = 0; i < data.length; i++) { - span_result += number + '款 各' + data[i].count + "箱,共" + data[i].price + "元" + '\n' + span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + '\n' data[i].number = number; } } else { for (let i = 0; i < data.length; i++) { - span_result += number + '款 ' + data[i].count + "箱,共" + data[i].price + "元" + '\n' + span_result += number + '款 ' + data[i].count + "张,共" + data[i].price + "元" + '\n' data[i].number = number; } }