ソースを参照

修改海报价格

zhuyiyi 5 日 前
コミット
162c230bf4

+ 41 - 6
src/main/java/lingtao/net/service/ProductService.java

@@ -1044,6 +1044,20 @@ public class ProductService {
                                 product.setPrice(product.getPrice() - 10);
                             }
                         }
+                        for (int i = 0; i < dto.getCraft().length; i++) {
+                            if ("模切".equals(dto.getCraft()[i])) {
+                                dto.getCraft()[i] = "";
+                            }
+                            if ("双面覆哑膜".equals(dto.getCraft()[i])) {
+                                dto.getCraft()[i] = "";
+                            }
+                            if ("压痕".equals(dto.getCraft()[i])) {
+                                dto.getCraft()[i] = "";
+                            }
+                            if ("压点线".equals(dto.getCraft()[i])) {
+                                dto.getCraft()[i] = "";
+                            }
+                        }
                     }
                     if ("1".equals(dto.getKind())) {
                         dto.setLengthTang(length);
@@ -1051,9 +1065,8 @@ public class ProductService {
                     }
                     List<String> containList = new ArrayList<>(Arrays.asList("单面星光膜", "双面星光膜", "单面镭射膜", "双面镭射膜", "单面触感膜", "双面触感膜", "单面雪花膜", "双面雪花膜", "单面局部UV", "双面局部UV"));
                     if ("3".equals(dto.getKind()) && "2".equals(dto.getKindValue2()) && craft_list != null && !Collections.disjoint(craft_list, containList)) {
-
                         priceList = gethuafangApiPrice(dto, craft_list, width, length);
-
+                        number = 1;
                     }
 
                     getCraft(dto, priceList, length * 10, width * 10, min);
@@ -6027,20 +6040,42 @@ public class ProductService {
             if (priceList.size() > 2) {
                 break;
             }
+            double price = 0;
+            if ("彩色".equals(dto.getShen_color())) {
+                double basePrice = 0;
+                if (itemCount == 1) {
+                    basePrice = 116;
+                } else if (itemCount == 2) {
+                    basePrice = 108;
+                } else {
+                    basePrice = 98;
+                }
+                price = basePrice * itemCount * number;
+            } else {
+                price = prices[base][i] * number * 1.2;
+            }
             pro = new Product();
             pro.setCount(itemCount);
-            pro.setPrice(Math.ceil(prices[base][i] * number * 1.2));
+            pro.setPrice(Math.ceil(price));
             pro.setNumber(number);
             pro.setWeight(df.format(baseWeight * itemCount));
             priceList.add(pro);
         }
         if (priceList.size() == 0 && count > maxCount) {
             double basePrice = prices[base][prices[base].length - 1];
+            double price = 0;
+            if ("彩色".equals(dto.getShen_color())) {
+                basePrice = 98;
+                price = basePrice * count * number;
+            } else {
+                price = basePrice / maxCount * count * number * 1.2;
+
+            }
             pro = new Product();
             pro.setCount(count);
-            pro.setPrice(Math.ceil(basePrice / maxCount * count * number * 1.2));
+            pro.setPrice(Math.ceil(price));
             pro.setNumber(number);
-            pro.setWeight(df.format(baseWeight * count));
+            pro.setWeight(df.format(baseWeight * count * number));
             priceList.add(pro);
         }
 
@@ -6566,7 +6601,7 @@ public class ProductService {
             double craft_price = 0;
             //3万张以内的价格需要加上上机费,1-2色的上机费是200元,3色400
             if (item_count <= 30000) {
-                craft_price = Math.ceil(Math.max(200, (dto.getCo_number() - 1) * 200));
+                craft_price = Math.ceil(Math.max(250, (dto.getCo_number() - 1) * 250));
             }
             double price = 0;
             price = Math.ceil(Math.max(miniPrice, basePrice * item_count + item_count / 10000 * yunPrice + banPrice + craft_price));

+ 34 - 17
src/main/java/lingtao/net/util/PosterPrice.java

@@ -362,8 +362,8 @@ public class PosterPrice {
             // 户外写真白胶(国产)
             case "0":
                 areas = new double[]{2, 5, 7, 8, 10, 20, 50};
-                prices = new double[]{50, 40, 35, 32, 26, 24, 22};
-                last_price = 26;
+                prices = new double[]{38, 38, 33, 30, 25, 23, 21};
+                last_price = 19;
                 min_price += 50 - 5;
                 // 根据面积得到单价
                 weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
@@ -372,8 +372,8 @@ public class PosterPrice {
             case "1":
                 // 根据面积得到单价
                 areas = new double[]{2, 5, 7, 8, 10, 20, 50};
-                prices = new double[]{50, 40, 35, 32, 26, 24, 22};
-                last_price = 26;
+                prices = new double[]{38, 38, 33, 30, 25, 23, 21};
+                last_price = 19;
                 min_price += 50 - 5;
                 weight = String.valueOf(DecimalFormat.format(area * 0.25 * number));
                 break;
@@ -417,27 +417,44 @@ public class PosterPrice {
                 weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
                 break;
         }
-        if (width * length < 40 * 50) {
-            price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
-        } else {
-            danjia = last_price;
+        Product pro = new Product();
+        List<Product> list = new ArrayList<Product>();
+        pro.setCount(count);
+        danjia = last_price;
+
+        if ("0".equals(kind2) || "1".equals(kind2)) {
             for (int i = 0; i < areas.length; i++) {
                 if (area <= areas[i]) {
                     danjia = prices[i];
                     break;
                 }
             }
-            price = Math.max(area * danjia, min_price);
-        }
-        Product pro = new Product();
-        List<Product> list = new ArrayList<Product>();
-        pro.setCount(count);
-        // 价格 = 面积 * 单价 + (款数-1) * 40
-        if (number > 1 && width * length >= 40 * 50) {
-            pro.setPrice(Math.ceil(price * number));
-        } else {
+            price = Math.max(area * danjia, min_price) * number;
+            if (area < areas[0]) {
+                price = min_price + 10 * number;
+            }
             pro.setPrice(Math.ceil(price));
+        } else {
+            if (width * length < 40 * 50) {
+                price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
+            } else {
+                for (int i = 0; i < areas.length; i++) {
+                    if (area <= areas[i]) {
+                        danjia = prices[i];
+                        break;
+                    }
+                }
+                price = Math.max(area * danjia, min_price);
+            }
+
+            // 价格 = 面积 * 单价 + (款数-1) * 40
+            if (number > 1 && width * length >= 40 * 50) {
+                pro.setPrice(Math.ceil(price * number));
+            } else {
+                pro.setPrice(Math.ceil(price));
+            }
         }
+
         pro.setWeight(weight);
         list.add(pro);
         return list;

+ 23 - 4
src/main/webapp/views/product/handkerchiefPaper.jsp

@@ -38,17 +38,21 @@
                     <option value="27*27">27*27cm</option>
                 </select>
             </div>
+            <span style="font-size: 14px; color: red">单色/双色:5000/箱   彩色:500/箱</span>
             <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="双色">
+                    <input type="radio" name="shen_color" lay-filter="colorType" title="双色" value="双色">
+                </span>
+                <span>
+                    <input type="radio" name="shen_color" lay-filter="colorType" title="彩色" value="彩色">
                 </span>
             </div>
             <p>
                 印刷颜色
             </p>
             <div class="layui-form-item">
-                <select name="craft" class="layui-form-select">
+                <select id="colorS" name="craft" class="layui-form-select">
                     <option value="黑色">黑色</option>
                     <option value="咖啡色">咖啡色</option>
                     <option value="浅绿色">浅绿色</option>
@@ -58,8 +62,6 @@
                     <option value="黄色">黄色</option>
                     <option value="红色">红色</option>
                 </select>
-
-
             </div>
             <div class="layui-form-item" style="display: none">
                 <select id="colorT" name="craft" class="layui-form-select" disabled>
@@ -189,21 +191,38 @@
             $("input[name='shen_color'][value='单色']").click();
             $("input[name='shen_color'][value='双色']").parent().show();
             $("input[name='shen_color'][value='双色']").attr("disabled", false);
+            $("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);
+                $("input[name='shen_color'][value='彩色']").parent().hide();
+                $("input[name='shen_color'][value='彩色']").attr("disabled", true);
             }
             form.render();
         })
         form.on("radio(colorType)", function (data) {
             $("#colorT").parent().hide();
             $("#colorT").attr("disabled", true)
+            let html = `<option value="黑色">黑色</option>
+                    <option value="咖啡色">咖啡色</option>
+                    <option value="浅绿色">浅绿色</option>
+                    <option value="深绿色">深绿色</option>
+                    <option value="蓝色">蓝色</option>
+                    <option value="橘色">橘色</option>
+                    <option value="黄色">黄色</option>
+                    <option value="红色">红色</option>`;
+            $("#colorS").empty().append(html);
             if (data.value == '双色') {
                 $("#colorT").parent().show();
                 $("#colorT").attr("disabled", false)
             }
+            if (data.value == "彩色") {
+                html = `<option value="彩色">彩色</option>`;
+                $("#colorS").empty().append(html);
+            }
             form.render();
         })
         form.on('checkbox(ui_craft)', function (data) {