diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 0de9cc6..0095ce2 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -1758,6 +1758,9 @@ public class ProductService { for (Product product : priceList) { product.setPrice(Math.ceil((product.getPrice() + addPrice) * product.getPriceMultiple())); } + for (Product product : priceList) { + product.setPrice(Math.ceil(product.getPrice() * number * min * zhekou)); + } if ("500克拉丝闪银".equals(kind)) { String[] craft = dto.getCraft(); if (!StringUtils.isEmpty(craft)) { @@ -1778,13 +1781,12 @@ public class ProductService { } } } else { + dto.setMaxian(1); getCraft(dto, priceList, null, null, 0); } // 根据位数重新算价格 // 根据款数重新算价格 - for (Product product : priceList) { - product.setPrice(Math.ceil(product.getPrice() * number * min * zhekou)); - } + //直角的价格 按照报价系统乘以2.3 异形的按照报价系统的价格乘以1.5哈 if ("金绒".equals(kind) && craft_list.contains("白墨")) { for (Product product : priceList) { @@ -5359,24 +5361,58 @@ public class ProductService { List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); String cailiao = dto.getCailiao(); + double price = 0; double min_price = 50; double last_price = 1000; + int count = dto.getCount(); + int number = dto.getNumber(); double area = width * length * dto.getCount() / 10000 * dto.getNumber(); - double[] areas = {0, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 2, 3, 5, 7, 9, 10, 20, 50}; - int[] prices = {0, 1500, 1480, 1450, 1400, 1380, 1350, 1200, 1100, 1080, 1050, 1000, 1000, 1000, 1000, 1000}; - if ("2.3".equals(cailiao) && carft_list.contains("激光")) { - prices = new int[]{0, 1500, 1400, 1350, 1300, 1280, 1250, 1100, 1000, 950, 900, 850, 850, 850, 850, 850}; - last_price = 850; + String weight = ""; + if ("冰箱贴".equals(dto.getKindValue())) { + + double[] areas = {0, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 2, 3, 5, 7, 9, 10, 20, 50}; + int[] prices = {0, 1500, 1480, 1450, 1400, 1380, 1350, 1200, 1100, 1080, 1050, 1000, 1000, 1000, 1000, 1000}; + if ("2.3".equals(cailiao) && carft_list.contains("激光")) { + prices = new int[]{0, 1500, 1400, 1350, 1300, 1280, 1250, 1100, 1000, 950, 900, 850, 850, 850, 850, 850}; + last_price = 850; + } + if ("4.2".equals(cailiao) && carft_list.contains("CNC")) { + prices = new int[]{0, 1600, 1500, 1480, 1450, 1400, 1380, 1350, 1300, 1250, 1200, 1200, 1200, 1200, 1200, 1200}; + last_price = 1200; + } + if ("2.3".equals(cailiao) && carft_list.contains("CNC")) { + prices = new int[]{0, 1500, 1400, 1380, 1350, 1300, 1280, 1250, 1200, 1150, 1100, 1100, 1100, 1100, 1100, 1100}; + last_price = 1100; + } + price = PriceUtils.TableUnitPrice(area, prices, areas, last_price); + price = Math.max(price, min_price) + ((dto.getNumber() - 1) * 8); + weight = df.format(width * length * 4.17 * dto.getCount() * 0.1 * number / 1000 * Double.parseDouble(cailiao)); } - if ("4.2".equals(cailiao) && carft_list.contains("CNC")) { - prices = new int[]{0, 1600, 1500, 1480, 1450, 1400, 1380, 1350, 1300, 1250, 1200, 1200, 1200, 1200, 1200, 1200}; - last_price = 1200; + if ("对联冰箱贴".equals(dto.getKindValue())) { + double basePrice = 0; + min_price = 55; + double baseWeight = 0.4; + if ("2.3".equals(cailiao) && "70*80".equals(dto.getSize())) { + basePrice = 8; + } + if ("2.3滴塑".equals(cailiao) && "70*80".equals(dto.getSize())) { + basePrice = 10; + } + if ("2.3".equals(cailiao) && "90*100".equals(dto.getSize())) { + basePrice = 10; + baseWeight = 0.6; + } + if ("2.3滴塑".equals(cailiao) && "90*100".equals(dto.getSize())) { + basePrice = 12; + baseWeight = 0.6; + } + if ("2.3滴塑".equals(cailiao)) { + cailiao = "2.3"; + } + price = Math.ceil(Math.max((basePrice * count * number), min_price) + 8 * number); + weight = df.format(width * length * 4.17 * dto.getCount() * number * 0.1 / 100000 * Double.parseDouble(cailiao)); } - if ("2.3".equals(cailiao) && carft_list.contains("CNC")) { - prices = new int[]{0, 1500, 1400, 1380, 1350, 1300, 1280, 1250, 1200, 1150, 1100, 1100, 1100, 1100, 1100, 1100}; - 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(); @@ -5443,8 +5479,8 @@ public class ProductService { 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) + card_price)); + pro.setWeight(weight); + pro.setPrice(Math.ceil(price + card_price)); priceList.add(pro); return priceList; diff --git a/src/main/webapp/views/product/fridgeMagnet.jsp b/src/main/webapp/views/product/fridgeMagnet.jsp index 1d0d931..d963152 100644 --- a/src/main/webapp/views/product/fridgeMagnet.jsp +++ b/src/main/webapp/views/product/fridgeMagnet.jsp @@ -20,6 +20,10 @@
+
+ + +

材质

@@ -34,9 +38,14 @@
- +

- 数量(个) + 数量(套)

@@ -52,7 +61,7 @@ 板材厚度

- @@ -65,7 +74,7 @@ class="layui-input">

- 工艺 + 工艺一套为一款

@@ -77,9 +86,11 @@
+
现货背卡尺寸:115*95mm
背纸工艺: +
+

@@ -154,46 +171,86 @@ var remark = " "; const carft_list1 = ["激光", "CNC"]; const carft_list2 = ["背卡直角裁切", "背卡异形模切"]; + const carft_list3 = ["背卡", "现货背卡"]; + const carft_list4 = ["红色款", "黄色款"]; + getImages() // 清空轮播图 - $("#carousel").empty(); - $("#remark").empty(); - $(".ui_feb").show(); - $(".ui_feb select").attr("disabled", false); - $.ajax({ - url: "${pageContext.request.contextPath}/getImgs", - type: "GET", - data: { - proTypeValue: $("#proTypeValue").val(), - kindValue: $('input[name="kindValue"]').val() - }, - success: function (result) { - for (let i = 0; i < result.length; i++) { - // 只留一个remark - remark = ""; - html += '
'; - remark += '
' + result[i].remark + '
'; - } - $("#carousel").append(html); - // 如果没有说明,就不显示null - if (remark.indexOf("null") < 0) { - $("#remark").append(remark); - } - // 如果没有轮播图就隐藏 - if (result.length == 0) { - document.getElementById("test1").style.display = "none"; //隐藏 - } else { - document.getElementById("test1").style.display = "block"; //显示 - ins.reload({ - elem: '#test1', - width: result[0].imgWidth, //设置容器宽度 - height: result[0].imgHeight - }); + function getImages() { + $("#carousel").empty(); + $("#remark").empty(); + $(".ui_feb").show(); + $(".ui_feb select").attr("disabled", false); + $.ajax({ + url: "${pageContext.request.contextPath}/getImgs", + type: "GET", + data: { + proTypeValue: $("#proTypeValue").val(), + kindValue: $('input[name="kindValue"]:checked').val() + }, + success: function (result) { + for (let i = 0; i < result.length; i++) { + // 只留一个remark + remark = ""; + html += '
'; + remark += '
' + result[i].remark + '
'; + } + $("#carousel").append(html); + // 如果没有说明,就不显示null + if (remark.indexOf("null") < 0) { + $("#remark").append(remark); + } + // 如果没有轮播图就隐藏 + if (result.length == 0) { + document.getElementById("test1").style.display = "none"; //隐藏 + } else { + document.getElementById("test1").style.display = "block"; //显示 + ins.reload({ + elem: '#test1', + width: result[0].imgWidth, //设置容器宽度 + height: result[0].imgHeight + }); + } } + }); + } + + form.on("radio(kindValue)", function (data) { + let kindValue = data.value; + let cailiaoHtml = ` + `; + $("#ui_size").show(); + $("#ui_size").find("input").attr("disabled", false); + $("#selectSize").parent().hide(); + $("#selectSize").attr("disabled", true); + $("input[name='craft'][value='激光']").prop("checked", true); + $("input[name='craft'][value='CNC']").prop("checked", false); + $("input[name='craft'][value='现货背卡']").prop("checked", false); + $(".xhbeika").hide(); + $(".xhbeika").find("input").prop("disabled", true) + if (kindValue == "对联冰箱贴") { + cailiaoHtml = ` + `; + $("#ui_size").hide(); + $("#ui_size").find("input").attr("disabled", true); + $("#selectSize").parent().show(); + $("#selectSize").attr("disabled", false); + $("input[name='craft'][value='现货背卡']").prop("checked", true); + $("input[name='craft'][value='背卡']").prop("checked", false); + $(".beika").hide(); + $(".beika").find("input").prop("disabled", true) + $(".xhbeika").show(); + $(".xhbeika").find("input").prop("disabled", false) } - }); + $("#cailiao").empty(); + $("#cailiao").append(cailiaoHtml); + getImages() + form.render(); + + }) form.on('checkbox(ui_craft)', function (data) { let craft_list = []; + let kindValue = $('input[name="kindValue"]:checked').val(); craft_list.push($("select[name='craft'] option:selected").val()); $("input[name='craft']:checked").each(function () { if (!$(this).is(':disabled')) { @@ -208,6 +265,13 @@ form.render(); return false; } + if (data.value == "CNC" && kindValue == "对联冰箱贴") { + $(data.elem).prop("checked", false); + layer.msg("对联冰箱贴CNC工艺不能选择", {offset: ['300px', '300px']}, function () { + }); + form.render(); + return false; + } const carft1 = carft_list1.filter(craft => craft_list.includes(craft)); if (carft1.length > 1) { $(data.elem).prop("checked", false); @@ -224,6 +288,29 @@ form.render(); return false; } + if (data.value == "现货背卡" && kindValue == "冰箱贴") { + $(data.elem).prop("checked", false); + layer.msg("冰箱贴现货背卡工艺不能选择", {offset: ['300px', '300px']}, function () { + }); + form.render(); + return false; + } + const carft3 = carft_list3.filter(craft => craft_list.includes(craft)); + if (carft3.length > 1) { + $(data.elem).prop("checked", false); + layer.msg("背卡工艺不能同时选择", {offset: ['300px', '300px']}, function () { + }); + form.render(); + return false; + } + const carft4 = carft_list4.filter(craft => craft_list.includes(craft)); + if (carft4.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) @@ -232,6 +319,14 @@ $(".beika").find("input").prop("disabled", false) } } + if (data.value == "现货背卡") { + $(".xhbeika").hide(); + $(".xhbeika").find("input").prop("disabled", true) + if (data.elem.checked) { + $(".xhbeika").show(); + $(".xhbeika").find("input").prop("disabled", false) + } + } form.render(); }) @@ -239,27 +334,35 @@ form.on('submit(acount_btn)', function (data) { var number = $("#number").val(); var size = $("#size").val(); + let kindValue = $('input[name="kindValue"]:checked').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 (kindValue == "对联冰箱贴") { + size = $("#selectSize option:selected").val(); + } if (size == "") { layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () { }); return false; } - if ((size.split("*")[0] > 16 || size.split("*")[1] > 16)) { - layer.msg('最大尺寸16*16cm!', {offset: ['300px', '300px']}, function () { - }); - return false; - } - if ((size.split("*")[0] < 2 || size.split("*")[1] < 2)) { - layer.msg('最小尺寸2*2cm!', {offset: ['300px', '300px']}, function () { - }); - return false; + if (kindValue == "冰箱贴") { + + if ((size.split("*")[0] > 16 || size.split("*")[1] > 16)) { + layer.msg('最大尺寸16*16cm!', {offset: ['300px', '300px']}, function () { + }); + return false; + } + if ((size.split("*")[0] < 2 || size.split("*")[1] < 2)) { + layer.msg('最小尺寸2*2cm!', {offset: ['300px', '300px']}, function () { + }); + return false; + } } + craft.push($("#xiangwei select[name='craft'] option:selected").val()); $("input:checkbox[name='craft']:checked").each(function (i) { // 没有被禁用的工艺加到arr中 @@ -308,19 +411,24 @@ return false; } var data = result.data.proList; - - var span_result = '冰箱贴 - ' + kind + '-' + $("select[name='cailiao'] option:selected").text() + ' - ' + size + ' CM (同款内容)\n'; + let unit = "套"; + if (kindValue == "冰箱贴") { + var span_result = kindValue + ' - ' + kind + '-' + $("select[name='cailiao'] option:selected").text() + ' - ' + size + ' CM (同款内容)\n'; + unit = "个" + } else { + var span_result = kindValue + ' - ' + kind + '-' + $("select[name='cailiao'] option:selected").text() + ' - 拼版' + size + ' MM (同款内容)\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 + unit + ",共" + 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 + unit + ",共" + data[i].price + "元" + '\n' data[i].number = number; } }