Browse Source

修改美纹纸价格,修改烫画向下取并加上设计费,修改宣传单尺寸

zhuyiyi 5 months ago
parent
commit
17def0dd1f

+ 8 - 7
src/main/java/lingtao/net/service/ProductService.java

@@ -2503,7 +2503,7 @@ public class ProductService {
                     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;
-
+                        double chu = 0.6;
 
                         if (craft_list.contains("冷转印")) {
                             paperLength = 20;
@@ -2512,22 +2512,23 @@ public class ProductService {
                         if (craft_list.contains("烫画")) {
                             paperLength = 100;
                             paperWidth = 57;
+                            chu = 1;
                         }
                         if (length == paperLength || length == paperWidth) {
 
                         } else {
-                            length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(0.6)).doubleValue();
+                            length = BigDecimal.valueOf(length).add(BigDecimal.valueOf(chu)).doubleValue();
                         }
                         if (width == paperLength || width == paperWidth) {
 
                         } else {
-                            width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(0.6)).doubleValue();
+                            width = BigDecimal.valueOf(width).add(BigDecimal.valueOf(chu)).doubleValue();
                         }
 
                         //一张大纸能放几个
                         double num = Math.max(Math.min(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length)), 1);
                         if (craft_list.contains("烫画")) {
-                            num = Math.max(Math.ceil(paperLength / length) * Math.ceil(paperWidth / width), Math.ceil(paperLength / width) * Math.ceil(paperWidth / length));
+                            num = Math.max(Math.floor(paperLength / length) * Math.floor(paperWidth / width), Math.floor(paperLength / width) * Math.floor(paperWidth / length));
 
                         }
 
@@ -2562,9 +2563,9 @@ public class ProductService {
                             priceList.add(pro);
                         }
 
-//                        for (Product product : priceList) {
-//                            product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));
-//                        }
+                        for (Product product : priceList) {
+                            product.setPrice(Math.ceil(product.getPrice() + (number - 1) * 0.5));
+                        }
 
                         return priceList;
                     }

+ 31 - 35
src/main/java/lingtao/net/util/PriceUtils.java

@@ -387,43 +387,39 @@ public class PriceUtils {
 
     // 不干胶常规数量美纹纸价格计算
     public List<Product> getMeiWenZhiPrice(Double length, Double width, int count, Integer number, String craftMo) {
-        double l = 420;
-        double w = 285;
-        Product pro = new Product();
-        List<Product> list = new ArrayList<Product>();
-        // 成本价 元/张
-        double danjia = 1.8;
-        if ("模切".equals(craftMo)) {
-            danjia = 2.2;
-        }
-        // 换成毫米每边+2
-        length = length * 10 + 4;
-        width = width * 10 + 4;
-        if ((length > l || width > w) && (length > w || width > l))
-            return null;
-        // 一张大纸能做多少个此类尺寸的不干胶
-        double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
-                Math.floor(l / width) * Math.floor(w / length));
-
-        for (int i = 0; i < countArr.length; i++) {
-            if (countArr[i] < count || list.size() > 3) {
+        List<Product> priceList = new ArrayList<>();
+        int[][] prices = new int[][]{
+                {79, 107, 134, 272, 343, 685, 1030, 1374, 1787, 2322, 2748, 3302, 4351},
+                {84, 112, 139, 277, 348, 690, 1035, 1379, 1792, 2327, 2753, 3307, 4356},
+                {161, 222, 278, 553, 690, 1377, 2065, 2748, 3584, 4653, 5505, 6614, 8712},
+                {318, 443, 552, 1101, 1377, 2753, 4119, 5475, 7128, 9108, 10613, 12435, 13068},
+                {475, 661, 828, 1652, 2066, 4129, 6178, 8213, 10692, 13662, 15920, 18652, 19602},
+                {788, 1099, 1380, 2743, 3430, 6856, 10272, 13613, 17721, 22275, 25542, 29700, 32670},
+                {1575, 2188, 2747, 5485, 6859, 13712, 20543, 27225, 35442, 44550, 51084, 59400, 65340},
+                {3150, 4355, 5494, 10930, 13662, 27324, 40887, 54054, 69894, 87120, 99000, 114444, 121968},
+        };
+        int[] count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000, 20000};
+        double[] areas = new double[]{26, 37, 49.6, 82, 127, 171, 231, 295, 361, 451, 600.5, 902, 1199};
+        double area = length * width;
+        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;
             }
-            pro = new Product();
-            // 报的数量需要多少张大纸
-            int num = (int) Math.ceil(countArr[i] / max);
-            pro.setCount(countArr[i]);
-            pro.setPrice(Math.ceil(num * danjia * 2.5 > 83 ? num * danjia * 2.5 : 83));
-            list.add(pro);
+            int count_index = Arrays.binarySearch(count_list, count_item);
+            double price = 0;
+            if (count_index >= 0) {
+                price = new PriceUtils().TablePrice(area, prices[count_index], areas);
+            }
+            Product product = new Product();
+            product.setCount(count_item);
+            product.setPrice(Math.ceil(price * number));
+            priceList.add(product);
         }
