Browse Source

新增产品重量

zhuyiyi 1 day ago
parent
commit
cb734e7d8f

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

@@ -4804,6 +4804,7 @@ public class ProductService {
                 break;
             }
             double craftPrice = 0;
+            double miniCraftPrice = 10;
             if (craft_list.contains("可变二维码") || craft_list.contains("序列号")) {
                 craftPrice = 0.02 * itemCount;
             }
@@ -4815,8 +4816,9 @@ public class ProductService {
             if (priceList.size() == 0) {
                 pro.setCount(count);
             }
-            pro.setPrice(Math.ceil((prices[j][i] + craftPrice) * number));
+            pro.setPrice(Math.ceil((prices[j][i] + Math.max(craftPrice, miniCraftPrice)) * number));
             pro.setNumber(number);
+            pro.setWeight(df.format(width * length * itemCount * 0.08 / 100 / 10000));
             priceList.add(pro);
             if (priceList.size() == 1 && itemCount != count) {
                 break;
@@ -4885,6 +4887,7 @@ public class ProductService {
         if (craft_list.contains("异形模切")) {
             rate = 1.35;
         }
+
         double unitPrice = 0;
         Product pro = new Product();
         for (int i = 0; i < counts.length; i++) {
@@ -4901,10 +4904,13 @@ public class ProductService {
                 pro.setCount(count);
                 pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice));
                 pro.setNumber(number);
+                pro.setWeight(df.format(width * length * 1.2 * count * 0.1 / 1000 * Double.parseDouble(kind)));
                 priceList.add(pro);
             }
+
             pro = new Product();
             pro.setCount(itemCount);
+            pro.setWeight(df.format(width * length * 1.2 * itemCount * 0.1 / 1000 * Double.parseDouble(kind)));
             pro.setPrice(Math.max(Math.ceil(unitPrice * itemCount * rate), miniPrice));
             pro.setNumber(number);
             priceList.add(pro);
@@ -4914,6 +4920,7 @@ public class ProductService {
             pro.setCount(count);
             pro.setPrice(Math.max(Math.ceil(unitPrice * count * rate), miniPrice));
             pro.setNumber(number);
+            pro.setWeight(df.format(width * length * 1.2 * count * 0.1 / 1000 * Double.parseDouble(kind)));
             priceList.add(pro);
         }
         return priceList;
@@ -4926,12 +4933,15 @@ public class ProductService {
         int count = dto.getCount();
         int number = dto.getNumber();
         int[] counts = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+        double baseWeight = 8.7;
         int base = 0;
         if (width == 23) {
             base = 1;
+            baseWeight = 9.3;
         }
         if (width == 27) {
             base = 2;
+            baseWeight = 11;
         }
         double[][] prices = {
                 {118, 236, 350, 450, 480, 576, 672, 768, 864, 900},
@@ -4959,6 +4969,7 @@ public class ProductService {
             pro.setCount(itemCount);
             pro.setPrice(Math.ceil(prices[base][i] * number));
             pro.setNumber(number);
+            pro.setWeight(df.format(baseWeight * itemCount));
             priceList.add(pro);
         }
         if (priceList.size() == 0 && count > maxCount) {
@@ -4967,6 +4978,7 @@ public class ProductService {
             pro.setCount(count);
             pro.setPrice(Math.ceil(basePrice / maxCount * count * number));
             pro.setNumber(number);
+            pro.setWeight(df.format(baseWeight * count));
             priceList.add(pro);
         }
 
@@ -4979,12 +4991,20 @@ public class ProductService {
         int count = dto.getCount();
         int number = dto.getNumber();
         double[] prices = {2500, 4800, 7200, 12000};
-
+        double height = 6.5;
+        width = 12.8;
+        length = 10.5;
         if (dto.getPcount() == 3) {
             prices = new double[]{6000, 12000, 18000, 27000};
+            height = 6.5;
+            width = 21.5;
+            length = 16.0;
         }
-        if (dto.getPcount() == 4) {
+        if (dto.getPcount() == 5) {
             prices = new double[]{3600, 7200, 10800, 17750};
+            height = 5.0;
+            width = 16.5;
+            length = 13.5;
         }
 
         int[] counts = {10000, 20000, 30000, 50000};
@@ -4997,6 +5017,7 @@ public class ProductService {
             pro.setCount(counts[i]);
             pro.setPrice(Math.ceil(prices[i] * number));
             pro.setNumber(number);
+            pro.setWeight(df.format(width * length * 2 * 0.35 / 10000 * counts[i]));
             priceList.add(pro);
         }
         return priceList;
@@ -5050,6 +5071,7 @@ public class ProductService {
             pro = new Product();
             pro.setCount(itemCount);
             pro.setPrice(Math.ceil(unit_prices[base][i] * itemCount * number));
+            pro.setWeight(df.format(width * length * 1.8 * itemCount / 10000 ));
             priceList.add(pro);
 
         }
@@ -5081,6 +5103,7 @@ public class ProductService {
         Product pro = new Product();
         pro.setCount(dto.getCount());
         pro.setNumber(dto.getNumber());
+        pro.setWeight(df.format(width * length * 4.17 * dto.getCount() * 0.1 / 1000 * Double.parseDouble(cailiao)));
         pro.setPrice(Math.ceil(Math.max(price, min_price) + ((dto.getNumber() - 1) * 8)));
         priceList.add(pro);
 
@@ -5213,6 +5236,7 @@ public class ProductService {
         priceList = getAreaCenterPrice(count_list, count, area, prices, areas, number);
         for (Product product : priceList) {
             product.setPrice(Math.ceil(product.getPrice() * 1.3));
+            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
         }
         if (carft_list.contains("印白墨")) {
             priceList = PriceUtils.getYinBaiPrice(priceList, width, length);
@@ -5273,8 +5297,21 @@ public class ProductService {
         if (carftList.contains("穿涤纶丝带") || carftList.contains("穿吊牌绳") || carftList.contains("穿弹力绳")) {
             craft_price += Math.ceil(0.15 * dto.getCount() * dto.getNumber());
         }
+        int number = dto.getNumber();
+        double designFee = 5.5 * (number - 1);
+        double cardDesignFee = 0.0;
+        int card_num = getNum((length - 4) / 10, (width - 4) / 10);
+        if (card_num <= 1) {
+            cardDesignFee = 8.5;
+        } else if (card_num <= 2) {
+            cardDesignFee = 12.5;
+        } else if (card_num <= 3) {
+            cardDesignFee = 16.5;
+        } else {
+            cardDesignFee = 20.5;
+        }
         Product pro = new Product();
-        pro.setPrice(Math.ceil(Math.max(base_price * num, min_price) + craft_price));
+        pro.setPrice(Math.ceil(Math.max(base_price * num + designFee + cardDesignFee, min_price) + craft_price));
         pro.setCount(dto.getCount());
         pro.setNumber(dto.getNumber());
         pro.setWeight(df.format(dto.getNumber() * (length - 4) / 1000 * (width - 4) / 1000 * dto.getCount() * 0.2 * 0.86));
@@ -5341,13 +5378,16 @@ public class ProductService {
                     {1365, 1575, 2135, 2345, 2800, 3150, 3220, 3703, 4258, 4855, 5534, 6254, 7067, 7915, 8864, 9840, 10921},
             };
         }
+        int number = dto.getNumber();
         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毫出血
         List<Product> priceList = getAreaNextPrice(count_list, dto.getCount(), area, prices, areas, dto.getNumber());
-        priceList.forEach(product -> {
+        for (Product product : priceList) {
             product.setPrice(Math.ceil(product.getPrice() * 0.8));
-        });
+            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3));
+        }
+
         return priceList;
     }
 
@@ -5580,6 +5620,7 @@ public class ProductService {
                 basePrice = 100;
             }
         }
+        int number = dto.getNumber();
         List<Product> priceList = new ArrayList<>();
         Product pro = new Product();
         double price = basePrice * dto.getCount() * area * dto.getNumber();
@@ -5588,6 +5629,7 @@ public class ProductService {
         }
         pro.setPrice(Math.ceil(Math.max(price, minPrice)));
         pro.setCount(dto.getCount());
+        pro.setWeight(df.format(area * 0.25 * number));
         priceList.add(pro);
         return priceList;
     }
@@ -5730,7 +5772,7 @@ public class ProductService {
         int num = getNum(width, length);
         List<Product> priceList = new ArrayList<>();
         List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
-
+        int number = dto.getNumber();
         for (int i = 0; i < count_list.length; i++) {
             int count_item = count_list[i];
             if (priceList.size() > 2) {
@@ -5744,6 +5786,7 @@ public class ProductService {
             Product product = new Product();
             product.setCount(count_item);
             product.setPrice(Math.ceil(price));
+
             priceList.add(product);
         }
         for (Product product : priceList) {
@@ -5778,6 +5821,8 @@ public class ProductService {
                 carft_price += Math.max(0.015 * item_count, 25);
             }
             product.setPrice(Math.ceil(product.getPrice() + carft_price) * dto.getNumber());
+            product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
+
         }
 
         return priceList;

+ 1 - 0
src/main/webapp/views/product/aromatherapyCard.jsp

@@ -78,6 +78,7 @@
                     <option value="柠檬香">柠檬香</option>
                     <option value="茉莉">茉莉</option>
                     <option value="邂逅">邂逅</option>
+                    <option value="无味">无味</option>
                 </select>
             </div>
             <p>

+ 3 - 3
src/main/webapp/views/product/stickers.jsp

@@ -349,9 +349,9 @@
                        lay-skin="primary">
                 <input type="checkbox" name="aotu" lay-filter="switch" value="加凹凸" title="加凹凸" class="aotu"
                        lay-skin="primary">
-                <input type="checkbox" name="aotu" lay-filter="switch" value="印2色" title="印2色" class="yayinHide aotu"
-                       lay-skin="primary">
-                <input type="checkbox" name="aotu" lay-filter="switch" value="纯烫金" title="纯烫金" class="yayinHide aotu"
+                <%--                <input type="checkbox" name="aotu" lay-filter="switch" value="印2色" title="印2色" class="yayinHide aotu"--%>
+                <%--                       lay-skin="primary">--%>
+                <input type="checkbox" name="aotu" lay-filter="switch" value="纯烫金" title="纯烫金" class="aotu"
                        lay-skin="primary">
                 <!--<input type="checkbox" name="aotu" lay-filter="switch" value="印2色+凹凸" title="印2色+凹凸" class="aotu" lay-skin="primary">-->
             </div>

+ 1 - 1
src/main/webapp/views/product/takeoutBox.jsp

@@ -245,7 +245,7 @@
                         }
                     } else {
                         for (let i = 0; i < data.length; i++) {
-                            span_result += number + '款 ' + data[i].count + "ge,共" + data[i].price + "元" + '\n'
+                            span_result += number + '款 ' + data[i].count + ",共" + data[i].price + "元" + '\n'
                             data[i].number = number;
                         }
                     }