diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 588289f..e6d365a 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -15,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; +import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.*; import java.util.regex.Pattern; @@ -2379,8 +2380,8 @@ 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; - length += 0.6; - width += 0.6; + length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(0.6)).doubleValue(); + width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(0.6)).doubleValue(); if (craft_list.contains("冷转印")) { paperLength = 20; paperWidth = 27; @@ -2390,7 +2391,7 @@ public class ProductService { paperWidth = 57; } //一张大纸能放几个 - double num = Math.max(Math.ceil(paperLength / length) * Math.ceil(paperWidth / width), Math.ceil(paperLength / width) * Math.ceil(paperWidth / length)); + double num = Math.min(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)); double baseCount = Math.max(Math.ceil(dto.getCount() * dto.getNumber() / num), 1); @@ -2777,6 +2778,29 @@ public class ProductService { } } } + if (dto.getCraft() != null && ("异形卡片".equals(dto.getKind()) || "直角卡片".equals(dto.getKind()) || "贺卡".equals(dto.getKind()) || "特种纸名片".equals(dto.getKind()))) { + double peijianPrice = 0; + if (Arrays.binarySearch(dto.getCraft(), "配葫芦针") > -1) { + peijianPrice = 0.03; + } + if (Arrays.binarySearch(dto.getCraft(), "配棉绳") > -1) { + peijianPrice = 0.05; + } + if (Arrays.binarySearch(dto.getCraft(), "配尼龙绳") > -1) { + peijianPrice = 0.01; + if ("红色绳子".equals(dto.getShen_color())) { + peijianPrice = 0.02; + } + } + if (Arrays.binarySearch(dto.getCraft(), "配弹力绳") > -1) { + peijianPrice = 0.05; + } + for (Product product : priceList) { + if (peijianPrice > 0) { + product.setPrice(Math.ceil(product.getPrice() + peijianPrice * dto.getCount() * dto.getNumber() + 5)); + } + } + } if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) { if (number > 1) { double designFee = 0; diff --git a/src/main/java/lingtao/net/util/PriceUtils.java b/src/main/java/lingtao/net/util/PriceUtils.java index 3b0455b..65b095d 100644 --- a/src/main/java/lingtao/net/util/PriceUtils.java +++ b/src/main/java/lingtao/net/util/PriceUtils.java @@ -3449,9 +3449,9 @@ public class PriceUtils { if (count <= 5) { price = 260; } else if (count < 100) { - price = 12 * count + 200; + price = 14 * count + 200; } else { - price = 14 * count; + price = 12 * count; } price = price + (coNumber - 1) * 100; } diff --git a/src/main/webapp/views/product/coupon.jsp b/src/main/webapp/views/product/coupon.jsp index 76d70ca..ce994cb 100644 --- a/src/main/webapp/views/product/coupon.jsp +++ b/src/main/webapp/views/product/coupon.jsp @@ -43,6 +43,9 @@ right: 40px; } + #lesspeijian .layui-form-select .layui-edge { + right: 40px; + }
@@ -733,6 +736,34 @@
+
@@ -1039,11 +1070,11 @@ if (data.value == "配尼龙绳" || data.value == "穿尼龙绳") { if ($(data.elem).is(":checked")) { - $("#peijian_ui .shengz").show(); - $("#peijian_ui .shengz").prop("disabled", false); + $("#peijian_ui .scolor").show(); + $("#peijian_ui .scolor").prop("disabled", false); } else { - $("#peijian_ui .shengz").hide(); - $("#peijian_ui .shengz").prop("disabled", true); + $("#peijian_ui .scolor").hide(); + $("#peijian_ui .scolor").prop("disabled", true); } } if (data.value == "配弹力绳" || data.value == "配弹力绳捆") { @@ -1055,7 +1086,34 @@ $("#peijian_ui .tscolor").prop("disabled", true); } } + }); + form.on("checkbox(lessz4PeiJian)", function (data) { + let peijiansize = $(".lesspeijian:checked").length; + if (peijiansize > 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; + } + if (data.value == "配尼龙绳") { + if ($(data.elem).is(":checked")) { + $("#lesspeijian .scolor").show(); + $("#lesspeijian .scolor").prop("disabled", false); + } else { + $("#lesspeijian .scolor").hide(); + $("#lesspeijian .scolor").prop("disabled", true); + } + } + if (data.value == "配弹力绳") { + if ($(data.elem).is(":checked")) { + $("#lesspeijian .tscolor").show(); + $("#lesspeijian .tscolor").prop("disabled", false); + } else { + $("#lesspeijian .tscolor").hide(); + $("#lesspeijian .tscolor").prop("disabled", true); + } + } }); form.on("radio(kindValue2)", function (data) { $("#peijian_ui .tscolor").hide(); @@ -1235,6 +1293,15 @@ $("#craftForm").find(":input").attr("disabled", false); $("#z4_craft").hide(); $("#z4_craft").find(":input").attr("disabled", true); + $(".lesspeijian").prop("checked", false); + $("#lesspeijian").hide(); + $("#lesspeijian").find(":input").attr("disabled", true); + if (data.value == '直角卡片' || data.value == '异形卡片' || data.value == '贺卡' || data.value == '特种纸名片') { + if (data.elem.checked) { + $("#lesspeijian").show(); + $("#lesspeijian").find(":input").attr("disabled", false); + } + } if (data.value == 8) { diff --git a/src/main/webapp/views/product/handBag.jsp b/src/main/webapp/views/product/handBag.jsp index 603edb8..7d4ec73 100644 --- a/src/main/webapp/views/product/handBag.jsp +++ b/src/main/webapp/views/product/handBag.jsp @@ -74,7 +74,7 @@