新增redis
This commit is contained in:
@@ -177,5 +177,7 @@ public class Product {
|
||||
private String ui_menu_size;
|
||||
private String address;
|
||||
|
||||
private Double lengthVU;
|
||||
private Double widthUV;
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import lingtao.net.bean.SysUser;
|
||||
import lingtao.net.service.PriceService;
|
||||
import lingtao.net.service.ProductService;
|
||||
import lingtao.net.service.QuoteLogService;
|
||||
import lingtao.net.util.HuaFangPriceUtil;
|
||||
import lingtao.net.vo.PricingListVo;
|
||||
import lingtao.net.vo.ProductVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
File diff ditekan karena terlalu besar
Load Diff
@@ -0,0 +1,198 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lingtao.net.vo.HuaFangPriceRequstVo;
|
||||
import lingtao.net.vo.HuaFangPriceResultVo;
|
||||
import lingtao.net.vo.HuaFangTokenVo;
|
||||
import okhttp3.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HuaFangPriceUtil {
|
||||
|
||||
private static final OkHttpClient HTTP_CLIENT = new OkHttpClient();
|
||||
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
private static final MediaType FORM = MediaType.parse("application/x-www-form-urlencoded; charset=utf-8");
|
||||
|
||||
private static final String userName = "001008";
|
||||
|
||||
private static final String password = "lt666888";
|
||||
|
||||
/**
|
||||
* 通用HTTP GET请求方法
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param headers 请求头映射
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String sendGetRequest(String url, Map<String, String> headers) {
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.header("Content-Type", "application/json")
|
||||
.url(url);
|
||||
// 添加请求头
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
builder.header(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Request request = builder.build();
|
||||
|
||||
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("请求异常: " + response.code());
|
||||
}
|
||||
return response.body().string();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用HTTP GET请求方法(无请求头)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String sendGetRequest(String url) {
|
||||
return sendGetRequest(url, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用HTTP POST请求方法(JSON参数)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param jsonParam JSON参数
|
||||
* @param headers 请求头映射
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String sendPostRequest(String url, String jsonParam, Map<String, String> headers) {
|
||||
RequestBody body = RequestBody.create(JSON, jsonParam);
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.header("Content-Type", "application/json")
|
||||
.url(url)
|
||||
.post(body);
|
||||
|
||||
// 添加请求头
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
builder.header(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Request request = builder.build();
|
||||
|
||||
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("请求异常: " + response.code());
|
||||
}
|
||||
return response.body().string();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用HTTP POST请求方法(JSON参数,无请求头)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param jsonParam JSON参数
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String sendPostRequest(String url, String jsonParam) {
|
||||
return sendPostRequest(url, jsonParam, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用HTTP POST请求方法(表单参数)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param formParams 表单参数映射
|
||||
* @param headers 请求头映射
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String sendPostFormRequest(String url, Map<String, String> formParams, Map<String, String> headers) {
|
||||
StringBuilder formBody = new StringBuilder();
|
||||
if (formParams != null && !formParams.isEmpty()) {
|
||||
for (Map.Entry<String, String> entry : formParams.entrySet()) {
|
||||
if (formBody.length() > 0) {
|
||||
formBody.append("&");
|
||||
}
|
||||
formBody.append(entry.getKey()).append("=").append(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
RequestBody body = RequestBody.create(FORM, formBody.toString());
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.header("Content-Type", "application/json")
|
||||
.url(url)
|
||||
.post(body);
|
||||
|
||||
// 添加请求头
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
builder.header(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Request request = builder.build();
|
||||
|
||||
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("请求异常: " + response.code());
|
||||
}
|
||||
return response.body().string();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用HTTP POST请求方法(表单参数,无请求头)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param formParams 表单参数映射
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String sendPostFormRequest(String url, Map<String, String> formParams) {
|
||||
return sendPostFormRequest(url, formParams, null);
|
||||
}
|
||||
|
||||
public static String getToken() {
|
||||
String token = "";
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
String templateName = "HUAFANG_TOKEN";
|
||||
|
||||
if (!RedisUtil.exists(templateName)) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("userName", userName);
|
||||
params.put("password", password);
|
||||
|
||||
String tokenString = sendPostRequest("http://ds.gw.chenghuiyin.com/ordering/api/User/GetToken", JSONObject.toJSONString(params));
|
||||
System.out.println("获取token返回:" + tokenString);
|
||||
HuaFangTokenVo huaFangTokenVo = JSONObject.parseObject(tokenString, HuaFangTokenVo.class);
|
||||
RedisUtil.set(templateName, huaFangTokenVo.getAccessToken(), huaFangTokenVo.getExpiresIn() - 50);
|
||||
}
|
||||
Object tokenObj = RedisUtil.get(templateName);
|
||||
if (tokenObj != null) {
|
||||
token = tokenObj.toString();
|
||||
}
|
||||
System.out.println("获取token:" + token);
|
||||
return token;
|
||||
}
|
||||
|
||||
public static HuaFangPriceResultVo getPrice(HuaFangPriceRequstVo params) {
|
||||
Map<String, String> heards = new HashMap<>();
|
||||
heards.put("Authorization", "Bearer " + getToken());
|
||||
String resultText = sendPostRequest("http://ds.quote.chenghuiyin.com/api/app/price/calc-price", JSONObject.toJSONString(params), heards);
|
||||
HuaFangPriceResultVo result = JSONObject.parseObject(resultText, HuaFangPriceResultVo.class);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package lingtao.net.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
public class RedisUtil implements ApplicationContextAware {
|
||||
|
||||
private static RedisTemplate redisTemplate;
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||
applicationContext = context;
|
||||
redisTemplate = (RedisTemplate) applicationContext.getBean("redisTemplate");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
*/
|
||||
public static void set(String key, Object value) {
|
||||
if (redisTemplate != null) {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置缓存(带过期时间)
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param expireTime 过期时间(秒)
|
||||
*/
|
||||
public static void set(String key, Object value, long expireTime) {
|
||||
if (redisTemplate != null) {
|
||||
redisTemplate.opsForValue().set(key, value, expireTime, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
public static Object get(String key) {
|
||||
if (redisTemplate != null) {
|
||||
return redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
*
|
||||
* @param key 键
|
||||
*/
|
||||
public static void delete(String key) {
|
||||
if (redisTemplate != null) {
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查键是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return 是否存在
|
||||
*/
|
||||
public static boolean exists(String key) {
|
||||
if (redisTemplate != null) {
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置过期时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param expireTime 过期时间(秒)
|
||||
* @return 是否成功
|
||||
*/
|
||||
public static boolean expire(String key, long expireTime) {
|
||||
if (redisTemplate != null) {
|
||||
return redisTemplate.expire(key, expireTime, TimeUnit.SECONDS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取剩余过期时间
|
||||
*
|
||||
* @param key 键
|
||||
* @return 剩余过期时间(秒)
|
||||
*/
|
||||
public static long getExpire(String key) {
|
||||
if (redisTemplate != null) {
|
||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package lingtao.net.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HuaFangPriceProcessItemsVo {
|
||||
|
||||
private String processName;
|
||||
private String processValue;
|
||||
private List<Double> sizes;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package lingtao.net.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HuaFangPriceRequstVo {
|
||||
|
||||
private Integer styleNum;
|
||||
|
||||
private List<Double> sizes;
|
||||
|
||||
private String productPrintFace;
|
||||
private String productPrintColor;
|
||||
private String productPaperCode;
|
||||
private String productPaperName;
|
||||
private String productName;
|
||||
private Integer num;
|
||||
|
||||
private List<HuaFangPriceProcessItemsVo> calcProcess;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package lingtao.net.vo;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class HuaFangPriceResultVo {
|
||||
private String id;
|
||||
|
||||
private Double amount;
|
||||
@JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
private LocalDateTime deliveryTime;
|
||||
|
||||
private Double totalWeight;
|
||||
|
||||
private Double deliveryAmount;
|
||||
|
||||
private Double productAmount;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package lingtao.net.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HuaFangTokenVo {
|
||||
|
||||
private String accessToken;
|
||||
private Integer expiresIn;
|
||||
|
||||
}
|
||||
@@ -123,4 +123,50 @@
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- =================配置Redis================= -->
|
||||
<!-- Redis连接池配置 -->
|
||||
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
||||
<property name="maxTotal" value="100"/>
|
||||
<property name="maxIdle" value="20"/>
|
||||
<property name="maxWaitMillis" value="10000"/>
|
||||
<property name="testOnBorrow" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Redis连接工厂 -->
|
||||
<bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
|
||||
<property name="hostName" value="localhost"/>
|
||||
<property name="port" value="6379"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="database" value="0"/>
|
||||
<property name="poolConfig" ref="jedisPoolConfig"/>
|
||||
</bean>
|
||||
|
||||
<!-- Redis模板 -->
|
||||
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
|
||||
<property name="connectionFactory" ref="jedisConnectionFactory"/>
|
||||
<property name="keySerializer">
|
||||
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
|
||||
</property>
|
||||
<property name="valueSerializer">
|
||||
<bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
|
||||
</property>
|
||||
<property name="hashKeySerializer">
|
||||
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
|
||||
</property>
|
||||
<property name="hashValueSerializer">
|
||||
<bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- StringRedisTemplate(可选,用于String类型操作) -->
|
||||
<bean id="stringRedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
|
||||
<property name="connectionFactory" ref="jedisConnectionFactory"/>
|
||||
</bean>
|
||||
|
||||
<!-- Redis缓存管理器 -->
|
||||
<bean id="redisCacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
|
||||
<constructor-arg name="redisOperations" ref="redisTemplate"/>
|
||||
<property name="defaultExpiration" value="3600"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
right: 40px;
|
||||
}
|
||||
|
||||
.huafangCraft .layui-form-select .layui-edge {
|
||||
right: 40px;
|
||||
}
|
||||
|
||||
.value7 .layui-form-select .layui-edge {
|
||||
right: 20px;
|
||||
}
|
||||
@@ -470,8 +474,13 @@
|
||||
<div>
|
||||
<span class="ui_fm_l">
|
||||
覆膜工艺:
|
||||
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面覆哑膜"
|
||||
title="双面覆哑膜"/>
|
||||
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面覆哑膜" title="双面覆哑膜"/>
|
||||
<span class="huafangCraft">
|
||||
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面星光膜" title="双面星光膜"/>
|
||||
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面镭射膜" title="双面镭射膜"/>
|
||||
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面触感膜" title="双面触感膜"/>
|
||||
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面雪花膜" title="双面雪花膜"/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
@@ -531,6 +540,21 @@
|
||||
id="widthTang" class="layui-input" style="width:50px;height:35px;">
|
||||
</div>
|
||||
</span>
|
||||
<span class="huafangCraft">
|
||||
<input type="checkbox" name="craft" class="tangjin" lay-filter="switch" value="单面局部UV" title="单面局部UV">
|
||||
<input type="checkbox" name="craft" class="tangjin" lay-filter="switch" value="双面局部UV" title="双面局部UV">
|
||||
<span class="sizeUV">
|
||||
<div class="layui-inline">
|
||||
<input type="text" placeholder="长边" autocomplete="off" name="lengthVU" id="lengthVU" class="layui-input"
|
||||
style="width:50px;height:35px;">
|
||||
</div>x
|
||||
<div class="layui-inline">
|
||||
<input type="text" placeholder="短边" autocomplete="off" name="widthUV" id="widthUV" class="layui-input"
|
||||
style="width:50px;height:35px;">
|
||||
</div>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<div class="layui-input-block craft">
|
||||
特殊工艺:
|
||||
@@ -1319,19 +1343,37 @@
|
||||
form.render();
|
||||
})
|
||||
form.on("checkbox(z4PeiJian)", function (data) {
|
||||
let peijiansize = [];
|
||||
let craft_pei = [];
|
||||
$(".peijian:checked").each(function (i) {
|
||||
// 没有被禁用的工艺加到arr中
|
||||
if (!$(this).is(':disabled') && $(this).val() != "opp袋") {
|
||||
peijiansize.push($(this).val());
|
||||
craft_pei.push($(this).val());
|
||||
}
|
||||
});
|
||||
if (peijiansize.length > 1) {
|
||||
let craft_list = [];
|
||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||
if (!$(this).is(':disabled')) {
|
||||
craft_list.push($(this).val());
|
||||
}
|
||||
});
|
||||
if (craft_pei.length > 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;
|
||||
}
|
||||
const carft_pei = ["配葫芦针", "流苏", "尼龙绳", "配弹力绳", "配弹力绳捆", "opp袋", "配棉绳", "内部模切"];
|
||||
const carft_nopei = ["单面局部UV", "双面局部UV", "双面星光膜", "双面镭射膜", "双面触感膜", "双面雪花膜"];
|
||||
const carftpei = carft_pei.filter(craft => craft_list.includes(craft));
|
||||
const carftnopei = carft_nopei.filter(craft => craft_list.includes(craft));
|
||||
|
||||
if (carftpei.length > 0 && carftnopei.length > 0) {
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg(carft_nopei.join(",") + "与配件、内部模切不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
if (data.value == "流苏") {
|
||||
if ($(data.elem).is(":checked")) {
|
||||
$("#peijian_ui .select_liusu").show();
|
||||
@@ -1408,6 +1450,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (data.value == "配尼龙绳") {
|
||||
if ($(data.elem).is(":checked")) {
|
||||
$("#lesspeijian .scolor").show();
|
||||
@@ -1438,6 +1481,7 @@
|
||||
});
|
||||
form.on("radio(kindValue2)", function (data) {
|
||||
peijianuiHide();
|
||||
|
||||
if (data.value == 10) {
|
||||
$("#craftForm").hide();
|
||||
$("#craftForm").find(":input").attr("disabled", true);
|
||||
@@ -1448,7 +1492,8 @@
|
||||
$("#z4_craft").find(":input").attr("disabled", false);
|
||||
$("#peijian_ui").find(":input").attr("disabled", false);
|
||||
$("#z4_craft .ui_double_fm").prop("checked", true);
|
||||
$('.ui_fm_l').find(":input").prop('checked', true);
|
||||
$('.ui_fm_l').find(":input").prop('checked', false);
|
||||
$('.ui_fm_l input[value="双面覆哑膜"]').prop('checked', true);
|
||||
$("#z4_craft .scolor").hide();
|
||||
$("#peijian_ui .scolor").hide();
|
||||
$("#z4_craft .dadianxianhide").hide();
|
||||
@@ -1612,6 +1657,15 @@
|
||||
$(".guaguaSize1").find("select").attr("disabled", true);
|
||||
var kind;
|
||||
var kindValue;
|
||||
form.on('checkbox(switchMQ)', function (switchData) {
|
||||
if ($(".normalCountHideCraft .mq:checked").length > 1) {
|
||||
$(switchData.elem).next().attr("class", "layui-unselect layui-form-checkbox");
|
||||
$(switchData.elem).prop("checked", false);
|
||||
layer.msg('[裁切- 模切]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
form.render('checkbox');
|
||||
return false;
|
||||
}
|
||||
})
|
||||
form.on('radio(kind)', function (data) {
|
||||
kind = data.value;
|
||||
if (data.value == 1) {
|
||||
@@ -1631,8 +1685,11 @@
|
||||
$(".lesspeijian").prop("checked", false);
|
||||
$("#lesspeijian").hide();
|
||||
$("#lesspeijian").find(":input").attr("disabled", true);
|
||||
$(".huafangCraft").hide();
|
||||
$(".huafangCraft").find(":input").attr("disabled", true);
|
||||
$(".ui_fm_l").show();
|
||||
$('.ui_fm_l').find(":input").attr("disabled", false);
|
||||
$('.ui_fm_l').find(":input").prop('checked', false);
|
||||
$("#peijian_ui form")[0].reset();
|
||||
peijianuiHide()
|
||||
if (data.value == '直角卡片' || data.value == '异形卡片' || data.value == '贺卡' || data.value == '特种纸名片') {
|
||||
@@ -1737,7 +1794,7 @@
|
||||
form.render('checkbox');
|
||||
if (kindValueData.value == 2) {
|
||||
$("#craftHu").show();
|
||||
$('.ui_fm_l').find(":input").prop('checked', true);
|
||||
$('.ui_fm_l input[value="双面覆哑膜"]').prop('checked', true);
|
||||
$(".ui_fm").prop('disabled', false);
|
||||
$(".yhydx").show();
|
||||
$('.yhydx').find(":input").attr("disabled", false);
|
||||
@@ -1772,6 +1829,13 @@
|
||||
} else {
|
||||
kindValueData.value = 1;
|
||||
}
|
||||
if ($(".normalCountHideCraft .mq:checked").length > 1) {
|
||||
$(switchData.elem).next().attr("class", "layui-unselect layui-form-checkbox");
|
||||
$(switchData.elem).prop("checked", false);
|
||||
layer.msg('[裁切- 模切]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
form.render('checkbox');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (switchData.elem.checked) {
|
||||
$(".disab").attr("disabled", true);
|
||||
@@ -1985,13 +2049,13 @@
|
||||
//卡片默认覆膜
|
||||
if (couponKind != "少数量" && data.value != 1 && data.value != 8 && data.value != 9 && data.value != 10 && data.value != 11) {
|
||||
$('.ui_double_fm').prop('checked', true);
|
||||
$('.ui_fm_l').find(":input").prop('checked', true);
|
||||
$('.ui_fm_l input[value="双面覆哑膜"]').prop('checked', true);
|
||||
form.on('checkbox(ui_fm)', function (switchData) {
|
||||
if (!switchData.elem.checked) {
|
||||
layer.msg('卡片不能取消 [覆膜] 工艺!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
$('.ui_double_fm').prop('checked', true);
|
||||
$('.ui_fm_l').find(":input").prop('checked', true);
|
||||
$('.ui_fm_l input[value="双面覆哑膜"]').prop('checked', true);
|
||||
form.render('checkbox');
|
||||
}
|
||||
getProductImage(switchData.elem.checked ? switchData.value : '')
|
||||
@@ -2085,14 +2149,12 @@
|
||||
$(".tj").hide();
|
||||
$(".tj").find(":input").attr("disabled", true);
|
||||
}
|
||||
form.on('checkbox(switchMQ)', function (switchData) {
|
||||
if ($(".normalCountHideCraft .mq:checked").length > 1) {
|
||||
$(switchData.elem).next().attr("class", "layui-unselect layui-form-checkbox");
|
||||
$(switchData.elem).prop("checked", false);
|
||||
layer.msg('[裁切- 模切]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (data.value == 3) {
|
||||
$(".huafangCraft").show();
|
||||
$(".huafangCraft").find(":input").attr("disabled", false);
|
||||
}
|
||||
form.render('checkbox');
|
||||
|
||||
|
||||
@@ -2620,13 +2682,13 @@
|
||||
layer.msg('单面覆膜和双面覆膜只能选一种!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
return false;
|
||||
}
|
||||
if (!data.elem.checked && data.value == "双面覆哑膜") {
|
||||
layer.msg('不能取消 [覆膜] 工艺!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
$(data.elem).prop("checked", true);
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
// if (!data.elem.checked && data.value == "双面覆哑膜") {
|
||||
// layer.msg('不能取消 [覆膜] 工艺!', {offset: ['300px', '300px']}, function () {
|
||||
// });
|
||||
// $(data.elem).prop("checked", true);
|
||||
// form.render();
|
||||
// return;
|
||||
// }
|
||||
let craft_list = [];
|
||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||
if (!$(this).is(':disabled')) {
|
||||
@@ -2642,6 +2704,26 @@
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
const carft_list2 = ["双面覆哑膜", "双面星光膜", "双面镭射膜", "双面触感膜", "双面雪花膜"];
|
||||
const carft_pei = ["配葫芦针", "流苏", "尼龙绳", "配弹力绳", "配弹力绳捆", "opp袋", "配棉绳"];
|
||||
const carft_nopei = ["单面局部UV", "双面局部UV", "双面星光膜", "双面镭射膜", "双面触感膜", "双面雪花膜"];
|
||||
const carft2 = carft_list2.filter(craft => craft_list.includes(craft));
|
||||
const carftpei = carft_pei.filter(craft => craft_list.includes(craft));
|
||||
const carftnopei = carft_nopei.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;
|
||||
}
|
||||
if (carftpei.length > 0 && carftnopei.length > 0) {
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg(carft_nopei.join(",") + "与配件不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
if (data.value == "压痕") {
|
||||
if (data.elem.checked) {
|
||||
$(".yhselect").show();
|
||||
@@ -2679,6 +2761,13 @@
|
||||
// 监听工艺多选框
|
||||
form.on('checkbox(switchMQ)', function (data) {
|
||||
var kind = $('input[name="kind"]:checked').val();
|
||||
if ($(".normalCountHideCraft .mq:checked").length > 1) {
|
||||
$(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg('[裁切- 模切]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
form.render('checkbox');
|
||||
return false;
|
||||
}
|
||||
//判断当前多选框是选中还是取消选中
|
||||
if (kind != 7) {
|
||||
// 除存酒卡
|
||||
@@ -2748,7 +2837,7 @@
|
||||
if (tangjin > 1) {
|
||||
$(data.elem).next().attr("class", "layui-unselect layui-form-checkbox");
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg('[单面烫金 - 双面烫金]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
layer.msg('烫金工艺不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
|
||||
return false;
|
||||
}
|
||||
var hu = $(".ui_hu:checked").length;
|
||||
@@ -3079,20 +3168,29 @@
|
||||
});
|
||||
|
||||
form.on('checkbox(nmq)', (data) => {
|
||||
let craft = [];
|
||||
let craft_list = [];
|
||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||
// 没有被禁用的工艺加到arr中
|
||||
if (!$(this).is(':disabled')) {
|
||||
craft.push($(this).val());
|
||||
craft_list.push($(this).val());
|
||||
}
|
||||
});
|
||||
if (!craft.includes("模切")) {
|
||||
if (!craft_list.includes("模切")) {
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg("异形模切才能选择内部模切", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
const carft_nopei = ["单面局部UV", "双面局部UV", "双面星光膜", "双面镭射膜", "双面触感膜", "双面雪花膜"];
|
||||
const carftnopei = carft_nopei.filter(craft => craft_list.includes(craft));
|
||||
if (data.elem.checked && carftnopei.length > 0) {
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg(carft_nopei.join(",") + "与配件、内部模切不能同时选择", {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);
|
||||
@@ -3250,6 +3348,22 @@
|
||||
}
|
||||
|
||||
}
|
||||
if (kindValue2 == 2 && kind == 3) {
|
||||
if ($(this).val() === '单面局部UV' || $(this).val() === '双面局部UV') {
|
||||
if ($("#lengthVU").val() == '' || $("#widthUV").val() == '') {
|
||||
layer.msg('请填写UV版尺寸!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (Number(size.split("*")[0]) < Number($("#widthUV").val()) || Number(size.split("*")[1]) < Number($("#lengthVU").val())) {
|
||||
layer.msg('UV版尺寸不能大于输入尺寸!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
arr.push($(this).val() + $("#widthUV").val() + "*" + $("#lengthVU").val());
|
||||
return
|
||||
}
|
||||
}
|
||||
if ($(this).val() === '打孔' && kind != "种子纸") {
|
||||
arr.push("打孔" + $(".wkong:enabled option:selected").val())
|
||||
return;
|
||||
@@ -3659,21 +3773,20 @@
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// 没选中[覆膜]工艺,设置工艺为“不覆膜”
|
||||
var fmFlag = false;
|
||||
if (arr.length > 0) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i].indexOf('覆') != -1) {
|
||||
fmFlag = true
|
||||
}
|
||||
}
|
||||
if (!fmFlag) {
|
||||
arr.push("双面不覆膜")
|
||||
}
|
||||
} else {
|
||||
arr.push("双面不覆膜")
|
||||
}
|
||||
// var fmFlag = false;
|
||||
// if (arr.length > 0) {
|
||||
// for (let i = 0; i < arr.length; i++) {
|
||||
// if (arr[i].indexOf('覆') != -1) {
|
||||
// fmFlag = true
|
||||
// }
|
||||
// }
|
||||
// if (!fmFlag) {
|
||||
// arr.push("双面不覆膜")
|
||||
// }
|
||||
// } else {
|
||||
// arr.push("双面不覆膜")
|
||||
// }
|
||||
} else {
|
||||
if (kind != "种子纸") {
|
||||
arr.push($('input[name="craftShua"]:checked').val())
|
||||
|
||||
@@ -0,0 +1,416 @@
|
||||
<%@ 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="1">157克哑粉纸</option>
|
||||
<option value="2">200克哑粉纸</option>
|
||||
<option value="3">250克哑粉纸</option>
|
||||
</select>
|
||||
</div>
|
||||
<p>
|
||||
尺寸(CM/厘米)
|
||||
</p>
|
||||
<div class="layui-form-item" id="ui_size">
|
||||
<input type="text" name="size" placeholder="格式:长*宽" id="size" class="layui-input" autocomplete="off">
|
||||
</div>
|
||||
<p>
|
||||
数量(个)
|
||||
</p>
|
||||
<div class="layui-form-item">
|
||||
<select class="layui-form-select" name="count" id="count">
|
||||
<option value="200">200</option>
|
||||
<option value="500">500</option>
|
||||
<option value="1000">1000</option>
|
||||
<option value="1000">2000</option>
|
||||
<option value="3000">3000</option>
|
||||
<option value="5000">5000</option>
|
||||
<option value="10000">10000</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<input type="text" name="count" id="diyCount" placeholder="请输入整数" class="layui-input" autocomplete="off"
|
||||
disabled>
|
||||
</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 no175" style="display: none">
|
||||
覆膜工艺:
|
||||
<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="异形模切" title="异形模切">
|
||||
</div>
|
||||
|
||||
<div class="layui-input-block">
|
||||
常见工艺:
|
||||
<div class="layui-inline no175" style="display: none">
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" 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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="折页" title="折页">
|
||||
<div class="layui-inline zyselect" style="width:100px; display:none">
|
||||
<select name="bianma" class="layui-select ">
|
||||
<option value="对折页">对折页</option>
|
||||
<option value="包心三折">包心三折</option>
|
||||
<option value="风琴三折">风琴三折</option>
|
||||
<option value="风琴四折">风琴四折</option>
|
||||
<option value="关门四折">关门四折</option>
|
||||
<option value="风琴五折">风琴五折</option>
|
||||
<option value="风琴六折">风琴六折</option>
|
||||
<option value="风琴七折">风琴七折</option>
|
||||
<option value="十字折">十字折</option>
|
||||
<option value="对折再对折">对折再对折</option>
|
||||
<option value="自定义折页">自定义折页</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" 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>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</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;
|
||||
|
||||
const carft_list1 = ["压痕", "点线", "折页"];
|
||||
const carft_list2 = ["直角裁切", "异形模切"];
|
||||
const carft_list3 = ["不覆膜", "双面哑膜", "双面亮膜"];
|
||||
//建造实例
|
||||
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('select(kind)', function (data) {
|
||||
$(".yhselect").hide();
|
||||
$(".ydxselect").hide();
|
||||
$(".zyselect").hide();
|
||||
$("#z4_craft input[name='craft']").prop("checked", false)
|
||||
|
||||
$("#z4_craft input[name='craft'][value='直角裁切']").prop("checked", true)
|
||||
$(".no175").hide();
|
||||
$(".no175").find(":input").attr("disabled", true);
|
||||
if (data.value == 1) {
|
||||
|
||||
} else {
|
||||
$("#z4_craft input[name='craft'][value='不覆膜']").prop("checked", true)
|
||||
$(".no175").show();
|
||||
$(".no175").find(":input").attr("disabled", false);
|
||||
}
|
||||
form.render();
|
||||
})
|
||||
|
||||
form.on('checkbox(ui_craft)', function (data) {
|
||||
let craft_list = [];
|
||||
craft_list.push($("select[name='craft'] option:selected").val());
|
||||
$("input[name='craft']:checked").each(function () {
|
||||
if (!$(this).is(':disabled')) {
|
||||
craft_list.push($(this).val());
|
||||
}
|
||||
}
|
||||
);
|
||||
// const carft1 = carft_list1.filter(craft => craft_list.includes(craft));
|
||||
// if (carft1.length > 1) {
|
||||
// $(data.elem).prop("checked", true);
|
||||
// layer.msg("常见工艺不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||
// });
|
||||
// form.render();
|
||||
// return false;
|
||||
// }
|
||||
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;
|
||||
}
|
||||
const carft3 = carft_list3.filter(craft => craft_list.includes(craft));
|
||||
if (carft3.length > 1) {
|
||||
$(data.elem).prop("checked", false);
|
||||
layer.msg("覆膜工艺不能同时选择", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
form.render();
|
||||
return false;
|
||||
}
|
||||
$(".yhselect").hide();
|
||||
$(".ydxselect").hide();
|
||||
$(".zyselect").hide();
|
||||
if (craft_list.includes("压痕")) {
|
||||
$(".yhselect").show();
|
||||
}
|
||||
if (craft_list.includes("点线")) {
|
||||
$(".ydxselect").show();
|
||||
}
|
||||
if (craft_list.includes("折页")) {
|
||||
$(".zyselect").show();
|
||||
}
|
||||
})
|
||||
|
||||
// 点击计算,计算价格
|
||||
form.on('submit(acount_btn)', function (data) {
|
||||
var number = $("#number").val();
|
||||
var size = $("#size").val();
|
||||
var count = $("#count option:selected").val();
|
||||
var kind = $("select[name='kind'] option:selected").text();
|
||||
var craft = [];
|
||||
if ($("input[name='switchCount']").is(":checked")) {
|
||||
count = $("#count").val();
|
||||
}
|
||||
if (size == "") {
|
||||
layer.msg('请填写尺寸!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||
// 没有被禁用的工艺加到arr中
|
||||
if (!$(this).is(':disabled')) {
|
||||
if ($(this).val() == "压痕") {
|
||||
craft.push("压痕" + $(".yhselect select option:selected").val());
|
||||
} else if ($(this).val() == "点线") {
|
||||
craft.push("点线" + $(".ydxselect select option:selected").val());
|
||||
} else if ($(this).val() == "折页") {
|
||||
craft.push($(this).val());
|
||||
craft.push($(".zyselect select option:selected").val());
|
||||
} else {
|
||||
craft.push($(this).val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const carft3 = carft_list3.filter(item => craft.includes(item));
|
||||
if (kind != 1 && carft3.length == 0) {
|
||||
layer.msg("请选择覆膜工艺!", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (craft.includes("折页")) {
|
||||
if ((size.split("*")[0] < 16 || size.split("*")[1] < 14.2) && (size.split("*")[0] < 14.2 || size.split("*")[1] < 16)) {
|
||||
layer.msg("折页尺寸不能超过16*14.2 cm", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//
|
||||
// if ((size.split("*")[0] < 5.4 || size.split("*")[1] < 5.4)) {
|
||||
// if (!craft.includes("异形模切")) {
|
||||
// layer.msg("尺寸小与5.4*5.4请选择异形模切", {offset: ['300px', '300px']}, function () {
|
||||
// });
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
if ((size.split("*")[0] < 5.4 || size.split("*")[1] < 5.4)) {
|
||||
layer.msg("最小尺寸不能小于5.4*5.4", {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.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;
|
||||
|
||||
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 += '包邮,免费设计呢~(偏远地区需补邮费)'
|
||||
$("#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>
|
||||
Reference in New Issue
Block a user