Selaa lähdekoodia

贺卡新增内部模切

zhuyiyi 1 viikko sitten
vanhempi
sitoutus
d6d264e86e

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

@@ -1094,6 +1094,9 @@ public class ProductService {
                             }
                             carft_price += carft_base_price * Math.ceil(product.getCount() / 1000.0);
                         }
+                        if (craft_list.contains("内部模切")) {
+                            carft_price += 15 * dto.getN_mq_num();
+                        }
                         //腰封的模切费单独计算
                         product.setPrice(Math.ceil((product.getPrice() + carft_price) * number + Math.max(Math.ceil(moqiePrice * product.getCount() * number), moqiePrice > 0 ? 55 : 0)));
                         product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
@@ -1307,7 +1310,9 @@ public class ProductService {
                             }
                             if ("4".equals(kind)) {
                                 product.setPrice(Math.floor(product.getPrice() * 1.3));
-
+                                if (num == 1 && "无".equals(kind2)) {
+                                    product.setPrice(Math.floor(product.getPrice() * 1.3));
+                                }
                                 // 服装吊牌里面的900克吊牌把价格
                                 if (product.getCount() <= 2000) {
                                     product.setPrice(Math.floor(product.getPrice() * 1.1));
@@ -4912,7 +4917,7 @@ public class ProductService {
             craft_price += Math.max(dto.getMaxian(), 1) * 1.5;
         }
         if (craft_list.contains("丝带")) {
-            craft_price += Math.max(dto.getPcount(), 1) * 1.5;
+            craft_price += Math.max(dto.getPcount(), 1) * 3.5;
         }
         for (int i = 0; i < counts.length; i++) {
             int countItem = counts[i];
@@ -4930,6 +4935,13 @@ public class ProductService {
             pro.setPrice(Math.ceil((double) base_price / counts[isFirst ? Math.max(i - 1, 0) : i] * Math.max(min_count, isFirst ? count : countItem) + craft_price));
             priceList.add(pro);
         }
+        if (priceList.size() == 0) {
+            Product pro = new Product();
+            pro.setCount(count);
+            pro.setNumber(number);
+            pro.setPrice(Math.ceil((double) prices[prices.length - 1] / counts[counts.length - 1] * Math.max(min_count, count) + craft_price));
+            priceList.add(pro);
+        }
         return priceList;
     }
 
@@ -5379,7 +5391,7 @@ public class ProductService {
             }
             pro = new Product();
             pro.setCount(itemCount);
-            pro.setPrice(Math.ceil(prices[base][i] * number));
+            pro.setPrice(Math.ceil(prices[base][i] * number * 1.2));
             pro.setNumber(number);
             pro.setWeight(df.format(baseWeight * itemCount));
             priceList.add(pro);
@@ -5779,13 +5791,13 @@ public class ProductService {
         if ("2".equals(dto.getKind())) {
             max_width = 420;
             max_length = 310;
-            base_price = 45;
+            base_price = 35;
             min_price = 60;
         }
         if ("3".equals(dto.getKind())) {
             max_width = 420;
             max_length = 310;
-            base_price = 48;
+            base_price = 40;
             min_price = 60;
         }
         width = width * 10 + 4;
@@ -7248,7 +7260,7 @@ public class ProductService {
                 double price = 0;
                 for (int i = 0; i < bigCountArr.length; i++) {
                     if (product.getCount() >= bigCountArr[i]) {
-                        price = productPrice + basePrice[i] * number;
+                        price = productPrice + basePrice[i];
                     }
                 }
                 product.setPrice(Math.max(price, productPrice));

+ 126 - 45
src/main/webapp/views/product/coupon.jsp

@@ -460,7 +460,46 @@
                         <%--                            <input type="checkbox" class="ui_double_fm" name="craft" lay-filter="ui_fm" value="双面覆哑膜"--%>
                         <%--                                   title="双面覆哑膜">--%>
                         <%--                        </div>--%>
+                        <div class="layui-input-block value7">
+                            <input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="模切"
+                                   title="异形模切">
+                            <input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="直角裁切"
+                                   title="直角裁切" checked>
+                            <span class="ui_fm_l">
+                                <input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面覆哑膜"
+                                       title="双面覆哑膜"/>
+                            </span>
+                            <span class="yhydx">
 
+                                <input type="checkbox" name="craft" class="layui-input" lay-filter="ui_yf_fm" value="压痕"
+                                       title="压痕">
+                                <div class="layui-inline yhselect" style="width:60px; display:none">
+                                    <select name="yaheng" class="layui-select ">
+                                        <option value="1">1</option>
+                                        <option value="2">2</option>
+                                        <option value="3">3</option>
+                                        <option value="4">4</option>
+                                    </select>
+                                </div>
+                                <input type="checkbox" name="craft" class="layui-input" lay-filter="ui_yf_fm"
+                                       value="压点线" title="压点线">
+                                <div class="layui-inline ydxselect" style="width:60px;display:none">
+                                    <select name="dadianxian" class="layui-select ">
+                                        <option value="1">1</option>
+                                        <option value="2">2</option>
+                                        <option value="3">3</option>
+                                        <option value="4">4</option>
+                                    </select>
+                                </div>
+                                <input type="checkbox" name="craft" class="tang" lay-filter="switch" value="单面烫金" title="单面烫金">
+                            </span>
+                            <div id="craftHu" style="display:none;margin-top: 5px;">
+                                <input type="checkbox" name="craft" class="ui_hu" lay-filter="switch" value="糊成品"
+                                       title="糊成品">
+                                <input type="checkbox" name="craft" class="ui_hu" lay-filter="switch" value="糊半成品"
+                                       title="糊半成品">
+                            </div>
+                        </div>
                         <div class="layui-input-block craft tj" style="display:inline-block;">
                             <input type="checkbox" name="craft" class="tangjin" lay-filter="switch" value="单面烫金"
                                    title="单面烫金">
@@ -552,53 +591,25 @@
                                     </select>
                                 </div>
                             </div>
-                            <div class="bmType" style="display:none"><span style="font-size:14px;color:red">打码数量为‘2’时,需要选择打码类型:[水平编码] 或 [上下编码]
-                                </br>水平编码:价格相同; 上下编码:价格不同
-                                </br>只能打红色码和黑色码 ,3个码的价格按照7个码的翻倍价格算
-                            </span>
+                            <div class="bmType" style="display:none">
+                                <span style="font-size:14px;color:red">打码数量为‘2’时,需要选择打码类型:[水平编码] 或 [上下编码]
+                                    </br>水平编码:价格相同; 上下编码:价格不同
+                                    </br>只能打红色码和黑色码 ,3个码的价格按照7个码的翻倍价格算
+                                </span>
                             </div>
                         </div>
-                        <div class="layui-input-block value7">
-                            <input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="模切"
-                                   title="异形模切">
-                            <input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="直角裁切"
-                                   title="直角裁切" checked>
-                            <span class="ui_fm_l">
-                                <input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面覆哑膜"
-                                       title="双面覆哑膜"/>
-                            </span>
-                            <span class="yhydx">
-
-                                <input type="checkbox" name="craft" class="layui-input" lay-filter="ui_yf_fm" value="压痕"
-                                       title="压痕">
-                                <div class="layui-inline yhselect" style="width:60px; display:none">
-                                    <select name="yaheng" class="layui-select ">
-                                        <option value="1">1</option>
-                                        <option value="2">2</option>
-                                        <option value="3">3</option>
-                                        <option value="4">4</option>
-                                    </select>
-                                </div>
-                                <input type="checkbox" name="craft" class="layui-input" lay-filter="ui_yf_fm"
-                                       value="压点线" title="压点线">
-                                <div class="layui-inline ydxselect" style="width:60px;display:none">
-                                    <select name="dadianxian" class="layui-select ">
-                                        <option value="1">1</option>
-                                        <option value="2">2</option>
-                                        <option value="3">3</option>
-                                        <option value="4">4</option>
-                                    </select>
-                                </div>
-                                <input type="checkbox" name="craft" class="tang" lay-filter="switch" value="单面烫金" title="单面烫金">
+                        <div class="neibu" style="display: none">
+                            <input type="checkbox" name="craft" class="yj" id="nmq" value="内部模切" title="内部模切" lay-filter="nmq"/>
+                            <span class="n_mq_input" style="display: none">
+                                 <span style="margin-top:12px;flex-shrink: 0">个数 : </span>
+                                <input type="text" placeholder="请输入整数" autocomplete="off" name="n_mq_num" value="0"
+                                       class="layui-input" style="width: 70px">
+                                 <span style="margin-top:12px;flex-shrink: 0">尺寸(CM/厘米) <span
+                                         style="font-size:14px;color:red">输入格式: 长 * 宽</span>  </span>
+                                <input type="text" placeholder="尺寸" autocomplete="off" name="n_mq_size"
+                                       class="layui-input">
                             </span>
-                            <div id="craftHu" style="display:none;margin-top: 5px;">
-                                <input type="checkbox" name="craft" class="ui_hu" lay-filter="switch" value="糊成品"
-                                       title="糊成品">
-                                <input type="checkbox" name="craft" class="ui_hu" lay-filter="switch" value="糊半成品"
-                                       title="糊半成品">
-                            </div>
                         </div>
-
                     </div>
                 </form>
             </div>
@@ -1417,8 +1428,10 @@
                         form.render('checkbox');
                     });
                 } else {
-                    $("#craftForm").show();
-                    $("#craftForm").find(":input").attr("disabled", false);
+                    if (couponKind != "少数量") {
+                        $("#craftForm").show();
+                        $("#craftForm").find(":input").attr("disabled", false);
+                    }
                     $("#z4_craft").hide();
                     $("#peijian_ui").hide();
                     $("#z4_craft").find(":input").attr("disabled", true);
@@ -1528,6 +1541,8 @@
                     $(".ui_yh").show();
                     $(".ui_yf").hide();
                 }
+                $(".n_mq_input").hide()
+                $(".n_mq_input input").prop("disabled", true);
                 $("#size").val("");
                 $("#craftForm").show();
                 $("#craftForm").find(":input").attr("disabled", false);
@@ -2291,9 +2306,13 @@
                 }
                 $(".carft_lius").hide();
                 $(".carft_lius checkbox[name='craft']").attr("disabled", true);
