zhuyiyi 10 месяцев назад
Родитель
Сommit
1dd5eed7a5

+ 28 - 5
src/main/java/lingtao/net/service/ProductService.java

@@ -601,12 +601,18 @@ public class ProductService {
                     priceList = priceList.subList(0, 4);
                 }
                 List<String> crafts_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
+                int[] shengzi = {1, 2, 4, 8, 12, 16, 20, 40};
+                int[] count_list = {200, 500, 1000, 2000, 3000, 4000, 5000, 10000};
                 // 根据款数重新算价格/计算重量
                 for (Product product : priceList) {
                     product.setPrice(Math.floor(product.getPrice() * number));
                     if (crafts_list.contains("弹力绳")) {
                         product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
                     }
+                    if (crafts_list.contains("弹力绳捆")) {
+                        int currentIndex = Arrays.binarySearch(count_list, product.getCount());
+                        product.setPrice(Math.floor(product.getPrice() + shengzi[currentIndex] * 10));
+                    }
                     product.setWeight(df.format(number * length * width * product.getCount() * 0.00003));
                 }
                 return priceList;
@@ -691,7 +697,8 @@ public class ProductService {
                         };
                         double[] areas = {16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 172.8, 194.4, 224, 288, 294, 400};
                         double[] tang_areas = {50, 100, 150, 250, 350, 450};
