diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 205e396..2f0addc 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4699,156 +4699,9 @@ public class ProductService { priceList.add(pro); return priceList; case "奖牌": - String kindValue = dto.getKindValue(); - String name = dto.getKind1Value(); - price = 0.0; - Double zhongliang = 0.0; - - if ("水晶".equals(kindValue)) { - if ("酸洗五角星".equals(name)) { - price = Math.ceil(98 * dto.getCount()); - zhongliang = 2.9; - } - if ("炫彩刀片".equals(name)) { - price = Math.ceil(98 * dto.getCount()); - zhongliang = 2.9; - } - if ("金色刀片".equals(name)) { - price = Math.ceil(120 * dto.getCount()); - zhongliang = 2.9; - } - if ("尖角".equals(name)) { - price = Math.ceil(160 * dto.getCount()); - zhongliang = 2.3; - } - if ("斜面6角星".equals(name)) { - price = Math.ceil(90 * dto.getCount()); - zhongliang = 2.6; - } - if ("八角".equals(name)) { - price = Math.ceil(108 * dto.getCount()); - zhongliang = 3.1; - } - if ("蓝色梦想".equals(name)) { - price = Math.ceil(120 * dto.getCount()); - zhongliang = 2.9; - } - if ("蓝色三条线".equals(name)) { - price = Math.ceil(98 * dto.getCount()); - zhongliang = 2.9; - } - if ("蓝色弯弯".equals(name)) { - price = Math.ceil(98 * dto.getCount()); - zhongliang = 2.2; - } - if ("斜面5角星".equals(name)) { - price = Math.ceil(88 * dto.getCount()); - zhongliang = 2.5; - } - if ("麦穗圆型".equals(name)) { - price = Math.ceil(108 * dto.getCount()); - zhongliang = 2.9; - } - if ("酸洗凹面".equals(name)) { - price = Math.ceil(118 * dto.getCount()); - zhongliang = 2.9; - } - if ("月牙".equals(name)) { - price = Math.ceil(108 * dto.getCount()); - zhongliang = 2.9; - } - if ("大拇指".equals(name)) { - price = Math.ceil(60 * dto.getCount()); - zhongliang = 2.9; - } - if ("宝剑".equals(name)) { - price = Math.ceil(108 * dto.getCount()); - zhongliang = 2.9; - } - if ("蓝色五角星".equals(name)) { - price = Math.ceil(128 * dto.getCount()); - zhongliang = 2.9; - } - } else { - List carfts = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); - if ("20*25".equals(dto.getSize())) { - if (carfts.contains("直边")) { - price = Math.ceil(33 * dto.getCount()); - } else { - price = Math.ceil(39 * dto.getCount()); - } - zhongliang = 1.3; - } - if ("24*31".equals(dto.getSize())) { - if (carfts.contains("直边")) { - price = Math.ceil(36 * dto.getCount()); - } else { - price = Math.ceil(45 * dto.getCount()); - } - zhongliang = 1.6; - } - if ("25*35".equals(dto.getSize())) { - if (carfts.contains("直边")) { - price = Math.ceil(39 * dto.getCount()); - } else { - price = Math.ceil(54 * dto.getCount()); - } - zhongliang = 1.7; - } - if ("30*40".equals(dto.getSize())) { - if (carfts.contains("直边")) { - price = Math.ceil(42 * dto.getCount()); - } else { - price = Math.ceil(66 * dto.getCount()); - } - zhongliang = 2.7; - } - if ("35*50".equals(dto.getSize())) { - if (carfts.contains("直边")) { - price = Math.ceil(57 * dto.getCount()); - } else { - price = Math.ceil(75 * dto.getCount()); - } - zhongliang = 3.6; - } - if ("40*60".equals(dto.getSize())) { - if (carfts.contains("直边")) { - price = Math.ceil(75 * dto.getCount()); - } else { - price = Math.ceil(108 * dto.getCount()); - } - zhongliang = 4.8; - } - } - pro = new Product(); - pro.setCount(count); - pro.setPrice(price * number); - pro.setWeight(df.format(Math.ceil(zhongliang * dto.getCount() * number))); - priceList.add(pro); - return priceList; + return getMedalPrice(dto, width, length); case "防伪标": - carft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); - int[][] prices = { - {176, 176, 176, 176, 176, 176, 176, 176, 180, 184, 192, 192, 202, 228, 228}, - {180, 180, 182, 184, 186, 188, 196, 206, 240, 260, 274, 286, 306, 344, 360}, - {184, 184, 184, 194, 214, 228, 264, 290, 358, 408, 434, 466, 506, 572, 650}, - {190, 202, 210, 224, 256, 282, 332, 374, 478, 554, 590, 660, 716, 814, 942}, - {200, 232, 254, 290, 338, 392, 468, 544, 728, 864, 920, 1046, 1138, 1298, 1520}, - {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}, - }; - 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; - priceList = getAreaCenterPrice(count_list, count, area, prices, areas, number); - for (Product product : priceList) { - product.setPrice(Math.ceil(product.getPrice() * 1.3)); - } - if (carft_list.contains("印白墨")) { - priceList = PriceUtils.getYinBaiPrice(priceList, width, length); - } - return priceList; + return getantiLabelPrice(dto, width, length); case "透卡": return getPETPrice(dto, width, length); case "澜达海报": @@ -4867,12 +4720,88 @@ public class ProductService { return getLingmoPrice(dto, width, length); case "香薰卡": return getaromatherapyPrice(dto, width, length); + case "金属微章": + return getbadgePrice(dto, width, length); default: break; } return null; } + private List getbadgePrice(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_list = { + {450, 880, 1700, 3250, 5380, 10000, 14728, 23685, 43103}, + }; + int[] count_list = { + 50, 100, 200, 500, 1000, 2000, 3000, 5000, 10000 + }; + int pre_count = 0; + for (int i = 0; i < count_list.length; i++) { + double price = prices_list[0][i]; + + int item_count = count_list[i]; + if (item_count < count) { + pre_count = item_count; + continue; + } + if (priceList.size() > 2) { + break; + } + //数量小于50 + Product pro = new Product(); + if (pre_count > 0 && count > pre_count) { + double base_price = prices_list[0][i - 1] / pre_count; + pro = new Product(); + pro.setCount(count); + pro.setWeight(df.format(0.005 * count * dto.getNumber())); + pro.setPrice(Math.ceil(base_price * count * dto.getNumber())); + priceList.add(pro); + } + pro = new Product(); + pro.setCount(item_count); + pro.setWeight(df.format(0.005 * item_count * dto.getNumber())); + pro.setPrice(Math.ceil(price * dto.getNumber())); + priceList.add(pro); + pre_count = item_count; + + } + + return priceList; + } + + + private List getantiLabelPrice(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(); + int[][] prices = { + {176, 176, 176, 176, 176, 176, 176, 176, 180, 184, 192, 192, 202, 228, 228}, + {180, 180, 182, 184, 186, 188, 196, 206, 240, 260, 274, 286, 306, 344, 360}, + {184, 184, 184, 194, 214, 228, 264, 290, 358, 408, 434, 466, 506, 572, 650}, + {190, 202, 210, 224, 256, 282, 332, 374, 478, 554, 590, 660, 716, 814, 942}, + {200, 232, 254, 290, 338, 392, 468, 544, 728, 864, 920, 1046, 1138, 1298, 1520}, + {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}, + }; + 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}; + + double area = length * width; + priceList = getAreaCenterPrice(count_list, count, area, prices, areas, number); + for (Product product : priceList) { + product.setPrice(Math.ceil(product.getPrice() * 1.3)); + } + if (carft_list.contains("印白墨")) { + priceList = PriceUtils.getYinBaiPrice(priceList, width, length); + } + return priceList; + } + private List getaromatherapyPrice(Product dto, Double width, Double length) { List carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); @@ -5232,6 +5161,138 @@ public class ProductService { return priceList; } + private List getMedalPrice(Product dto, Double width, Double length) { + String kindValue = dto.getKindValue(); + String name = dto.getKind1Value(); + double price = 0.0; + Double zhongliang = 0.0; + List priceList = new ArrayList<>(); + int count = dto.getCount(); + int number = dto.getNumber(); + if ("水晶".equals(kindValue)) { + if ("酸洗五角星".equals(name)) { + price = Math.ceil(98 * dto.getCount()); + zhongliang = 2.9; + } + if ("炫彩刀片".equals(name)) { + price = Math.ceil(98 * dto.getCount()); + zhongliang = 2.9; + } + if ("金色刀片".equals(name)) { + price = Math.ceil(120 * dto.getCount()); + zhongliang = 2.9; + } + if ("尖角".equals(name)) { + price = Math.ceil(160 * dto.getCount()); + zhongliang = 2.3; + } + if ("斜面6角星".equals(name)) { + price = Math.ceil(90 * dto.getCount()); + zhongliang = 2.6; + } + if ("八角".equals(name)) { + price = Math.ceil(108 * dto.getCount()); + zhongliang = 3.1; + } + if ("蓝色梦想".equals(name)) { + price = Math.ceil(120 * dto.getCount()); + zhongliang = 2.9; + } + if ("蓝色三条线".equals(name)) { + price = Math.ceil(98 * dto.getCount()); + zhongliang = 2.9; + } + if ("蓝色弯弯".equals(name)) { + price = Math.ceil(98 * dto.getCount()); + zhongliang = 2.2; + } + if ("斜面5角星".equals(name)) { + price = Math.ceil(88 * dto.getCount()); + zhongliang = 2.5; + } + if ("麦穗圆型".equals(name)) { + price = Math.ceil(108 * dto.getCount()); + zhongliang = 2.9; + } + if ("酸洗凹面".equals(name)) { + price = Math.ceil(118 * dto.getCount()); + zhongliang = 2.9; + } + if ("月牙".equals(name)) { + price = Math.ceil(108 * dto.getCount()); + zhongliang = 2.9; + } + if ("大拇指".equals(name)) { + price = Math.ceil(60 * dto.getCount()); + zhongliang = 2.9; + } + if ("宝剑".equals(name)) { + price = Math.ceil(108 * dto.getCount()); + zhongliang = 2.9; + } + if ("蓝色五角星".equals(name)) { + price = Math.ceil(128 * dto.getCount()); + zhongliang = 2.9; + } + } else { + List carfts = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>(); + if ("20*25".equals(dto.getSize())) { + if (carfts.contains("直边")) { + price = Math.ceil(33 * dto.getCount()); + } else { + price = Math.ceil(39 * dto.getCount()); + } + zhongliang = 1.3; + } + if ("24*31".equals(dto.getSize())) { + if (carfts.contains("直边")) { + price = Math.ceil(36 * dto.getCount()); + } else { + price = Math.ceil(45 * dto.getCount()); + } + zhongliang = 1.6; + } + if ("25*35".equals(dto.getSize())) { + if (carfts.contains("直边")) { + price = Math.ceil(39 * dto.getCount()); + } else { + price = Math.ceil(54 * dto.getCount()); + } + zhongliang = 1.7; + } + if ("30*40".equals(dto.getSize())) { + if (carfts.contains("直边")) { + price = Math.ceil(42 * dto.getCount()); + } else { + price = Math.ceil(66 * dto.getCount()); + } + zhongliang = 2.7; + } + if ("35*50".equals(dto.getSize())) { + if (carfts.contains("直边")) { + price = Math.ceil(57 * dto.getCount()); + } else { + price = Math.ceil(75 * dto.getCount()); + } + zhongliang = 3.6; + } + if ("40*60".equals(dto.getSize())) { + if (carfts.contains("直边")) { + price = Math.ceil(75 * dto.getCount()); + } else { + price = Math.ceil(108 * dto.getCount()); + } + zhongliang = 4.8; + } + } + Product pro = new Product(); + pro.setCount(count); + pro.setPrice(price * number); + pro.setWeight(df.format(Math.ceil(zhongliang * dto.getCount() * number))); + priceList.add(pro); + return priceList; + } + private List getLeiseDiaoPrice(Product dto, double length, double width) { double[] prices = new double[]{170, 233, 370, 537, 643, 843, 1613, 3117, 4847}; int[] count_list = new int[]{500, 1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000}; diff --git a/src/main/webapp/views/product/badge.jsp b/src/main/webapp/views/product/badge.jsp index 1e2033e..7720dcd 100644 --- a/src/main/webapp/views/product/badge.jsp +++ b/src/main/webapp/views/product/badge.jsp @@ -19,29 +19,49 @@

金属微章


- +

材质

尺寸(CM/厘米) 输入格式: 长 * 宽

- +
-

- 数量(个) -

- +
+

+ 数量(个) +

+
+ +
+
+
+

+ 自定义数量 +

+
+ +
+

款数 @@ -50,36 +70,6 @@ -

- 香味 -

-
- -

客户旺旺

@@ -92,59 +82,22 @@

- 印面工艺: - - + 画面工艺: +
- 裁切工艺: - - + 底托颜色: + +
- -
- 常见工艺: - -
-
- 包装: - - - -
-
配件: - - - -
-
- 穿配件: - - - - -
-

@@ -187,14 +140,9 @@ ins = carousel.render({}); var html = " "; var remark = " "; - const carft_list1 = ["单面", "双面"]; + const carft_list1 = ["金色", "银色"]; - const carft_list2 = ["直角裁切", "异形模切"]; - - const carft_list3 = ["单独包装", "真空包装", "无需包装"]; - - const carft_list4 = ["穿涤纶丝带", "穿吊牌绳", "穿弹力绳"]; - const carft_list5 = ["配涤纶丝带", "配吊牌绳", "配弹力绳"]; + const carft_list2 = ["别针", "蝴蝶扣", "磁铁"]; // 清空轮播图 $("#carousel").empty(); @@ -233,6 +181,9 @@ } } }); + form.on("select(count_select)", function (val) { + $("#count").val(val.value); + }) form.on('checkbox(ui_craft)', function (data) { let craft_list = []; craft_list.push($("select[name='craft'] option:selected").val()); @@ -242,27 +193,18 @@ } } ); + if (data.value == "PET印刷") { + $(data.elem).prop("checked", true); + layer.msg("画面工艺不能取消", {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); - layer.msg("印面工艺不能同时选择", {offset: ['300px', '300px']}, function () { - }); - form.render(); - return false; - } - const carft2 = carft_list2.filter(craft => craft_list.includes(craft)); - if (carft2.length > 1) { - $(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 () { + layer.msg("底托颜色不能同时选择", {offset: ['300px', '300px']}, function () { }); form.render(); return false; @@ -276,28 +218,15 @@ } } ); - const carft4 = carft_list4.filter(craft => craft_list.includes(craft)); - const carft5 = carft_list5.filter(craft => craft_list.includes(craft)); - if (carft4.length > 0 && carft5.length > 0) { + const carft2 = carft_list2.filter(craft => craft_list.includes(craft)); + if (carft2.length > 1) { $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox"); $(data.elem).prop("checked", false); - layer.msg('配 - 穿只能选择一种!', {offset: ['300px', '300px']}, {icon: 5}); + layer.msg('配件只能选择一种!', {offset: ['300px', '300px']}, {icon: 5}); + form.render(); return false; } - if (carft4.length > 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.elem).is(":checked")) { - $("#peijian_ui").show(); - $("#peijian_ui .scolor select").prop("disabled", false); - } else { - $("#peijian_ui").hide(); - $("#peijian_ui .scolor select").prop("disabled", true); - } - form.render(); + }) // 点击计算,计算价格 @@ -307,48 +236,23 @@ var count = $("#count").val(); var kind = $("select[name='kind'] option:selected").text(); var craft = []; - 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] < 1 || size.split("*")[1] < 1)) { - layer.msg('最小尺寸1*1cm!', {offset: ['300px', '300px']}, function () { - }); - return false; - } - craft.push($("#xiangwei select[name='craft'] option:selected").val()); + $("input:checkbox[name='craft']:checked").each(function (i) { // 没有被禁用的工艺加到arr中 if (!$(this).is(':disabled')) { - if (carft_list4.indexOf($(this).val()) > -1) { - craft.push($(this).val() + $("#peijian_ui select[name='shen_color'] option:selected").val()); - } else { - craft.push($(this).val()); - } + craft.push($(this).val()); } }); const carft1 = carft_list1.filter(item => craft.includes(item)); if (carft1.length == 0) { - layer.msg("请选择印面工艺", {offset: ['300px', '300px']}, function () { + layer.msg("请选择底托颜色", {offset: ['300px', '300px']}, function () { }); return false; } const carft2 = carft_list2.filter(item => craft.includes(item)); if (carft2.length == 0) { - layer.msg("请选择裁切工艺", {offset: ['300px', '300px']}, function () { - }); - return false; - } - const carft3 = carft_list3.filter(item => craft.includes(item)); - if (carft3.length == 0) { - layer.msg("请选择包装工艺", {offset: ['300px', '300px']}, function () { + layer.msg("请选择配件", {offset: ['300px', '300px']}, function () { }); return false; } @@ -364,18 +268,18 @@ } var data = result.data.proList; - var span_result = '香薰卡 - ' + kind + ' - ' + size + ' CM (同款内容)\n'; + var span_result = '金属徽章 - ' + kind + ' - ' + size + ' CM (同款内容)\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 + "个,共" + 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 + "个,共" + data[i].price + "元" + '\n' data[i].number = number; } }