From 79c764ad7802b9d9e417c9f40414b20ab6398c96 Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Mon, 12 Jan 2026 16:38:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B7=8B=E8=86=9C=E7=BA=B8?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lingtao/net/service/ProductService.java | 19 ++++----- src/main/webapp/views/product/lingmo.jsp | 40 ++++++++++++++++++- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 184784d..d97616c 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -5718,16 +5718,17 @@ public class ProductService { private List getLingmoPrice(Product dto, Double width, Double length) { List carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); - String[] sizes = {"21*29", "36*24", "36*26", "42*28.5"}; - double[][] prices = new double[][]{ - {1150, 1950, 2350, 3300, 6150}, - {1350, 2050, 2550, 4050, 7200}, - {1450, 2100, 2650, 4250, 7500}, - {1700, 2750, 3600, 6000, 11000}, - }; int count_list[] = {10000, 20000, 30000, 50000, 100000}; - int current_int = Arrays.binarySearch(sizes, dto.getSize()); - double[] prices_list = prices[current_int]; + double[] prices_list = {1150, 1950, 2350, 3300, 6150}; + if ((width <= 21 && length <= 29) || (length <= 21 && width <= 29)) { + + } else if ((width <= 36 && length <= 24) || (length <= 36 && width <= 24)) { + prices_list = new double[]{1350, 2050, 2550, 4050, 7200}; + } else if ((width <= 36 && length <= 26) || (length <= 36 && width <= 26)) { + prices_list = new double[]{1450, 2100, 2650, 4250, 7500}; + } else if ((width <= 42 && length <= 28.5) || (length <= 42 && width <= 28.5)) { + prices_list = new double[]{1700, 2750, 3600, 6000, 11000}; + } List list = new ArrayList<>(); for (int i = 0; i < count_list.length; i++) { double price = prices_list[i]; diff --git a/src/main/webapp/views/product/lingmo.jsp b/src/main/webapp/views/product/lingmo.jsp index b07b526..bfef19d 100644 --- a/src/main/webapp/views/product/lingmo.jsp +++ b/src/main/webapp/views/product/lingmo.jsp @@ -31,6 +31,9 @@

尺寸(CM/厘米) + + +

- +

数量(个)

@@ -193,6 +198,20 @@ return false; } }) + form.on('checkbox(switchSize)', function (data) { + $("#diySize").parent().hide() + $("#size").parent().show() + $("#size").attr("disabled", false); + $("#diySize").attr("disabled", true); + if (data.elem.checked) { + $("#diySize").parent().show() + $("#size").parent().hide() + $("#size").attr("disabled", true); + $("#diySize").attr("disabled", false); + + } + form.render(); + }) // 点击计算,计算价格 form.on('submit(acount_btn)', function (data) { @@ -202,9 +221,28 @@ var kind = $("#ui_bq_name option:selected").text(); var craft = []; let coNumber = $("select[name='co_number'] option:selected").val() + if ($("input[name='switchSize']").is(":checked")) { + size = $("#diySize").val(); + } if(coNumber == ""){ layer.msg("请选择印色数量", {offset: ['300px', '300px']}, function () { }); + return false; + } + if (size == "") { + layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () { + }); + return false; + } + if ((size.split("*")[0] > 42 || size.split("*")[1] > 28.5) && (size.split("*")[1] > 42 || size.split("*")[0] > 28.5)) { + layer.msg('最大尺寸42*28.5cm!', {offset: ['300px', '300px']}, function () { + }); + return false; + } + if ((size.split("*")[0] < 21 || size.split("*")[1] < 14)&&(size.split("*")[0] < 14 || size.split("*")[1] < 21)) { + layer.msg('最小尺寸21*14cm!', {offset: ['300px', '300px']}, function () { + }); + return false; } $("input:checkbox[name='craft']:checked").each(function (i) { // 没有被禁用的工艺加到arr中