新增鼠标垫
This commit is contained in:
@@ -3009,6 +3009,11 @@ public class ProductService {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ("直角卡片".equals(dto.getKind()) && ((width > 42 && length > 28.5) || (width > 28.5 && length > 42))) {
|
||||||
|
for (Product product : priceList) {
|
||||||
|
product.setPrice(Math.max(Math.ceil(product.getPrice() * 0.85), fixPrice + designFee));
|
||||||
|
}
|
||||||
|
}
|
||||||
if ("1".equals(dto.getKindValue())) {
|
if ("1".equals(dto.getKindValue())) {
|
||||||
// 给产品加上重量 扣除出血的4毫米
|
// 给产品加上重量 扣除出血的4毫米
|
||||||
for (Product product : priceList) {
|
for (Product product : priceList) {
|
||||||
@@ -4747,12 +4752,108 @@ public class ProductService {
|
|||||||
return getTakeoutBoxPrice(dto, width, length);
|
return getTakeoutBoxPrice(dto, width, length);
|
||||||
case "方巾纸":
|
case "方巾纸":
|
||||||
return getHandkerPrice(dto, width, length);
|
return getHandkerPrice(dto, width, length);
|
||||||
|
case "鼠标垫":
|
||||||
|
return getMousePadPrice(dto, width, length);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Product> getMousePadPrice(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 miniPrice = 55;
|
||||||
|
double rate = 1;
|
||||||
|
|
||||||
|
String kind = dto.getKind();
|
||||||
|
int[] counts = {5, 10, 20, 30, 50, 100, 200};
|
||||||
|
double[] areas = {100, 400, 900, 1600, 2500, 3600, 4900, 6400, 8100, 10000, 20000, 30000, 45000};
|
||||||
|
double[][] prices = {
|
||||||
|
{10, 10, 10, 16, 24, 35, 47, 61, 70, 90, 180, 280, 400},
|
||||||
|
{4.7, 5, 8.75, 15, 23, 32, 44, 57.5, 71, 89, 175, 260, 350},
|
||||||
|
{2.35, 3.7, 7.8, 13, 21, 29, 40, 52, 65, 81, 160, 240, 340},
|
||||||
|
{1.5, 3.2, 6.8, 11, 18, 26, 35, 46, 55, 71, 142, 212, 317},
|
||||||
|
{0.8, 2.8, 6.06, 10.5, 16, 23, 31, 40, 50, 60, 126, 188, 280},
|
||||||
|
{0.7, 2.5, 5.44, 9.5, 14, 20, 28.3, 36.8, 46, 58, 113, 169, 254},
|
||||||
|
{0.63, 2.27, 4.9, 8.6, 13, 18, 25, 33, 40, 52, 100, 150, 230},
|
||||||
|
};
|
||||||
|
if ("3".equals(kind)) {
|
||||||
|
prices = new double[][]{
|
||||||
|
{11, 11, 11, 17.6, 26.4, 38.5, 51.7, 67.1, 77, 99, 198, 308, 440},
|
||||||
|
{5.17, 5.5, 9.625, 16.5, 25.3, 35.2, 48.4, 63.25, 78.1, 97.9, 192.5, 286, 385},
|
||||||
|
{2.585, 4.07, 8.58, 14.3, 23.1, 31.9, 44, 57.2, 71.5, 89.1, 176, 264, 374},
|
||||||
|
{1.65, 3.52, 7.48, 12.1, 19.8, 28.6, 38.5, 50.6, 60.5, 78.1, 156.2, 233.2, 348.7},
|
||||||
|
{0.88, 3.08, 6.666, 11.55, 17.6, 25.3, 34.1, 44, 55, 66, 138.6, 206.8, 308},
|
||||||
|
{0.77, 2.75, 5.984, 10.45, 15.4, 22, 31.13, 40.48, 50.6, 63.8, 124.3, 185.9, 279.4},
|
||||||
|
{0.693, 2.497, 5.39, 9.46, 14.3, 19.8, 27.5, 36.3, 44, 57.2, 110, 165, 253},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ("4".equals(kind)) {
|
||||||
|
prices = new double[][]{
|
||||||
|
{12.1, 12.1, 12.1, 19.36, 29.04, 42.35, 56.87, 73.81, 84.7, 108.9, 217.8, 338.8, 484},
|
||||||
|
{5.687, 6.05, 10.5875, 18.15, 27.83, 38.72, 53.24, 69.575, 85.91, 107.69, 211.75, 314.6, 423.5},
|
||||||
|
{2.8435, 4.477, 9.438, 15.73, 25.41, 35.09, 48.4, 62.92, 78.65, 98.01, 193.6, 290.4, 411.4},
|
||||||
|
{1.815, 3.872, 8.228, 13.31, 21.78, 31.46, 42.35, 55.66, 66.55, 85.91, 171.82, 256.52, 383.57},
|
||||||
|
{0.968, 3.388, 7.3326, 12.705, 19.36, 27.83, 37.51, 48.4, 60.5, 72.6, 152.46, 227.48, 338.8},
|
||||||
|
{0.847, 3.025, 6.5824, 11.495, 16.94, 24.2, 34.243, 44.528, 55.66, 70.18, 136.73, 204.49, 307.34},
|
||||||
|
{0.7623, 2.7467, 5.929, 10.406, 15.73, 21.78, 30.25, 39.93, 48.4, 62.92, 121, 181.5, 278.3},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ("5".equals(kind)) {
|
||||||
|
prices = new double[][]{
|
||||||
|
{13.2, 13.2, 13.2, 20.9, 31.9, 46.2, 62.7, 81.4, 93.5, 119.9, 239.8, 372.9, 532.4},
|
||||||
|
{6.05, 6.6, 12.1, 19.8, 30.8, 42.9, 58.3, 77, 94.6, 118.8, 233.2, 346.5, 466.4},
|
||||||
|
{3.08, 4.4, 9.9, 17.6, 27.5, 38.5, 52.8, 69.3, 86.9, 107.8, 213.4, 319, 452.1},
|
||||||
|
{1.98, 4.4, 8.8, 14.3, 24.2, 34.1, 46.2, 61.6, 73.7, 94.6, 189.2, 282.7, 422.4},
|
||||||
|
{0.99, 3.3, 7.7, 14.3, 20.9, 30.8, 41.8, 52.8, 67.1, 80.3, 167.2, 249.7, 372.9},
|
||||||
|
{0.88, 3.3, 7.7, 12.1, 18.7, 26.4, 37.4, 49.5, 61.6, 77, 150.7, 224.4, 337.7},
|
||||||
|
{0.88, 3.3, 6.6, 11, 17.6, 24.2, 33, 44, 52.8, 69.3, 133.1, 200.2, 305.8},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//不锁边97折
|
||||||
|
if (craft_list.contains("不锁边")) {
|
||||||
|
rate = 0.97;
|
||||||
|
}
|
||||||
|
if (craft_list.contains("异形模切")) {
|
||||||
|
rate = 1.35;
|
||||||
|
}
|
||||||
|
double unitPrice = 0;
|
||||||
|
Product pro = new Product();
|
||||||
|
for (int i = 0; i < counts.length; i++) {
|
||||||
|
int itemCount = counts[i];
|
||||||
|
unitPrice = PriceUtils.TableDoublePrice(width * length, prices[i], areas);
|
||||||
|
if (itemCount < count) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (priceList.size() > 2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (priceList.size() == 0 && itemCount != count) {
|
||||||
|
pro = new Product();
|
||||||
|
pro.setCount(count);
|
||||||
|
pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice));
|
||||||
|
pro.setNumber(number);
|
||||||
|
priceList.add(pro);
|
||||||
|
}
|
||||||
|
pro = new Product();
|
||||||
|
pro.setCount(itemCount);
|
||||||
|
pro.setPrice(Math.max(Math.ceil(unitPrice * itemCount * rate), miniPrice));
|
||||||
|
pro.setNumber(number);
|
||||||
|
priceList.add(pro);
|
||||||
|
}
|
||||||
|
if (priceList.size() == 0) {
|
||||||
|
pro = new Product();
|
||||||
|
pro.setCount(count);
|
||||||
|
pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice));
|
||||||
|
pro.setNumber(number);
|
||||||
|
priceList.add(pro);
|
||||||
|
}
|
||||||
|
return priceList;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Product> getHandkerPrice(Product dto, Double width, Double length) {
|
private List<Product> getHandkerPrice(Product dto, Double width, Double length) {
|
||||||
List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
List<String> carft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||||
List<Product> priceList = new ArrayList<>();
|
List<Product> priceList = new ArrayList<>();
|
||||||
@@ -4772,6 +4873,13 @@ public class ProductService {
|
|||||||
{0, 0, 340, 450, 570, 684, 798, 912, 1026, 1040},
|
{0, 0, 340, 450, 570, 684, 798, 912, 1026, 1040},
|
||||||
{0, 0, 350, 460, 810, 972, 1134, 1296, 1458, 1780},
|
{0, 0, 350, 460, 810, 972, 1134, 1296, 1458, 1780},
|
||||||
};
|
};
|
||||||
|
if ("双色".equals(dto.getShen_color())) {
|
||||||
|
prices = new double[][]{
|
||||||
|
{0, 0, 0, 0, 625, 720, 840, 960, 1080, 1200},
|
||||||
|
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{0, 0, 0, 0, 875, 1020, 1190, 1280, 1350, 1450},
|
||||||
|
};
|
||||||
|
}
|
||||||
Product pro = new Product();
|
Product pro = new Product();
|
||||||
|
|
||||||
for (int i = 0; i < counts.length; i++) {
|
for (int i = 0; i < counts.length; i++) {
|
||||||
|
|||||||
@@ -3631,6 +3631,26 @@ public class PriceUtils {
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double TableDoublePrice(double area, double[] price_list, double[] areas) {
|
||||||
|
double price = 0;
|
||||||
|
int startIndex = 0;
|
||||||
|
int endIndex = 0;
|
||||||
|
for (int i = 0; i < areas.length; i++) {
|
||||||
|
if (area > areas[i]) {
|
||||||
|
startIndex = endIndex;
|
||||||
|
endIndex = Math.min(i + 1, areas.length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (startIndex == endIndex && startIndex == 0) {
|
||||||
|
price = price_list[endIndex];
|
||||||
|
} else if (startIndex == endIndex) {
|
||||||
|
price = (price_list[endIndex] / areas[endIndex]) * area;
|
||||||
|
} else {
|
||||||
|
price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) {
|
public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) {
|
||||||
double price = 0;
|
double price = 0;
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
|
|||||||
@@ -3403,7 +3403,7 @@
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (type == 1) {
|
if (!switchz3Size && type == 1) {
|
||||||
if (arr.indexOf("圆角") == -1 && arr.indexOf("直角") == -1) {
|
if (arr.indexOf("圆角") == -1 && arr.indexOf("直角") == -1) {
|
||||||
layer.msg("圆角,直角必选 无法报价", {offset: ['300px', '300px']}, function () {
|
layer.msg("圆角,直角必选 无法报价", {offset: ['300px', '300px']}, function () {
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,6 +38,12 @@
|
|||||||
<option value="27*27">27*27cm</option>
|
<option value="27*27">27*27cm</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<input type="radio" name="shen_color" lay-filter="colorType" title="单色" value="单色" checked>
|
||||||
|
<span>
|
||||||
|
<input type="radio" name="shen_color" lay-filter="colorType" title="双色" value="双色">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
印刷颜色
|
印刷颜色
|
||||||
</p>
|
</p>
|
||||||
@@ -52,6 +58,20 @@
|
|||||||
<option value="黄色">黄色</option>
|
<option value="黄色">黄色</option>
|
||||||
<option value="红色">红色</option>
|
<option value="红色">红色</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" style="display: none">
|
||||||
|
<select id="colorT" name="craft" class="layui-form-select" disabled>
|
||||||
|
<option value="黑色">黑色</option>
|
||||||
|
<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>
|
<p>
|
||||||
数量(箱)
|
数量(箱)
|
||||||
@@ -166,15 +186,25 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
form.on('select(pcount_filter)', function (data) {
|
form.on('select(pcount_filter)', function (data) {
|
||||||
if (data.value == 1) {
|
$("input[name='shen_color'][value='单色']").click();
|
||||||
$("#size").val("12.8*10.5*6.5")
|
$("input[name='shen_color'][value='双色']").parent().show();
|
||||||
|
$("input[name='shen_color'][value='双色']").attr("disabled", false);
|
||||||
|
$("#colorT").parent().hide();
|
||||||
|
$("#colorT").attr("disabled", true)
|
||||||
|
if (data.value == '23*23') {
|
||||||
|
$("input[name='shen_color'][value='双色']").parent().hide();
|
||||||
|
$("input[name='shen_color'][value='双色']").attr("disabled", true);
|
||||||
}
|
}
|
||||||
if (data.value == 3) {
|
form.render();
|
||||||
$("#size").val("21.5*16*6.5")
|
})
|
||||||
}
|
form.on("radio(colorType)", function (data) {
|
||||||
if (data.value == 5) {
|
$("#colorT").parent().hide();
|
||||||
$("#size").val("16.5*13.5*5")
|
$("#colorT").attr("disabled", true)
|
||||||
|
if (data.value == '双色') {
|
||||||
|
$("#colorT").parent().show();
|
||||||
|
$("#colorT").attr("disabled", false)
|
||||||
}
|
}
|
||||||
|
form.render();
|
||||||
})
|
})
|
||||||
form.on('checkbox(ui_craft)', function (data) {
|
form.on('checkbox(ui_craft)', function (data) {
|
||||||
let craft_list = [];
|
let craft_list = [];
|
||||||
@@ -204,7 +234,13 @@
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
craft.push($("select[name='craft'] option:selected").val());
|
$("select[name='craft']").each(function (i) {
|
||||||
|
// 没有被禁用的工艺加到arr中
|
||||||
|
if (!$(this).is(':disabled')) {
|
||||||
|
craft.push($(this).find("option:selected").val());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||||
// 没有被禁用的工艺加到arr中
|
// 没有被禁用的工艺加到arr中
|
||||||
if (!$(this).is(':disabled')) {
|
if (!$(this).is(':disabled')) {
|
||||||
@@ -220,12 +256,25 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (size == "23*23" || size == "27*27") {
|
if (size == "23*23" || size == "27*27") {
|
||||||
if(count < 3){
|
if (count < 3) {
|
||||||
layer.msg("23*23、27*27尺寸3箱起做", {offset: ['300px', '300px']}, function () {
|
layer.msg("23*23、27*27尺寸3箱起做", {offset: ['300px', '300px']}, function () {
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let colorType = $("input[name='shen_color']:checked").val();
|
||||||
|
if (size == "23*23" || size == "27*27") {
|
||||||
|
if (count < 3) {
|
||||||
|
layer.msg("23*23、27*27尺寸3箱起做", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (colorType == "双色" && count < 5) {
|
||||||
|
layer.msg("双色5箱起做", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "${path}/getThanSum",
|
url: "${path}/getThanSum",
|
||||||
|
|||||||
@@ -0,0 +1,373 @@
|
|||||||
|
<%@ 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="2">2mm</option>
|
||||||
|
<option value="3">3mm</option>
|
||||||
|
<option value="4">4mm</option>
|
||||||
|
<option value="5">5mm</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
尺寸(CM/厘米) <span style="font-size: 14px; color: red">输入格式: 长 * 宽</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="21*26">21*26</option>
|
||||||
|
<option value="25*30">25*30</option>
|
||||||
|
<option value="30*70">30*70</option>
|
||||||
|
<option value="30*80">30*80</option>
|
||||||
|
<option value="40*90">40*90</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" style="display: none">
|
||||||
|
<input type="text" name="size" id="diySize" 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" 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="单面" checked>
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
裁切工艺:
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="圆角" title="圆角" checked>
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="异形模切" title="异形模切">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-input-block">
|
||||||
|
锁边工艺:
|
||||||
|
<span>
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="锁边" title="锁边" checked>
|
||||||
|
</span>
|
||||||
|
<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 = ["单面", "双面"];
|
||||||
|
|
||||||
|
const carft_list2 = ["圆角", "异形模切"];
|
||||||
|
|
||||||
|
const carft_list3 = ["锁边", "不锁边"];
|
||||||
|
|
||||||
|
// 清空轮播图
|
||||||
|
$("#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('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 carft2 = carft_list2.filter(craft => craft_list.includes(craft));
|
||||||
|
if (carft2.length > 1) {
|
||||||
|
$(data.elem).prop("checked", false);
|
||||||
|
layer.msg("裁切工艺不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const carft3 = carft_list3.filter(craft => craft_list.includes(craft));
|
||||||
|
if (carft3.length > 1) {
|
||||||
|
$(data.elem).prop("checked", false);
|
||||||
|
layer.msg("锁边工艺不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$("input[name='craft'][value='锁边']").parent().show();
|
||||||
|
$("input[name='craft'][value='锁边']").attr("disabled", false)
|
||||||
|
if (craft_list.includes("异形模切")) {
|
||||||
|
$("input[name='craft'][value='锁边']").prop("checked", false);
|
||||||
|
$("input[name='craft'][value='不锁边']").prop("checked", true);
|
||||||
|
$("input[name='craft'][value='锁边']").parent().hide();
|
||||||
|
$("input[name='craft'][value='锁边']").attr("disabled", true)
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if ((size.split("*")[0] > 300 || size.split("*")[1] > 150) && (size.split("*")[1] > 300 || size.split("*")[0] > 150)) {
|
||||||
|
layer.msg('最大尺寸300*150cm!', {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((size.split("*")[0] < 10 || size.split("*")[1] < 10)) {
|
||||||
|
layer.msg('最小尺寸10*10cm!', {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||||
|
// 没有被禁用的工艺加到arr中
|
||||||
|
if (!$(this).is(':disabled')) {
|
||||||
|
craft.push($(this).val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const carft1 = carft_list1.filter(item => craft.includes(item));
|
||||||
|
if (carft1.length == 0) {
|
||||||
|
layer.msg("请选择印面工艺", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const carft2 = carft_list2.filter(item => craft.includes(item));
|
||||||
|
if (carft2.length == 0) {
|
||||||
|
layer.msg("请选择裁切工艺", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const carft3 = carft_list3.filter(item => craft.includes(item));
|
||||||
|
if (carft3.length == 0) {
|
||||||
|
layer.msg("请选择锁边工艺", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.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>
|
||||||
Reference in New Issue
Block a user