+                $(".neibu").hide();
+                $(".neibu").find("input").attr("disabled", true);
                 if (data.value == 3 && couponKind != "少数量") {
                     $(".carft_lius").show();
                     $(".carft_lius checkbox[name='craft']").attr("disabled", false);
+                    $(".neibu").css("display", "flex");
+                    $(".neibu").find("input").attr("disabled", false);
                 }
                 form.render();
             });
@@ -3000,6 +3019,30 @@
                 form.render();
             });
 
+            form.on('checkbox(nmq)', (data) => {
+                let craft = [];
+                $("input:checkbox[name='craft']:checked").each(function (i) {
+                    // 没有被禁用的工艺加到arr中
+                    if (!$(this).is(':disabled')) {
+                        craft.push($(this).val());
+                    }
+                });
+                if (!craft.includes("模切")) {
+                    $(data.elem).prop("checked", false);
+                    layer.msg("异形模切才能选择内部模切", {offset: ['300px', '300px']}, function () {
+                    });
+                    form.render();
+                    return false;
+                }
+                if (data.elem.checked) {
+                    $(".n_mq_input").css("display", "flex")
+                    $(".n_mq_input input").prop("disabled", false);
+                } else {
+                    $(".n_mq_input").hide()
+                    $(".n_mq_input input").prop("disabled", true);
+                }
+            })
+
             //点击计算,计算价格
             form.on('submit(acount_btn)', function (data) {
                 /* var wangwang = $("#wangwang").val();
@@ -3187,6 +3230,9 @@
                             arr.push(oppdai + oppSize);
                             return;
                         }
+                        if ($(this).val() == "内部模切") {
+                            return;
+                        }
                         arr.push($(this).val());
                     }
                 });
@@ -3589,6 +3635,38 @@
                         return false;
                     }
                 }
+                let n_moq_num = $('input[name="n_mq_num"]').val()
+                let n_moq_size = $("input[name='n_mq_size']").val()
+                let nmq = $("#nmq:checked").val();
+                if (!$("#nmq").is(':disabled')) {
+                    if (nmq == '内部模切' && n_moq_num == 0) {
+                        layer.msg('请输入内模切个数!', {offset: ['300px', '300px']}, function () {
+                        });
+                        return false;
+                    }
+                    if (nmq == '内部模切' && n_moq_num > 0 && n_moq_size == "") {
+                        layer.msg('请输入内模切尺寸!', {offset: ['300px', '300px']}, function () {
+                        });
+                        return false;
+                    }
+                    if (nmq == '内部模切' && n_moq_num > 0 && n_moq_size.indexOf("*") == -1) {
+                        layer.msg('请输入内模切正确尺寸!', {offset: ['300px', '300px']}, function () {
+                        });
+                        return false;
+                    }
+
+                    if (n_moq_num > 0) {
+                        let main_size = size.split("*");
+                        let moq_size = n_moq_size.split("*");
+
+                        let max_number = Math.max(Math.floor(main_size[0] * 10 / (moq_size[0] * 10 + 2)) * Math.floor(main_size[1] * 10 / (moq_size[1] * 10 + 2)), Math.floor(main_size[1] * 10 / (moq_size[0] * 10 + 2)) * Math.floor(main_size[0] * 10 / (moq_size[1] * 10 + 2)))
+                        if (max_number < n_moq_num) {
+                            layer.msg('内模切尺寸超出范围!', {offset: ['300px', '300px']})
+                            return false;
+                        }
+                    }
+                }
+
                 $.ajax({
                     url: "${pageContext.request.contextPath}/getThanSum",
                     type: "GET",
@@ -3693,6 +3771,9 @@
                         if (couponKind == '少数量' && number > 1) {
                             same = "不同内容"
                         }
+                        if (!$("#nmq").is(':disabled') && nmq == '内部模切' && n_moq_num > 0) {
+                            arr.push("内部模切:" + n_moq_num + "/" + n_moq_size)
+                        }
                         var data = result.data.proList;
                         if (kind == 13 || kind == "刮刮卡") {
                             var span_result = kindData[kind] + " -" + kindValueData[kindValue] + "-" + kindValueSelect + "-" + size