Cette révision appartient à :
2025-12-26 17:40:15 +08:00
Parent d622d5b937
révision 8e1d6b5185
4 fichiers modifiés avec 456 ajouts et 9 suppressions
+111 -2
Voir le fichier
@@ -8,6 +8,7 @@ import lingtao.net.dao.ProductMapper;
import lingtao.net.dao.QuoteLogMapper; import lingtao.net.dao.QuoteLogMapper;
import lingtao.net.util.*; import lingtao.net.util.*;
import lingtao.net.vo.FunReturnVo; import lingtao.net.vo.FunReturnVo;
import org.apache.commons.collections.map.HashedMap;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -2978,7 +2979,7 @@ public class ProductService {
designFee = 50; designFee = 50;
designFee9 = 60; designFee9 = 60;
} else { } else {
designFee = 80; designFee = 50;
designFee9 = 80; designFee9 = 80;
} }
if ("腰封".equals(dto.getKind())) { if ("腰封".equals(dto.getKind())) {
@@ -4788,12 +4789,111 @@ public class ProductService {
return getPlasticBagPrice(dto, width, length); return getPlasticBagPrice(dto, width, length);
case "纸碗": case "纸碗":
return getPaperBowlPrice(dto, width, length); return getPaperBowlPrice(dto, width, length);
case "挂画":
return getWallPaintingPrice(dto, width, length);
default: default:
break; break;
} }
return null; return null;
} }
private List<Product> getWallPaintingPrice(Product dto, Double width, Double length) {
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();
double[][] prices = {
{45, 45, 55, 75},
{40, 40, 45, 65}
};
double area = length * width / 10000;
double price = 0, dj = 0;
double craft_price = 0;
int index = 0;
String product_weight = "";
Map<String, Double> craft_weight_map = new HashMap<>();
craft_weight_map.put("30", 0.055);
craft_weight_map.put("40", 0.08);
craft_weight_map.put("50", 0.095);
craft_weight_map.put("60", 0.12);
craft_weight_map.put("70", 0.14);
craft_weight_map.put("80", 0.16);
craft_weight_map.put("90", 0.18);
craft_weight_map.put("100", 0.2);
long key = Math.round(length);
if ("贡缎布".equals(dto.getKind())) {
index = 1;
}
if ("30*50".equals(dto.getSize())) {
dj = prices[index][0];
price = Math.ceil(count * dj);
} else if ("50*80".equals(dto.getSize())) {
dj = prices[index][1];
price = Math.ceil(count * dj);
} else if ("60*100".equals(dto.getSize())) {
dj = prices[index][2];
price = Math.ceil(count * dj);
} else if ("80*120".equals(dto.getSize())) {
dj = prices[index][3];
price = Math.ceil(count * dj);
} else {
if ("贡缎布".equals(dto.getKind())) {
if (area < 0.25) {
dj = 40;
} else {
dj = 35;
}
area *= count;
price = Math.max(Math.ceil(area * dj), 40);
}
if ("帆布".equals(dto.getKind())) {
dto.setStickerKind("");
priceList = new PriceUtils().getFbPrice(dto, number, width, length, count, priceList);
}
Map<String, Double> craft_price_map = new HashMap<>();
craft_price_map.put("30", 5.0);
craft_price_map.put("40", 6.0);
craft_price_map.put("50", 7.0);
craft_price_map.put("60", 8.0);
craft_price_map.put("70", 9.0);
craft_price_map.put("80", 10.0);
craft_price_map.put("90", 11.0);
craft_price_map.put("100", 12.0);
if (craft_price_map.containsKey(String.valueOf(key))) {
craft_price = craft_price_map.get(String.valueOf(key));
if (craft_price > 0) {
craft_price = Math.ceil(craft_price * count * number);
}
}
}
if (price > 0) {
Product pro = new Product();
pro.setCount(count);
pro.setPrice(price * number);
priceList.add(pro);
}
if (craft_weight_map.containsKey(String.valueOf(key))) {
double weight = craft_weight_map.get(String.valueOf(key));
if ("贡缎布".equals(dto.getKind())) {
product_weight = (df.format(0.165 * length * width * count / 10000 * number + weight * count * number));
}
if ("帆布".equals(dto.getKind())) {
product_weight = (df.format(length * width * count / 10000 * 0.28 * number + weight * count * number));
}
}
for (Product product : priceList) {
product.setPrice(product.getPrice() + craft_price);
product.setWeight(product_weight);
}
return priceList;
}
private List<Product> getPaperBowlPrice(Product dto, Double width, Double length) { private List<Product> getPaperBowlPrice(Product dto, Double width, Double length) {
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
List<Product> priceList = new ArrayList<>(); List<Product> priceList = new ArrayList<>();
@@ -5197,18 +5297,26 @@ public class ProductService {
int number = dto.getNumber(); int number = dto.getNumber();
//布钱 +人工+印刷+手提 //布钱 +人工+印刷+手提
Product pro = null; Product pro = null;
double lastPrice = 0;
for (int i = 0; i < counts.length; i++) { for (int i = 0; i < counts.length; i++) {
int itemCount = counts[i]; int itemCount = counts[i];
double basePrice = unit_prices[base][i];
if (itemCount < count) { if (itemCount < count) {
lastPrice = basePrice;
continue; continue;
} }
if (priceList.size() > 2) { if (priceList.size() > 2) {
break; break;
} }
if (priceList.size() == 0 && itemCount != count) { if (priceList.size() == 0 && itemCount != count) {
if (lastPrice > 0) {
basePrice = (lastPrice + basePrice) / 2;
}
pro = new Product(); pro = new Product();
pro.setCount(count); pro.setCount(count);
pro.setPrice(Math.ceil(unit_prices[base][i] * count * number)); pro.setPrice(Math.ceil(basePrice * count * number));
priceList.add(pro); priceList.add(pro);
} }
pro = new Product(); pro = new Product();
@@ -5216,6 +5324,7 @@ public class ProductService {
pro.setPrice(Math.ceil(unit_prices[base][i] * itemCount * number)); pro.setPrice(Math.ceil(unit_prices[base][i] * itemCount * number));
pro.setWeight(df.format(width * length * 1.8 * itemCount / 10000)); pro.setWeight(df.format(width * length * 1.8 * itemCount / 10000));
priceList.add(pro); priceList.add(pro);
lastPrice = basePrice;
} }
return priceList; return priceList;
+4 -5
Voir le fichier
@@ -2485,16 +2485,16 @@ public class PriceUtils {
double area = length * width / 10000; double area = length * width / 10000;
double price = 0, dj = 0; double price = 0, dj = 0;
if (area < 0.25) { if (area < 0.25) {
dj = 50;
} else {
dj = 40; dj = 40;
} else {
dj = 35;
} }
area *= count; area *= count;
if ("6".equals(kind2)) { if ("6".equals(kind2)) {
price = price + 30; price = price + 30;
} }
price = Math.ceil(area * dj > 58 ? area * dj : 58); price = Math.ceil(area * dj > 40 ? area * dj : 40);
pro.setCount(count); pro.setCount(count);
pro.setPrice(price * number); pro.setPrice(price * number);
list.add(pro); list.add(pro);
@@ -3075,12 +3075,11 @@ public class PriceUtils {
Product pro = new Product(); Product pro = new Product();
double price = 0, dj = 0; double price = 0, dj = 0;
String[] craft = dto.getCraft(); String[] craft = dto.getCraft();
if (dto.getStickerKind().equals("套餐")) { if ("套餐".equals(dto.getStickerKind())) {
pro.setCount(count); pro.setCount(count);
pro.setPrice(198.0); pro.setPrice(198.0);
list.add(pro); list.add(pro);
} else { } else {
double area = length * width * count / 10000; double area = length * width * count / 10000;
double d = length * width * count / 10000; double d = length * width * count / 10000;
if (length == 100 && width == 45) { if (length == 100 && width == 45) {
-2
Voir le fichier
@@ -234,8 +234,6 @@
<option value="黑底玫红字">黑底玫红字</option> <option value="黑底玫红字">黑底玫红字</option>
<option value="绿底黑字">绿底黑字</option> <option value="绿底黑字">绿底黑字</option>
<option value="黑底绿字">黑底绿字</option> <option value="黑底绿字">黑底绿字</option>
<option value="橙底黑字">橙底黑字</option>
<option value="黑底橙子">黑底橙子</option>
`; `;
} }
if (kind == '3') { if (kind == '3') {
+341
Voir le fichier
@@ -0,0 +1,341 @@
<%@ 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>
<option value="帆布">帆布</option>
<option value="贡缎布">贡缎布</option>
</select>
</div>
<p>
尺寸(CM/厘米) <span style="font-size: 14px; color: red">备注提示:默认宽度的尺寸固定木轴,备注方式统一宽度*高度</span>
<span>
<input type="checkbox" name="switchSize" lay-filter="switchSize" title="自定义尺寸">
</span>
</p>
<div class="layui-form-item">
<select name="size" id="size" class="layui-form-select">
<option value="30*50">30*50</option>
<option value="50*80">50*80</option>
<option value="60*100">60*100</option>
<option value="80*120">80*120</option>
</select>
</div>
<div class="layui-form-item" style="display: none">
<p>
宽幅
</p>
<select name="width" id="width" class="layui-form-select" lay-filter="widthSwitch">
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
<option value="70">70</option>
<option value="80">80</option>
<option value="90">90</option>
<option value="100">100</option>
</select>
<p>
</p>
<input type="text" name="length" id="length" lay-filter="lengthChange" placeholder="格式:长" class="layui-input" autocomplete="off">
<input type="text" name="size" id="diySize" disabled style="display:none;">
</div>
<p>
数量(个)
</p>
<div class="layui-form-item">
<input type="text" name="count" id="count" placeholder="请输入整数" class="layui-input" autocomplete="off">
</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="粘钩">
<input type="checkbox" name="craft" lay-filter="ui_craft" value="钉钩" title="钉钩">
</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 = " ";
const carft_list1 = ["粘钩", "钉钩"];
// 清空轮播图
$("#carousel").empty();
$("#remark").empty();
$(".ui_feb").show();
$(".ui_feb select").attr("disabled", false);
$.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("select(widthSwitch)", function (data) {
setDiySize()
})
$("#length").change((data) => {
setDiySize()
})
function setDiySize() {
let diySize = $("#width").val() + "*" + $("#length").val()
console.log(diySize)
$("#diySize").val(diySize)
}
form.on('checkbox(switchSize)', function (data) {
$("#diySize").parent().hide()
$("#size").parent().show()
$("#size").attr("disabled", false);
$("#diySize").attr("disabled", true);
if (data.elem.checked) {
$("#diySize").parent().show()
$("#size").parent().hide()
$("#size").attr("disabled", true);
$("#diySize").attr("disabled", false);
}
form.render();
})
form.on('checkbox(ui_craft)', function (data) {
let craft_list = [];
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 == 0) {
// $(data.elem).prop("checked", true);
// layer.msg("印面工艺不能取消", {offset: ['300px', '300px']}, function () {
// });
// form.render();
// return false;
// }
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;
}
form.render();
})
// 点击计算,计算价格
form.on('submit(acount_btn)', function (data) {
var number = $("#number").val();
var size = $("#size option:selected").val();
var count = $("#count").val();
var kind = $("select[name='kind'] option:selected").text();
var craft = [];
if ($("input[name='switchSize']").is(":checked")) {
size = $("#diySize").val();
}
if (size == "") {
layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () {
});
return false;
}
$("input:checkbox[name='craft']:checked").each(function (i) {
// 没有被禁用的工艺加到arr中
if (!$(this).is(':disabled')) {
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;
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 += '包邮,免费设计呢~(偏远地区需补邮费)'
$("#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>