From 8a85fa1d2a6be158b6cfffbba77801a086033698 Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Thu, 3 Apr 2025 11:35:45 +0800 Subject: [PATCH] edit --- .../lingtao/net/service/ProductService.java | 62 ++++--- src/main/webapp/views/product/coupon.jsp | 169 +++++++++++------- src/main/webapp/views/product/tagClothes.jsp | 91 +++++----- 3 files changed, 183 insertions(+), 139 deletions(-) diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 2069e33..8b5ba66 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -601,8 +601,7 @@ public class ProductService { priceList = priceList.subList(0, 4); } List crafts_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); - int[] shengzi = {1, 2, 4, 8, 12, 16, 20, 40}; - int[] count_list = {200, 500, 1000, 2000, 3000, 4000, 5000, 10000}; + // 根据款数重新算价格/计算重量 for (Product product : priceList) { product.setPrice(Math.floor(product.getPrice() * number)); @@ -610,8 +609,8 @@ public class ProductService { product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1))); } if (crafts_list.contains("弹力绳捆")) { - int currentIndex = Arrays.binarySearch(count_list, product.getCount()); - product.setPrice(Math.floor(product.getPrice() + shengzi[currentIndex] * 10)); + + product.setPrice(Math.floor(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10)); } product.setWeight(df.format(number * length * width * product.getCount() * 0.00003)); } @@ -675,6 +674,7 @@ public class ProductService { } } } else { + List craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); if ("10".equals(dto.getKindValue2())) { area = length * width; int[][] prices = { @@ -697,9 +697,8 @@ public class ProductService { }; double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 172.8, 194.4, 224, 288, 294, 400}; double[] tang_areas = {50, 100, 150, 250, 350, 450}; - count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000}; - int[] shenzi_list = {1, 2, 4, 8, 12, 20, 40}; - List craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); + int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000}; + for (int i = 0; i < count_list.length; i++) { int item_count = count_list[i]; if (count > item_count) { @@ -750,8 +749,7 @@ public class ProductService { carft_price += Math.max(0.1 * item_count, 10); } if (craft_list.contains("配弹力绳捆")) { - carft_price += 10 * shenzi_list[count_index]; - + carft_price += 10 * Math.ceil(item_count * 20.0 / 5000); } double tang_price = 0; if (craft_list.contains("单面烫金") || craft_list.contains("双面烫金")) { @@ -789,7 +787,33 @@ public class ProductService { } // 根据款数重新算价格/计算重量 for (Product product : priceList) { - product.setPrice(Math.floor(product.getPrice() * number)); + double carft_price = 0; + if (craft_list.contains("配葫芦针")) { + carft_price += Math.max(0.016 * product.getCount(), 10); + } + if (craft_list.contains("配流苏")) { + carft_price += Math.max(0.15 * product.getCount(), 30); + } + if (craft_list.contains("穿流苏")) { + carft_price += Math.max(0.5 * product.getCount(), 100); + } + if (craft_list.contains("配尼龙绳")) { + if ("红色绳子".equals(dto.getShen_color())) { + carft_price += Math.max(0.009 * product.getCount(), 10); + } else { + carft_price += Math.max(0.03 * product.getCount(), 3); + } + } + if (craft_list.contains("穿尼龙绳")) { + carft_price += Math.max(0.2 * product.getCount(), 40); + } + if (craft_list.contains("配弹力绳")) { + carft_price += Math.max(0.1 * product.getCount(), 10); + } + if (craft_list.contains("配弹力绳捆")) { + carft_price += 10 * Math.ceil(product.getCount() * 20.0 / 5000); + } + product.setPrice(Math.floor((product.getPrice() + carft_price) * number)); product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86)); } @@ -905,8 +929,6 @@ public class ProductService { int min = getNum(length, width); priceList = getHekaPrice(min, product1, priceList, count); getCraft(product1, priceList, length * 10, width * 10, min); - shengzi = new int[]{1, 2, 4, 8, 12, 16, 20, 40}; - count_list = new int[]{200, 500, 1000, 2000, 3000, 4000, 5000, 10000}; for (Product product : priceList) { if ("凹凸".equals(dto.getAotu())) { product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153))); @@ -915,8 +937,7 @@ public class ProductService { product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1))); } if (craft.contains("弹力绳捆")) { - int currentIndex = Arrays.binarySearch(count_list, product.getCount()); - product.setPrice(Math.floor(product.getPrice() + shengzi[currentIndex] * 10)); + product.setPrice(Math.floor(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10)); } } // 根据款数重新算价格/计算重量 @@ -989,8 +1010,6 @@ public class ProductService { } } } - shengzi = new int[]{1, 2, 4, 8, 12, 16, 20, 40}; - count_list = new int[]{200, 500, 1000, 2000, 3000, 4000, 5000, 10000}; // +棉绳钱 1分5一条 for (Product product : priceList) { if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("棉绳")) { @@ -1000,8 +1019,7 @@ public class ProductService { product.setPrice(product.getPrice() + Math.max(product.getCount() * 0.1, 10)); } if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("弹力绳捆")) { - int currentIndex = Arrays.binarySearch(count_list, product.getCount()); - product.setPrice(product.getPrice() + 10 * shengzi[currentIndex]); + product.setPrice(product.getPrice() + 10 * Math.ceil(product.getCount() * 20.0 / 5000)); } } for (Product product : priceList) { @@ -1128,7 +1146,7 @@ public class ProductService { priceList.add(dto2); getCraft(dto, priceList, null, null, 0); } else if ("素芸".equals(kind)) { - count_list = new int[]{100, 200, 400, 500, 1000, 2000, 3000, 5000, 10000}; + int[] count_list = {100, 200, 400, 500, 1000, 2000, 3000, 5000, 10000}; List craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); double[] prices = {}; if (craft_list.size() == 0 || craft_list.contains("异形模切")) { @@ -1172,7 +1190,7 @@ public class ProductService { } return priceList; } else if ("草香".equals(kind) || "芳怡".equals(kind)) { - count_list = new int[]{200, 500, 1000, 2000, 5000, 10000}; + int[] count_list = {200, 500, 1000, 2000, 5000, 10000}; // 出血(一边2毫米) length = length * 10 + 4; width = width * 10 + 4; @@ -3564,7 +3582,7 @@ public class ProductService { product.setPrice(Math.floor(product.getPrice() * 1.3)); } } else if ("10".equals(kind) || "11".equals(kind)) { - count_list = new int[]{50, 100, 200, 500, 1000}; + int[] count_list = {50, 100, 200, 500, 1000}; double[] jitu = {}; double[] jitu_add = {}; double[] tang = {}; @@ -4213,7 +4231,7 @@ public class ProductService { {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}, }; - count_list = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000}; + 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; diff --git a/src/main/webapp/views/product/coupon.jsp b/src/main/webapp/views/product/coupon.jsp index b70444c..2921b20 100644 --- a/src/main/webapp/views/product/coupon.jsp +++ b/src/main/webapp/views/product/coupon.jsp @@ -39,6 +39,10 @@ right: 40px; } + #peijian_ui .layui-form-select .layui-edge { + right: 40px; + } +
@@ -507,10 +511,7 @@
-
- -
+ @@ -650,36 +651,7 @@ -
- 配件: - - - - - - - - - -
+ +
@@ -1010,35 +1016,44 @@ layer.msg('配件只能选择一种!', {offset: ['300px', '300px']}, {icon: 5}); return false; } + if (data.value == "配尼龙绳" || data.value == "穿尼龙绳") { if ($(data.elem).is(":checked")) { - $("#z4_craft .shengz").show(); - $("#z4_craft .shengz").prop("disabled", false); + $("#peijian_ui .shengz").show(); + $("#peijian_ui .shengz").prop("disabled", false); } else { - $("#z4_craft .shengz").hide(); - $("#z4_craft .shengz").prop("disabled", true); + $("#peijian_ui .shengz").hide(); + $("#peijian_ui .shengz").prop("disabled", true); } } if (data.value == "配弹力绳" || data.value == "配弹力绳捆") { if ($(data.elem).is(":checked")) { - $("#z4_craft .tscolor").show(); - $("#z4_craft .tscolor").prop("disabled", false); + $("#peijian_ui .tscolor").show(); + $("#peijian_ui .tscolor").prop("disabled", false); } else { - $("#z4_craft .tscolor").hide(); - $("#z4_craft .tscolor").prop("disabled", true); + $("#peijian_ui .tscolor").hide(); + $("#peijian_ui .tscolor").prop("disabled", true); } } }); form.on("radio(kindValue2)", function (data) { + $("#peijian_ui .tscolor").hide(); + $("#peijian_ui .tscolor").prop("disabled", true); + $("#peijian_ui .scolor").hide(); + $("#peijian_ui .scolor").prop("disabled", true); if (data.value == 10) { $("#craftForm").hide(); $("#craftForm").find(":input").attr("disabled", true); $("#z4_craft form")[0].reset(); + $("#peijian_ui form")[0].reset(); $("#z4_craft").show(); + $("#peijian_ui").show(); $("#z4_craft").find(":input").attr("disabled", false); + $("#peijian_ui").find(":input").attr("disabled", false); $("#z4_craft .ui_double_fm").prop("checked", true); $("#z4_craft .scolor").hide(); + $("#peijian_ui .scolor").hide(); $("#z4_craft .dadianxianhide").hide(); $("#z4_craft .yahenghide").hide(); $("#z4_craft .maxianhide").hide(); @@ -1090,7 +1105,16 @@ $("#craftForm").show(); $("#craftForm").find(":input").attr("disabled", false); $("#z4_craft").hide(); + $("#peijian_ui").hide(); $("#z4_craft").find(":input").attr("disabled", true); + $("#peijian_ui .scolor").hide(); + $("#peijian_ui").find(":input").attr("disabled", true); + if (data.value == 2) { + $("#peijian_ui form")[0].reset(); + $("#peijian_ui").show(); + $("#peijian_ui").find(":input").attr("disabled", false); + $("#peijian_ui .scolor").hide(); + } } getProductImage(); form.render(); @@ -1191,6 +1215,8 @@ $("#craftForm").find(":input").attr("disabled", false); $("#z4_craft").hide(); $("#z4_craft").find(":input").attr("disabled", true); + + if (data.value == 8) { $("#doorList").show(); $("#doorList").find(":input").attr("disabled", false); @@ -1720,7 +1746,9 @@ $(".z3_craft").hide() $(".z3_craft input[name='craft']").prop("disabled", true); $(".z4_craft").hide(); + $(".peijian_ui").hide(); $(".z4_craft").find(":input").attr("disabled", true); + $(".peijian_ui").find(":input").attr("disabled", true); $(".kindValue5").hide(); $(".kindValue5").find(":input").attr("disabled", true); $(".ui_hlbz").hide(); @@ -1829,7 +1857,9 @@ $(".z3_craft").show() $(".z3_craft").find(":input").attr("disabled", false); $(".z4_craft").hide(); + $(".peijian_ui").hide(); $(".z4_craft").find(":input").attr("disabled", true); + $(".peijian_ui").find(":input").attr("disabled", true); z3Select($('input[name="z3type"]:checked').val()); $(".switchz3Size").show(); $("#kindValueForm").hide() @@ -1872,7 +1902,9 @@ $(".z3_craft").hide(); $(".z3_craft input[name='craft']").prop("disabled", true); $(".z4_craft").hide(); + $(".peijian_ui").hide(); $(".z4_craft").find(":input").attr("disabled", true); + $(".peijian_ui").find(":input").attr("disabled", true); $(".size-tip-other").show(); $('input[class = specialCraft]').prop('checked', false); @@ -1892,6 +1924,8 @@ if (data.value == 3) { $(".kindValue2 input[value='10']").prop("disabled", false); + $("#peijian_ui").show(); + $("#peijian_ui").find(":input").attr("disabled", false); } $(".carft_lius").hide(); $(".carft_lius checkbox[name='craft']").attr("disabled", true); @@ -2646,6 +2680,9 @@ 10: "400克铜版纸" }; var arr = []; + let szkun = false; + let tscolor = $(".tscolor select option:selected").val(); + let selectCount = $("#selectCount").val(); $(".sizeTang").find(":input").attr("disabled", true); $("input:checkbox[name='craft']:checked").each(function (i) { // 没有被禁用的工艺加到arr中 @@ -2686,20 +2723,22 @@ arr.push("压痕" + $(".yadianxian option:selected").val() + "组") return; } - if ($(this).val() === '配尼龙绳' || $(this).val() === '穿尼龙绳') { - arr.push($(this).val() + "-" + $("select[name='shen_color'] option:selected").val()) - return; - } - if ($(this).val() == "配弹力绳捆") { - arr.push("配弹力绳(捆)"); - return; - } - if ($(this).val() == "配弹力绳") { - arr.push("配弹力绳(15CM)"); - return; - } - } + } + if ($(this).val() === '配尼龙绳' || $(this).val() === '穿尼龙绳') { + arr.push($(this).val() + "-" + $("select[name='shen_color'] option:selected").val()) + return; + } + if ($(this).val() == "配弹力绳捆") { + + arr.push(tscolor + "配弹力绳(" + Math.ceil(selectCount * 20 / 5000) + "捆)"); + szkun = true; + return; + } + if ($(this).val() == "配弹力绳") { + arr.push(tscolor + "配弹力绳(15CM)"); + return; + } arr.push($(this).val()); } }); @@ -3146,9 +3185,10 @@ if (!$(this).is(':disabled')) { if ($(this).val() != "双面覆哑膜") { if ($(this).val() == "配弹力绳捆") { - arr.push("配弹力绳(捆)"); + arr.push(tscolor + "配弹力绳(" + Math.ceil(data[0].count * 20 / 5000) + "捆)"); + szkun = true; } else if ($(this).val() == "配弹力绳") { - arr.push("配弹力绳(15CM)"); + arr.push(tscolor + "配弹力绳(15CM)"); } else { arr.push($(this).val()); } @@ -3256,7 +3296,6 @@ + "厘米-(" + same + ") \n" + "工艺 :" + arr + "\n"; } - let count_price = {200: 1, 500: 2, 1000: 4, 2000: 8, 3000: 12, 4000: 16, 5000: 20, 10000: 40}; if (number > 1) { if (couponKind == "少数量") { let numberType = $("#desType option:selected").text(); @@ -3266,11 +3305,8 @@ for (let i = 0; i < data.length; i++) { let price_text = ""; - if (arr.indexOf("配弹力绳(捆)") > -1) { - let price_count = count_price[data[i].count]; - if (price_count) { - price_text = "," + price_count + "捆"; - } + if (szkun) { + price_text = "," + Math.ceil(data[i].count * 20 / 5000) + "捆"; } span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + price_text + '\n' data[i].number = number; @@ -3279,11 +3315,8 @@ for (let i = 0; i < data.length; i++) { let price_text = ""; - if (arr.indexOf("配弹力绳(捆)") > -1) { - let price_count = count_price[data[i].count]; - if (price_count) { - price_text = "," + price_count + "捆"; - } + if (szkun) { + price_text = "," + Math.ceil(data[i].count * 20 / 5000) + "捆"; } span_result += number + '款 ' + data[i].count + "个,共" + data[i].price + "元" + price_text + '\n' data[i].number = number; diff --git a/src/main/webapp/views/product/tagClothes.jsp b/src/main/webapp/views/product/tagClothes.jsp index e816bd0..54c8e97 100644 --- a/src/main/webapp/views/product/tagClothes.jsp +++ b/src/main/webapp/views/product/tagClothes.jsp @@ -697,7 +697,17 @@ return false; } var data = result.data.proList; - + let shengku = false; + var count = 0; + if (kindValue == "3") { + if ($("input[name='switchCount']:checked").val() == undefined) { + count = $("#zjCount option:selected").val(); + } else { + count = $("#count").val(); + } + } else { + count = $("#mqCount option:selected").val(); + } if ($('input[name="kindValue"]:checked').val() == "4") { craftQie = "" var size1 = $(".size1").val(); @@ -720,10 +730,13 @@ //arr = $('input[name="kind2Value"]:checked').val(); // arr.push("双面哑膜"); let shengcraft = $("input[name='craftSheng']:checked").val(); + let szColor = $(".craftSheng select option:selected").val(); if (shengcraft == "配弹力绳") { - arr.push("配弹力绳(15CM)") + arr.push(szColor + "配弹力绳(15CM)") } else if (shengcraft == "配弹力绳捆") { - arr.push("配弹力绳(捆)") + + arr.push(szColor + "配弹力绳(" + Math.ceil(data[0].count * 20 / 5000) + "捆)") + shengku = true; } arr.push($('input[name="kind2Value"]:checked').val()); } else if ($('input[name="kindValue"]:checked').val() == "6") { @@ -748,10 +761,12 @@ //arr = $('input[name="kind2Value"]:checked').val(); // arr.push("双面哑膜"); let shengcraft = $("input[name='craftSheng']:checked").val(); + let szColor = $(".craftSheng select option:selected").val(); if (shengcraft == "配弹力绳") { - arr.push("配弹力绳(15CM)") + arr.push(szColor + "配弹力绳(15CM)") } else if (shengcraft == "配弹力绳捆") { - arr.push("配弹力绳(捆)") + arr.push(szColor + "配弹力绳(" + Math.ceil(data[0].count * 20 / 5000) + "捆)") + shengku = true; } arr.push($('input[name="kind2Value"]:checked').val()); } else if ($('input[name="kindValue"]:checked').val() == "3") { // && craftQie == "异形模切" @@ -763,10 +778,12 @@ $("input:checkbox[name='craft']:checked").each(function (i) { if (!$(this).is(':disabled')) { if ($(this).val() != "双面覆哑膜") { + let szColor = $(".tscolor select option:selected").val(); if ($(this).val() == "弹力绳") { - arr.push("配弹力绳(15cm)"); + arr.push(szColor + "配弹力绳(15cm)"); } else if ($(this).val() == "弹力绳捆") { - arr.push("配弹力绳(捆)"); + arr.push(szColor + "配弹力绳(" + Math.ceil(data[0].count * 20 / 5000) + "捆)"); + shengku = true; } else { arr.push($(this).val()); } @@ -797,18 +814,13 @@ span_result += "工艺: " + craftQie + ', ' + arr + "," + craftAotu + "\n"; } } - - let count_price = {200: 1, 500: 2, 1000: 4, 2000: 8, 3000: 12, 4000: 16, 5000: 20, 10000: 40}; if (kindValue == 3) { if (number > 1) { for (let i = 0; i < data.length; i++) { let price_text = ""; - if (arr.indexOf("配弹力绳(捆)") > -1) { - let price_count = count_price[data[i].count]; - if (price_count) { - price_text = "," + price_count + "捆"; - } + if (shengku) { + price_text = "," + Math.ceil(data[i].count * 20 / 5000) + "捆"; } span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + price_text + '\n' @@ -818,22 +830,19 @@ for (let i = 0; i < data.length; i++) { let price_text = ""; - if (arr.indexOf("配弹力绳(捆)") > -1) { - let price_count = count_price[data[i].count]; - if (price_count) { - price_text = "," + price_count + "捆"; - } + if (shengku) { + price_text = "," + Math.ceil(data[i].count * 20 / 5000) + "捆"; } span_result += data[i].count + "张" + data[i].price + "元" + price_text + '\n' data[i].number = number; } } span_result += '免费设计,全国包邮(偏远地区除外)\n' - if (!craftSheng) { - span_result += '送通用吊绳' - } else { - span_result += '配' + craftSheng; - } + // if (!craftSheng) { + // span_result += '送通用吊绳' + // } else { + // span_result += '配' + craftSheng; + // } } else { if (number > 1) { @@ -841,11 +850,8 @@ let price_text = ""; - if (arr.indexOf("配弹力绳(捆)") > -1) { - let price_count = count_price[data[i].count]; - if (price_count) { - price_text = "," + price_count + "捆"; - } + if (shengku) { + price_text = "," + Math.ceil(data[i].count * 20 / 5000) + "捆"; } span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + price_text + '\n' data[i].number = number; @@ -855,37 +861,24 @@ for (let i = 0; i < data.length; i++) { let price_text = ""; - if (arr.indexOf("配弹力绳(捆)") > -1) { - let price_count = count_price[data[i].count]; - if (price_count) { - price_text = "," + price_count + "捆"; - } + if (shengku) { + price_text = "," + Math.ceil(data[i].count * 20 / 5000) + "捆"; } span_result += number + '款 ' + data[i].count + "张,共" + data[i].price + "元" + price_text + '\n' data[i].number = number; } } - if (!craftSheng) { - span_result += '配送普通吊绳' - } else { - span_result += '配棉绳' - } + // if (!craftSheng) { + // span_result += '配送普通吊绳' + // } else { + // span_result += '配棉绳' + // } span_result += "\n9*5.4CM以内 (不限形状)\n"; span_result += '包邮,免费设计呢~(偏远地区需补邮费)' } $("#span_result").val(span_result); - var count = ""; - if (kindValue == "3") { - if ($("input[name='switchCount']:checked").val() == undefined) { - count = $("#zjCount option:selected").val(); - } else { - count = $("#count").val(); - } - } else { - count = $("#mqCount option:selected").val(); - } var craft = craftQie + arr; getRemark($("#proTypeValue").val(), size, count + "张", kindValueData[kindValue], number, craft, "");