新增封口贴

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)) {
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) {
product.setPrice(Math.floor(product.getPrice() * number));
@@ -645,7 +645,7 @@ public class ProductService {
case "2":
// 单个产品的面积
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) {
product.setPrice(Math.floor(product.getPrice() * number));
+37 -7
View File
@@ -27,9 +27,33 @@ public class PriceUtils {
* @param yinbai
* @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>();
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;
// 印工价格
@@ -281,8 +305,9 @@ public class PriceUtils {
// 换成毫米每边+2
length = length * 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;
}
// 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -332,8 +357,9 @@ public class PriceUtils {
// 换成毫米每边+2
length = length * 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;
}
// 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -1328,8 +1354,9 @@ public class PriceUtils {
width = width * 10 + 2 * 1.5;
// 数量*款数就是张数
// count = count * number;
if ((length > l || width > w) && (length > w || width > l))
if ((length > l || width > w) && (length > w || width > l)) {
return null;
}
// 一张大纸29*19cm 能做多少个此类尺寸的金属标
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -1998,8 +2025,9 @@ public class PriceUtils {
width = width * 10 + 2 * 1.5;
// 数量*款数就是张数
count = count * number;
if ((length > l || width > w) && (length > w || width > l))
if ((length > l || width > w) && (length > w || width > l)) {
return null;
}
// 一张大纸45*40cm 能做多少个此类尺寸的桌贴
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -2100,8 +2128,9 @@ public class PriceUtils {
width = width * 10 + 2 * 3;
// 数量 * 款数就是张数
count = count * number;
if ((length > l || width > w) && (length > w || width > l))
if ((length > l || width > w) && (length > w || width > l)) {
return null;
}
// 一张大纸420*380mm 能做多少个此类尺寸的桌贴
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -3305,8 +3334,9 @@ public class PriceUtils {
String kind = dto.getKind2Value();
length = length * 10;
width = width * 10;
if ((length > l || width > w) && (length > w || width > l))
if ((length > l || width > w) && (length > w || width > l)) {
return null;
}
// 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
+91 -17
View File
@@ -23,12 +23,16 @@
<hr>
<form class="layui-form">
<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>
<div class="layui-form-item">
<select name="kindValue" id="kindValue" lay-filter="kindValue" class="select">
<option value=""></option>
<option value="0">格底铜板纸卷标</option>
<option value="1">格底PP合成纸</option>
<option value="2">8丝光白PVC</option>
@@ -42,16 +46,34 @@
<p>
尺寸(CM/厘米) <span style="font-size:14px;color:red">输入格式: 长 * 宽</span>
</p>
<div class="layui-form-item">
<input type="text" placeholder="格式:长*宽" name="size" id="size" class="layui-input" lay-verify="required"
autocomplete="off">
<div class="layui-form-item roll">
<input type="text" placeholder="格式:长*宽" name="size" id="size" class="layui-input" 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>
<p>数量(个)</p>
<div class="layui-form-item">
<div class="layui-form-item roll">
<div class="layui-input-block">
<input type="text" name="count" autocomplete="off" class="layui-input" placeholder="数量">
</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>
<div class="layui-form-item">
<div class="layui-input-block">
@@ -75,25 +97,35 @@
<div class="layui-form-item">
<div class="layui-input-block check">
<span style="float:left;margin-top:10px">覆膜 </span>
<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="大雪花镭射膜">
</span>
<span class="sealant">
<input type="checkbox" name="craft" class="fm" lay-filter="switch" value="覆亮膜" title="覆亮膜" checked>
</span>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item roll">
<span style="float:left;margin-top:10px">白墨 </span>
<input type="checkbox" class="yb" name="yinbai" lay-filter="switch" value="印白" title="印白">
</div>
<div class="layui-form-item">
<div class="layui-form-item roll">
<span style="float:left;margin-top:10px">烫金 </span>
<input type="checkbox" class="tang" name="craftTang" lay-filter="switch" value="烫金" title="烫金">
</div>
<div class="layui-form-item">
<span style="float:left;margin-top:10px">卷芯 </span>
<span class="roll">
<input type="radio" class="jc" name="jx" lay-filter="switch" value="7.5cm" title="7.5cm"
checked="checked"/>
<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 class="layui-form-item">
<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="右出标"/>
</div>
<hr>
<hr class="layui-bg-orange">
<div class="layui-form-item">
<button class="layui-btn" lay-submit="" lay-filter="acount_btn">计算</button>
@@ -141,7 +172,11 @@
layui.use(['table', 'form'], function () {
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
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) {
// 中间三个可以印白
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) {
// 亮膜哑膜只能选一个
var moLen = $(".fm:checked").length;
var moLen = $(".fm:checked:not(:disabled)").length;
if (moLen > 1) {
$(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
$(data.elem).prop("checked", false);
@@ -199,6 +266,7 @@
3: "5丝格底透明", 4: "格底哑银 / 亮银", 5: "格底银平光",
6: "单防热敏纸(底纸白色)", 7: "三防热敏纸(底纸蓝色)"
};
var type = $("input[name='kind']:checked").val();
var kind = kindData[$("#kindValue").val()];
var size = $("#size").val();
var number = $("#number").val();
@@ -215,6 +283,10 @@
yinbai.push($(this).val());
}
});
if (type == "封口贴") {
size = $("select[name='size'] option:selected").val()
}
if (type == "卷标") {
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 () {
});
@@ -225,6 +297,8 @@
});
return false;
}
}
$.ajax({
url: "${path}/getThanSum",
type: "GET",
@@ -240,23 +314,23 @@
let craft_list = [];
if ($("#kindValue").val() == 0) {
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 {
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) {
craft_list.push(fm);
}
let yb = $("input[name='yinbai']:checked").val();
let yb = $("input[name='yinbai']:checked:not(:disabled)").val();
if (!!yb) {
craft_list.push(yb);
}
let craftTang = $("input[name='craftTang']:checked").val();
let craftTang = $("input[name='craftTang']:checked:not(:disabled)").val();
if (!!craftTang) {
craft_list.push(craftTang);
}
if(craft_list.length > 0){
if (craft_list.length > 0) {
span_result += "工艺:" + craft_list.join(",") + '\n';
}
if (number > 1) {
@@ -271,8 +345,8 @@
}
}
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);