diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 475b8b6..674321e 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -5651,61 +5651,93 @@ public class ProductService { int count = dto.getCount(); int number = dto.getNumber(); int awards = dto.getAwards(); - int[][] prices = { - {900, 900, 1000, 1000}, - {950, 950, 1100, 1100}, - {1022, 1023, 1200, 1200}, - {1591, 1591, 1628, 1744}, - {1932, 1932, 1977, 2093}, - {2273, 2273, 2326, 2558}, - {3409, 3409, 3488, 3953}, - {5682, 5682, 5814, 6512}, - {11818, 11818, 12791, 13721}, - }; + double mini_price = 1000; + int[] prices = {80, 80, 75, 70, 65, 60, 55, 50, 45}; if (craft_list.contains("单面哑膜")) { - prices = new int[][]{ - {1000, 1000, 1050, 1050}, - {1110, 1110, 1110, 1110}, - {1222, 1222, 1550, 1650}, - {1778, 1778, 1778, 1889}, - {2111, 2111, 2111, 2222}, - {2444, 2444, 2444, 2667}, - {3778, 3778, 3778, 4222}, - {6222, 6222, 6222, 6889}, - {13333, 13333, 13778, 15333}, - }; + prices = new int[]{85, 85, 80, 75, 70, 65, 60, 55, 50}; + mini_price = 1100; } - int price_index = 0; - if ((width > 4.0 || length > 6.0) && (length > 4.0 || width > 6.0)) { - price_index = 1; + if (craft_list.contains("异形模切")) { + mini_price += 300; + } - if ((width > 9.0 || length > 5.4) && (length > 9.0 || width > 5.4)) { - price_index = 2; - } - if ((width > 6.0 || length > 7.0) && (length > 6.0 || width > 7.0)) { - price_index = 3; + if (craft_list.contains("打码")) { + mini_price += 250; + } int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000, 20000, 50000}; - for (int i = 0; i < counts.length; i++) { - int itemCount = counts[i]; - if (count > itemCount) { - continue; - } - if (priceList.size() > 2) { - break; - } + + if (count > counts[counts.length - 1]) { double awards_price = 0; - if (itemCount <= 10000) { - if (awards > 5) { - awards_price = 30 * Math.max((awards - 5), 0); + if (awards > 5) { + awards_price = 30 * Math.max((awards - 5), 0); + } + double craft_price = 0; + double craft_base = 0; + if (craft_list.contains("异形模切")) { + craft_base = 0.02; + if (count >= 100000) { + craft_base = 0.015; + } + craft_price += craft_base * count; + } + if (craft_list.contains("打码")) { + craft_base = 0.02; + if (count >= 100000) { + craft_base = 0.015; + + } + craft_price += craft_base * count; } Product pro = new Product(); - pro.setCount(itemCount); + pro.setCount(count); pro.setNumber(number); - pro.setPrice(Math.ceil((prices[i][price_index] + awards_price) * number)); + pro.setPrice(Math.ceil(Math.max((prices[prices.length - 1] * count * width * length / 10000 + awards_price + craft_price), mini_price) * number)); priceList.add(pro); + } else { + + for (int i = 0; i < counts.length; i++) { + int itemCount = counts[i]; + if (count > itemCount) { + continue; + } + if (priceList.size() > 2) { + break; + } + double awards_price = 0; + if (itemCount <= 10000) { + if (awards > 5) { + awards_price = 30 * Math.max((awards - 5), 0); + } + } + double craft_price = 0; + double craft_base = 0; + if (craft_list.contains("异形模切")) { + craft_base = 0.025; + if (itemCount >= 50000) { + craft_base = 0.02; + } + + craft_price += craft_base * itemCount; + } + if (craft_list.contains("打码")) { + craft_base = 0.03; + if (itemCount >= 50000) { + craft_base = 0.02; + } + + craft_price += craft_base * itemCount; + } + + Product pro = new Product(); + pro.setCount(itemCount); + pro.setNumber(number); + pro.setPrice(Math.ceil(Math.max((prices[i] * itemCount * width * length / 10000 + awards_price + craft_price), mini_price) * number)); + priceList.add(pro); + } } + return priceList; } diff --git a/src/main/webapp/views/product/tearingJoy.jsp b/src/main/webapp/views/product/tearingJoy.jsp index eabb6bb..7c4f33f 100644 --- a/src/main/webapp/views/product/tearingJoy.jsp +++ b/src/main/webapp/views/product/tearingJoy.jsp @@ -35,7 +35,9 @@

- 数量 + 数量 + +

+

款数

@@ -61,18 +67,7 @@ 奖项

- +

客户旺旺 @@ -87,15 +82,17 @@

印面工艺: - +
裁切工艺: - + +
常见工艺: - + +
覆膜工艺: @@ -150,6 +147,7 @@ var html = " "; var remark = " "; const carft_list1 = ["不覆膜", "单面哑膜"]; + const carft_list2 = ["直角裁切", "异形模切"]; // 清空轮播图 $("#carousel").empty(); @@ -188,7 +186,20 @@ } } }); + form.on('checkbox(switchCount)', function (data) { + $("#diyCount").parent().hide() + $("#count").parent().show() + $("#count").attr("disabled", false); + $("#diyCount").attr("disabled", true); + if (data.elem.checked) { + $("#diyCount").parent().show() + $("#count").parent().hide() + $("#count").attr("disabled", true); + $("#diyCount").attr("disabled", false); + } + form.render(); + }) form.on('checkbox(ui_craft)', function (data) { let craft_list = []; @@ -208,17 +219,9 @@ return false; } - if (!craft_list.includes("直角裁切")) { - $(data.elem).prop("checked", true); - layer.msg("裁切工艺不能取消选择", {offset: ['300px', '300px']}, function () { - }); - form.render(); - return false; - } - if (!craft_list.includes("手撕线")) { $(data.elem).prop("checked", true); - layer.msg("常见工艺不能取消选择", {offset: ['300px', '300px']}, function () { + layer.msg("手撕线工艺不能取消选择", {offset: ['300px', '300px']}, function () { }); form.render(); return false; @@ -232,6 +235,14 @@ 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; + } if (data.value == '抠图') { $(".crop").hide(); @@ -263,12 +274,12 @@ }); return false; } - if ((size.split("*")[0] > 11 || size.split("*")[1] > 9) && (size.split("*")[1] > 11 || size.split("*")[0] > 9)) { - layer.msg('撕撕乐最大尺寸11*9cm!', {offset: ['300px', '300px']}, function () { + 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; } - craft.push($("select[name='awards'] option:selected").val() + "个奖项"); + craft.push($("input[name='awards']").val() + "个奖项"); $("input:checkbox[name='craft']:checked").each(function (i) { // 没有被禁用的工艺加到arr中 if (!$(this).is(':disabled')) { @@ -309,9 +320,9 @@ } span_result += '包邮,免费设计呢~(偏远地区需补邮费)' - if(window.parent.system_isGai){ - span_result +="\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!" - } + if (window.parent.system_isGai) { + span_result += "\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!" + } addLog(span_result); $("#span_result").val(span_result);