فهرست منبع

新增产品,新增uv工艺

zhuyiyi 3 ماه پیش
والد
کامیت
ab9ab9ca8d

+ 62 - 1
src/main/java/lingtao/net/service/ProductService.java

@@ -2393,6 +2393,8 @@ public class ProductService {
                 }
                 return priceList;
             case "金属标":
+                craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
+
                 if ("金属标".equals(dto.getKind())) {
                     priceList = new PriceUtils().getMetalPrice(priceList, width, length, count, number);
                     // 根据款数重新算价格
@@ -2409,7 +2411,6 @@ public class ProductService {
                         }
                     }
                 } else if ("UV转印贴".equals(dto.getKind())) {
-                    craft_list = dto.getCraft() == null ? null : Arrays.asList(dto.getCraft());
                     if (dto.getCraft() != null && craft_list.size() > 0 && (craft_list.contains("冷转印") || craft_list.contains("烫画"))) {
                         int[] quantitySteps = {10, 20, 30, 50, 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000};
                         double paperLength = 0, paperWidth = 0;
@@ -2507,6 +2508,12 @@ public class ProductService {
                             product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));
                         }
                     }
+                    if (craft_list.contains("刮板")) {
+                        dto.setPcount(dto.getPcount() == null ? 1 : dto.getPcount());
+                        for (Product product : priceList) {
+                            product.setPrice(product.getPrice() + 2 * Math.max(dto.getPcount(), 1));
+                        }
+                    }
 //                    double base = number < 6 && number > 1 ? 5 : 0;
                     double apprise = 0;
                     for (Product product : priceList) {
@@ -4648,12 +4655,43 @@ public class ProductService {
                 return getCheTiePrice(dto, length, width);
             case "胶带":
                 return getJiadaoPrice(dto, length, width);
+            case "特光不干胶":
+                return getLightPrice(dto, length, width);
             default:
                 break;
         }
         return null;
     }
 
