新增封口贴

This commit is contained in:
2026-06-13 18:00:39 +08:00
parent 59119cab4c
commit 86839e0b2b
3 changed files with 146 additions and 42 deletions
@@ -420,7 +420,7 @@ public class ProductService {
if ("18".equals(kind)) { if ("18".equals(kind)) {
kind = "7"; kind = "7";
} }
priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000)); priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000), dto);
// 根据款数重新算价格/计算重量 // 根据款数重新算价格/计算重量
for (Product product : priceList) { for (Product product : priceList) {
product.setPrice(Math.floor(product.getPrice() * number)); product.setPrice(Math.floor(product.getPrice() * number));
@@ -645,7 +645,7 @@ public class ProductService {
case "2": case "2":
// 单个产品的面积 // 单个产品的面积
area = (length + 0.3) * (width + 0.3) / 10000; area = (length + 0.3) * (width + 0.3) / 10000;
priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000)); priceList = new PriceUtils().rollLabelPrice(kind, area, count, dto.getCraft(), dto.getYinbai(), dto.getCraftTang(), getStickersTanBasePrice(area * 10000), dto);
// 根据款数重新算价格/计算重量 // 根据款数重新算价格/计算重量
for (Product product : priceList) { for (Product product : priceList) {
product.setPrice(Math.floor(product.getPrice() * number)); product.setPrice(Math.floor(product.getPrice() * number));
+37 -7
View File
@@ -27,9 +27,33 @@ public class PriceUtils {
* @param yinbai * @param yinbai
* @return * @return
*/ */
public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices) { public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices, Product dto) {
List<Product> list = new ArrayList<Product>(); List<Product> list = new ArrayList<Product>();
Product pro = new Product(); Product pro = new Product();
if ("封口贴".equals(dto.getKind())) {
int[] counts = {1000, 2000, 3000, 5000, 10000, 20000, 50000, 100000};
double[] prices = {180, 260, 311, 400, 558, 650, 1100, 1800};
if ("9*2".equals(dto.getSize())) {
prices = new double[]{180, 260, 311, 400, 558, 650, 1100, 1800};
}
if ("10*2".equals(dto.getSize())) {
prices = new double[]{220, 300, 337, 412, 600, 680, 1200, 1980};
}
for (int i = 0; i < counts.length; i++) {
if (counts[i] < dto.getCount()) {
continue;
}
if (list.size() > 2) {
break;
}
pro = new Product();
pro.setCount(counts[i]);
pro.setPrice(prices[i] );
list.add(pro);
}
return list;
}
// 最低收费 // 最低收费
double lowerPrice = 0.0; double lowerPrice = 0.0;
// 印工价格 // 印工价格
@@ -281,8 +305,9 @@ public class PriceUtils {
// 换成毫米每边+2 // 换成毫米每边+2
length = length * 10 + 4; length = length * 10 + 4;
width = width * 10 + 4; width = width * 10 + 4;
if ((length > l || width > w) && (length > w || width > l)) if ((length > l || width > w) && (length > w || width > l)) {
return null; return null;
}
// 一张大纸能做多少个此类尺寸的不干胶 // 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width), double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)); Math.floor(l / width) * Math.floor(w / length));
@@ -332,8 +357,9 @@ public class PriceUtils {
// 换成毫米每边+2 // 换成毫米每边+2
length = length * 10 + 4; length = length * 10 + 4;
width = width * 10 + 4; width = width * 10 + 4;
if ((length > l || width > w) && (length > w || width > l)) if ((length > l || width > w) && (length > w || width > l)) {
return null; return null;
}
// 一张大纸能做多少个此类尺寸的不干胶 // 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width), double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)); Math.floor(l / width) * Math.floor(w / length));
@@ -1328,8 +1354,9 @@ public class PriceUtils {
width = width * 10 + 2 * 1.5; width = width * 10 + 2 * 1.5;
// 数量*款数就是张数 // 数量*款数就是张数
// count = count * number; // count = count * number;
if ((length > l || width > w) && (length > w || width > l)) if ((length > l || width > w) && (length > w || width > l)) {
return null; return null;
}
// 一张大纸29*19cm 能做多少个此类尺寸的金属标 // 一张大纸29*19cm 能做多少个此类尺寸的金属标
double max = Math.max(Math.floor(l / length) * Math.floor(w / width), double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)); Math.floor(l / width) * Math.floor(w / length));
@@ -1998,8 +2025,9 @@ public class PriceUtils {
width = width * 10 + 2 * 1.5; width = width * 10 + 2 * 1.5;
// 数量*款数就是张数 // 数量*款数就是张数
count = count * number; count = count * number;
if ((length > l || width > w) && (length > w || width > l)) if ((length > l || width > w) && (length > w || width > l)) {
return null; return null;
}
// 一张大纸45*40cm 能做多少个此类尺寸的桌贴 // 一张大纸45*40cm 能做多少个此类尺寸的桌贴
double max = Math.max(Math.floor(l / length) * Math.floor(w / width), double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)); Math.floor(l / width) * Math.floor(w / length));
@@ -2100,8 +2128,9 @@ public class PriceUtils {
width = width * 10 + 2 * 3; width = width * 10 + 2 * 3;
// 数量 * 款数就是张数 // 数量 * 款数就是张数
count = count * number; count = count * number;
if ((length > l || width > w) && (length > w || width > l)) if ((length > l || width > w) && (length > w || width > l)) {
return null; return null;
}
// 一张大纸420*380mm 能做多少个此类尺寸的桌贴 // 一张大纸420*380mm 能做多少个此类尺寸的桌贴
double max = Math.max(Math.floor(l / length) * Math.floor(w / width), double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)); Math.floor(l / width) * Math.floor(w / length));
@@ -3305,8 +3334,9 @@ public class PriceUtils {
String kind = dto.getKind2Value(); String kind = dto.getKind2Value();
length = length * 10; length = length * 10;
width = width * 10; width = width * 10;
if ((length > l || width > w) && (length > w || width > l)) if ((length > l || width > w) && (length > w || width > l)) {
return null; return null;
}
// 一张大纸能做多少个此类尺寸的不干胶 // 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width), double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)); Math.floor(l / width) * Math.floor(w / length));
+107 -33
View File
@@ -23,12 +23,16 @@
<hr> <hr>
<form class="layui-form"> <form class="layui-form">
<input type="hidden" name="proTypeValue" id="proTypeValue" class="layui-input" value="2"> <input type="hidden" name="proTypeValue" id="proTypeValue" class="layui-input" value="2">
<p>
品类
</p>
<input type="radio" lay-filter="kind" name="kind" value="卷标" title="卷标" checked>
<input type="radio" lay-filter="kind" name="kind" value="封口贴" title="封口贴">
<p> <p>
材料 材料
</p> </p>
<div class="layui-form-item"> <div class="layui-form-item">
<select name="kindValue" id="kindValue" lay-filter="kindValue" class="select"> <select name="kindValue" id="kindValue" lay-filter="kindValue" class="select">
<option value=""></option>
<option value="0">格底铜板纸卷标</option> <option value="0">格底铜板纸卷标</option>
<option value="1">格底PP合成纸</option> <option value="1">格底PP合成纸</option>
<option value="2">8丝光白PVC</option> <option value="2">8丝光白PVC</option>
@@ -42,16 +46,34 @@
<p> <p>
尺寸(CM/厘米) <span style="font-size:14px;color:red">输入格式: 长 * 宽</span> 尺寸(CM/厘米) <span style="font-size:14px;color:red">输入格式: 长 * 宽</span>
</p> </p>
<div class="layui-form-item"> <div class="layui-form-item roll">
<input type="text" placeholder="格式:长*宽" name="size" id="size" class="layui-input" lay-verify="required" <input type="text" placeholder="格式:长*宽" name="size" id="size" class="layui-input" autocomplete="off">
autocomplete="off"> </div>
<div class="layui-form-item sealant">
<select name="size">
<option value="8*2">8*2cm</option>
<option value="9*2">9*2cm</option>
<option value="10*2">10*2cm</option>
</select>
</div> </div>
<p>数量(个)</p> <p>数量(个)</p>
<div class="layui-form-item"> <div class="layui-form-item roll">
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="count" autocomplete="off" class="layui-input" placeholder="数量"> <input type="text" name="count" autocomplete="off" class="layui-input" placeholder="数量">
</div> </div>
</div> </div>
<div class="layui-form-item sealant">
<select name="count">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
<option value="5000">5000</option>
<option value="10000">10000</option>
<option value="20000">20000</option>
<option value="50000">50000</option>
<option value="100000">100000</option>
</select>
</div>
<p>款数</p> <p>款数</p>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
@@ -75,25 +97,35 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block check"> <div class="layui-input-block check">
<span style="float:left;margin-top:10px">覆膜 </span> <span style="float:left;margin-top:10px">覆膜 </span>
<input type="checkbox" name="craft" class="fm" lay-filter="switch" value="覆膜" title="覆膜"> <span class="roll">
<input type="checkbox" name="craft" class="fm" lay-filter="switch" value="覆膜" title="覆膜"> <input type="checkbox" name="craft" class="fm" lay-filter="switch" value="覆膜" title="覆膜">
<input type="checkbox" name="craft" class="fm" lay-filter="switch" value="大雪花镭射膜" title="大雪花镭射膜"> <input type="checkbox" name="craft" class="fm" lay-filter="switch" value="覆哑膜" title="覆哑膜">
<input type="checkbox" name="craft" class="fm" lay-filter="switch" value="大雪花镭射膜" title="大雪花镭射膜">
</span>
<span class="sealant">
<input type="checkbox" name="craft" class="fm" lay-filter="switch" value="覆亮膜" title="覆亮膜" checked>
</span>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item roll">
<span style="float:left;margin-top:10px">白墨 </span> <span style="float:left;margin-top:10px">白墨 </span>
<input type="checkbox" class="yb" name="yinbai" lay-filter="switch" value="印白" title="印白"> <input type="checkbox" class="yb" name="yinbai" lay-filter="switch" value="印白" title="印白">
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item roll">
<span style="float:left;margin-top:10px">烫金 </span> <span style="float:left;margin-top:10px">烫金 </span>
<input type="checkbox" class="tang" name="craftTang" lay-filter="switch" value="烫金" title="烫金"> <input type="checkbox" class="tang" name="craftTang" lay-filter="switch" value="烫金" title="烫金">
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<span style="float:left;margin-top:10px">卷芯 </span> <span style="float:left;margin-top:10px">卷芯 </span>
<input type="radio" class="jc" name="jx" lay-filter="switch" value="7.5cm" title="7.5cm" <span class="roll">
checked="checked"/> <input type="radio" class="jc" name="jx" lay-filter="switch" value="7.5cm" title="7.5cm"
<input type="radio" class="jc" name="jx" lay-filter="switch" value="4cm" title="4cm"/> checked="checked"/>
<input type="radio" class="jc" name="jx" lay-filter="switch" value="3cm" title="3cm"/> <input type="radio" class="jc" name="jx" lay-filter="switch" value="4cm" title="4cm"/>
<input type="radio" class="jc" name="jx" lay-filter="switch" value="3cm" title="3cm"/>
</span>
<span class="sealant">
<input type="radio" class="jc" name="jx" lay-filter="switch" value="2.5cm" title="2.5cm"/>
</span>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<span style="float:left;margin-top:10px">出标方向 </span> <span style="float:left;margin-top:10px">出标方向 </span>
@@ -102,7 +134,6 @@
<input type="radio" class="cb" name="cb" lay-filter="switch" value="左出标" title="左出标"/> <input type="radio" class="cb" name="cb" lay-filter="switch" value="左出标" title="左出标"/>
<input type="radio" class="cb" name="cb" lay-filter="switch" value="右出标" title="右出标"/> <input type="radio" class="cb" name="cb" lay-filter="switch" value="右出标" title="右出标"/>
</div> </div>
<hr>
<hr class="layui-bg-orange"> <hr class="layui-bg-orange">
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn" lay-submit="" lay-filter="acount_btn">计算</button> <button class="layui-btn" lay-submit="" lay-filter="acount_btn">计算</button>
@@ -141,7 +172,11 @@
layui.use(['table', 'form'], function () { layui.use(['table', 'form'], function () {
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功 var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
var table = layui.table; var table = layui.table;
$(".sealant").hide();
$(".sealant").find("input").attr("disabled", true);
$(".sealant").find("select").attr("disabled", true);
$("input[name='yinbai']").attr("disabled", true);
form.render()
form.on('select(kindValue)', function (data) { form.on('select(kindValue)', function (data) {
// 中间三个可以印白 // 中间三个可以印白
if (data.value == 3 || data.value == 4 || data.value == 5) { if (data.value == 3 || data.value == 4 || data.value == 5) {
@@ -182,9 +217,41 @@
}); });
}) })
form.on("radio(kind)", function (data) {
let html = ` <option value="0">格底铜板纸卷标</option>
<option value="1">格底PP合成纸</option>
<option value="2">8丝光白PVC</option>
<option value="3">5丝格底透明</option>
<option value="4">格底哑银 / 亮银</option>
<option value="5">格底银平光</option>
<option value="6">单防热敏纸(底纸白色)</option>
<option value="7">三防热敏纸(底纸蓝色)</option>`
$(".sealant").hide();
$(".sealant").find("input").attr("disabled", true);
$(".sealant").find("select").attr("disabled", true);
$(".roll").hide();
$(".roll").find("input").attr("disabled", true);
if (data.value == "卷标") {
$(".roll").show();
$(".roll").find("input").attr("disabled", false);
$("input[name='jx'][value='7.5cm']").click()
}
if (data.value == "封口贴") {
html = ` <option value="0">格底铜板纸卷标</option>`
$(".sealant").show();
$(".sealant").find("input").attr("disabled", false);
$(".sealant").find("select").attr("disabled", false);
$("input[name='jx'][value='2.5cm']").click()
}
$("input[name='yinbai']").attr("disabled", true);
$("#kindValue").empty().append(html);
form.render()
})
form.on('checkbox(switch)', function (data) { form.on('checkbox(switch)', function (data) {
// 亮膜哑膜只能选一个 // 亮膜哑膜只能选一个
var moLen = $(".fm:checked").length; var moLen = $(".fm:checked:not(:disabled)").length;
if (moLen > 1) { if (moLen > 1) {
$(data.elem).next().attr("class", "layui-unselect layui-form-checkbox"); $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
$(data.elem).prop("checked", false); $(data.elem).prop("checked", false);
@@ -199,6 +266,7 @@
3: "5丝格底透明", 4: "格底哑银 / 亮银", 5: "格底银平光", 3: "5丝格底透明", 4: "格底哑银 / 亮银", 5: "格底银平光",
6: "单防热敏纸(底纸白色)", 7: "三防热敏纸(底纸蓝色)" 6: "单防热敏纸(底纸白色)", 7: "三防热敏纸(底纸蓝色)"
}; };
var type = $("input[name='kind']:checked").val();
var kind = kindData[$("#kindValue").val()]; var kind = kindData[$("#kindValue").val()];
var size = $("#size").val(); var size = $("#size").val();
var number = $("#number").val(); var number = $("#number").val();
@@ -215,16 +283,22 @@
yinbai.push($(this).val()); yinbai.push($(this).val());
} }
}); });
if ((size.split("*")[0] > 42 || size.split("*")[1] > 38) && (size.split("*")[0] > 38 || size.split("*")[1] > 42)) { if (type == "封口贴") {
layer.msg("卷装标签尺寸不能超过42*38 cm", {offset: ['300px', '300px']}, function () { size = $("select[name='size'] option:selected").val()
});
return false;
} }
if ((size.split("*")[0] < 2 || size.split("*")[1] < 2)) { if (type == "卷标") {
layer.msg("卷装标签尺寸小于2*2 cm 请单独报价!", {offset: ['300px', '300px']}, function () { if ((size.split("*")[0] > 42 || size.split("*")[1] > 38) && (size.split("*")[0] > 38 || size.split("*")[1] > 42)) {
}); layer.msg("卷装标签尺寸不能超过42*38 cm", {offset: ['300px', '300px']}, function () {
return false; });
return false;
}
if ((size.split("*")[0] < 2 || size.split("*")[1] < 2)) {
layer.msg("卷装标签尺寸小于2*2 cm 请单独报价!", {offset: ['300px', '300px']}, function () {
});
return false;
}
} }
$.ajax({ $.ajax({
url: "${path}/getThanSum", url: "${path}/getThanSum",
type: "GET", type: "GET",
@@ -240,23 +314,23 @@
let craft_list = []; let craft_list = [];
if ($("#kindValue").val() == 0) { if ($("#kindValue").val() == 0) {
jx = $("input[name='jx']:checked").val(); jx = $("input[name='jx']:checked").val();
span_result = kind + ' - ' + size + ' 厘米 -卷芯直径' + $("input[name='jx']:checked").val() + '出标方向' + $("input[name='cb']:checked").val() + '(同款内容)\n' + '款数 : ' + number + '\n'; span_result = kind + ' - ' + size + ' 厘米 -卷芯直径' + $("input[name='jx']:checked:not(:disabled)").val() + '出标方向' + $("input[name='cb']:checked:not(:disabled)").val() + '(同款内容)\n' + '款数 : ' + number + '\n';
} else { } else {
span_result = kind + ' - ' + size + ' 厘米 -(同款内容)\n' + '款数 : ' + number + '\n'; span_result = kind + ' - ' + size + ' 厘米 -(同款内容)\n' + '款数 : ' + number + '\n';
} }
let fm = $("input[name='craft']:checked").val(); let fm = $("input[name='craft']:checked:not(:disabled)").val();
if (!!fm) { if (!!fm) {
craft_list.push(fm); craft_list.push(fm);
} }
let yb = $("input[name='yinbai']:checked").val(); let yb = $("input[name='yinbai']:checked:not(:disabled)").val();
if (!!yb) { if (!!yb) {
craft_list.push(yb); craft_list.push(yb);
} }
let craftTang = $("input[name='craftTang']:checked").val(); let craftTang = $("input[name='craftTang']:checked:not(:disabled)").val();
if (!!craftTang) { if (!!craftTang) {
craft_list.push(craftTang); craft_list.push(craftTang);
} }
if(craft_list.length > 0){ if (craft_list.length > 0) {
span_result += "工艺:" + craft_list.join(",") + '\n'; span_result += "工艺:" + craft_list.join(",") + '\n';
} }
if (number > 1) { if (number > 1) {
@@ -271,9 +345,9 @@
} }
} }
span_result += '包邮,免费设计呢~(偏远地区需补邮费)' span_result += '包邮,免费设计呢~(偏远地区需补邮费)'
if(window.parent.system_isGai){ if (window.parent.system_isGai) {
span_result +="\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!" span_result += "\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!"
} }
addLog(span_result); addLog(span_result);
$("#span_result").val(span_result); $("#span_result").val(span_result);