Browse Source

修改特种纸烫金

zhuyiyi 6 months ago
parent
commit
e3f6d2e5d5

+ 170 - 13
src/main/java/lingtao/net/service/ProductService.java

@@ -1210,6 +1210,132 @@ public class ProductService {
             // 名片-特种纸名片
             case "特种纸名片":
                 double addPrice = 5;
+                List<String> craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
+                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("异形模切")) {
+                        prices = new HashMap<String, int[]>() {
+                            {
+                                put("萱姿", new int[]{360, 365, 547, 911, 1180, 1450, 1737, 2026, 2315, 2604, 2893, 3181});
+                                put("岚蝶", new int[]{350, 355, 512, 831, 1110, 1380, 1657, 1970, 2283, 2596, 2909, 3221});
+                                put("皙贝", new int[]{350, 355, 512, 831, 1111, 1381, 1657, 1971, 2284, 2597, 2910, 3221});
+                                put("琮纹", new int[]{350, 355, 512, 831, 1112, 1382, 1657, 1972, 2285, 2598, 2911, 3221});
+                                put("睿狐", new int[]{350, 355, 512, 831, 1113, 1383, 1657, 1973, 2286, 2599, 2912, 3221});
+                                put("溪雪", new int[]{360, 365, 547, 911, 1180, 1450, 1737, 2026, 2315, 2604, 2893, 3181});
+                                put("玉蕊", new int[]{365, 375, 557, 921, 1230, 1550, 1937, 2300, 2663, 3026, 3389, 3751});
+                                put("金绒", new int[]{365, 375, 557, 921, 1230, 1550, 1937, 2300, 2663, 3026, 3389, 3751});
+                                put("芳怡", new int[]{455, 495, 957, 1691, 2365, 3195, 3777, 4425, 5083, 5713, 6389, 7048});
+                            }
+                        };
+
+                    }
+                    if (craft_list.contains("双面烫金") && !craft_list.contains("圆角") && !craft_list.contains("异形模切")) {
+                        prices = new HashMap<String, int[]>() {
+                            {
+                                put("萱姿", new int[]{660, 665, 969, 1587, 2060, 2550, 3069, 3611, 4153, 4695, 5237, 5777});
+                                put("岚蝶", new int[]{650, 655, 934, 1507, 1990, 2480, 2989, 3555, 4121, 4687, 5253, 5817});
+                                put("皙贝", new int[]{650, 655, 934, 1507, 1991, 2481, 2989, 3556, 4122, 4688, 5254, 5817});
+                                put("琮纹", new int[]{650, 655, 934, 1507, 1992, 2482, 2989, 3557, 4123, 4689, 5255, 5817});
+                                put("睿狐", new int[]{650, 655, 934, 1507, 1993, 2483, 2989, 3558, 4124, 4690, 5256, 5817});
+                                put("溪雪", new int[]{660, 665, 969, 1587, 2060, 2550, 3069, 3611, 4153, 4695, 5237, 5777});
+                                put("玉蕊", new int[]{665, 675, 979, 1597, 2110, 2650, 3269, 3885, 4501, 5117, 5733, 6347});
+                                put("金绒", new int[]{665, 675, 979, 1597, 2110, 2650, 3269, 3885, 4501, 5117, 5733, 6347});
+                                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<String, int[]>() {
+                            {
+                                put("萱姿", new int[]{468, 473, 747, 1287, 1660, 2010, 2385, 2731, 3078, 3425, 3771, 4117});
+                                put("岚蝶", new int[]{455, 460, 584, 955, 1294, 1604, 1917, 2278, 2639, 3000, 3361, 3721});
+                                put("皙贝", new int[]{455, 460, 584, 955, 1295, 1605, 1917, 2280, 2648, 3002, 3362, 3721});
+                                put("琮纹", new int[]{455, 460, 584, 955, 1298, 1607, 1917, 2282, 2643, 3004, 3364, 3721});
+                                put("睿狐", new int[]{455, 460, 584, 955, 1300, 1609, 1917, 2283, 2644, 3005, 3366, 3721});
+                                put("溪雪", new int[]{468, 468, 647, 1099, 1420, 1730, 2061, 2378, 2696, 3014, 3332, 3649});
+                                put("玉蕊", new int[]{475, 480, 760, 1289, 1755, 2225, 2845, 3373, 3901, 4429, 4957, 5484});
+                                put("金绒", new int[]{475, 480, 760, 1289, 1755, 2225, 2845, 3373, 3901, 4429, 4957, 5484});
+                                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<String, int[]>() {
+                            {
+                                put("萱姿", new int[]{756, 769, 1169, 2540, 2639, 3110, 3717, 4316, 4916, 5516, 6115, 6713});
+                                put("岚蝶", new int[]{690, 699, 1006, 2174, 2307, 2704, 3249, 3863, 4477, 5091, 5705, 6317});
+                                put("皙贝", new int[]{690, 699, 1006, 2175, 2307, 2705, 3249, 3865, 4486, 5093, 5706, 6317});
+                                put("琮纹", new int[]{690, 699, 1006, 2178, 2307, 2707, 3249, 3867, 4481, 5095, 5708, 6317});
+                                put("睿狐", new int[]{690, 699, 1006, 2180, 2307, 2709, 3249, 3868, 4482, 5096, 5710, 6317});
+                                put("溪雪", new int[]{708, 717, 1069, 2300, 2451, 2830, 3393, 3963, 4534, 5105, 5676, 6245});
+                                put("玉蕊", new int[]{763, 788, 1182, 2635, 2641, 3325, 4177, 4958, 5739, 6520, 7301, 8080});
+                                put("金绒", new int[]{763, 788, 1182, 2635, 2641, 3325, 4177, 4958, 5739, 6520, 7301, 8080});
+                                put("芳怡", new int[]{830, 830, 1516, 3569, 2603, 4867, 5619, 6528, 7448, 8356, 9276, 10195});
+                            }
+                        };
+
+                    }
+                    if (craft_list.contains("单面烫金") && !craft_list.contains("圆角") && craft_list.contains("异形模切")) {
+                        prices = new HashMap<String, int[]>() {
+                            {
+                                put("萱姿", new int[]{480, 495, 747, 1240, 1600, 1940, 2304, 2467, 2792, 3117, 3442, 3766});
+                                put("岚蝶", new int[]{450, 465, 656, 1048, 1432, 1772, 2112, 2355, 2728, 3101, 3474, 3846});
+                                put("皙贝", new int[]{450, 465, 656, 1048, 1435, 1775, 2112, 2357, 2730, 3103, 3476, 3846});
+                                put("琮纹", new int[]{450, 465, 656, 1048, 1437, 1777, 2112, 2359, 2732, 3105, 3478, 3846});
+                                put("睿狐", new int[]{450, 465, 656, 1048, 1440, 1780, 2112, 2361, 2734, 3107, 3480, 3846});
+                                put("溪雪", new int[]{480, 495, 747, 1240, 1600, 1940, 2304, 2467, 2792, 3117, 3442, 3766});
+                                put("玉蕊", new int[]{495, 525, 773, 1264, 1720, 2180, 2784, 3015, 3488, 3961, 4434, 4906});
+                                put("金绒", new int[]{495, 525, 773, 1264, 1720, 2180, 2784, 3015, 3488, 3961, 4434, 4906});
+                                put("芳怡", new int[]{819, 891, 1722, 3043, 4257, 5751, 6798, 7965, 9148, 10282, 11499, 12687});
+                            }
+                        };
+
+                    }
+                    if (craft_list.contains("双面烫金") && !craft_list.contains("圆角") && craft_list.contains("异形模切")) {
+                        prices = new HashMap<String, int[]>() {
+                            {
+                                put("萱姿", new int[]{780, 795, 1169, 1916, 2480, 3040, 3636, 4052, 4630, 5208, 5786, 6362});
+                                put("岚蝶", new int[]{750, 765, 1078, 1724, 2312, 2872, 3444, 3940, 4566, 5192, 5818, 6442});
+                                put("皙贝", new int[]{750, 765, 1078, 1724, 2315, 2875, 3444, 3942, 4568, 5194, 5820, 6442});
+                                put("琮纹", new int[]{750, 765, 1078, 1724, 2317, 2877, 3444, 3944, 4570, 5196, 5822, 6442});
+                                put("睿狐", new int[]{750, 765, 1078, 1724, 2320, 2880, 3444, 3946, 4572, 5198, 5824, 6442});
+                                put("溪雪", new int[]{780, 795, 1169, 1916, 2480, 3040, 3636, 4052, 4630, 5208, 5786, 6362});
+                                put("玉蕊", new int[]{795, 825, 1195, 1940, 2600, 3280, 4116, 4600, 5326, 6052, 6778, 7502});
+                                put("金绒", new int[]{795, 825, 1195, 1940, 2600, 3280, 4116, 4600, 5326, 6052, 6778, 7502});
+                                put("芳怡", new int[]{1245, 1245, 2274, 3904, 5353, 7300, 8428, 9792, 11172, 12534, 13914, 15292});
+                            }
+                        };
+
+                    }
+                    int min = getNum(length, width);
+                    int[] base_price = prices.get(kind);
+                    for (int i = 0; i < counts.length; i++) {
+                        if (counts[i] < dto.getCount()) {
+                            continue;
+                        }
+                        if (priceList.size() > 3) {
+                            break;
+                        }
+
+                        Product pro = new Product();
+                        pro.setCount(counts[i]);
+                        pro.setPrice((double) base_price[i]);
+                        priceList.add(pro);
+                    }
+                    getCraft(dto, priceList, null, null, 0);
+                    // 根据位数重新算价格
+                    for (Product product : priceList) {
+                        product.setPrice(Math.ceil(product.getPrice() * min));
+                    }
+                    // 根据款数重新算价格
+                    for (Product product : priceList) {
+                        product.setPrice(Math.ceil(product.getPrice() * number));
+                    }
+                    return priceList;
+                }
                 if ("雅柔".equals(kind) || "萱姿".equals(kind)) {
                     kind = "珠光";
                     dto.setKindValue("珠光");
@@ -1243,7 +1369,6 @@ public class ProductService {
                     getCraft(dto, priceList, null, null, 0);
                 } else if ("素芸".equals(kind)) {
                     int[] count_list = {100, 200, 400, 500, 1000, 2000, 3000, 5000, 10000};
-                    List<String> craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
                     double[] prices = {};
                     if (craft_list.size() == 0 || craft_list.contains("异形模切")) {
                         prices = new double[]{144, 272, 528, 660, 1280, 2560, 3840, 6400, 12800};
@@ -1286,6 +1411,22 @@ public class ProductService {
                         dto2.setPrice(Math.ceil(prices[i] * rate));
                         priceList.add(dto2);
                     }
+                    if (craft_list.contains("打码")) {
+                        double danjia = 0.0;
+                        if (dto.getMaxian() == 1) {
+                            danjia = 0.8;
+                        }
+                        if (dto.getMaxian() == 2) {
+                            danjia = 1.6;
+                        }
+                        if (dto.getMaxian() == 3) {
+                            danjia = 2.4;
+                        }
+                        for (Product product : priceList) {
+                            product.setPrice(Math.ceil(product.getPrice() + product.getCount() * danjia));
+                        }
+                    }
+
                     int min = getNum(length, width);
                     for (Product product : priceList) {
                         if (craft_list.contains("异形模切")) {
@@ -1447,11 +1588,11 @@ public class ProductService {
                     }
                     // 根据位数重新算价格
                     for (Product product : priceList) {
-                        product.setPrice(Math.floor(product.getPrice() * min));
+                        product.setPrice(Math.ceil(product.getPrice() * min));
                     }
                     // 根据款数重新算价格
                     for (Product product : priceList) {
-                        product.setPrice(Math.floor(product.getPrice() * number));
+                        product.setPrice(Math.ceil(product.getPrice() * number));
                     }
                     if ("芳怡".equals(kind) || "草香".equals(kind)) {
                         for (Product product : priceList) {
@@ -2376,7 +2517,7 @@ public class ProductService {
                         }
                     }
                 } else if ("UV转印贴".equals(dto.getKind())) {
-                    List<String> craft_list = dto.getCraft() == null ? null : Arrays.asList(dto.getCraft());
+                    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;
@@ -2392,12 +2533,12 @@ public class ProductService {
                         }
                         if (length == paperLength || length == paperWidth) {
 
-                        }else{
+                        } else {
                             length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(0.6)).doubleValue();
                         }
                         if (width == paperLength || width == paperWidth) {
 
-                        }else{
+                        } else {
                             width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(0.6)).doubleValue();
                         }
 
@@ -2540,7 +2681,7 @@ public class ProductService {
                     if (!StringUtils.isEmpty(dto.getSwitchz3Size())) {
                         price += 100;
                     }
-                    List<String> craft_list = crafts != null ? Arrays.asList(crafts) : new ArrayList<>();
+                    craft_list = crafts != null ? Arrays.asList(crafts) : new ArrayList<>();
                     if (craft_list.size() > 0 && craft_list.contains("绳子")) {
                         price += Math.max(5, Math.ceil(0.1 * number * count));
                     }
@@ -3557,7 +3698,7 @@ public class ProductService {
                         product.setPrice(Math.floor(product.getPrice() * 1.2));
                     }
                 }
-                List<String> craft_list = Arrays.asList(dto.getCraft());
+                craft_list = Arrays.asList(dto.getCraft());
                 for (Product product : priceList) {
                     double base = 1;
                     if (craft_list.contains("异形")) {
@@ -5404,7 +5545,7 @@ public class ProductService {
                     product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 30 ? 0.03 * product.getCount() : 30)));
                 }
             }
-            if (craftList.contains("单面烫金")) {
+            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("单面烫金")) {
                 if (min < 2) {
                     for (Product product : priceList) {
                         product.setPrice(Math.ceil(product.getPrice() + 50) + (0.1 * product.getCount() > 50 ? 0.1 * product.getCount() : 50));
@@ -5421,7 +5562,7 @@ public class ProductService {
                     product.setPrice(Math.ceil(product.getPrice() + (areaTang * 0.2 > 10 ? areaTang * 0.2 : 10)));
                 }
             }
-            if (craftList.contains("双面烫金")) {
+            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("双面烫金")) {
                 if (min < 2) {
                     for (Product product : priceList) {
                         product.setPrice(Math.ceil(product.getPrice()) + (0.2 * product.getCount() > 220 ? 0.2 * product.getCount() : 220));
@@ -5438,7 +5579,7 @@ public class ProductService {
                     product.setPrice(Math.ceil(product.getPrice() + (areaTang * 0.2 > 10 ? areaTang * 0.2 : 10)));
                 }
             }
-            if (craftList.contains("打码")) {
+            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("打码")) {
                 double danjia = 0.0;
                 // 5000张以上,一张10分
                 if (dto.getCount() > 5000) {
@@ -5461,6 +5602,22 @@ public class ProductService {
                     }
                 }
             }
+            if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("打码")) {
+                double danjia = 0.0;
+                if (dto.getMaxian() == 1) {
+                    danjia = 0.4;
+                }
+                if (dto.getMaxian() == 2) {
+                    danjia = 0.8;
+                }
+                if (dto.getMaxian() == 3) {
+                    danjia = 1.2;
+                }
+                for (Product product : priceList) {
+                    product.setPrice(Math.ceil(product.getPrice() + product.getCount() * danjia));
+                }
+
+            }
             //(!"4".equals(dto.getProTypeValue()) || !"4".equals(dto.getKind()) || !"5".equals(dto.getKind())) &&
             if (craftList.contains("模切") && !craftList.contains("打码")) {// 3个位以下25,3-16:50; 16 上 80
                 if (min < 3) {
@@ -5517,7 +5674,7 @@ public class ProductService {
                     product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 30 ? 0.03 * product.getCount() : 30)));
                 }
             }
-            if (craftList.contains("圆角")) {// 特种纸名片工艺
+            if (!"特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("圆角")) {// 特种纸名片工艺
                 for (Product product : priceList) {
                     product.setPrice(Math.ceil(product.getPrice() + (0.03 * product.getCount() > 30 ? 0.03 * product.getCount() : 30) * 1.5));
                 }
@@ -5544,7 +5701,7 @@ public class ProductService {
                     product.setPrice(Math.ceil(product.getPrice() + (0.05 * product.getCount() > 50 ? 0.05 * product.getCount() : 50)));
                 }
             }
-            if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("异形模切")) {// 200-500张按照原有的价格乘以3倍  1000-5000张按照原有的价格乘以2.4倍   5000-10000张按照原有的价格乘以2倍
+            if ("特种纸名片".equals(dto.getProTypeValue()) && craftList.contains("异形模切") && !craftList.contains("单面烫金") && !craftList.contains("双面烫金")) {// 200-500张按照原有的价格乘以3倍  1000-5000张按照原有的价格乘以2.4倍   5000-10000张按照原有的价格乘以2倍
                 for (Product product : priceList) {
                     if (200 <= product.getCount() && product.getCount() <= 500) {
                         product.setPrice(Math.ceil(product.getPrice() * 3));

+ 53 - 16
src/main/webapp/views/product/specialCard2.jsp

@@ -10,6 +10,13 @@
 </head>
 <!-- 特种纸名片 -->
 <style>
+    #tang_type .layui-form-select .layui-edge {
+        right: 20px;
+    }
+
+    #dama .layui-form-select .layui-edge {
+        right: 20px;
+    }
 </style>
 <body>
 <div class="big_box">
@@ -172,22 +179,29 @@
                         <option value="有色加凹凸">有色加凹凸</option>
                     </select>
                 </div>
-                <br/>
-                <input type="checkbox" name="craft" lay-filter="mianka" value="单面烫金" title="单面烫金" disabled>
-                <input type="checkbox" name="craft" lay-filter="mianka" value="双面烫金" title="双面烫金" disabled>
-                <div id="tang_type" class="layui-inline" style="display: none;width: 200px">
-                    <select name="craft" class="select" disabled>
-                        <option value="烫金" selected>烫金</option>
-                        <option value="烫银">烫银</option>
-                        <option value="烫蓝">烫蓝</option>
-                        <option value="烫绿">烫绿</option>
-                        <option value="烫紫">烫紫</option>
-                        <option value="烫玫瑰">烫玫瑰</option>
-                    </select>
-                </div>
-            </div>
-
 
+            </div>
+            <br/>
+            <input type="checkbox" name="craft" lay-filter="mianka" value="单面烫金" title="单面烫金">
+            <input type="checkbox" name="craft" lay-filter="mianka" value="双面烫金" title="双面烫金">
+            <div id="tang_type" class="layui-inline" style="display: none;width: 90px">
+                <select name="craft" class="select">
+                    <option value="烫金" selected>烫金</option>
+                    <option value="烫银">烫银</option>
+                    <option value="烫蓝">烫蓝</option>
+                    <option value="烫绿">烫绿</option>
+                    <option value="烫紫">烫紫</option>
+                    <option value="烫玫瑰">烫玫瑰</option>
+                </select>
+            </div>
+            <input type="checkbox" name="craft" lay-filter="switch" value="打码" title="打码">
+            <div id="dama" class="layui-inline" style="display: none;width: 90px">
+                <select name="maxian" class="select">
+                    <option value="1" selected>1</option>
+                    <option value="2">2</option>
+                    <option value="3">3</option>
+                </select>
+            </div>
             <!--<input type="checkbox" name="craft" lay-filter="switch" value="烫金/" title="烫金" class="hasCraft ui_ls_craft">
             <input type="checkbox" name="craft" lay-filter="switch" value="击凸" title="击凸" class="hasCraft">
             <input type="checkbox" name="craft" lay-filter="switch" value="凹凸" title="凹凸" class="ui_ls_craft" disabled="disabled">
@@ -492,6 +506,13 @@
             //         $('.niupikaNoMQCraft').removeAttr('disabled');
             //     }
             // }
+            let craft_list = [];
+            $("input[name='craft']:checked").each(function () {
+                    if (!$(this).is(':disabled')) {
+                        craft_list.push($(this).val());
+                    }
+                }
+            );
             $("#dakong").removeAttr('disabled');
             $("#craft_mo").removeAttr('disabled');
             $(".newCraft").children().removeAttr('disabled');
@@ -509,6 +530,13 @@
                 $("#craft_yuanjiao").prop('disabled', 'disabled');
                 $("#craft_dianxian").prop('disabled', 'disabled');
             }
+            if (craft_list.indexOf("打码") > -1) {
+                $("#dama").show();
+                $("#dama").find("select").attr("disabled", false);
+            } else {
+                $("#dama").hide();
+                $("#dama").find("select").attr("disabled", true);
+            }
 
             form.render();
             setRemark()
@@ -626,7 +654,16 @@
             $("input:checkbox[name='craft']:checked").each(function (i) {
                 if (!$(this).is(':disabled')) {
                     if ($(this).val() != "双面覆哑膜") {
-                        arr.push($(this).val());
+                        if ($(this).val() == "单面烫金" || $(this).val() == "双面烫金") {
+                            let tangColor = $("#tang_type select[name='craft'] option:selected").val();
+                            arr.push($(this).val() + tangColor);
+                        }
+                        else if ($(this).val() == "打码") {
+                            let ma_num = $("select[name='maxian'] option:selected").val();
+                            arr.push($(this).val() + ma_num + "个");
+                        }else {
+                            arr.push($(this).val());
+                        }
                     }
                 }
             });