From 1633d9b1020e48c6358e19593c1952247a484a97 Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Sat, 29 Nov 2025 09:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=86=E5=B8=83=E8=A2=8B?= =?UTF-8?q?=EF=BC=8C=E5=A4=96=E5=8D=96=E7=9B=92=EF=BC=8C=E6=96=B9=E5=B7=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lingtao/net/service/ProductService.java | 136 ++++++ src/main/webapp/views/product/badge.jsp | 113 +++-- src/main/webapp/views/product/canvasBag.jsp | 395 ++++++++++++++++++ .../views/product/handkerchiefPaper.jsp | 316 ++++++++++++++ src/main/webapp/views/product/takeoutBox.jsp | 311 ++++++++++++++ 5 files changed, 1229 insertions(+), 42 deletions(-) create mode 100644 src/main/webapp/views/product/canvasBag.jsp create mode 100644 src/main/webapp/views/product/handkerchiefPaper.jsp create mode 100644 src/main/webapp/views/product/takeoutBox.jsp diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 898f273..33b53ca 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4741,12 +4741,148 @@ public class ProductService { return getbadgePrice(dto, width, length); case "冰箱贴": return getfridgePrice(dto, width, length); + case "帆布袋": + return getCanvasBagPrice(dto, width, length); + case "外卖盒": + return getTakeoutBoxPrice(dto, width, length); + case "方巾纸": + return getHandkerPrice(dto, width, length); default: break; } return null; } + private List getHandkerPrice(Product dto, Double width, Double length) { + List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + int maxCount = 10; + int count = dto.getCount(); + int number = dto.getNumber(); + int[] counts = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + int base = 0; + if (width == 23) { + base = 1; + } + if (width == 27) { + base = 2; + } + double[][] prices = { + {118, 236, 350, 450, 480, 576, 672, 768, 864, 900}, + {0, 0, 340, 450, 570, 684, 798, 912, 1026, 1040}, + {0, 0, 350, 460, 810, 972, 1134, 1296, 1458, 1780}, + }; + Product pro = new Product(); + + for (int i = 0; i < counts.length; i++) { + int itemCount = counts[i]; + if (itemCount < count) { + continue; + } + if (priceList.size() > 2) { + break; + } + pro = new Product(); + pro.setCount(itemCount); + pro.setPrice(Math.ceil(prices[base][i] * number)); + pro.setNumber(number); + priceList.add(pro); + } + if (priceList.size() == 0 && count > maxCount) { + double basePrice = prices[base][prices[base].length - 1]; + pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.ceil(basePrice / maxCount * count * number)); + pro.setNumber(number); + priceList.add(pro); + } + + return priceList; + } + + private List getTakeoutBoxPrice(Product dto, Double width, Double length) { + List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + int count = dto.getCount(); + int number = dto.getNumber(); + double[] prices = {2500, 4800, 7200, 12000}; + + if (dto.getPcount() == 3) { + prices = new double[]{6000, 12000, 18000, 27000}; + } + if (dto.getPcount() == 4) { + prices = new double[]{3600, 7200, 10800, 17750}; + } + + int[] counts = {10000, 20000, 30000, 50000}; + Product pro = new Product(); + for (int i = 0; i < counts.length; i++) { + if (counts[i] < count) { + continue; + } + pro = new Product(); + pro.setCount(counts[i]); + pro.setPrice(Math.ceil(prices[i] * number)); + pro.setNumber(number); + priceList.add(pro); + } + return priceList; + } + + private double getListNumber(int[] counts, int count, double[] numbers) { + for (int j = 0; j < counts.length; j++) { + if (counts[j] <= count) { + continue; + } + return numbers[j]; + } + return 0.0; + } + + private List getCanvasBagPrice(Product dto, Double width, Double length) { + List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + int count = dto.getCount(); + //布钱 + int[] counts = {5, 10, 20, 30, 50, 100, 200, 500, 1000, 5000, 10000}; + double[][] unit_prices = { + {50, 34, 18, 12, 7.9, 4.5, 4, 3.6, 3.5, 3.3, 3}, + {50, 35, 19, 13, 7.9, 4.4, 4.2, 3.6, 3.3, 3.1, 3}, + {55, 38, 22, 15, 9.2, 4.8, 4.5, 4, 3.6, 3.4, 3.3} + }; + int base = 2; + if (width <= 27 && length <= 33 || length <= 27 && width <= 33) { + base = 0; + } + if (width <= 30 && length <= 35 || length <= 30 && width <= 35) { + base = 1; + } + int number = dto.getNumber(); + //布钱 +人工+印刷+手提 + Product pro = null; + for (int i = 0; i < counts.length; i++) { + int itemCount = counts[i]; + if (itemCount < count) { + continue; + } + if (priceList.size() > 2) { + break; + } + if (priceList.size() == 0 && itemCount != count) { + pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.ceil(unit_prices[base][i] * count * number)); + priceList.add(pro); + } + pro = new Product(); + pro.setCount(itemCount); + pro.setPrice(Math.ceil(unit_prices[base][i] * itemCount * number)); + priceList.add(pro); + + } + return priceList; + } + private List getfridgePrice(Product dto, Double width, Double length) { List carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); diff --git a/src/main/webapp/views/product/badge.jsp b/src/main/webapp/views/product/badge.jsp index 8ec3cf0..0f3d9d1 100644 --- a/src/main/webapp/views/product/badge.jsp +++ b/src/main/webapp/views/product/badge.jsp @@ -79,7 +79,7 @@ class="layui-input">

- 工艺 + 工艺PET印刷只能做固定3*3cm尺寸

@@ -93,7 +93,9 @@ 底托颜色: - + + +
配件: @@ -151,7 +153,8 @@ if (craft_list.includes("UV印刷")) { remark = "预计发货时间:
发货地:浙江
快递:中通 顺丰特快
10-12天发货"; } - $("#remark").empty().append(remark); + $("#remark").empty(); + $("#remark").append(remark); } layui.use(['table', 'form', 'carousel'], function () { @@ -162,50 +165,60 @@ //建造实例 ins = carousel.render({}); - var html = " "; - var remark = " "; - const carft_list1 = ["金色", "银色"]; + + const carft_list1 = ["金色", "银色", "黑色"]; const carft_list2 = ["别针", "蝴蝶扣", "磁铁"]; const carft_list3 = ["UV印刷", "PET印刷"]; - // 清空轮播图 - $("#carousel").empty(); - $("#remark").empty(); - $(".ui_feb").show(); - $(".ui_feb select").attr("disabled", false); - $.ajax({ - url: "${pageContext.request.contextPath}/getImgs", - type: "GET", - data: { + getImages() + + function getImages() { + // 清空轮播图 + let html = " "; + let remark = " "; + $("#carousel").empty(); + $("#remark").empty(); + $(".ui_feb").show(); + $(".ui_feb select").attr("disabled", false); + let params = { 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 - }); - } } - }); + if ($("input[name='craft'][value='UV印刷']:checked").length > 0) { + params.craftValue = "UV"; + } + $.ajax({ + url: "${pageContext.request.contextPath}/getImgs", + type: "GET", + data: params, + success: function (result) { + for (let i = 0; i < result.length; i++) { + // 只留一个remark + remark = ""; + html += '
'; + remark = '
' + result[0].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('select(kind)', function (val) { $("input[name='craft'][value='UV印刷']").prop("checked", true); $("input[name='craft'][value='PET印刷']").parent().show(); @@ -216,7 +229,8 @@ $("input[name='craft'][value='PET印刷']").prop("disabled", true); } form.render(); - changeRemark() + getImages() + // changeRemark() }) form.on("select(count_select)", function (val) { $("#count").val(val.value); @@ -249,10 +263,25 @@ form.render(); return false; } + if (data.value == "UV印刷") { + + $("input[name='craft'][value='黑色']").parent().show(); + $("input[name='craft'][value='黑色']").prop("disabled", false); + } + if (data.value == "PET印刷") { + $("input[name='craft'][value='金色']").prop("checked", true); + $("input[name='craft'][value='银色']").prop("checked", false); + $("input[name='craft'][value='黑色']").parent().hide(); + $("input[name='craft'][value='黑色']").prop("disabled", true); + + $("input[name='craft'][value='黑色']").prop("checked", false); + } if (craft_list.includes("PET印刷") > 0) { $("#size").val("3*3") } - changeRemark() + getImages(); + form.render(); + // changeRemark() }) form.on('checkbox(peijian)', function (data) { let craft_list = []; diff --git a/src/main/webapp/views/product/canvasBag.jsp b/src/main/webapp/views/product/canvasBag.jsp new file mode 100644 index 0000000..f167a2e --- /dev/null +++ b/src/main/webapp/views/product/canvasBag.jsp @@ -0,0 +1,395 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + +
+
+

帆布袋

+
+
+ +

+ 材质 +

+
+ +
+
+
+

+ 宽: +

+
+ +
+
+
+

+ 高: +

+
+ +
+
+
+ +

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 款式 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+

+ 工艺 +

+
+
+ 印刷工艺: + + +
+
+ 印面工艺: + + +
+
+ 布料颜色: + + +
+
+ 配件: + + + + + +
+
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/product/handkerchiefPaper.jsp b/src/main/webapp/views/product/handkerchiefPaper.jsp new file mode 100644 index 0000000..91d3c0d --- /dev/null +++ b/src/main/webapp/views/product/handkerchiefPaper.jsp @@ -0,0 +1,316 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + +
+
+

方巾纸

+
+
+ +

+ 材质 +

+
+ +
+

+ 尺寸 +

+
+ +
+

+ 印刷颜色 +

+
+ +
+

+ 数量(箱) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+

+ 工艺 +

+
+
+ 印面工艺: + +
+
+ 裁切工艺: + +
+
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/product/takeoutBox.jsp b/src/main/webapp/views/product/takeoutBox.jsp new file mode 100644 index 0000000..79c42e3 --- /dev/null +++ b/src/main/webapp/views/product/takeoutBox.jsp @@ -0,0 +1,311 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + +
+
+

外卖盒

+
+
+ +

+ 材质 +

+
+ +
+

+ 尺寸 +

+
+ +
+

+ 尺寸(长宽高) +

+
+ +
+

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+

+ 工艺 +

+
+
+ 印面工艺: + +
+
+ 印刷工艺: + +
+
+ 内部工艺: + +
+
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file