新增杯垫盛大

This commit is contained in:
2026-07-10 09:56:48 +08:00
parent b5f9823175
commit a984fce392
4 changed files with 625 additions and 245 deletions
@@ -4545,7 +4545,7 @@ public class ProductService {
basePrice = 22;
basePrice = new PriceUtils().calcByTargetN(5000, 24, 10000, 22, num);
} else {
basePrice = 20*num;
basePrice = 20 * num;
//basePrice = new PriceUtils().calcByTargetN(10000, 20, 10000, 20, num);
}
double craftPrice = 0;
@@ -5119,6 +5119,7 @@ public class ProductService {
}
rate = 1.2;
}
List<String> sdList = Arrays.asList("14", "15", "16", "17", "18", "19", "20");
// 300克
if ("3".equals(kind)) {
// 异形模切价格
@@ -5222,6 +5223,123 @@ public class ProductService {
priceList.add(pro);
return priceList;
} else if (sdList.contains(dto.getKindValue())) {
ShengDaPriceNoPartsRequstVo requstVo = new ShengDaPriceNoPartsRequstVo();
requstVo.setProductCategory("BEIDIAN");
requstVo.setWidth(width * 10);
requstVo.setHeight(length * 10);
requstVo.setSizeUnit("MM");
requstVo.setNum(count);
requstVo.setStyleNum(number);
requstVo.setSize(dto.getNotePaperKind());
requstVo.setPrintSide(1);
List<ShengDaPriceRequstItemVo> craft = new ArrayList<>();
boolean isMO = true;
double base_rate = 0;
double min_pirce = 80;
double[] rate_list = {0.75, 0.72, 0.70, 0.68, 0.65, 0.60, 0.58, 0.55, 0.50};
int[] counts = {200, 400, 600, 800, 1000, 2000, 3000, 5000, 10000};
double maxRate = 0.48;
if ("14".equals(dto.getKindValue())) {
requstVo.setPaper("250克吸水棉纸");
if ("90*90圆形".equals(requstVo.getSize())) {
isMO = false;
}
if ("90*90方形".equals(requstVo.getSize())) {
isMO = false;
}
if ("90*90花边".equals(requstVo.getSize())) {
isMO = false;
}
if ("100*100圆形".equals(requstVo.getSize())) {
isMO = false;
}
}
if ("15".equals(dto.getKindValue())) {
requstVo.setPaper("450克瑞典棉卡");
}
if ("16".equals(dto.getKindValue())) {
requstVo.setPaper("500克吸水棉纸");
}
if ("17".equals(dto.getKindValue())) {
requstVo.setPaper("980克吸水杯垫");
}
if ("18".equals(dto.getKindValue())) {
requstVo.setPaper("PU皮革杯垫");
isMO = false;
}
if ("19".equals(dto.getKindValue())) {
requstVo.setProductCategory("MAOZHANDIAN");
requstVo.setPaper("3MM毛毡");
isMO = false;
}
if ("20".equals(dto.getKindValue())) {
requstVo.setProductCategory("MAOZHANDIAN");
requstVo.setPaper("彩色毛毡");
isMO = false;
ShengDaPriceRequstItemVo item = new ShengDaPriceRequstItemVo();
item.setName("彩色毛毡");
item.setParameters(Collections.singletonMap("颜色", dto.getTcolor()));
craft.add(item);
}
if ("18".equals(dto.getKindValue()) || "19".equals(dto.getKindValue()) || "20".equals(dto.getKindValue())) {
rate_list = new double[]{0.70, 0.65, 0.60, 0.55, 0.50};
counts = new int[]{50, 100, 200, 500, 1000};
maxRate = 0.45;
}
if (craft_list.contains("双面")) {
requstVo.setPrintSide(2);
requstVo.setDoubleSideType("不同");
}
if (craft_list.contains("装OPP袋")) {
ShengDaPriceRequstItemVo item = new ShengDaPriceRequstItemVo();
item.setName("装OPP袋");
item.setParameters(Collections.singletonMap("类型", "平口袋"));
craft.add(item);
}
if (craft_list.contains("模切")) {
ShengDaPriceRequstItemVo item = new ShengDaPriceRequstItemVo();
item.setName("模切");
item.setParameters(Collections.singletonMap("类型", "圆形(仅模切外轮廓 "));
craft.add(item);
}
if (craft_list.contains("激光")) {
ShengDaPriceRequstItemVo item = new ShengDaPriceRequstItemVo();
item.setName("激光");
craft.add(item);
}
if (craft_list.contains("雕刻")) {
ShengDaPriceRequstItemVo item = new ShengDaPriceRequstItemVo();
item.setName("雕刻");
craft.add(item);
}
if (isMO) {
ShengDaPriceRequstItemVo item = new ShengDaPriceRequstItemVo();
item.setName("光油");
craft.add(item);
}
requstVo.setCrafts(craft);
ShengDaPriceResultVo result = ShengDaPriceUtils.getPrice(requstVo);
for (int i = 0; i < counts.length; i++) {
if (counts[i] < count) {
continue;
}
base_rate = rate_list[i];
break;
}
if (base_rate == 0) {
base_rate = maxRate;
}
double price = Math.ceil(result.getData().getPrice() / (1 - base_rate));
double designPrice = 0;
Product product = new Product();
product.setPrice(Math.ceil(Math.max(price, min_pirce) + designPrice));
product.setCount(dto.getCount());
product.setNumber(dto.getNumber());
priceList.add(product);
} else {
priceList = new PriceUtils().tags600Price(dto, kind, kind2, area, count);
// 服装吊牌里面的900克吊牌把价格*1.3倍
@@ -30,4 +30,12 @@ public class ShengDaPriceUtils {
return result;
}
public static ShengDaPriceResultVo getPrice(ShengDaPriceNoPartsRequstVo params) {
Map<String, String> heards = new HashMap<>();
heards.put("Authorization", "Bearer " + getToken());
String resultText = HttpUtils.sendPostRequest("https://open.sd2000.com/api/app/calculate", JSONObject.toJSONString(params), heards);
ShengDaPriceResultVo result = JSONObject.parseObject(resultText, ShengDaPriceResultVo.class);
return result;
}
}
@@ -0,0 +1,24 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.List;
@Data
public class ShengDaPriceNoPartsRequstVo {
private String productCategory;
private String paper;
private List<ShengDaPriceRequstItemVo> crafts;
private String name;
private String size;
private Integer num;
private String sizeUnit;
private String doubleSideType;
private Double height;
private Double width;
private Integer printSide;
private Integer styleNum;
}
+249 -19
View File
@@ -44,15 +44,25 @@
<hr>
<form class="layui-form">
<input type="hidden" name="proTypeValue" id="proTypeValue" class="layui-input" value="杯垫">
<input type="hidden" name="notePaperKind" class="layui-input">
<p>材质</p>
<div>
<!--<input type="radio" name="kindValue" lay-filter="kindValue" value="3" title="350克铜版纸" checked>-->
<input type="radio" name="kindValue" lay-filter="kindValue" value="6" title="600克铜版纸" checked>
<input type="radio" name="kindValue" lay-filter="kindValue" value="4" title="900克双胶纸">
<input type="radio" name="kindValue" lay-filter="kindValue" value="10" title="轻羽(1.5mm厚度)">
<input type="radio" name="kindValue" lay-filter="kindValue" value="11" title="简单1.0mm厚度)">
<input type="radio" name="kindValue" lay-filter="kindValue" value="12" title="透明PVC">
<input type="radio" name="kindValue" lay-filter="kindValue" value="13" title="香薰卡">
<select name="kindValue" lay-filter="kindValue">
<%-- <option title="350克铜版纸" value="3">350克铜版纸</option>--%>
<option title="900克双胶纸" value="4">900克双胶纸</option>
<option title="600克铜版纸" value="6">600克铜版纸</option>
<option title="轻羽(1.5mm厚度)" value="10">轻羽1.5mm厚度</option>
<option title="简单(1.0mm厚度)" value="11">简单(1.0mm厚度)</option>
<option title="透明PVC" value="12">透明PVC</option>
<option title="香薰卡" value="13">香薰卡</option>
<option title="250克吸水棉纸" value="14">250克吸水棉纸</option>
<option title="450克瑞典棉卡" value="15">450克瑞典棉卡</option>
<option title="500克吸水棉纸" value="16">500克吸水棉纸</option>
<option title="980克吸水棉纸" value="17">980克吸水棉纸</option>
<option title="PU皮革" value="18">PU皮革</option>
<option title="3MM毛毡" value="19">3MM毛毡</option>
<option title="彩色毛毡" value="20">彩色毛毡</option>
</select>
</div>
<div class="tagOther">
<div class="layui-form-item pvcCraft" style="display: none">
@@ -70,9 +80,13 @@
<p>
尺寸(CM/厘米) <span style="font-size: 14px; color: red">输入格式: 长 * 宽</span>
</p>
<div class="layui-form-item">
<input type="text" name="size" placeholder="格式:长*宽" id="size" class="layui-input"
autocomplete="off">
<div class="layui-form-item" id="diySize">
<input type="text" name="size" placeholder="格式:长*宽" id="size" class="layui-input" autocomplete="off">
</div>
<div class="layui-form-item" id="sdSize" style="display: none">
<select class="layui-select" name="size" disabled>
</select>
</div>
<p>
数量(张)
@@ -101,6 +115,9 @@
<div class="layui-form-item aromatherCraft" style="display: none">
<input type="text" name="count" placeholder="请输入整数" class="layui-input" autocomplete="off" disabled>
</div>
<div class="layui-form-item sdCraft" style="display: none">
<input type="text" name="count" placeholder="请输入整数" class="layui-input" autocomplete="off" disabled>
</div>
<p>款数</p>
<div class="layui-form-item">
<input type="text" placeholder="请输入整数" autocomplete="off"
@@ -148,6 +165,23 @@
<option value="无味">无味</option>
</select>
</div>
</div>
<div class="layui-form-item colorCraft" style="display: none">
<p>
颜色
</p>
<div class="layui-form-item">
<select name="tcolor" class="select">
<option value="蓝色">蓝色</option>
<option value="棕色">棕色</option>
<option value="红色">红色</option>
<option value="绿色">绿色</option>
<option value="黄色">黄色</option>
<option value="深灰">深灰</option>
<option value="浅灰">浅灰</option>
</select>
</div>
</div>
<p>
客户旺旺
@@ -328,6 +362,29 @@
</div>
</div>
</div>
<div class="layui-form-item sdCraft" id="sdCraft" style="display: none">
<p>
工艺
</p>
<div class="layui-input-block">
<span style="float:left;margin-top:10px">印面: </span>
<input type="checkbox" name="craft" lay-filter="sd_craft" value="单面" title="单面" checked/>
<input type="checkbox" name="craft" lay-filter="sd_craft" value="双面" title="双面"/>
</div>
<div class="layui-input-block qieCraft">
<span style="float:left;margin-top:10px">裁切: </span>
<input type="checkbox" name="craft" lay-filter="sd_craft" value="模切" title="模切" checked/>
</div>
<div class="layui-input-block colorCraft">
<span style="float:left;margin-top:10px">常见工艺: </span>
<input type="checkbox" name="craft" lay-filter="sd_craft" value="激光" title="激光" checked/>
<input type="checkbox" name="craft" lay-filter="sd_craft" value="雕刻" title="雕刻"/>
</div>
<div class="layui-input-block">
<span style="float:left;margin-top:10px">配件: </span>
<input type="checkbox" name="craft" lay-filter="sd_craft" value="装OPP袋" title="装OPP袋"/>
</div>
</div>
</div>
<div class="layui-input-block">
<input type="checkbox" name="craft" lay-filter="ui_craft" value="抠图" title="抠图">
@@ -369,8 +426,9 @@
layui.use(['table', 'form'], function () {
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
var table = layui.table;
let sdList = [14, 15, 16, 17, 18, 19, 20]
form.on('radio(kindValue)', function (kindValueData) {
form.on('select(kindValue)', function (kindValueData) {
$(".diycount").hide();
$(".diycount").find(":input").attr("disabled", true);
$(".diycount").find("select").attr("disabled", true);
@@ -380,6 +438,9 @@
$(".pvcCraft").hide();
$(".pvcCraft").find(":input").attr("disabled", true);
$(".pvcCraft").find("select").attr("disabled", true);
$(".sdCraft").hide();
$(".sdCraft").find(":input").attr("disabled", true);
$(".sdCraft").find("select").attr("disabled", true);
$(".aromatherCraft").hide();
$(".aromatherCraft").find(":input").attr("disabled", true);
$(".aromatherCraft").find("select").attr("disabled", true);
@@ -398,6 +459,12 @@
$("#color_type").hide();
$("#color_type").find("select").attr("disabled", true);
$("input[name='kind2Value'][value='无']").prop("checked", true);
$("#diySize").show();
$("#diySize").find(":input").attr("disabled", false);
$("#sdSize").hide();
$("#sdSize").find("select").attr("disabled", true);
if (kindValueData.value == 10 || kindValueData.value == 11) {
$(".fixcount").show();
$(".fixcount").find(":input").attr("disabled", false);
@@ -407,7 +474,7 @@
$(".pvcCraft").show();
$(".pvcCraft").find(":input").attr("disabled", false);
$(".pvcCraft").find("select").attr("disabled", false);
} else if (kindValueData.value != 13) {
} else if (kindValueData.value == 4 || kindValueData.value == 6) {
$(".diycount").show();
$(".diycount").find(":input").attr("disabled", false);
$(".diycount").find("select").attr("disabled", false);
@@ -442,6 +509,72 @@
$(".aromatherCraft").find(":input").attr("disabled", false);
$(".aromatherCraft").find("select").attr("disabled", false);
$(".pvcCraft")
} else if (sdList.includes(Number(kindValueData.value))) {
$("#diySize").hide();
$("#diySize").find("input").attr("disabled", true);
$("#sdSize").show();
$("#sdSize").find("select").attr("disabled", false);
$(".sdCraft").show();
$(".sdCraft").find("input").attr("disabled", false);
$(".sdCraft").find("select").attr("disabled", false);
$(".colorCraft").hide();
$(".colorCraft").find("select").attr("disabled", true);
$(".colorCraft").find("input").attr("disabled", true);
$(".qieCraft").hide();
$(".qieCraft").find("input").attr("disabled", true);
let html = `<option value="7*7">7*7圆形</option>
<option value="8*8">8*8圆形</option>
<option value="8.1*8.1">8.1*8.1圆形</option>
<option value="8.3*8.3">8.3*8.3圆形</option>
<option value="8.5*8.5">8.5*8.5圆形</option>
<option value="9*9">9*9圆形</option>
<option value="9*9">9*9方形</option>
<option value="9*9">9*9花边</option>
<option value="10*10">10*10圆形</option>
<option value="10*10">10*10方形</option>
<option value="10.5*10.5">10.5*10.5方形</option>
<option value="12*12">12*12圆形</option>
<option value="12*12">12*12方形</option>
<option value="13.8*13.8">13.8*13.8方形</option>
<option value="14*14">14*14圆形</option>`;
if (kindValueData.value == 15 || kindValueData.value == 16 || kindValueData.value == 17) {
html = `<option value="7*7">7*7圆形</option>
<option value="8*8">8*8圆形</option>
<option value="8.1*8.1">8.1*8.1圆形</option>
<option value="8.3*8.3">8.3*8.3圆形</option>
<option value="8.5*8.5">8.5*8.5圆形</option>
<option value="9*9">9*9圆形</option>
<option value="9*9">9*9方形</option>
<option value="10*10">10*10圆形</option>
<option value="10.5*10.5">10.5*10.5方形</option>
<option value="12*12">12*12圆形</option>
<option value="12*12">12*12方形</option>
<option value="13.8*13.8">13.8*13.8方形</option>
<option value="14*14">14*14圆形</option>`;
}
if (kindValueData.value == 18) {
html = ` <option value="10*10">10*10圆形</option>
<option value="10*10">10*10方形</option>`;
}
if (kindValueData.value == 19 || kindValueData.value == 20) {
html = ` <option value="9*9">9*9</option>
<option value="10*10">10*10</option>
<option value="11*11">11*11</option>`;
$(".qieCraft").show();
$(".qieCraft").find("input").attr("disabled", false);
}
$("#sdCraft input[name='craft'][value='双面']").attr("disabled", false);
if (kindValueData.value == 17 || kindValueData.value == 19 || kindValueData.value == 20) {
$("#sdCraft input[name='craft'][value='单面']").prop("checked", true);
$("#sdCraft input[name='craft'][value='双面']").prop("checked", false);
$("#sdCraft input[name='craft'][value='双面']").attr("disabled", true);
}
if (kindValueData.value == 20) {
$(".colorCraft").show();
$(".colorCraft").find("select").attr("disabled", false);
$(".colorCraft").find("input").attr("disabled", false);
}
$("#sdSize select").empty().append(html);
}
form.render();
@@ -523,7 +656,7 @@
let data = {proTypeValue: "杯垫"}
let remark = "";
let html = "";
let kindValue = $("input[name='kindValue']:checked").val();
let kindValue = $("select[name='kindValue'] option:selected").val();
if (!!kindValue) {
if (kindValue == 4 || kindValue == 6) {
kindValue = "铜版纸";
@@ -577,6 +710,43 @@
const carft_list4 = ["穿涤纶丝带", "穿吊牌绳", "穿弹力绳"];
const carft_list5 = ["配涤纶丝带", "配吊牌绳", "配弹力绳"];
const carft_list6 = ["激光", "雕刻"];
form.on('checkbox(sd_craft)', function (data) {
let craft_list = [];
let kindValue = $("select[name='kindValue'] option:selected").val();
craft_list.push($("select[name='craft'] option:selected").val());
$("input[name='craft']:checked").each(function () {
if (!$(this).is(':disabled')) {
craft_list.push($(this).val());
}
}
);
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;
}
if (!craft_list.includes("模切") && (kindValue == 19 || kindValue == 20)) {
$(data.elem).prop("checked", true);
layer.msg("裁切工艺不能取消选择", {offset: ['300px', '300px']}, function () {
});
form.render();
return false;
}
const carft6 = carft_list6.filter(craft => craft_list.includes(craft));
if (carft6.length > 1 && (kindValue == 19 || kindValue == 20)) {
$(data.elem).prop("checked", false);
layer.msg("常见工艺不能同时选择", {offset: ['300px', '300px']}, function () {
});
form.render();
return false;
}
})
form.on('checkbox(ui_craft)', function (data) {
let craft_list = [];
craft_list.push($("select[name='craft'] option:selected").val());
@@ -654,11 +824,21 @@
}
form.render();
})
function scaleSize(str, factor = 10) {
// 匹配所有数字(整数或小数,这里只考虑整数),将匹配到的数字乘以因子
return str.replace(/\d+(\.\d+)?/g, (match) => {
const num = parseFloat(match) * factor;
// 如果结果不是整数,保留原小数位数(或者直接返回 num 本身)
return Number.isInteger(num) ? num.toString() : num.toFixed(2);
});
}
// 点击计算,计算价格
form.on('submit(acount_btn)', function (data) {
// 选中‘自定义数量’
var kindValue = $('input[name="kindValue"]:checked').val();
var kindValue = $("select[name='kindValue'] option:selected").val();
var kind2Value = $('input[name="kind2Value"]:checked').val();
var craftQie = $('input[name="craftQie"]:checked').val();
var craftMo = $('input[name="craftMo"]:checked').val();
@@ -695,7 +875,6 @@
} else {
if ((size.split("*")[0] < 3 || size.split("*")[1] < 3)) {
$("#proTypeValue").val(3);
$("input[name='kindValue']:checked").val(0);
} else {
$("#proTypeValue").val("杯垫");
}
@@ -773,6 +952,48 @@
return false;
}
}
if (sdList.includes(Number(kindValue))) {
count = $("input[name='count']:not(:disabled)").val();
size = $("select[name='size']:not(:disabled) option:selected").val();
$("input[name='notePaperKind']").val(scaleSize($("#sdSize select option:selected").text()))
arr = [];
if (kindValue == "20") {
arr.push($("select[name='tcolor'] option:selected").val())
}
$("input:checkbox[name='craft']:checked").each(function (i) {
// 没有被禁用的工艺加到arr中
if (!$(this).is(':disabled')) {
if (carft_list4.indexOf($(this).val()) > -1) {
arr.push($(this).val() + $("#peijian_ui select[name='shen_color'] option:selected").val());
} else if ($(this).val() == "抠图") {
arr.push($(this).val() + $("input[name='cropNumber']").val());
return;
} else {
arr.push($(this).val());
}
}
});
if (arr.includes("装OPP袋")) {
if (size.split("*")[0] != 9 || size.split("*")[1] != 9) {
layer.msg("当工艺包含装OPP袋时,尺寸限于90*90圆形、90*90方形、90*90花边", {offset: ['300px', '300px']}, function () {
});
return false;
}
}
if (kindValue != "18" && kindValue != "19" && kindValue != "20") {
if (count % 200 != 0) {
layer.msg("数量大于等于200的且是200的倍数", {offset: ['300px', '300px']}, function () {
});
return false;
}
}
const carft6 = carft_list6.filter(craft => arr.includes(craft));
if (carft6.length == 0 && (kindValue == 20)) {
layer.msg("常见工艺必须选择", {offset: ['300px', '300px']}, function () {
});
return false;
}
}
kindValueData = {
3: "350克铜版纸",
6: "600克铜版纸",
@@ -780,7 +1001,14 @@
10: "轻羽",
11: "简单",
12: "透明PVC",
13: "香薰卡"
13: "香薰卡",
14: "250克吸水棉纸",
15: "450克瑞典棉卡",
16: "500克吸水棉纸",
17: "980克吸水棉纸",
18: "PU皮革",
19: "3MM毛毡",
20: "彩色毛毡",
};
$.ajax({
url: "${path}/getThanSum",
@@ -793,7 +1021,7 @@
return false;
}
var data = result.data.proList;
if ("无" != kind2Value) {
if ("无" != kind2Value && !$('input[name="kind2Value"]:checked').is(":disabled")) {
if (kind2Value == "击凸" || kind2Value == "压凹" || kind2Value == "单面烫金+压凹" || kind2Value == "单面烫金+击凸") {
arr.push(kind2Value + $("#color_type select[name='craft'] option:selected").val())
@@ -814,7 +1042,7 @@
let size1 = $("select[name='size1'] option:selected").val();
let craft_list = ['规格' + size1, craftQie, craftQieType];
span_result += "工艺: " + craft_list.join(",") + "\n";
} else if (kindValue == "13") {
} else if (kindValue == "13" || sdList.includes(Number(kindValue))) {
span_result += `工艺:` + arr.join(",") + '\n';
} else {
let aotu = $("input[name='aotu']:checked").val();
@@ -907,7 +1135,9 @@
}
});
return false;
});
}
)
;
});
</script>
</html>