瀏覽代碼

修改淋膜纸加个

zhuyiyi 2 周之前
父節點
當前提交
8ea3cc18c9
共有 2 個文件被更改,包括 31 次插入26 次删除
  1. 27 22
      src/main/java/lingtao/net/service/ProductService.java
  2. 4 4
      src/main/webapp/views/product/lingmo.jsp

+ 27 - 22
src/main/java/lingtao/net/service/ProductService.java

@@ -1801,14 +1801,7 @@ public class ProductService {
                     for (Product product : priceList) {
                         product.setPrice(Math.ceil(product.getPrice() * number * min * zhekou));
                     }
-                    for (Product product : priceList) {
-                        if (craft_list.contains("配流苏")) {
-                            product.setPrice(Math.ceil(product.getPrice() + 0.15 * dto.getCount() * number));
-                        }
-                        if (craft_list.contains("穿流苏")) {
-                            product.setPrice(Math.ceil(product.getPrice() + 0.5 * dto.getCount() * number));
-                        }
-                    }
+
                     if ("500克拉丝闪银".equals(kind)) {
                         String[] craft = dto.getCraft();
                         if (!StringUtils.isEmpty(craft)) {
@@ -1832,6 +1825,15 @@ public class ProductService {
                         dto.setMaxian(1);
                         getCraft(dto, priceList, length, width, 0);
                     }
+
+                    for (Product product : priceList) {
+                        if (craft_list.contains("配流苏")) {
+                            product.setPrice(Math.ceil(product.getPrice() + 0.15 * dto.getCount() * number));
+                        }
+                        if (craft_list.contains("穿流苏")) {
+                            product.setPrice(Math.ceil(product.getPrice() + 0.5 * dto.getCount() * number));
+                        }
+                    }
                     // 根据位数重新算价格
                     // 根据款数重新算价格
 
@@ -6306,19 +6308,19 @@ public class ProductService {
     private List<Product> getLingmoPrice(Product dto, Double width, Double length) {
         List<String> carftList = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
         int count_list[] = {10000, 20000, 30000, 50000, 100000};
-        double[] prices_list = {1150, 1950, 2350, 3300, 6150};
-        if ((width <= 21 && length <= 29) || (length <= 21 && width <= 29)) {
-
-        } else if ((width <= 36 && length <= 24) || (length <= 36 && width <= 24)) {
-            prices_list = new double[]{1350, 2050, 2550, 4050, 7200};
-        } else if ((width <= 36 && length <= 26) || (length <= 36 && width <= 26)) {
-            prices_list = new double[]{1450, 2100, 2650, 4250, 7500};
-        } else if ((width <= 42 && length <= 28.5) || (length <= 42 && width <= 28.5)) {
-            prices_list = new double[]{1700, 2750, 3600, 6000, 11000};
-        }
+        int number = dto.getNumber();
         List<Product> list = new ArrayList<>();
+        double basePrice = width * length * 55 * 12 / 10000 / 1000 + 0.05;
+        if ((width > 60 || length > 80) && width > 80 || length > 60) {
+            basePrice = basePrice * 4;
+        } else if ((width > 50 || length > 30) && width > 30 || length > 50) {
+            basePrice = basePrice * 2;
+        }
+        double miniPrice = 850;
+        double yunPrice = 50;
+        double banPrice = 180;
+
         for (int i = 0; i < count_list.length; i++) {
-            double price = prices_list[i];
 
             int item_count = count_list[i];
 
@@ -6329,13 +6331,16 @@ public class ProductService {
                 break;
             }
             double craft_price = 0;
-            if (dto.getCo_number() >= 2) {
-                craft_price = 150 * (dto.getCo_number() - 1);
+            //3万张以内的价格需要加上上机费,1-2色的上机费是200元,3色400
+            if (item_count <= 30000) {
+                craft_price = Math.ceil(Math.max(200, (dto.getCo_number() - 1) * 200));
             }
+            double price = 0;
+            price = Math.ceil(Math.max(miniPrice, basePrice * item_count + item_count / 10000 * yunPrice + banPrice + craft_price));
             Product pro = new Product();
             pro.setCount(item_count);
+            pro.setPrice(price * number);
             pro.setWeight(df.format(0.005 * item_count * dto.getNumber()));
-            pro.setPrice(Math.ceil((price * dto.getNumber() + craft_price) * 1.2));
             list.add(pro);
         }
         return list;

+ 4 - 4
src/main/webapp/views/product/lingmo.jsp

@@ -234,13 +234,13 @@
                 });
                 return false;
             }
-            if ((size.split("*")[0] > 42 || size.split("*")[1] > 28.5) && (size.split("*")[1] > 42 || size.split("*")[0] > 28.5)) {
-                layer.msg('最大尺寸42*28.5cm!', {offset: ['300px', '300px']}, function () {
+            if ((size.split("*")[0] > 100 || size.split("*")[1] > 100) && (size.split("*")[1] > 100 || size.split("*")[0] > 100)) {
+                layer.msg('最大尺寸100*100cm!', {offset: ['300px', '300px']}, function () {
                 });
                 return false;
             }
-            if ((size.split("*")[0] < 21 || size.split("*")[1] < 14)&&(size.split("*")[0] < 14 || size.split("*")[1] < 21)) {
-                layer.msg('最小尺寸21*14cm!', {offset: ['300px', '300px']}, function () {
+            if ((size.split("*")[0] < 9 || size.split("*")[1] < 5.4)&&(size.split("*")[0] < 5.4 || size.split("*")[1] < 9)) {
+                layer.msg('最小尺寸9*5.4cm!', {offset: ['300px', '300px']}, function () {
                 });
                 return false;
             }