+    private List<Product> getLightPrice(Product dto, Double width, Double length) {
+        List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
+        double[][] prices = new double[][]{
+                {403, 503, 503, 503, 543, 582, 582, 582, 620, 620, 660, 698, 775, 775, 852.5, 853, 853},
+                {520, 520, 520, 520, 560, 600, 600, 600, 640, 640, 680, 720, 800, 800, 880, 880, 880},
+                {600, 600, 600, 600, 637.5, 675, 675, 675, 750, 750, 825, 862.5, 975, 975, 1050, 1050, 1125},
+                {625, 625, 625, 625, 662.5, 700, 700, 700, 775, 775, 850, 887.5, 1000, 1000, 1075, 1075, 1150},
+                {652, 652, 652, 652, 725, 762, 762, 762, 870, 870, 942, 978, 1051, 1051, 1087, 1087, 1196},
+                {798, 798, 798, 798, 943, 1015, 1015, 1015, 1087, 1087, 1196, 1196, 1341, 1341, 1450, 1450, 1631},
+                {910, 910, 910, 910, 1120, 1155, 1225, 1225, 1400, 1470, 1575, 1575, 1680, 1680, 1855, 1925, 2100},
+        };
+        if (carftList.contains("烫金+激凸")) {
+            prices = new double[][]{
+                    {620, 620, 620, 698, 698, 852, 852, 980, 1127, 1285, 1465, 1656, 1871, 2095, 2346, 2605, 2892},
+                    {640, 640, 640, 720, 720, 880, 880, 1012, 1164, 1327, 1512, 1709, 1931, 2163, 2422, 2689, 2984},
+                    {713, 713, 713, 788, 788, 938, 938, 1078, 1240, 1413, 1611, 1821, 2057, 2304, 2581, 2864, 3197},
+                    {863, 863, 863, 1050, 1050, 1125, 1125, 1294, 1488, 1696, 1934, 2185, 2469, 2765, 3097, 3437, 3815},
+                    {979, 943, 1015, 1160, 1160, 1341, 1341, 1542, 1774, 2022, 2305, 2605, 2944, 3297, 3692, 4098, 4549},
+                    {1124, 1160, 1160, 1450, 1595, 1740, 1885, 2168, 2493, 2842, 3240, 3661, 4137, 4633, 5189, 5760, 6393},
+                    {1365, 1575, 2135, 2345, 2800, 3150, 3220, 3703, 4258, 4855, 5534, 6254, 7067, 7915, 8864, 9840, 10921},
+            };
+        }
+        int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000};
+        double[] areas = new double[]{9, 12.25, 16, 20.25, 25, 30.25, 36, 42.25, 49, 56.25, 64, 72.25, 81, 90.25, 100, 110.25, 121};
+        double area = (length + 0.4) * (width + 0.4);//加上4毫出血
+
+        return getAreaNextPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
+    }
+
     private List<Product> getDalanPrice(Product dto, Double width, Double length) {
         //铜版纸200g (售价)
         int[][] prices = new int[][]{
@@ -4963,6 +5001,29 @@ public class ProductService {
         return new ArrayList<>();
     }
 
+    private List<Product> getAreaNextPrice(int[] count_list, int count, double area, double[][] prices, double[] areas, int number) {
+        List<Product> priceList = new ArrayList<>();
+        for (int i = 0; i < count_list.length; i++) {
+            int count_item = count_list[i];
+            if (priceList.size() > 2) {
+                break;
+            }
+            if (count > count_item) {
+                continue;
+            }
+            int count_index = Arrays.binarySearch(count_list, count_item);
+            double price = 0;
+            if (count_index >= 0) {
+                price = new PriceUtils().TableNextPrice(area, prices[count_index], areas);
+            }
+            Product product = new Product();
+            product.setCount(count_item);
+            product.setPrice(Math.ceil(price * number));
+            priceList.add(product);
+        }
+        return priceList;
+    }
+
     private List<Product> getAreaCenterPrice(int[] count_list, int count, double area, int[][] prices,
                                              double[] areas, int number) {
         List<Product> priceList = new ArrayList<>();

+ 14 - 0
src/main/java/lingtao/net/util/PriceUtils.java

@@ -3544,6 +3544,20 @@ public class PriceUtils {
         return list;
     }
 
+    public double TableNextPrice(double area, double[] price_list, double[] areas) {
+        double price = 0;
+        double last_price = 0;
+        for (int i = 0; i < areas.length; i++) {
+            if (area <= areas[i]) {
+                price = price_list[i];
+                break;
+            }
+            last_price = price_list[i];
+        }
+
+        return price == 0 ? last_price : price;
+    }
+
     public double TablePrice(double area, int[] price_list, double[] areas) {
         double price = 0;
         int startIndex = 0;

+ 305 - 0
src/main/webapp/views/product/light.jsp

@@ -0,0 +1,305 @@
+<%@ 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>
+<style>
+    .edge .layui-edge {
+        right: 20px;
+    }
+
+    .tangj.scolor .layui-form-select .layui-edge {
+        right: 20px;
+    }
+</style>
+<body>
+<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">
+                <input type="radio" lay-filter="kind" name="kind" value="特光不干胶" title="特光不干胶" checked/>
+            </div>
+            <p>
+                尺寸(CM/厘米)
+            </p>
+            <input type="text" name="size" placeholder="格式:长*宽" id="size" class="layui-input" autocomplete="off">
+            <p>
+                数量(张)
+            </p>
+            <div class="count">
+                <div class="layui-form-item">
+                    <select name="count" class="select">
+                        <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>
+                    </select>
+                </div>
+            </div>
+            <div class="diyCount" style="display: none">
+                <div class="layui-form-item">
+                    <input type="text" name="count" id="count" placeholder="请输入整数" class="layui-input"
+                           autocomplete="off">
+                </div>
+            </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-input-block" style="display:inline-block;">
+                <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>
+                    <input type="checkbox" name="craft" lay-filter="ui_craft" value="烫金+激凸" title="烫金+激凸">
+                    <div class="layui-inline tangj scolor" style="width: 150px;display: none">
+                        <select class="select">
+                            <option value="金色">金色</option>
+                            <option value="蓝色">蓝色</option>
+                            <option value="银色">银色</option>
+                            <option value="玫瑰金">玫瑰金</option>
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <hr>
+            <div class="layui-form-item">
+                <button class="layui-btn" lay-submit="" lay-filter="acount_btn" id="queryCondBtn">计算</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">
+        <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;
+        let remark_html = ''
+
+        // 监听回车键,如果敲了回车,调用点击‘计算’
+        $(document).keydown(function (e) {
+            if (e.keyCode === 13) {
+                $("#queryCondBtn").trigger("click");
+            }
+        });
+        //建造实例
+        ins = carousel.render({});
+        var html = " ";
+        var remark = " ";
+        // 清空轮播图
+        $("#carousel").empty();
+        $("#remark").empty();
+        $.ajax({
+            url: "${pageContext.request.contextPath}/getImgs",
+            type: "GET",
+            data: {
+                proTypeValue: $('input[name="kind"]:checked').val()
+            },
+            //dataType : "json",
+            success: function (result) {
+                for (let i = 0; i < result.length; i++) {
+                    // 只留一个remark
+                    remark = "";
+                    html += '<div><img style="width:' + result[0].imgWidth + 'px" src="' + result[i].imgUrl + '"></div>';
+                    remark += '<div><span>' + result[i].remark + '<span/></div>';
+                }
+                $("#carousel").append(html);
+                // 如果没有说明,就不显示null
+                if (remark.indexOf("null") < 0) {
+                    remark_html = remark;
+                    $("#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.indexOf("哑膜") == -1) {
+                $(data.elem).prop("checked", true);
+                layer.msg("覆膜不能取消选择", {offset: ['300px', '300px']}, function () {
+                });
+                form.render();
+                return false;
+            }
+            if (craft_list.indexOf("模切") == -1) {
+                $(data.elem).prop("checked", true);
+                layer.msg("裁切不能取消选择", {offset: ['300px', '300px']}, function () {
+                });
+                form.render();
+                return false;
+            }
+            const carft_list1 = ["印刷+激凸", "烫金+激凸"];
+            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.indexOf("烫金+激凸") > -1) {
+                $(".tangj.scolor").show();
+            } else {
+                $(".tangj.scolor").hide();
+            }
+        })
+
+        // 点击计算,计算价格
+        form.on('submit(acount_btn)', function (data) {
+
+            var number = $("#number").val();
+            var size = $("input[name='size']").val();
+            var count = $("select[name='count'] option:selected").text();
+            var arr = []
+            $("input:checkbox[name='craft']:checked").each(function (i) {
+                if (!$(this).is(':disabled')) {
+                    arr.push($(this).val());
+                    if ($(this).val() == "烫金+激凸") {
+                        arr.push($(".tangj select option:selected").val());
+                    }
+                }
+            });
+            if (arr.indexOf("印刷+激凸") == -1 && arr.indexOf("烫金+激凸") == -1) {
+                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 = '特光不干胶 - ' + size + ' CM (同款内容)\n';
+                    span_result += `工艺:` + arr.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: 'weight',
+                                width: '21%',
+                                align: "center",
+                                title: '重量(kg)'
+                            }
+                        ]],
+                        done: function () {
+                        }
+                    });
+                }
+            });
+            return false;
+        });
+    });
+</script>
+</html>

