新增拍立得
This commit is contained in:
@@ -497,8 +497,7 @@ public class ProductController {
|
|||||||
* 根据用户搜索的产品名称获取产品
|
* 根据用户搜索的产品名称获取产品
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/getSearchPro")
|
@RequestMapping(value = "/getSearchPro")
|
||||||
public List<SysDictSearchPro> searchPro(@RequestParam("likeProTypeLabel") String likeProTypeLabel)
|
public List<SysDictSearchPro> searchPro(@RequestParam("likeProTypeLabel") String likeProTypeLabel) throws Exception {
|
||||||
throws Exception {
|
|
||||||
List<SysDictSearchPro> proList = productService.searchPro(likeProTypeLabel);
|
List<SysDictSearchPro> proList = productService.searchPro(likeProTypeLabel);
|
||||||
return proList;
|
return proList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import lingtao.net.bean.SysUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import lingtao.net.bean.SysPermission;
|
import lingtao.net.bean.SysPermission;
|
||||||
import lingtao.net.service.SysPermissionService;
|
import lingtao.net.service.SysPermissionService;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
@RequestMapping("/sysPermission")
|
@RequestMapping("/sysPermission")
|
||||||
@Controller
|
@Controller
|
||||||
public class SysPermissionController {
|
public class SysPermissionController {
|
||||||
@@ -30,6 +33,13 @@ public class SysPermissionController {
|
|||||||
return sysPermissionService.getParentPers();
|
return sysPermissionService.getParentPers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/persByUserId")
|
||||||
|
@ResponseBody
|
||||||
|
public List<SysPermission> persByUserId(HttpServletRequest request) {
|
||||||
|
SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION");
|
||||||
|
return sysPermissionService.getPersByUserId(user.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Map<String, Object> list() throws Exception {
|
public Map<String, Object> list() throws Exception {
|
||||||
|
|||||||
@@ -4469,15 +4469,58 @@ public class ProductService {
|
|||||||
case "地垫":
|
case "地垫":
|
||||||
priceList = getFloorMatPrice(dto, width, length, height);
|
priceList = getFloorMatPrice(dto, width, length, height);
|
||||||
return chucklePrice(role, priceList, dto);
|
return chucklePrice(role, priceList, dto);
|
||||||
|
|
||||||
case "滴胶转印贴":
|
case "滴胶转印贴":
|
||||||
priceList = getDippingPrice(dto, width, length, height);
|
priceList = getDippingPrice(dto, width, length, height);
|
||||||
return chucklePrice(role, priceList, dto);
|
return chucklePrice(role, priceList, dto);
|
||||||
|
case "撕拉片":
|
||||||
|
priceList = getTearStripPrice(dto, width, length, height);
|
||||||
|
return chucklePrice(role, priceList, dto);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Product> getTearStripPrice(Product dto, Double width, Double length, Double height) {
|
||||||
|
|
||||||
|
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||||
|
List<Product> 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<Product> getDippingPrice(Product dto, Double width, Double length, Double height) {
|
private List<Product> getDippingPrice(Product dto, Double width, Double length, Double height) {
|
||||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||||
List<Product> priceList = new ArrayList<>();
|
List<Product> priceList = new ArrayList<>();
|
||||||
@@ -5523,9 +5566,9 @@ public class ProductService {
|
|||||||
if (craft_list.contains("镭射膜")) {
|
if (craft_list.contains("镭射膜")) {
|
||||||
crafts.add(new ShengDaPriceRequstItemVo("镭射膜"));
|
crafts.add(new ShengDaPriceRequstItemVo("镭射膜"));
|
||||||
}
|
}
|
||||||
if (craft_list.contains("模切") || craft_list.contains("镂空")) {
|
// if (craft_list.contains("模切") || craft_list.contains("镂空")) {
|
||||||
crafts.add(new ShengDaPriceRequstItemVo("镂空"));
|
// crafts.add(new ShengDaPriceRequstItemVo("镂空"));
|
||||||
}
|
// }
|
||||||
if (craft_list.contains("挂绳")) {
|
if (craft_list.contains("挂绳")) {
|
||||||
ShengDaPriceRequstItemVo baseCrafts = new ShengDaPriceRequstItemVo("挂绳");
|
ShengDaPriceRequstItemVo baseCrafts = new ShengDaPriceRequstItemVo("挂绳");
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
@@ -5796,9 +5839,9 @@ public class ProductService {
|
|||||||
} else {
|
} else {
|
||||||
double area = width * length / 10000 * count * dto.getNumber();
|
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};
|
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())) {
|
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;
|
double last_price = 450;
|
||||||
price = PriceUtils.TableUnitPrice(area, prices, areas, last_price);
|
price = PriceUtils.TableUnitPrice(area, prices, areas, last_price);
|
||||||
@@ -5807,10 +5850,10 @@ public class ProductService {
|
|||||||
}
|
}
|
||||||
double craft_price = 0;
|
double craft_price = 0;
|
||||||
if (!StringUtils.isEmpty(dto.getBianma())) {
|
if (!StringUtils.isEmpty(dto.getBianma())) {
|
||||||
double craft_base = 0.1;
|
double craft_base = 0.2;
|
||||||
if ("圆型钥匙扣银色".equals(dto.getBianma()) || "珠链银色".equals(dto.getBianma())) {
|
// if ("圆型钥匙扣银色".equals(dto.getBianma()) || "珠链银色".equals(dto.getBianma())) {
|
||||||
craft_base = 0;
|
// craft_base = 0;
|
||||||
}
|
// }
|
||||||
craft_price = Math.ceil(craft_base * count * dto.getNumber());
|
craft_price = Math.ceil(craft_base * count * dto.getNumber());
|
||||||
}
|
}
|
||||||
String weight = df.format(width * length * 4.17 * dto.getCount() * 0.1 * number / 1000 * 2);
|
String weight = df.format(width * length * 4.17 * dto.getCount() * 0.1 * number / 1000 * 2);
|
||||||
|
|||||||
@@ -453,8 +453,8 @@
|
|||||||
<input type="hidden" id="search-url">
|
<input type="hidden" id="search-url">
|
||||||
<!-- 答题通过显示 -->
|
<!-- 答题通过显示 -->
|
||||||
<c:if test="${sessionScope.USER_SESSION.sysStatus == 2}">
|
<c:if test="${sessionScope.USER_SESSION.sysStatus == 2}">
|
||||||
<input type="text" name="proTypeLabel" id="proTypeLabel" style="width:350px;"
|
<input type="text" name="proTypeLabel" id="proTypeLabel" style="width:350px;" autocomplete="on" placeholder="搜索产品名称"
|
||||||
autocomplete="on" placeholder="搜索产品名称" class="layui-input search">
|
class="layui-input search">
|
||||||
<button type="button" onclick="searching()" class="layui-btn layui-btn-normal search">搜索</button>
|
<button type="button" onclick="searching()" class="layui-btn layui-btn-normal search">搜索</button>
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
@@ -701,54 +701,43 @@
|
|||||||
requestAnimationFrame(cartoon);//递归调用动画效果;
|
requestAnimationFrame(cartoon);//递归调用动画效果;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let permissionList = [];
|
||||||
|
let selectPermission = {}
|
||||||
|
|
||||||
/* } */
|
/* } */
|
||||||
|
function debounce(fn, delay) {
|
||||||
|
let timer = null;
|
||||||
// 搜索菜单
|
return function (...args) {
|
||||||
$("#proTypeLabel").autocomplete({
|
clearTimeout(timer);
|
||||||
// 通过函数自定义处理数据源
|
timer = setTimeout(() => {
|
||||||
source: function (request, response) {
|
fn.apply(this, args);
|
||||||
// request对象只有一个term属性,对应用户输入的文本
|
}, delay);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
var active = {}
|
||||||
|
|
||||||
// 搜索菜单
|
|
||||||
function searching() {
|
function searching() {
|
||||||
var proTypeLabel = $("#proTypeLabel").val();
|
let ui = selectPermission;
|
||||||
var url = $("#search-url").val();
|
if ($(".layui-tab-title li[lay-id]").length <= 0) {
|
||||||
if (url == '') {
|
//如果比零小,则直接打开新的tab项
|
||||||
return false;
|
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;
|
||||||
}
|
}
|
||||||
//var address = $(this).attr("data-src");
|
})
|
||||||
$("iframe").attr("src", url);
|
if (isData == false) {
|
||||||
|
//标志为false 新增一个tab项
|
||||||
|
active.tabAdd(ui.item.url, ui.item.id, ui.item.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//最后不管是否新增tab,最后都转到要打开的选项页面上
|
||||||
|
active.tabChange(ui.item.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//JavaScript代码区域
|
//JavaScript代码区域
|
||||||
@@ -761,7 +750,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// 动态添加选项卡,关闭选项卡
|
// 动态添加选项卡,关闭选项卡
|
||||||
var active = {
|
active = {
|
||||||
//在这里给active绑定几项事件,后面可通过active调用这些事件
|
//在这里给active绑定几项事件,后面可通过active调用这些事件
|
||||||
tabAdd: function (url, id, name) {
|
tabAdd: function (url, id, name) {
|
||||||
//新增一个Tab项 传入三个参数,分别对应其标题,tab页面的地址,还有一个规定的id,是标签中data-id的属性值
|
//新增一个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属性的标签时,即左侧菜单栏中内容 ,触发点击事件
|
||||||
$('.site-demo-active').on('click', function () {
|
$('.site-demo-active').on('click', function () {
|
||||||
var dataid = $(this);
|
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})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -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" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Insert title here</title>
|
||||||
|
<%@include file="/views/common.jsp" %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
#z4_craft .layui-form-select .layui-edge {
|
||||||
|
right: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="big_box">
|
||||||
|
<div class="left_div">
|
||||||
|
<h1 class="h1">撕拉片拍立得</h1> <span style="color:red;font-weight:700;"></span>
|
||||||
|
<hr>
|
||||||
|
<form class="layui-form">
|
||||||
|
<input type="hidden" name="proTypeValue" id="proTypeValue" class="layui-input" value="撕拉片"/>
|
||||||
|
<p>
|
||||||
|
材质
|
||||||
|
</p>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<select name="kind" class="select" lay-search lay-filter="kind">
|
||||||
|
<option value="320克铜版纸">320克铜版纸</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
尺寸(CM/厘米)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<select class="layui-form-select" name="size">
|
||||||
|
<option value="8.6*6.3">8.6*6.3cm</option>
|
||||||
|
<option value="11*8.6">11*8.6cm</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
数量(个)
|
||||||
|
</p>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<input type="text" name="count" id="count" placeholder="请输入整数" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
款数
|
||||||
|
</p>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<input type="text" placeholder="请输入整数" autocomplete="off" name="number" id="number" value="1" class="layui-input" lay-verify="number">
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
客户旺旺
|
||||||
|
</p>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<input type="text" placeholder="请输入客户旺旺号" autocomplete="off" name="wangwang" id="wangwang" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
工艺
|
||||||
|
</p>
|
||||||
|
<div class="layui-form-item" id='z4_craft'>
|
||||||
|
<div class="layui-input-block ">
|
||||||
|
印面:
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="单面" title="单面" checked>
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="双面" title="双面">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-block ">
|
||||||
|
覆膜工艺:
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="哑膜" title="哑膜" checked>
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="亮膜" title="亮膜">
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="触感膜" title="触感膜">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-block ">
|
||||||
|
底片工艺:
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="黑色" title="黑色" checked>
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="装opp袋" title="装opp袋" checked>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="抠图" title="抠图">
|
||||||
|
<div class="layui-inline crop" style="display:none;width: 80px">
|
||||||
|
<input class="layui-input" type="text" name="cropNumber">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<button class="layui-btn" lay-submit="" lay-filter="acount_btn">计算</button>
|
||||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
</div>
|
||||||
|
<h2>计算结果-
|
||||||
|
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm copyResult"
|
||||||
|
onclick="copyResult()">点击复制
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div>
|
||||||
|
<textarea rows="11" cols="75" id="span_result" readonly="readonly"></textarea>
|
||||||
|
<%@include file="../acountExpressFee.jsp" %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<table class="layui-hide" id="priceTable" lay-filter="priceTable"></table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="right_div" style="margin-left:50px;">
|
||||||
|
<div class="layui-carousel" id="test1">
|
||||||
|
<div carousel-item id="carousel"></div>
|
||||||
|
<br>
|
||||||
|
<div id="remark" style="font-size:20px;color:red"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<%@include file="/views/copyResult.jsp" %>
|
||||||
|
<script>
|
||||||
|
layui.use(['table', 'form', 'carousel'], function () {
|
||||||
|
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
|
||||||
|
var carousel = layui.carousel;
|
||||||
|
var table = layui.table;
|
||||||
|
|
||||||
|
//建造实例
|
||||||
|
ins = carousel.render({});
|
||||||
|
var html = " ";
|
||||||
|
var remark = " ";
|
||||||
|
|
||||||
|
// 清空轮播图
|
||||||
|
$("#carousel").empty();
|
||||||
|
$("#remark").empty();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "${pageContext.request.contextPath}/getImgs",
|
||||||
|
type: "GET",
|
||||||
|
data: {
|
||||||
|
proTypeValue: $("#proTypeValue").val(),
|
||||||
|
kindValue: $('input[name="kindValue"]').val()
|
||||||
|
},
|
||||||
|
success: function (result) {
|
||||||
|
for (let i = 0; i < result.length; i++) {
|
||||||
|
// 只留一个remark
|
||||||
|
remark = "";
|
||||||
|
html += '<div><img style="width:100%;height: 100%;object-fit: contain" src="' + result[i].imgUrl + '"></div>';
|
||||||
|
remark += '<div><span>' + result[i].remark + '<span/></div>';
|
||||||
|
}
|
||||||
|
$("#carousel").append(html);
|
||||||
|
// 如果没有说明,就不显示null
|
||||||
|
if (remark.indexOf("null") < 0) {
|
||||||
|
$("#remark").append(remark);
|
||||||
|
}
|
||||||
|
// 如果没有轮播图就隐藏
|
||||||
|
if (result.length == 0) {
|
||||||
|
document.getElementById("test1").style.display = "none"; //隐藏
|
||||||
|
} else {
|
||||||
|
document.getElementById("test1").style.display = "block"; //显示
|
||||||
|
ins.reload({
|
||||||
|
elem: '#test1',
|
||||||
|
width: result[0].imgWidth, //设置容器宽度
|
||||||
|
height: result[0].imgHeight
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
form.on('checkbox(ui_craft)', function (data) {
|
||||||
|
let craft_list = [];
|
||||||
|
$("input[name='craft']:checked").each(function () {
|
||||||
|
if (!$(this).is(':disabled')) {
|
||||||
|
craft_list.push($(this).val());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!craft_list.includes("黑色")) {
|
||||||
|
$(data.elem).prop("checked", true);
|
||||||
|
layer.msg("底片工艺无法取消选择", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!craft_list.includes("装opp袋")) {
|
||||||
|
$(data.elem).prop("checked", true);
|
||||||
|
layer.msg("底片工艺无法取消选择", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let carft_list1 = ["哑膜", "亮膜", "触感膜"]
|
||||||
|
const carft1 = carft_list1.filter(craft => craft_list.includes(craft));
|
||||||
|
if (carft1.length > 1) {
|
||||||
|
$(data.elem).prop("checked", false);
|
||||||
|
layer.msg("覆膜工艺不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let carft_list2 = ["单面", "双面"]
|
||||||
|
const carft2 = carft_list2.filter(craft => craft_list.includes(craft));
|
||||||
|
if (carft2.length > 1) {
|
||||||
|
$(data.elem).prop("checked", false);
|
||||||
|
layer.msg("印面工艺不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
form.render();
|
||||||
|
})
|
||||||
|
|
||||||
|
// 点击计算,计算价格
|
||||||
|
form.on('submit(acount_btn)', function (data) {
|
||||||
|
var number = $("#number").val();
|
||||||
|
var size = $("select[name='size'] option:selected").val();
|
||||||
|
var count = $("#count").val();
|
||||||
|
var kind = $("select[name='kind'] option:selected").text();
|
||||||
|
var kindValue = $("select[name='kindValue'] option:selected").text();
|
||||||
|
var craft = [];
|
||||||
|
|
||||||
|
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||||
|
// 没有被禁用的工艺加到arr中
|
||||||
|
if (!$(this).is(':disabled')) {
|
||||||
|
if ($(this).val() == "抠图") {
|
||||||
|
craft.push($(this).val() + $("input[name='cropNumber']").val());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
craft.push($(this).val());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "${path}/getThanSum",
|
||||||
|
type: "GET",
|
||||||
|
data: $(".big_box form").serialize(),
|
||||||
|
success: function (result) {
|
||||||
|
if (result.code == 100) {
|
||||||
|
layer.msg(result.msg, {offset: ['300px', '300px']}, function () {
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var data = result.data.proList;
|
||||||
|
|
||||||
|
let kind = $("select[name='kind'] option:selected").val();
|
||||||
|
|
||||||
|
var span_result = '撕拉片拍立得 - ' + kind + ' - ' + size + ' cm (同款内容)\n';
|
||||||
|
|
||||||
|
span_result += `工艺:` + craft.join(",") + '\n';
|
||||||
|
|
||||||
|
if (number > 1) {
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
span_result += number + '款 各' + data[i].count + "个,共" + data[i].price + "元" + '\n'
|
||||||
|
data[i].number = number;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
span_result += number + '款 ' + data[i].count + "个,共" + data[i].price + "元" + '\n'
|
||||||
|
data[i].number = number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span_result += '包邮,免费设计呢~(偏远地区需补邮费)'
|
||||||
|
if (window.parent.system_isGai) {
|
||||||
|
span_result += "\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!"
|
||||||
|
}
|
||||||
|
addLog(span_result);
|
||||||
|
$("#span_result").val(span_result);
|
||||||
|
|
||||||
|
//计算完自动复制文本
|
||||||
|
var e = document.getElementById("span_result");//对象是content
|
||||||
|
if (e.value != "") {
|
||||||
|
e.select();//选择对象
|
||||||
|
document.execCommand("Copy");//执行浏览器复制命令
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成表格
|
||||||
|
table.render({
|
||||||
|
elem: '#priceTable',
|
||||||
|
even: true, //隔行变色
|
||||||
|
data: data, // 赋值已知数据
|
||||||
|
width: 500,
|
||||||
|
cols: [[
|
||||||
|
{
|
||||||
|
field: 'number',
|
||||||
|
width: '12%',
|
||||||
|
align: "center",
|
||||||
|
title: '款数'
|
||||||
|
}, {
|
||||||
|
field: 'count',
|
||||||
|
width: '16%',
|
||||||
|
align: "center",
|
||||||
|
title: '数量'
|
||||||
|
}, {
|
||||||
|
field: 'price',
|
||||||
|
width: '16%',
|
||||||
|
align: "center",
|
||||||
|
title: '报价'
|
||||||
|
}, {
|
||||||
|
field: 'wangwang',
|
||||||
|
align: "center",
|
||||||
|
width: '16%',
|
||||||
|
title: '折扣价'
|
||||||
|
}, {
|
||||||
|
field: 'wangwang',
|
||||||
|
align: "center",
|
||||||
|
width: '19%',
|
||||||
|
title: '跳楼价'
|
||||||
|
}, {
|
||||||
|
field: 'weight',
|
||||||
|
width: '21%',
|
||||||
|
align: "center",
|
||||||
|
title: '重量(kg)'
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
done: function () {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
裁切工艺:
|
裁切工艺:
|
||||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="圆角" title="圆角" checked>
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="圆角" title="圆角" checked>
|
||||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="模切" title="模切">
|
<input type="checkbox" name="craft" lay-filter="ui_craft" value="模切" title="模切">
|
||||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="镂空" title="镂空">
|
<%-- <input type="checkbox" name="craft" lay-filter="ui_craft" value="镂空" title="镂空">--%>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-block ">
|
<div class="layui-input-block ">
|
||||||
常见工艺:
|
常见工艺:
|
||||||
@@ -188,6 +188,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const carft_list1 = ["单面", "双面"];
|
const carft_list1 = ["单面", "双面"];
|
||||||
|
|
||||||
const carft1 = carft_list1.filter(craft => craft_list.includes(craft));
|
const carft1 = carft_list1.filter(craft => craft_list.includes(craft));
|
||||||
|
|||||||
Reference in New Issue
Block a user