-
-		/*if(number > 1) {
-			for (Product product : list) {
-				product.setPrice(Math.ceil(product.getPrice() * number));
-			}
-		}*/
-
-        return list;
+        return priceList;
     }
 
     /**
@@ -3433,7 +3429,7 @@ public class PriceUtils {
             }
         }
         if (startIndex == endIndex) {
-            price = (price_list[endIndex] / areas[endIndex]) * area;
+            price = price_list[endIndex];
         } else {
             price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
         }

+ 2 - 2
src/main/webapp/views/product/flyer.jsp

@@ -246,8 +246,8 @@
             var kind2 = kind2Data[$("#kind2Value").val()];
             var number = $("#number").val();
             var size = $("#size").val();
-            if ((size.split("*")[0] > 140 || size.split("*")[1] > 110) && (size.split("*")[0] > 110 || size.split("*")[1] > 140)) {
-                layer.msg("宣传单尺寸不能超过140*110 cm", {offset: ['300px', '300px']}, function () {
+            if ((size.split("*")[0] > 110 || size.split("*")[1] > 110) && (size.split("*")[0] > 110 || size.split("*")[1] > 110)) {
+                layer.msg("宣传单尺寸不能超过110*110 cm", {offset: ['300px', '300px']}, function () {
                 });
                 return false;
             }

+ 0 - 4
src/main/webapp/views/product/metal.jsp

@@ -184,10 +184,6 @@
                                 <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>
                     </span>

+ 31 - 7
src/main/webapp/views/product/stickers.jsp

@@ -471,11 +471,11 @@
                 }
             }
             if ($("#kindValue1").val() == "美纹纸" && (stickerKind == '' || stickerKind != '专版打印')) {
-                if ((size.split("*")[0] > 9 || size.split("*")[1] > 5.4) && (size.split("*")[0] > 5.4 || size.split("*")[1] > 9)) {
-                    $(".meiwenzhiQie").show();
-                } else {
-                    $(".meiwenzhiQie").hide();
-                }
+                // if ((size.split("*")[0] > 9 || size.split("*")[1] > 5.4) && (size.split("*")[0] > 5.4 || size.split("*")[1] > 9)) {
+                //     $(".meiwenzhiQie").show();
+                // } else {
+                //     $(".meiwenzhiQie").hide();
+                // }
             }
         });
         $("#number").on("input", function (e) {
@@ -868,6 +868,21 @@
             $(".n_mq").hide();
             $('.pf input').prop("checked", false);
             $('.n_mq input').prop("disabled", true);
+            let count_html = `<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="30000">30000</option>
+                        <option value="40000">40000</option>
+                        <option value="50000">50000</option>
+                        <option value="60000">60000</option>
+                        <option value="70000">70000</option>
+                        <option value="80000">80000</option>
+                        <option value="90000">90000</option>
+                        <option value="100000">100000</option>`;
             // A级、PVC、透明
             if (data.value == 0 || data.value == 1 || data.value == 2) {
                 $(".tj").show();
@@ -989,9 +1004,17 @@
                 $(".caiqie").show();
             }
             if (data.value == "美纹纸") {
-                $(".meiwenzhiQie").show();
+                // $(".meiwenzhiQie").show();
+                count_html = `<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>`;
             } else {
-                $(".meiwenzhiQie").hide();
+                // $(".meiwenzhiQie").hide();
                 // 切换按钮工艺恢复
                 $("#craftForm")[0].reset();
             }
@@ -1024,6 +1047,7 @@
                 $(".n_mq").hide();
                 $('.n_mq input').prop("disabled", true);
             }
+            $("#ui_normal #count").empty().append(count_html);
             form.render();//必须写
 
             var content = getContent(kindvalue);