zhuyiyi пре 6 дана
родитељ
комит
03c70c9598

+ 94 - 28
src/main/java/lingtao/net/service/ProductService.java

@@ -1447,7 +1447,7 @@ public class ProductService {
                 if (!"素芸".equals(kind) && (craft_list.contains("单面烫金") || craft_list.contains("双面烫金"))) {
                     int[] counts = new int[]{200, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000};
                     Map<String, int[]> prices = null;
-                    if (craft_list.contains("单面烫金") && !craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
+                    if (craft_list.contains("单面烫金") && !craft_list.contains("异形模切")) {
                         prices = new HashMap<>();
                         prices.put("萱姿", new int[]{257, 329, 500, 863, 1278, 1692, 2106, 2520, 2934, 3348, 3762, 4177});
                         prices.put("岚蝶", new int[]{229, 263, 354, 571, 846, 1121, 1377, 1645, 1913, 2181, 2449, 2720});
@@ -1460,7 +1460,7 @@ public class ProductService {
                         prices.put("芳怡", new int[]{455, 495, 957, 1691, 2365, 3195, 3777, 4431, 5085, 5739, 6939, 7048});
 
                     }
-                    if (craft_list.contains("双面烫金") && !craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
+                    if (craft_list.contains("双面烫金") && !craft_list.contains("异形模切")) {
                         prices = new HashMap<>();
                         prices.put("萱姿", new int[]{463, 592, 900, 1553, 2300, 3046, 3791, 4536, 5281, 6026, 6772, 7519});
                         prices.put("岚蝶", new int[]{412, 473, 637, 1028, 1523, 2018, 2479, 2961, 3443, 3926, 4408, 4896});
@@ -1473,32 +1473,32 @@ public class ProductService {
                         prices.put("芳怡", new int[]{755, 755, 1379, 2367, 3245, 4425, 5109, 5935, 6771, 7597, 8433, 9269});
 
                     }
-                    if (craft_list.contains("单面烫金") && craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
-                        prices = new HashMap<>();
-                        prices.put("萱姿", new int[]{368, 373, 647, 1187, 1560, 2010, 2385, 2731, 3078, 3425, 3771, 4117});
-                        prices.put("岚蝶", new int[]{355, 360, 484, 855, 1194, 1604, 1917, 2278, 2639, 3000, 3361, 3721});
-                        prices.put("皙贝", new int[]{355, 360, 484, 855, 1195, 1605, 1917, 2280, 2648, 3002, 3362, 3721});
-                        prices.put("琮纹", new int[]{355, 360, 484, 855, 1198, 1607, 1917, 2282, 2643, 3004, 3364, 3721});
-                        prices.put("睿狐", new int[]{355, 360, 484, 855, 1200, 1609, 1917, 2283, 2644, 3005, 3366, 3721});
-                        prices.put("溪雪", new int[]{368, 373, 547, 999, 1320, 1730, 2061, 2378, 2696, 3014, 3332, 3649});
-                        prices.put("玉蕊", new int[]{375, 380, 660, 1189, 1655, 2225, 2845, 3373, 3901, 4429, 4957, 5484});
-                        prices.put("金绒", new int[]{475, 480, 760, 1289, 1755, 2225, 2845, 3373, 3901, 4429, 4957, 5484});
-                        prices.put("芳怡", new int[]{546, 594, 1148, 2029, 2838, 3834, 4532, 5310, 6099, 6855, 7666, 8458});
-
-                    }
-                    if (craft_list.contains("双面烫金") && craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
-                        prices = new HashMap<>();
-                        prices.put("萱姿", new int[]{662, 671, 1165, 2137, 2808, 3618, 4293, 4916, 5540, 6165, 6800, 8200});
-                        prices.put("岚蝶", new int[]{639, 648, 871, 1539, 2149, 2887, 3451, 4100, 4750, 5400, 6050, 6698});
-                        prices.put("皙贝", new int[]{639, 648, 871, 1539, 2151, 2889, 3451, 4104, 4766, 5404, 6052, 6698});
-                        prices.put("琮纹", new int[]{639, 648, 871, 1539, 2156, 2893, 3451, 4108, 4757, 5407, 6055, 6698});
-                        prices.put("睿狐", new int[]{639, 648, 871, 1539, 2160, 2896, 3451, 4109, 4759, 5409, 6059, 6698});
-                        prices.put("溪雪", new int[]{662, 671, 985, 1798, 2376, 3114, 3710, 4280, 4853, 5425, 5998, 6568});
-                        prices.put("玉蕊", new int[]{675, 684, 1188, 2140, 2979, 4005, 5121, 6071, 7022, 7972, 8923, 9871});
-                        prices.put("金绒", new int[]{546, 594, 1148, 2029, 2838, 3834, 4532, 5310, 6099, 6855, 7666, 8458});
-                        prices.put("芳怡", new int[]{755, 755, 1379, 2367, 3245, 4425, 5109, 5935, 6771, 7597, 8433, 9269});
-
-                    }
+//                    if (craft_list.contains("单面烫金") && craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
+//                        prices = new HashMap<>();
+//                        prices.put("萱姿", new int[]{368, 373, 647, 1187, 1560, 2010, 2385, 2731, 3078, 3425, 3771, 4117});
+//                        prices.put("岚蝶", new int[]{355, 360, 484, 855, 1194, 1604, 1917, 2278, 2639, 3000, 3361, 3721});
+//                        prices.put("皙贝", new int[]{355, 360, 484, 855, 1195, 1605, 1917, 2280, 2648, 3002, 3362, 3721});
+//                        prices.put("琮纹", new int[]{355, 360, 484, 855, 1198, 1607, 1917, 2282, 2643, 3004, 3364, 3721});
+//                        prices.put("睿狐", new int[]{355, 360, 484, 855, 1200, 1609, 1917, 2283, 2644, 3005, 3366, 3721});
+//                        prices.put("溪雪", new int[]{368, 373, 547, 999, 1320, 1730, 2061, 2378, 2696, 3014, 3332, 3649});
+//                        prices.put("玉蕊", new int[]{375, 380, 660, 1189, 1655, 2225, 2845, 3373, 3901, 4429, 4957, 5484});
+//                        prices.put("金绒", new int[]{475, 480, 760, 1289, 1755, 2225, 2845, 3373, 3901, 4429, 4957, 5484});
+//                        prices.put("芳怡", new int[]{546, 594, 1148, 2029, 2838, 3834, 4532, 5310, 6099, 6855, 7666, 8458});
+//
+//                    }
+//                    if (craft_list.contains("双面烫金") && craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
+//                        prices = new HashMap<>();
+//                        prices.put("萱姿", new int[]{662, 671, 1165, 2137, 2808, 3618, 4293, 4916, 5540, 6165, 6800, 8200});
+//                        prices.put("岚蝶", new int[]{639, 648, 871, 1539, 2149, 2887, 3451, 4100, 4750, 5400, 6050, 6698});
+//                        prices.put("皙贝", new int[]{639, 648, 871, 1539, 2151, 2889, 3451, 4104, 4766, 5404, 6052, 6698});
+//                        prices.put("琮纹", new int[]{639, 648, 871, 1539, 2156, 2893, 3451, 4108, 4757, 5407, 6055, 6698});
+//                        prices.put("睿狐", new int[]{639, 648, 871, 1539, 2160, 2896, 3451, 4109, 4759, 5409, 6059, 6698});
+//                        prices.put("溪雪", new int[]{662, 671, 985, 1798, 2376, 3114, 3710, 4280, 4853, 5425, 5998, 6568});
+//                        prices.put("玉蕊", new int[]{675, 684, 1188, 2140, 2979, 4005, 5121, 6071, 7022, 7972, 8923, 9871});
+//                        prices.put("金绒", new int[]{546, 594, 1148, 2029, 2838, 3834, 4532, 5310, 6099, 6855, 7666, 8458});
+//                        prices.put("芳怡", new int[]{755, 755, 1379, 2367, 3245, 4425, 5109, 5935, 6771, 7597, 8433, 9269});
+//
+//                    }
                     if (craft_list.contains("单面烫金") && !craft_list.contains("圆角") && craft_list.contains("异形模切")) {
                         prices = new HashMap<>();
                         prices.put("萱姿", new int[]{463, 592, 900, 1553, 2300, 3046, 3791, 4536, 5281, 6026, 6772, 7519});
@@ -4889,12 +4889,78 @@ public class ProductService {
                 return getWireTapePrice(dto, width, length);
             case "包装纸":
                 return getWrappingPaper(dto, width, length);
+            case "撕撕乐":
+                return getTearingJoyPrice(dto, width, length);
             default:
                 break;
         }
         return null;
     }
 
+    private List<Product> getTearingJoyPrice(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();
+        int awards = dto.getAwards();
+        int[][] prices = {
+                {900, 900, 1000, 1000},
+                {950, 950, 1100, 1100},
+                {1022, 1023, 1200, 1200},
+                {1591, 1591, 1628, 1744},
+                {1932, 1932, 1977, 2093},
+                {2273, 2273, 2326, 2558},
+                {3409, 3409, 3488, 3953},
+                {5682, 5682, 5814, 6512},
+                {11818, 11818, 12791, 13721},
+        };
+        if (craft_list.contains("单面哑膜")) {
+            prices = new int[][]{
+                    {1000, 1000, 1050, 1050},
+                    {1110, 1110, 1110, 1110},
+                    {1222, 1222, 1550, 1650},
+                    {1778, 1778, 1778, 1889},
+                    {2111, 2111, 2111, 2222},
+                    {2444, 2444, 2444, 2667},
+                    {3778, 3778, 3778, 4222},
+                    {6222, 6222, 6222, 6889},
+                    {13333, 13333, 13778, 15333},
+            };
+        }
+        int price_index = 0;
+        if ((width > 4.0 || length > 6.0) && (length > 4.0 || width > 6.0)) {
+            price_index = 1;
+        }
+        if ((width > 9.0 || length > 5.4) && (length > 9.0 || width > 5.4)) {
+            price_index = 2;
+        }
+        if ((width > 6.0 || length > 7.0) && (length > 6.0 || width > 7.0)) {
+            price_index = 3;
+        }
+        int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000, 20000, 50000};
+        for (int i = 0; i < counts.length; i++) {
+            int itemCount = counts[i];
+            if (count > itemCount) {
+                continue;
+            }
+            if (priceList.size() > 2) {
+                break;
+            }
+            double awards_price = 0;
+            if (itemCount <= 10000) {
+                if (awards > 5) {
+                    awards_price = 30 * Math.max((awards - 5), 0);
+                }
+            }
+            Product pro = new Product();
+            pro.setCount(itemCount);
+            pro.setNumber(number);
+            pro.setPrice(Math.ceil((prices[i][price_index] + awards_price) * number));
+            priceList.add(pro);
+        }
+        return priceList;
+    }
+
     private List<Product> getWrappingPaper(Product dto, Double width, Double length) {
         List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
         List<Product> priceList = new ArrayList<>();

+ 352 - 0
src/main/webapp/views/product/tearingJoy.jsp

@@ -0,0 +1,352 @@
+<%@ 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_filter">
+                    <option value="1">300克铜版纸对裱</option>
+                </select>
+            </div>
+            <p>
+                尺寸<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">
+            </div>
+            <p>
+                数量
+            </p>
+            <div class="layui-form-item">
+                <select name="count" id="count" class="layui-form-select" lay-filter="pcount_filter">
+                    <option value="200">200</option>
+                    <option value="500">500</option>
+                    <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>
+                </select>
+            </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">
+                <select class="layui-form-select" name="awards">
+                    <option value="1">1</option>
+                    <option value="2">2</option>
+                    <option value="3">3</option>
+                    <option value="4">4</option>
+                    <option value="5">5</option>
+                    <option value="6">6</option>
+                    <option value="7">7</option>
+                    <option value="8">8</option>
+                    <option value="9">9</option>
+                    <option value="10">10</option>
+                </select>
+            </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 readonly>
+                </div>
+                <div class="layui-input-block">
+                    裁切工艺:
+                    <input type="checkbox" name="craft" lay-filter="ui_craft" value="直角裁切" title="直角裁切" checked readonly>
+                </div>
+                <div class="layui-input-block fumo">
+                    常见工艺:
+                    <input type="checkbox" name="craft" lay-filter="ui_craft" value="手撕线" title="手撕线" checked readonly>
+                </div>
+                <div class="layui-input-block fumo">
+                    覆膜工艺:
+                    <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>
+            <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('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;
+            }
+
+            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 = $("input[name='size']").val();
+            var count = $("#count").val();
+            var kind = $("select[name='kind'] option:selected").text();
+            var craft = [];
+
+            if (size == "") {
+                layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () {
+                });
+                return false;
+            }
+
+            if ((size.split("*")[0] < 4 || size.split("*")[1] < 5) && (size.split("*")[1] < 4 || size.split("*")[0] < 5)) {
+                layer.msg('撕撕乐最大尺寸4*5cm!', {offset: ['300px', '300px']}, function () {
+                });
+                return false;
+            }
+            if ((size.split("*")[0] > 11 || size.split("*")[1] > 9) && (size.split("*")[1] > 11 || size.split("*")[0] > 9)) {
+                layer.msg('撕撕乐最大尺寸11*9cm!', {offset: ['300px', '300px']}, function () {
+                });
+                return false;
+            }
+            craft.push($("select[name='awards'] option:selected").val() + "个奖项");
+            $("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>

+ 17 - 0
src/main/webapp/views/product/wrappingPaper.jsp

@@ -193,6 +193,23 @@
                     }
                 }
             );
+
+            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;
+            }
+
             const carft1 = carft_list1.filter(craft => craft_list.includes(craft));
             if (carft1.length > 1) {
                 $(data.elem).prop("checked", false);