-                        int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};
+                        count_list = new int[]{200, 500, 1000, 2000, 3000, 5000, 10000};
+                        int[] shenzi_list = {1, 2, 4, 8, 12, 20, 40};
                         List<String> craft_list = dto.getCraft() != null ? Arrays.asList(dto.getCraft()) : new ArrayList<>();
                         for (int i = 0; i < count_list.length; i++) {
                             int item_count = count_list[i];
@@ -742,6 +749,10 @@ public class ProductService {
                                 if (craft_list.contains("配弹力绳")) {
                                     carft_price += Math.max(0.1 * item_count, 10);
                                 }
+                                if (craft_list.contains("配弹力绳捆")) {
+                                    carft_price += 10 * shenzi_list[count_index];
+
+                                }
                                 double tang_price = 0;
                                 if (craft_list.contains("单面烫金") || craft_list.contains("双面烫金")) {
                                     tang_price = new PriceUtils().TablePrice(area, tang_prices[count_index], tang_areas);
@@ -894,6 +905,8 @@ public class ProductService {
                         int min = getNum(length, width);
                         priceList = getHekaPrice(min, product1, priceList, count);
                         getCraft(product1, priceList, length * 10, width * 10, min);
+                        shengzi = new int[]{1, 2, 4, 8, 12, 16, 20, 40};
+                        count_list = new int[]{200, 500, 1000, 2000, 3000, 4000, 5000, 10000};
                         for (Product product : priceList) {
                             if ("凹凸".equals(dto.getAotu())) {
                                 product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
@@ -901,6 +914,10 @@ public class ProductService {
                             if (craft.contains("弹力绳")) {
                                 product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
                             }
+                            if (craft.contains("弹力绳捆")) {
+                                int currentIndex = Arrays.binarySearch(count_list, product.getCount());
+                                product.setPrice(Math.floor(product.getPrice() + shengzi[currentIndex] * 10));
+                            }
                         }
                         // 根据款数重新算价格/计算重量
                         for (Product product : priceList) {
@@ -972,6 +989,8 @@ public class ProductService {
                                 }
                             }
                         }
+                        shengzi = new int[]{1, 2, 4, 8, 12, 16, 20, 40};
+                        count_list = new int[]{200, 500, 1000, 2000, 3000, 4000, 5000, 10000};
                         // +棉绳钱 1分5一条
                         for (Product product : priceList) {
                             if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("棉绳")) {
@@ -980,6 +999,10 @@ public class ProductService {
                             if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("弹力绳")) {
                                 product.setPrice(product.getPrice() + Math.max(product.getCount() * 0.1, 10));
                             }
+                            if (!StringUtils.isEmpty(dto.getCraftSheng()) && dto.getCraftSheng().contains("弹力绳捆")) {
+                                int currentIndex = Arrays.binarySearch(count_list, product.getCount());
+                                product.setPrice(product.getPrice() + 10 * shengzi[currentIndex]);
+                            }
                         }
                         for (Product product : priceList) {
                             product.setWeight(df.format(length * width * product.getCount() / 10000 * 0.6));
@@ -1105,7 +1128,7 @@ public class ProductService {
                     priceList.add(dto2);
                     getCraft(dto, priceList, null, null, 0);
                 } else if ("素芸".equals(kind)) {
-                    int[] count_list = {100, 200, 400, 500, 1000, 2000, 3000, 5000, 10000};
+                    count_list = new int[]{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("异形模切")) {
@@ -1149,7 +1172,7 @@ public class ProductService {
                     }
                     return priceList;
                 } else if ("草香".equals(kind) || "芳怡".equals(kind)) {
-                    int[] count_list = {200, 500, 1000, 2000, 5000, 10000};
+                    count_list = new int[]{200, 500, 1000, 2000, 5000, 10000};
                     // 出血(一边2毫米)
                     length = length * 10 + 4;
                     width = width * 10 + 4;
@@ -3541,7 +3564,7 @@ public class ProductService {
                         product.setPrice(Math.floor(product.getPrice() * 1.3));
                     }
                 } else if ("10".equals(kind) || "11".equals(kind)) {
-                    int[] count_list = {50, 100, 200, 500, 1000};
+                    count_list = new int[]{50, 100, 200, 500, 1000};
                     double[] jitu = {};
                     double[] jitu_add = {};
                     double[] tang = {};
@@ -4190,7 +4213,7 @@ public class ProductService {
                         {226, 312, 368, 452, 550, 672, 814, 980, 1358, 1636, 1746, 2008, 2190, 2502, 2970},
                         {274, 470, 594, 784, 988, 1250, 1518, 1854, 2614, 3184, 3398, 3936, 4298, 4916, 5872},
                 };
-                int[] count_list = {500, 1000, 2000, 3000, 5000, 10000, 20000};
+                count_list = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
                 double[] areas = {1, 4, 6, 9, 12, 16, 20, 25, 36, 45, 48.6, 54, 60, 72, 81};
 
                 area = length * width;

+ 38 - 5
src/main/webapp/views/product/coupon.jsp

@@ -670,7 +670,9 @@
                             </select>
                         </div>
                         <input type="checkbox" class="peijian" name="craft" lay-filter="z4PeiJian" value="配弹力绳"
-                               title="配弹力绳(20cm)">
+                               title="配弹力绳(15cm)">
+                        <input type="checkbox" class="peijian" name="craft" lay-filter="z4PeiJian" value="配弹力绳捆"
+                               title="配弹力绳(捆)">
                         <div class="layui-inline shengz tscolor" style="width: 110px;display: none">
                             <select class="select">
                                 <option value="金色绳子">金色绳子</option>
@@ -1017,7 +1019,7 @@
                         $("#z4_craft .shengz").prop("disabled", true);
                     }
                 }
-                if (data.value == "配弹力绳" ) {
+                if (data.value == "配弹力绳" || data.value == "配弹力绳捆") {
                     if ($(data.elem).is(":checked")) {
                         $("#z4_craft .tscolor").show();
                         $("#z4_craft .tscolor").prop("disabled", false);
@@ -2688,6 +2690,14 @@
                                 arr.push($(this).val() + "-" + $("select[name='shen_color'] option:selected").val())
                                 return;
                             }
+                            if ($(this).val() == "配弹力绳捆") {
+                                arr.push("配弹力绳(捆)");
+                                return;
+                            }
+                            if ($(this).val() == "配弹力绳") {
+                                arr.push("配弹力绳(15CM)");
+                                return;
+                            }
                         }
 
                         arr.push($(this).val());
@@ -3135,7 +3145,13 @@
                             $("input:checkbox[name='craft']:checked").each(function (i) {
                                 if (!$(this).is(':disabled')) {
                                     if ($(this).val() != "双面覆哑膜") {
-                                        arr.push($(this).val());
+                                        if ($(this).val() == "配弹力绳捆") {
+                                            arr.push("配弹力绳(捆)");
+                                        } else if ($(this).val() == "配弹力绳") {
+                                            arr.push("配弹力绳(15CM)");
+                                        } else {
+                                            arr.push($(this).val());
+                                        }
                                     }
                                 }
                             });
@@ -3240,6 +3256,7 @@
                                 + "厘米-(" + same + ") \n" + "工艺 :" + arr + "\n";
                         }
 
+                        let count_price = {200: 1, 500: 2, 1000: 4, 2000: 8, 3000: 12, 4000: 16, 5000: 20, 10000: 40};
                         if (number > 1) {
                             if (couponKind == "少数量") {
                                 let numberType = $("#desType option:selected").text();
@@ -3247,12 +3264,28 @@
                             }
 
                             for (let i = 0; i < data.length; i++) {
-                                span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + '\n'
+                                let price_text = "";
+
+                                if (arr.indexOf("配弹力绳(捆)") > -1) {
+                                    let price_count = count_price[data[i].count];
+                                    if (price_count) {
+                                        price_text = "," + price_count + "捆";
+                                    }
+                                }
+                                span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + price_text + '\n'
                                 data[i].number = number;
                             }
                         } else {
                             for (let i = 0; i < data.length; i++) {
-                                span_result += number + '款 ' + data[i].count + "个,共" + data[i].price + "元" + '\n'
+                                let price_text = "";
+
+                                if (arr.indexOf("配弹力绳(捆)") > -1) {
+                                    let price_count = count_price[data[i].count];
+                                    if (price_count) {
+                                        price_text = "," + price_count + "捆";
+                                    }
+                                }
+                                span_result += number + '款 ' + data[i].count + "个,共" + data[i].price + "元" + price_text + '\n'
                                 data[i].number = number;
                             }
                         }

+ 3 - 1
src/main/webapp/views/product/tag.jsp

@@ -46,7 +46,9 @@ class="layui-input" value="吊牌"> -->
 <span class="craftSheng">
 	<input type="checkbox" class="craftSheng2" name="craftSheng" lay-filter="switch" value="棉绳" title="棉绳"
            lay-skin="primary">
-    <input type="checkbox" class="craftSheng2" name="craftSheng" lay-filter="switch" value="配弹力绳" title="配弹力绳(20cm)"
+    <input type="checkbox" class="craftSheng2" name="craftSheng" lay-filter="switch" value="配弹力绳" title="配弹力绳(15cm)"
+           lay-skin="primary">
+    <input type="checkbox" class="craftSheng2" name="craftSheng" lay-filter="switch" value="配弹力绳捆" title="配弹力绳(捆)"
            lay-skin="primary">
     <div class="shengz tscolor" style="width: 150px;display: none">
         <select class="select">

+ 73 - 9
src/main/webapp/views/product/tagClothes.jsp

@@ -160,7 +160,9 @@
                                 </select>
                             </div>
                             <input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳"
-                                   title="弹力绳(20cm)">
+                                   title="弹力绳(15cm)">
+                            <input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳捆"
+                                   title="弹力绳(捆)">
                             <div class="shengz tscolor" style="width: 150px;display: none">
                                 <select class="select">
                                     <option value="金色绳子">金色绳子</option>
@@ -385,12 +387,18 @@
             getProductImage()
             let shengz = $(".shengz:checked").length;
             let tshengz = $(".tshengz:checked").length;
-            if(shengz == 1 && tshengz == 1){
+            if (shengz == 1 && tshengz == 1) {
                 $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
                 $(data.elem).prop("checked", false);
                 layer.msg('棉绳和弹力绳不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
                 return false;
             }
+            if (tshengz > 1) {
+                $(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
+                $(data.elem).prop("checked", false);
+                layer.msg('弹力绳不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
+                return false;
+            }
             if (shengz == 1) {
                 $(".scolor").css("display", "inline-block")
             } else {
@@ -446,7 +454,7 @@
                 layer.msg('棉绳和弹力绳不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
                 return false;
             }
-            if (data.value == "配弹力绳") {
+            if (data.value == "配弹力绳" || data.value == "配弹力绳捆") {
                 if ($(data.elem).is(":checked")) {
                     $(".craftSheng .tscolor").show();
                     $(".craftSheng .tscolor").prop("disabled", false);
@@ -711,6 +719,12 @@
                         arr = []
                         //arr = $('input[name="kind2Value"]:checked').val();
                         // arr.push("双面哑膜");
+                        let shengcraft = $("input[name='craftSheng']:checked").val();
+                        if (shengcraft == "配弹力绳") {
+                            arr.push("配弹力绳(15CM)")
+                        } else if (shengcraft == "配弹力绳捆") {
+                            arr.push("配弹力绳(捆)")
+                        }
                         arr.push($('input[name="kind2Value"]:checked').val());
                     } else if ($('input[name="kindValue"]:checked').val() == "6") {
                         craftQie = ""
@@ -733,6 +747,12 @@
                         arr = []
                         //arr = $('input[name="kind2Value"]:checked').val();
                         // arr.push("双面哑膜");
+                        let shengcraft = $("input[name='craftSheng']:checked").val();
+                        if (shengcraft == "配弹力绳") {
+                            arr.push("配弹力绳(15CM)")
+                        } else if (shengcraft == "配弹力绳捆") {
+                            arr.push("配弹力绳(捆)")
+                        }
                         arr.push($('input[name="kind2Value"]:checked').val());
                     } else if ($('input[name="kindValue"]:checked').val() == "3") { //  && craftQie == "异形模切"
                         var size2 = $(".size2").val();
@@ -743,7 +763,15 @@
                         $("input:checkbox[name='craft']:checked").each(function (i) {
                             if (!$(this).is(':disabled')) {
                                 if ($(this).val() != "双面覆哑膜") {
-                                    arr.push($(this).val());
+                                    if ($(this).val() == "弹力绳") {
+                                        arr.push("配弹力绳(15cm)");
+                                    } else if ($(this).val() == "弹力绳捆") {
+                                        arr.push("配弹力绳(捆)");
+                                    } else {
+                                        arr.push($(this).val());
+                                    }
+
+
                                 }
                             }
                         });
@@ -770,16 +798,33 @@
                         }
                     }
 
+                    let count_price = {200: 1, 500: 2, 1000: 4, 2000: 8, 3000: 12, 4000: 16, 5000: 20, 10000: 40};
                     if (kindValue == 3) {
-
                         if (number > 1) {
                             for (let i = 0; i < data.length; i++) {
-                                span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + '\n'
+                                let price_text = "";
+
+                                if (arr.indexOf("配弹力绳(捆)") > -1) {
+                                    let price_count = count_price[data[i].count];
+                                    if (price_count) {
+                                        price_text = "," + price_count + "捆";
+                                    }
+                                }
+
+                                span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + price_text + '\n'
                                 data[i].number = number;
                             }
                         } else {
                             for (let i = 0; i < data.length; i++) {
-                                span_result += data[i].count + "张" + data[i].price + "元" + '\n'
+                                let price_text = "";
+
+                                if (arr.indexOf("配弹力绳(捆)") > -1) {
+                                    let price_count = count_price[data[i].count];
+                                    if (price_count) {
+                                        price_text = "," + price_count + "捆";
+                                    }
+                                }
+                                span_result += data[i].count + "张" + data[i].price + "元" + price_text + '\n'
                                 data[i].number = number;
                             }
                         }
@@ -791,13 +836,32 @@
                         }
                     } else {
                         if (number > 1) {
+
                             for (let i = 0; i < data.length; i++) {
-                                span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + '\n'
+
+                                let price_text = "";
+
+                                if (arr.indexOf("配弹力绳(捆)") > -1) {
+                                    let price_count = count_price[data[i].count];
+                                    if (price_count) {
+                                        price_text = "," + price_count + "捆";
+                                    }
+                                }
+                                span_result += number + '款 各' + data[i].count + "张,共" + data[i].price + "元" + price_text + '\n'
                                 data[i].number = number;
                             }
                         } else {
+
                             for (let i = 0; i < data.length; i++) {
-                                span_result += number + '款 ' + data[i].count + "张,共" + data[i].price + "元" + '\n'
+                                let price_text = "";
+
+                                if (arr.indexOf("配弹力绳(捆)") > -1) {
+                                    let price_count = count_price[data[i].count];
+                                    if (price_count) {
+                                        price_text = "," + price_count + "捆";
+                                    }
+                                }
+                                span_result += number + '款 ' + data[i].count + "张,共" + data[i].price + "元" + price_text + '\n'
                                 data[i].number = number;
                             }
                         }