新增滴胶转印贴
This commit is contained in:
@@ -4469,12 +4469,50 @@ public class ProductService {
|
||||
case "地垫":
|
||||
priceList = getFloorMatPrice(dto, width, length, height);
|
||||
return chucklePrice(role, priceList, dto);
|
||||
case "滴胶转印贴":
|
||||
priceList = getDippingPrice(dto, width, length, height);
|
||||
return chucklePrice(role, priceList, dto);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Product> getDippingPrice(Product dto, Double width, Double length, Double height) {
|
||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
|
||||
int count = dto.getCount();
|
||||
int number = dto.getNumber();
|
||||
|
||||
int max_width = 290;
|
||||
int max_length = 400;
|
||||
width = width * 10 + 4;
|
||||
length = length * 10 + 4;
|
||||
double max = 1;
|
||||
|
||||
if (length == max_width + 4 || length == max_length + 4 || width == max_width + 4 || width == max_length + 4) {
|
||||
max = Math.max(Math.floor(max_width / (length - 4)) * Math.floor(max_length / (width - 4)), Math.floor(max_width / (width - 4)) * Math.floor(max_length / (length - 4)));
|
||||
} else {
|
||||
max = Math.max(Math.floor(max_width / length) * Math.floor(max_length / width), Math.floor(max_width / width) * Math.floor(max_length / length));
|
||||
}
|
||||
max = Math.max(max, 1);
|
||||
// 报的数量需要多少张大纸
|
||||
// 需要多少张大纸 = 数量 * 款数 /每张做多少个 ===总数量/每张多少个
|
||||
double num = Math.ceil(count * number / max);
|
||||
|
||||
int[] counts = {1, 2, 3, 10, 50, 100, 200, 300, 400, 500};
|
||||
double[] prices = {233.4, 233.4, 257.2, 857.2, 3500, 4000, 5000, 7500, 10000, 12500};
|
||||
|
||||
double price = new PriceUtils().TableCountCenterPrice((int) num, prices, counts);
|
||||
double design_price = number * 8;
|
||||
Product pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(price) + design_price);
|
||||
priceList.add(pro);
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private List<Product> getFloorMatPrice(Product dto, Double width, Double length, Double height) {
|
||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
@@ -9861,6 +9899,38 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("异形模切")) {// 200-500张按照原有的价格乘以3倍 1000-5000张按照原有的价格乘以2.4倍 5000-10000张按照原有的价格乘以2倍
|
||||
double[] prices = {1560, 1720, 2320, 5840, 8520, 9680, 12900};
|
||||
int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000};
|
||||
int num = getNum(width, length);
|
||||
double[][] prices_area = {
|
||||
{112, 152, 208, 376, 552, 888, 1328},
|
||||
{200, 280, 380, 688, 1000, 1620, 2420},
|
||||
{272, 376, 500, 912, 1320, 2140, 3100},
|
||||
{328, 448, 600, 1088, 1576, 2440, 3600},
|
||||
{380, 520, 696, 1260, 1832, 2740, 4100},
|
||||
{480, 640, 880, 1520, 2040, 3200, 4800},
|
||||
{600, 760, 1040, 2000, 2760, 3920, 5700},
|
||||
{720, 880, 1200, 2480, 3480, 4640, 6600},
|
||||
{840, 1000, 1360, 2960, 4200, 5360, 7500},
|
||||
{960, 1120, 1520, 3440, 4920, 6080, 8400},
|
||||
{1080, 1240, 1680, 3920, 5640, 6800, 9300},
|
||||
{1200, 1360, 1840, 4400, 6360, 7520, 10200},
|
||||
{1320, 1480, 2000, 4880, 7080, 8240, 11100},
|
||||
{1440, 1600, 2160, 5360, 7800, 8960, 12000},
|
||||
};
|
||||
if (num < 15) {
|
||||
prices = prices_area[num - 1];
|
||||
}
|
||||
for (Product product : priceList) {
|
||||
for (int i = 0; i < counts.length; i++) {
|
||||
if (counts[i] == product.getCount()) {
|
||||
product.setPrice(prices[i] * dto.getNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (craftList.contains("压痕")) {
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(Math.ceil(product.getPrice() + Math.max(0.03 * product.getCount(), 20)));
|
||||
@@ -10051,38 +10121,7 @@ public class ProductService {
|
||||
product.setPrice(Math.ceil(product.getPrice() + (0.05 * product.getCount() > 50 ? 0.05 * product.getCount() : 50)));
|
||||
}
|
||||
}
|
||||
if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("异形模切")) {// 200-500张按照原有的价格乘以3倍 1000-5000张按照原有的价格乘以2.4倍 5000-10000张按照原有的价格乘以2倍
|
||||
double[] prices = {1560, 1720, 2320, 5840, 8520, 9680, 12900};
|
||||
int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000};
|
||||
int num = getNum(width, length);
|
||||
double[][] prices_area = {
|
||||
{112, 152, 208, 376, 552, 888, 1328},
|
||||
{200, 280, 380, 688, 1000, 1620, 2420},
|
||||
{272, 376, 500, 912, 1320, 2140, 3100},
|
||||
{328, 448, 600, 1088, 1576, 2440, 3600},
|
||||
{380, 520, 696, 1260, 1832, 2740, 4100},
|
||||
{480, 640, 880, 1520, 2040, 3200, 4800},
|
||||
{600, 760, 1040, 2000, 2760, 3920, 5700},
|
||||
{720, 880, 1200, 2480, 3480, 4640, 6600},
|
||||
{840, 1000, 1360, 2960, 4200, 5360, 7500},
|
||||
{960, 1120, 1520, 3440, 4920, 6080, 8400},
|
||||
{1080, 1240, 1680, 3920, 5640, 6800, 9300},
|
||||
{1200, 1360, 1840, 4400, 6360, 7520, 10200},
|
||||
{1320, 1480, 2000, 4880, 7080, 8240, 11100},
|
||||
{1440, 1600, 2160, 5360, 7800, 8960, 12000},
|
||||
};
|
||||
if (num < 15) {
|
||||
prices = prices_area[num - 1];
|
||||
}
|
||||
for (Product product : priceList) {
|
||||
for (int i = 0; i < counts.length; i++) {
|
||||
if (counts[i] == product.getCount()) {
|
||||
product.setPrice(prices[i] * dto.getNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (craftList.contains("异形")) {// 广告扇工艺(选了异形,每把+3毛钱
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(Math.ceil(product.getPrice() + 0.3 * product.getCount()));
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
<%@include file="/views/common.jsp" %>
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
#z4_craft .layui-form-select .layui-edge {
|
||||
right: 20px;
|
||||
}
|
||||
</style>
|
||||
<div class="big_box">
|
||||
<div class="left_div">
|
||||
<h1 class="h1">滴胶转印贴</h1> <span style="color:red;font-weight:700;"></span>
|
||||
<hr>
|
||||
<form class="layui-form">
|
||||
<input type="hidden" name="proTypeValue" id="proTypeValue" class="layui-input" value="滴胶转印贴"/>
|
||||
<p>
|
||||
材质
|
||||
</p>
|
||||
<div class="layui-form-item">
|
||||
<select name="kind" class="select" lay-search lay-filter="kind">
|
||||
<option value="滴胶">滴胶</option>
|
||||
</select>
|
||||
</div>
|
||||
<p>
|
||||
尺寸(CM/厘米)
|
||||
</p>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<input type="text" name="size" id="size" placeholder="格式:长*宽" class="layui-input" autocomplete="off">
|
||||
</div>
|
||||
<p>
|
||||
数量(个)
|
||||
</p>
|
||||
<div class="layui-form-item">
|
||||
<input type="text" name="count" id="count" placeholder="请输入整数" class="layui-input">
|
||||
</div>
|
||||
<p>
|
||||
款数
|
||||
</p>
|
||||
<div class="layui-form-item">
|
||||
<input type="text" placeholder="请输入整数" autocomplete="off" name="number" id="number" value="1" class="layui-input" lay-verify="number">
|
||||
</div>
|
||||
<p>
|
||||
客户旺旺
|
||||
</p>
|
||||
<div class="layui-form-item">
|
||||
<input type="text" placeholder="请输入客户旺旺号" autocomplete="off" name="wangwang" id="wangwang" class="layui-input">
|
||||
</div>
|
||||
<p>
|
||||
工艺
|
||||
</p>
|
||||
<div class="layui-form-item" id='z4_craft'>
|
||||
<div class="layui-input-block ">
|
||||
印面:
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="单面" title="单面" checked>
|
||||
</div>
|
||||
<div class="layui-input-block ">
|
||||
裁切:
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="模切" title="模切" checked>
|
||||
</div>
|
||||
<div class="layui-input-block ">
|
||||
底色:
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="透明底" title="透明底" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="抠图" title="抠图">
|
||||
<div class="layui-inline crop" style="display:none;width: 80px">
|
||||
<input class="layui-input" type="text" name="cropNumber">
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" lay-submit="" lay-filter="acount_btn">计算</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
<h2>计算结果-
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm copyResult"
|
||||
onclick="copyResult()">点击复制
|
||||
</button>
|
||||
</h2>
|
||||
<div>
|
||||
<textarea rows="11" cols="75" id="span_result" readonly="readonly"></textarea>
|
||||
<%@include file="../acountExpressFee.jsp" %>
|
||||
</div>
|
||||
<div>
|
||||
<table class="layui-hide" id="priceTable" lay-filter="priceTable"></table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="right_div" style="margin-left:50px;">
|
||||
<div class="layui-carousel" id="test1">
|
||||
<div carousel-item id="carousel"></div>
|
||||
<br>
|
||||
<div id="remark" style="font-size:20px;color:red"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<%@include file="/views/copyResult.jsp" %>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'carousel'], function () {
|
||||
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
|
||||
var carousel = layui.carousel;
|
||||
var table = layui.table;
|
||||
|
||||
//建造实例
|
||||
ins = carousel.render({});
|
||||
var html = " ";
|
||||
var remark = " ";
|
||||
|
||||
// 清空轮播图
|
||||
$("#carousel").empty();
|
||||
$("#remark").empty();
|
||||
|
||||
$.ajax({
|
||||
url: "${pageContext.request.contextPath}/getImgs",
|
||||
type: "GET",
|
||||
data: {
|
||||
proTypeValue: $("#proTypeValue").val(),
|
||||
kindValue: $('input[name="kindValue"]').val()
|
||||
},
|
||||
success: function (result) {
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
// 只留一个remark
|
||||
remark = "";
|
||||
html += '<div><img style="width:100%;height: 100%;object-fit: contain" src="' + result[i].imgUrl + '"></div>';
|
||||
remark += '<div><span>' + result[i].remark + '<span/></div>';
|
||||
}
|
||||
$("#carousel").append(html);
|
||||
// 如果没有说明,就不显示null
|
||||
if (remark.indexOf("null") < 0) {
|
||||
$("#remark").append(remark);
|
||||
}
|
||||
// 如果没有轮播图就隐藏
|
||||
if (result.length == 0) {
|
||||
document.getElementById("test1").style.display = "none"; //隐藏
|
||||
} else {
|
||||
document.getElementById("test1").style.display = "block"; //显示
|
||||
ins.reload({
|
||||
elem: '#test1',
|
||||
width: result[0].imgWidth, //设置容器宽度
|
||||
height: result[0].imgHeight
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
form.on('checkbox(ui_craft)', function (data) {
|
||||
let craft_list = [];
|
||||
$("input[name='craft']:checked").each(function () {
|
||||
if (!$(this).is(':disabled')) {
|
||||
craft_list.push($(this).val());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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 () {
|
||||
});
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
if (!craft_list.includes("透明底")) {
|
||||
$(data.elem).prop("checked", true);
|
||||
layer.msg("底色工艺无法取消选择", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
form.render();
|
||||
})
|
||||
|
||||
// 点击计算,计算价格
|
||||
form.on('submit(acount_btn)', function (data) {
|
||||
var number = $("#number").val();
|
||||
var size = $("#size").val();
|
||||
var count = $("#count").val();
|
||||
var kind = $("select[name='kind'] option:selected").text();
|
||||
var kindValue = $("select[name='kindValue'] option:selected").text();
|
||||
var craft = [];
|
||||
|
||||
if (size == "") {
|
||||
layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// if ((size.split("*")[0] < 11 || size.split("*")[1] < 11) && (size.split("*")[0] < 11 || size.split("*")[1] < 11)) {
|
||||
// layer.msg('最小尺寸不能小于11*11cm!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if ((size.split("*")[0] > 29 || size.split("*")[1] > 40) && (size.split("*")[0] > 40 || size.split("*")[1] > 29)) {
|
||||
layer.msg("最大尺寸不能超过29*40cm", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||
// 没有被禁用的工艺加到arr中
|
||||
if (!$(this).is(':disabled')) {
|
||||
if ($(this).val() == "抠图") {
|
||||
craft.push($(this).val() + $("input[name='cropNumber']").val());
|
||||
return;
|
||||
} else {
|
||||
craft.push($(this).val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "${path}/getThanSum",
|
||||
type: "GET",
|
||||
data: $(".big_box form").serialize(),
|
||||
success: function (result) {
|
||||
if (result.code == 100) {
|
||||
layer.msg(result.msg, {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
var data = result.data.proList;
|
||||
|
||||
let kind = $("select[name='kind'] option:selected").val();
|
||||
|
||||
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'
|
||||
data[i].number = number;
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
span_result += number + '款 ' + data[i].count + "个,共" + data[i].price + "元" + '\n'
|
||||
data[i].number = number;
|
||||
}
|
||||
}
|
||||
|
||||
span_result += '包邮,免费设计呢~(偏远地区需补邮费)'
|
||||
if (window.parent.system_isGai) {
|
||||
span_result += "\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!"
|
||||
}
|
||||
addLog(span_result);
|
||||
$("#span_result").val(span_result);
|
||||
|
||||
//计算完自动复制文本
|
||||
var e = document.getElementById("span_result");//对象是content
|
||||
if (e.value != "") {
|
||||
e.select();//选择对象
|
||||
document.execCommand("Copy");//执行浏览器复制命令
|
||||
}
|
||||
|
||||
//生成表格
|
||||
table.render({
|
||||
elem: '#priceTable',
|
||||
even: true, //隔行变色
|
||||
data: data, // 赋值已知数据
|
||||
width: 500,
|
||||
cols: [[
|
||||
{
|
||||
field: 'number',
|
||||
width: '12%',
|
||||
align: "center",
|
||||
title: '款数'
|
||||
}, {
|
||||
field: 'count',
|
||||
width: '16%',
|
||||
align: "center",
|
||||
title: '数量'
|
||||
}, {
|
||||
field: 'price',
|
||||
width: '16%',
|
||||
align: "center",
|
||||
title: '报价'
|
||||
}, {
|
||||
field: 'wangwang',
|
||||
align: "center",
|
||||
width: '16%',
|
||||
title: '折扣价'
|
||||
}, {
|
||||
field: 'wangwang',
|
||||
align: "center",
|
||||
width: '19%',
|
||||
title: '跳楼价'
|
||||
}, {
|
||||
field: 'weight',
|
||||
width: '21%',
|
||||
align: "center",
|
||||
title: '重量(kg)'
|
||||
}
|
||||
]],
|
||||
done: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user