+ 44 - 2
src/main/webapp/views/product/metal.jsp

@@ -168,6 +168,14 @@
                            class="craftZhuan">
                     <input type="checkbox" name="craft" lay-filter="craftZhuan" value="双面贴" title="双面贴"
                            class="craftZhuan">
+                    <input type="checkbox" name="craft" lay-filter="craftZhuan" value="刮板" title="刮板"
+                           class="craftZhuan">
+                    <div class="layui-inline" id="guaban" style="width: 80px;display: none">
+                        <div style="display:flex;align-items: center">
+                            <span style="flex-shrink: 0">数量:</span>
+                            <input type="text" name="pcount" class="layui-input layui-inline" value="1">
+                        </div>
+                    </div>
                 </div>
                 <div class="layui-form-item">
                     <input type="checkbox" name="craft" lay-filter="craftZhuan" value="烫画" title="烫画"
@@ -338,13 +346,35 @@
 
         form.on('checkbox(craftZhuan)', function (data) {
             // 专金专银只能选一个
+            let craft_list = [];
+            $("input:checkbox[name='craft']:checked").each(function (i) {
+                if (!$(this).is(':disabled')) {
+                    craft_list.push($(this).val());
+                }
+            });
+
+            if (craft_list.indexOf("刮板") > -1 && (craft_list.indexOf("烫画") > -1 || craft_list.indexOf("冷转印") > -1)) {
+                $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
+                $(data.elem).prop("checked", false);
+                layer.msg('[烫画,冷转印]不能选择刮板配件!', {offset: ['300px', '300px']}, {icon: 5});
+                return false;
+            }
+            let most = 1;
+            if (craft_list.indexOf("刮板") > -1) {
+                most = 2;
+                $("#guaban").show();
+            } else {
+                $("#guaban").hide();
+            }
+
             var craftZhuan = $(".craftZhuan:checked").length;
-            if (craftZhuan > 1) {
+            if (craftZhuan > most) {
                 $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
                 $(data.elem).prop("checked", false);
                 layer.msg('[专金 - 专银]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
                 return false;
             }
+
             if (data.value == "冷转印") {
                 if ($(data.elem).is(":checked")) {
                     $("#sehu_number").show();
@@ -366,7 +396,18 @@
             } else {
                 var size = $("#UVSize").val();
                 var craftMo = $('input[name="craftMo"]:checked').val();
-                var craftShua = [$('input[name="craft"]:checked').val()];
+                var craftShua = [];
+
+                $("input:checkbox[name='craft']:checked").each(function (i) {
+                    if (!$(this).is(':disabled')) {
+                        if ($(this).val() == "刮板") {
+                            let co_count = $("input[name='pcount']").val();
+                            craftShua.push($(this).val() + co_count + "个");
+                        } else {
+                            craftShua.push($(this).val());
+                        }
+                    }
+                });
             }
             if (!kind) {
                 layer.msg("请选择产品种类!", {offset: ['300px', '300px']}, function () {
@@ -452,6 +493,7 @@
                             let co_count = $("select[name='co_number'] option:selected").val();
                             craftShua.push(co_count + "色数");
                         }
+
                         craftShua = craftShua.filter(item => item !== null && item != "");
                         var span_result = 'UV转印贴 - ' + craftShua.join(" - ") + ' - ' + size + '厘米 -(同款内容) - ' + [data[0].msg] + '\n';
                         if (number > 1) {

+ 1 - 0
src/main/webapp/views/system/instructions/manage/printing.jsp

@@ -34,6 +34,7 @@
             <i class="layui-icon layui-icon-add-circle-fine" style="font-size:20px;font-weight:bold"> </i> 新增内容
         </button>
     </div>
+    <span style="color: #FF5722;font-weight: bold">未经注册商标所有人许可,在同一种商品上使用与其注册商标相同的商标,情节严重的,处三年以下有期徒刑或拘役并处罚金。情节特别严重的,处三年以上七年以下有期徒刑并处罚金。</span>
 </script>
 <script type="text/html" id="barDemo">
     <a class="layui-btn layui-btn-xs" lay-event="edit">