diff --git a/src/main/java/lingtao/net/controller/ProductController.java b/src/main/java/lingtao/net/controller/ProductController.java index b4a6738..644a9f1 100644 --- a/src/main/java/lingtao/net/controller/ProductController.java +++ b/src/main/java/lingtao/net/controller/ProductController.java @@ -497,8 +497,7 @@ public class ProductController { * 根据用户搜索的产品名称获取产品 */ @RequestMapping(value = "/getSearchPro") - public List searchPro(@RequestParam("likeProTypeLabel") String likeProTypeLabel) - throws Exception { + public List searchPro(@RequestParam("likeProTypeLabel") String likeProTypeLabel) throws Exception { List proList = productService.searchPro(likeProTypeLabel); return proList; } diff --git a/src/main/java/lingtao/net/controller/SysPermissionController.java b/src/main/java/lingtao/net/controller/SysPermissionController.java index e794b7a..5749cfd 100644 --- a/src/main/java/lingtao/net/controller/SysPermissionController.java +++ b/src/main/java/lingtao/net/controller/SysPermissionController.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import lingtao.net.bean.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -12,31 +13,40 @@ import org.springframework.web.bind.annotation.ResponseBody; import lingtao.net.bean.SysPermission; import lingtao.net.service.SysPermissionService; +import javax.servlet.http.HttpServletRequest; + @RequestMapping("/sysPermission") @Controller public class SysPermissionController { - @Autowired - private SysPermissionService sysPermissionService; + @Autowired + private SysPermissionService sysPermissionService; - @RequestMapping("/index") - public String index() throws Exception { - return "system/permission/index"; - } + @RequestMapping("/index") + public String index() throws Exception { + return "system/permission/index"; + } - @RequestMapping("/parentList") - @ResponseBody - public List parentList() { - return sysPermissionService.getParentPers(); - } + @RequestMapping("/parentList") + @ResponseBody + public List parentList() { + return sysPermissionService.getParentPers(); + } - @RequestMapping("/list") - @ResponseBody - public Map list() throws Exception { - Map map = new HashMap<>(); - map.put("code", 0); - map.put("msg", null); - map.put("data", sysPermissionService.getAll()); - return map; - } + @RequestMapping("/persByUserId") + @ResponseBody + public List persByUserId(HttpServletRequest request) { + SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION"); + return sysPermissionService.getPersByUserId(user.getUserId()); + } + + @RequestMapping("/list") + @ResponseBody + public Map list() throws Exception { + Map map = new HashMap<>(); + map.put("code", 0); + map.put("msg", null); + map.put("data", sysPermissionService.getAll()); + return map; + } } diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index 0ecd80a..fc593af 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -4469,15 +4469,58 @@ public class ProductService { case "地垫": priceList = getFloorMatPrice(dto, width, length, height); return chucklePrice(role, priceList, dto); + case "滴胶转印贴": priceList = getDippingPrice(dto, width, length, height); return chucklePrice(role, priceList, dto); + case "撕拉片": + priceList = getTearStripPrice(dto, width, length, height); + return chucklePrice(role, priceList, dto); default: break; } return null; } + private List getTearStripPrice(Product dto, Double width, Double length, Double height) { + + List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); + List priceList = new ArrayList<>(); + + int count = dto.getCount(); + int number = dto.getNumber(); + double max = Math.max(width, length); + double min = Math.min(width, length); + int[] counts = {50, 100, 200, 500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 50000, 100000}; + double[][] prices_area = { + {260, 500, 970, 2090, 4020, 7610, 11100, 18000, 34500, 66200, 96400, 156000, 299000}, + {260, 500, 970, 2090, 4020, 7610, 11100, 18000, 34500, 66200, 96400, 156000, 299000}, + {270, 530, 1040, 2250, 4340, 8210, 12000, 19400, 37300, 71500, 104000, 169000, 324000} + }; + if (max == 11 && min == 8.6) { + prices_area = new double[][]{ + {310, 600, 1180, 2590, 4990, 9440, 13800, 22200, 42700, 82000, 120000, 194000, 371000}, + {310, 600, 1180, 2590, 4990, 9440, 13800, 22200, 42700, 82000, 120000, 194000, 371000}, + {330, 640, 1250, 2750, 5310, 10100, 14700, 23700, 45500, 87300, 128000, 207000, 394000} + }; + } + int current_index = 0; + if (craft_list.contains("亮膜")) { + current_index = 1; + } + if (craft_list.contains("触感膜")) { + current_index = 2; + } + + double price = new PriceUtils().TableCountCenterPrice(count, prices_area[current_index], counts); + double design_price = 0; + Product pro = new Product(); + pro.setCount(count); + pro.setPrice(Math.ceil(price * number) + design_price); + priceList.add(pro); + return priceList; + } + private List getDippingPrice(Product dto, Double width, Double length, Double height) { List craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft()); List priceList = new ArrayList<>(); @@ -5523,9 +5566,9 @@ public class ProductService { if (craft_list.contains("镭射膜")) { crafts.add(new ShengDaPriceRequstItemVo("镭射膜")); } - if (craft_list.contains("模切") || craft_list.contains("镂空")) { - crafts.add(new ShengDaPriceRequstItemVo("镂空")); - } +// if (craft_list.contains("模切") || craft_list.contains("镂空")) { +// crafts.add(new ShengDaPriceRequstItemVo("镂空")); +// } if (craft_list.contains("挂绳")) { ShengDaPriceRequstItemVo baseCrafts = new ShengDaPriceRequstItemVo("挂绳"); Map map = new HashMap<>(); @@ -5796,9 +5839,9 @@ public class ProductService { } else { double area = width * length / 10000 * count * dto.getNumber(); double[] areas = {0, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 1, 2, 3, 5, 7, 9, 10, 20, 50}; - int[] prices = {0, 1100, 1000, 950, 900, 850, 800, 750, 700, 650, 600, 550, 500, 480, 470, 460}; + int[] prices = {0, 1300, 1200, 1150, 1100, 1050, 1000, 950, 900, 850, 800, 750, 700, 680, 670, 660}; if ("4".equals(dto.getKindValue())) { - prices = new int[]{0, 1130, 1030, 980, 930, 880, 830, 780, 730, 680, 630, 580, 530, 510, 500, 490}; + prices = new int[]{0, 1330, 1230, 1180, 1130, 1080, 1030, 980, 930, 880, 830, 780, 730, 710, 700, 690}; } double last_price = 450; price = PriceUtils.TableUnitPrice(area, prices, areas, last_price); @@ -5807,10 +5850,10 @@ public class ProductService { } double craft_price = 0; if (!StringUtils.isEmpty(dto.getBianma())) { - double craft_base = 0.1; - if ("圆型钥匙扣银色".equals(dto.getBianma()) || "珠链银色".equals(dto.getBianma())) { - craft_base = 0; - } + double craft_base = 0.2; +// if ("圆型钥匙扣银色".equals(dto.getBianma()) || "珠链银色".equals(dto.getBianma())) { +// craft_base = 0; +// } craft_price = Math.ceil(craft_base * count * dto.getNumber()); } String weight = df.format(width * length * 4.17 * dto.getCount() * 0.1 * number / 1000 * 2); diff --git a/src/main/webapp/views/main.jsp b/src/main/webapp/views/main.jsp index 08bf450..eebbee1 100644 --- a/src/main/webapp/views/main.jsp +++ b/src/main/webapp/views/main.jsp @@ -453,8 +453,8 @@ - + @@ -701,54 +701,43 @@ requestAnimationFrame(cartoon);//递归调用动画效果; } + let permissionList = []; + let selectPermission = {} + /* } */ - - - // 搜索菜单 - $("#proTypeLabel").autocomplete({ - // 通过函数自定义处理数据源 - source: function (request, response) { - // request对象只有一个term属性,对应用户输入的文本 - // response是一个函数,在你自行处理并获取数据后,将JSON数据交给该函数处理,以便于autocomplete根据数据显示列表 - $.ajax({ - url: '${pageContext.request.contextPath}/getSearchPro', - dataType: 'json', - data: { - 'likeProTypeLabel': $("#proTypeLabel").val(), - }, - success: function (dataObj) { - var data = [] - for (var i = 0; i < dataObj.length; i++) { - var data1 = {} - //data.push(dataObj[i].proTypeLabel) - data1.label = dataObj[i].proTypeLabel - data1.value = dataObj[i].proTypeLabel - data1.url = dataObj[i].url - data.push(data1) - } - response(data); //将数据交给autocomplete去展示 - } - }); - }, - // 选中菜单事件 - select: function (event, ui) { - $("#search-url").val(ui.item.url); - }, - _resizeMenu: function () { - this.menu.element.outerWidth(500); + function debounce(fn, delay) { + let timer = null; + return function (...args) { + clearTimeout(timer); + timer = setTimeout(() => { + fn.apply(this, args); + }, delay); } - }); + } + var active = {} - // 搜索菜单 function searching() { - var proTypeLabel = $("#proTypeLabel").val(); - var url = $("#search-url").val(); - if (url == '') { - return false; + let ui = selectPermission; + if ($(".layui-tab-title li[lay-id]").length <= 0) { + //如果比零小,则直接打开新的tab项 + active.tabAdd(ui.item.url, ui.item.id, ui.item.title); + } else { + //否则判断该tab项是否以及存在 + var isData = false; //初始化一个标志,为false说明未打开该tab项 为true则说明已有 + $.each($(".layui-tab-title li[lay-id]"), function () { + //如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开 + if ($(this).attr("lay-id") == ui.item.id) { + isData = true; + } + }) + if (isData == false) { + //标志为false 新增一个tab项 + active.tabAdd(ui.item.url, ui.item.id, ui.item.title); + } } - //var address = $(this).attr("data-src"); - $("iframe").attr("src", url); + //最后不管是否新增tab,最后都转到要打开的选项页面上 + active.tabChange(ui.item.id); } //JavaScript代码区域 @@ -761,7 +750,7 @@ // 动态添加选项卡,关闭选项卡 - var active = { + active = { //在这里给active绑定几项事件,后面可通过active调用这些事件 tabAdd: function (url, id, name) { //新增一个Tab项 传入三个参数,分别对应其标题,tab页面的地址,还有一个规定的id,是标签中data-id的属性值 @@ -797,6 +786,52 @@ } }; + + // 搜索菜单 + $("#proTypeLabel").autocomplete({ + // 通过函数自定义处理数据源 + source: debounce(function (request, response) { + let val = $("#proTypeLabel").val(); + let list = [] + permissionList.forEach(item => { + if (item.title.indexOf(val) >= 0) { + list.push({...item, label: item.title}) + } + }) + response(list); + }, 300), + // 选中菜单事件 + select: function (event, ui) { + selectPermission = ui; + if ($(".layui-tab-title li[lay-id]").length <= 0) { + //如果比零小,则直接打开新的tab项 + active.tabAdd(ui.item.url, ui.item.id, ui.item.title); + } else { + //否则判断该tab项是否以及存在 + var isData = false; //初始化一个标志,为false说明未打开该tab项 为true则说明已有 + $.each($(".layui-tab-title li[lay-id]"), function () { + //如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开 + if ($(this).attr("lay-id") == ui.item.id) { + isData = true; + } + }) + if (isData == false) { + //标志为false 新增一个tab项 + active.tabAdd(ui.item.url, ui.item.id, ui.item.title); + } + } + //最后不管是否新增tab,最后都转到要打开的选项页面上 + active.tabChange(ui.item.id); + }, + _resizeMenu: function () { + this.menu.element.outerWidth(500); + } + }); + + + // 搜索菜单 + + //当点击有site-demo-active属性的标签时,即左侧菜单栏中内容 ,触发点击事件 $('.site-demo-active').on('click', function () { var dataid = $(this); @@ -1033,6 +1068,20 @@ } }) }) + let baseUrl = `${pageContext.request.contextPath}`; + $(document).ready(function () { + $.ajax({ + url: "${pageContext.request.contextPath}/sysPermission/persByUserId", + type: "get", + success: function (obj) { + if (obj != null) { + obj.forEach(item => { + permissionList.push({url: baseUrl + "/" + item.url, id: item.perName, title: item.perName}) + }) + } + } + }) + }) }) diff --git a/src/main/webapp/views/product/tearStrip.jsp b/src/main/webapp/views/product/tearStrip.jsp new file mode 100644 index 0000000..f6daaf1 --- /dev/null +++ b/src/main/webapp/views/product/tearStrip.jsp @@ -0,0 +1,322 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + Insert title here + <%@include file="/views/common.jsp" %> + + + +
+
+

撕拉片拍立得

+
+
+ +

+ 材质 +

+
+ +
+

+ 尺寸(CM/厘米) +

+ +
+ +
+

+ 数量(个) +

+
+ +
+

+ 款数 +

+
+ +
+

+ 客户旺旺 +

+
+ +
+

+ 工艺 +

+
+
+ 印面: + + +
+
+ 覆膜工艺: + + + +
+
+ 底片工艺: + + +
+ +
+
+ + +
+
+
+ + +
+

计算结果- + +

+
+ + <%@include file="../acountExpressFee.jsp" %> +
+
+
+
+
+
+
+ +
+
+ +<%@include file="/views/copyResult.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/views/product/workPermit.jsp b/src/main/webapp/views/product/workPermit.jsp index 414dfb7..1dc4ced 100644 --- a/src/main/webapp/views/product/workPermit.jsp +++ b/src/main/webapp/views/product/workPermit.jsp @@ -66,7 +66,7 @@ 裁切工艺: - + <%-- --%>
常见工艺: @@ -188,6 +188,7 @@ } } ); + const carft_list1 = ["单面", "双面"]; const carft1 = carft_list1.filter(craft => craft_list.includes(craft));