新增手提袋
This commit is contained in:
@@ -2063,211 +2063,12 @@ public class ProductService {
|
||||
return chucklePrice(role, priceList, dto);
|
||||
// 牛皮纸手提袋
|
||||
case "11":
|
||||
List<Product> hanbagList = new ArrayList<Product>();
|
||||
craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
// 没有尺寸,就是常规,查询数据库
|
||||
if (StringUtils.isEmpty(size) && !dto.getK().equals("4")) {
|
||||
// 各常规尺寸展开的长宽--用于计算重量
|
||||
double danjia = 0.0;
|
||||
if ("0".equals(dto.getKind2Value())) {
|
||||
length = 640.0;
|
||||
height = 385.0;
|
||||
if (count <= 10000) {
|
||||
danjia = 0.88;
|
||||
} else {
|
||||
danjia = 0.78;
|
||||
}
|
||||
} else if ("1".equals(dto.getKind2Value())) {
|
||||
length = 720.0;
|
||||
height = 400.0;
|
||||
if (count <= 10000) {
|
||||
danjia = 1.064;
|
||||
} else {
|
||||
danjia = 0.9;
|
||||
}
|
||||
} else if ("2".equals(dto.getKind2Value())) {
|
||||
length = 780.0;
|
||||
height = 385.0;
|
||||
danjia = 1.11;
|
||||
}
|
||||
// 第一位添加自定义数量的价格
|
||||
if (dto.isDiyCount() && count > 3000) {
|
||||
Product dto2 = new Product();
|
||||
dto2.setCount(count);
|
||||
dto2.setPrice(Math.ceil(danjia * count));
|
||||
priceList.add(dto2);
|
||||
}
|
||||
if ("2".equals(dto.getKindValue())) {
|
||||
dto.setKindValue("0");
|
||||
}
|
||||
hanbagList = productMapper.getThanPrice(dto);
|
||||
// 把查出来的价格跟在自定义数量价格后面
|
||||
for (int i = 0; i < hanbagList.size(); i++) {
|
||||
if (priceList.size() > 0) {
|
||||
if (count == hanbagList.get(i).getCount())
|
||||
continue;
|
||||
}
|
||||
priceList.add(hanbagList.get(i));
|
||||
}
|
||||
// 给产品加上重量
|
||||
for (Product product : priceList) {
|
||||
product.setWeight(df.format(product.getCount() * 0.03));
|
||||
}
|
||||
} else {
|
||||
if ("4".equals(dto.getK())) {
|
||||
String kind2Value = dto.getKind2Value();
|
||||
String kindValue = dto.getKindValue();
|
||||
int[] base_count = null;
|
||||
double[] base_price = null;
|
||||
length = 0.0;
|
||||
height = 0.0;
|
||||
width = 0.0;
|
||||
List<String> kind2ValueList = Arrays.asList("11", "12", "31", "37", "38", "62");
|
||||
if ("0".equals(kindValue) && !kind2ValueList.contains(kind2Value)) {
|
||||
base_count = new int[]{100, 500, 1000, 2000, 3000, 5000, 10000};
|
||||
} else {
|
||||
base_count = new int[]{500, 1000, 2000, 3000, 5000, 10000};
|
||||
}
|
||||
FunReturnVo funReturnVo = new PriceUtils().getBagTagPrice(kind2Value, kindValue);
|
||||
if (funReturnVo.getBase_price() != null) {
|
||||
base_price = funReturnVo.getBase_price();
|
||||
width = funReturnVo.getWidth();
|
||||
height = funReturnVo.getHeight();
|
||||
length = funReturnVo.getLength();
|
||||
}
|
||||
|
||||
Product pro = null;
|
||||
double color_price = 0;
|
||||
double bei_price = 0;
|
||||
if (dto.getShen_type() == 0) {
|
||||
if (!"白色".equals(dto.getShen_color()) && !"黄牛皮本色".equals(dto.getShen_color())) {
|
||||
color_price = 0.02;
|
||||
}
|
||||
}
|
||||
if (dto.getShen_type() == 1) {
|
||||
color_price = 0.06;
|
||||
if ("白色".equals(dto.getShen_color()) || "黄牛皮本色".equals(dto.getShen_color())) {
|
||||
color_price = 0.03;
|
||||
}
|
||||
}
|
||||
if (dto.getZheye() != null && dto.getZheye() == 0) {
|
||||
bei_price = 0.4;
|
||||
}
|
||||
if (dto.getZheye() != null && dto.getZheye() == 1) {
|
||||
bei_price = 0.6;
|
||||
}
|
||||
if (dto.getZheye() != null && dto.getZheye() == 2) {
|
||||
bei_price = 0.3;
|
||||
}
|
||||
for (int i = 0; i < base_count.length; i++) {
|
||||
if (base_count[i] < count) {
|
||||
continue;
|
||||
}
|
||||
if (priceList.size() > 2) {
|
||||
break;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(base_count[i]);
|
||||
pro.setPrice(Math.ceil(base_price[i] + (base_count[i] * color_price) + (base_count[i] * bei_price)));
|
||||
priceList.add(pro);
|
||||
}
|
||||
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(product.getPrice() * number);
|
||||
product.setWeight(df.format((width + height) * length * 2 * 0.25 * 1.5 * product.getCount() / 10000));
|
||||
}
|
||||
|
||||
return chucklePrice(role, priceList, dto);
|
||||
}
|
||||
double sizeLength = 0.0;
|
||||
double sizeWidth = 0.0;
|
||||
// 厘米转成毫米
|
||||
sizeLength = length = length * 10;
|
||||
sizeWidth = width = width * 10;
|
||||
height = height * 10;
|
||||
length = (length + width) * 2 + 20;
|
||||
height = (height + (width / 2 + 20)) + 40;
|
||||
double price = 0.0;
|
||||
int ikai = 0;
|
||||
String kai = "";
|
||||
String kaiDa = PriceUtils.getDa(length, height);
|
||||
String kaiZheng = PriceUtils.getZheng(length, height);
|
||||
int intDa = Integer.parseInt(kaiDa);
|
||||
int intZheng = Integer.parseInt(kaiZheng);
|
||||
int maxDa = intDa > intZheng ? intDa : intZheng;
|
||||
if (intZheng >= intDa) {
|
||||
kai = "+" + maxDa;
|
||||
}
|
||||
if (kai.contains("+")) {
|
||||
kai = kai.replaceAll("[^(0-9)]", "");
|
||||
ikai = Integer.parseInt(kai);
|
||||
// 140克牛皮纸
|
||||
if ("0".equals(kind)) {
|
||||
price = 1.2;
|
||||
// 250克牛皮纸
|
||||
} else {
|
||||
price = 2.2;
|
||||
}
|
||||
} else {
|
||||
ikai = maxDa;
|
||||
if ("0".equals(kind)) {
|
||||
price = 1.4;
|
||||
} else {
|
||||
price = 2.8;
|
||||
}
|
||||
}
|
||||
// !福袋/礼品袋
|
||||
if (!"2".equals(dto.getK())) {
|
||||
if (length >= 1000 || height >= 700) {
|
||||
ikai = 1;
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 2);
|
||||
} else {
|
||||
// 系数 5千-1万的*1.6 5千以下的*1.7
|
||||
if (count <= 5000) {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.7);
|
||||
} else {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (length >= 1000 || height >= 700) {
|
||||
ikai = 1;
|
||||
}
|
||||
// 数量超过1万个,系数*1.6
|
||||
if (count > 10000) {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6);
|
||||
} else {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.8);
|
||||
}
|
||||
}
|
||||
// 给产品加上重量
|
||||
if ("0".equals(kind)) {
|
||||
for (Product product : priceList) {
|
||||
product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.14 * 1.25));
|
||||
}
|
||||
} else {
|
||||
for (Product product : priceList) {
|
||||
double craft_price = 0.0;
|
||||
if (craft_list.contains("烫金")) {
|
||||
craft_price = Math.ceil(300 + 0.5 * product.getCount());
|
||||
//craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number), 200);
|
||||
}
|
||||
if (craft_list.contains("双面")) {
|
||||
craft_price = Math.ceil(300 + 0.5 * product.getCount()) * 2;
|
||||
//craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number * 2), 200);
|
||||
}
|
||||
product.setPrice(Math.ceil(product.getPrice() + craft_price));
|
||||
product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25));
|
||||
}
|
||||
}
|
||||
}
|
||||
priceList = getHandBagPrice(dto, width, length, height);
|
||||
if (priceList.size() >= 4) {
|
||||
priceList = priceList.subList(0, 4);
|
||||
}
|
||||
// 根据款数重新算价格
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(Math.floor(product.getPrice() * number));
|
||||
}
|
||||
|
||||
return chucklePrice(role, priceList, dto);
|
||||
// 250克白牛皮纸
|
||||
case "12":
|
||||
@@ -4627,6 +4428,301 @@ public class ProductService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Product> getHandBagPrice(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();
|
||||
String kind = dto.getKindValue();
|
||||
String size = dto.getSize();
|
||||
List<Product> hanbagList = new ArrayList<Product>();
|
||||
// 没有尺寸,就是常规,查询数据库
|
||||
if (StringUtils.isEmpty(size) && !dto.getK().equals("4") && !dto.getK().equals("5")) {
|
||||
// 各常规尺寸展开的长宽--用于计算重量
|
||||
double danjia = 0.0;
|
||||
if ("0".equals(dto.getKind2Value())) {
|
||||
length = 640.0;
|
||||
height = 385.0;
|
||||
if (count <= 10000) {
|
||||
danjia = 0.88;
|
||||
} else {
|
||||
danjia = 0.78;
|
||||
}
|
||||
} else if ("1".equals(dto.getKind2Value())) {
|
||||
length = 720.0;
|
||||
height = 400.0;
|
||||
if (count <= 10000) {
|
||||
danjia = 1.064;
|
||||
} else {
|
||||
danjia = 0.9;
|
||||
}
|
||||
} else if ("2".equals(dto.getKind2Value())) {
|
||||
length = 780.0;
|
||||
height = 385.0;
|
||||
danjia = 1.11;
|
||||
}
|
||||
// 第一位添加自定义数量的价格
|
||||
if (dto.isDiyCount() && count > 3000) {
|
||||
Product dto2 = new Product();
|
||||
dto2.setCount(count);
|
||||
dto2.setPrice(Math.ceil(danjia * count));
|
||||
priceList.add(dto2);
|
||||
}
|
||||
if ("2".equals(dto.getKindValue())) {
|
||||
dto.setKindValue("0");
|
||||
}
|
||||
hanbagList = productMapper.getThanPrice(dto);
|
||||
// 把查出来的价格跟在自定义数量价格后面
|
||||
for (int i = 0; i < hanbagList.size(); i++) {
|
||||
if (priceList.size() > 0) {
|
||||
if (count == hanbagList.get(i).getCount())
|
||||
continue;
|
||||
}
|
||||
priceList.add(hanbagList.get(i));
|
||||
}
|
||||
// 给产品加上重量
|
||||
for (Product product : priceList) {
|
||||
product.setWeight(df.format(product.getCount() * 0.03));
|
||||
}
|
||||
} else {
|
||||
if ("4".equals(dto.getK())) {
|
||||
String kind2Value = dto.getKind2Value();
|
||||
String kindValue = dto.getKindValue();
|
||||
int[] base_count = null;
|
||||
double[] base_price = null;
|
||||
length = 0.0;
|
||||
height = 0.0;
|
||||
width = 0.0;
|
||||
List<String> kind2ValueList = Arrays.asList("11", "12", "31", "37", "38", "62");
|
||||
if ("0".equals(kindValue) && !kind2ValueList.contains(kind2Value)) {
|
||||
base_count = new int[]{100, 500, 1000, 2000, 3000, 5000, 10000};
|
||||
} else {
|
||||
base_count = new int[]{500, 1000, 2000, 3000, 5000, 10000};
|
||||
}
|
||||
FunReturnVo funReturnVo = new PriceUtils().getBagTagPrice(kind2Value, kindValue);
|
||||
if (funReturnVo.getBase_price() != null) {
|
||||
base_price = funReturnVo.getBase_price();
|
||||
width = funReturnVo.getWidth();
|
||||
height = funReturnVo.getHeight();
|
||||
length = funReturnVo.getLength();
|
||||
}
|
||||
|
||||
Product pro = null;
|
||||
double color_price = 0;
|
||||
double bei_price = 0;
|
||||
if (dto.getShen_type() == 0) {
|
||||
if (!"白色".equals(dto.getShen_color()) && !"黄牛皮本色".equals(dto.getShen_color())) {
|
||||
color_price = 0.02;
|
||||
}
|
||||
}
|
||||
if (dto.getShen_type() == 1) {
|
||||
color_price = 0.06;
|
||||
if ("白色".equals(dto.getShen_color()) || "黄牛皮本色".equals(dto.getShen_color())) {
|
||||
color_price = 0.03;
|
||||
}
|
||||
}
|
||||
if (dto.getZheye() != null && dto.getZheye() == 0) {
|
||||
bei_price = 0.4;
|
||||
}
|
||||
if (dto.getZheye() != null && dto.getZheye() == 1) {
|
||||
bei_price = 0.6;
|
||||
}
|
||||
if (dto.getZheye() != null && dto.getZheye() == 2) {
|
||||
bei_price = 0.3;
|
||||
}
|
||||
for (int i = 0; i < base_count.length; i++) {
|
||||
if (base_count[i] < count) {
|
||||
continue;
|
||||
}
|
||||
if (priceList.size() > 2) {
|
||||
break;
|
||||
}
|
||||
pro = new Product();
|
||||
pro.setCount(base_count[i]);
|
||||
pro.setPrice(Math.ceil(base_price[i] + (base_count[i] * color_price) + (base_count[i] * bei_price)));
|
||||
priceList.add(pro);
|
||||
}
|
||||
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(product.getPrice() * number);
|
||||
product.setWeight(df.format((width + height) * length * 2 * 0.25 * 1.5 * product.getCount() / 10000));
|
||||
}
|
||||
|
||||
return priceList;
|
||||
} else if ("5".equals(dto.getK())) {
|
||||
int[] counts = {100, 200, 500, 1000, 2000, 5000, 10000, 50000, 100000};
|
||||
double[][] prices = {
|
||||
{140, 190, 380, 690, 1330, 3110, 5980, 27540, 51430},
|
||||
{150, 230, 460, 850, 1640, 3790, 7320, 34060, 64290},
|
||||
{160, 240, 500, 930, 1790, 4170, 8060, 36960, 70000},
|
||||
{170, 270, 560, 1040, 2000, 4700, 8960, 41310, 78580},
|
||||
};
|
||||
if (craft_list.contains("单色") && craft_list.contains("双面")) {
|
||||
prices = new double[][]{
|
||||
{183, 241, 308, 443, 812, 1446, 3333, 6418, 30580, 60143},
|
||||
{200, 275, 358, 525, 969, 1754, 4091, 7910, 37826, 74429},
|
||||
{191, 291, 383, 566, 1047, 1908, 4470, 8657, 41449, 81572},
|
||||
{216, 316, 418, 631, 1156, 2123, 5000, 9701, 46522, 91572},
|
||||
{250, 366, 498, 754, 1406, 2615, 6212, 12090, 58116, 114429},
|
||||
};
|
||||
}
|
||||
if (craft_list.contains("彩色") && craft_list.contains("单面")) {
|
||||
prices = new double[][]{
|
||||
{150, 198, 363, 691, 1329, 3215, 6286, 30001, 57143},
|
||||
{166, 214, 439, 838, 1615, 3858, 7572, 36429, 70000},
|
||||
{175, 253, 477, 911, 1758, 4215, 8286, 39286, 75715},
|
||||
{183, 276, 537, 1014, 1958, 4715, 9286, 44286, 85715},
|
||||
};
|
||||
}
|
||||
if (craft_list.contains("彩色") && craft_list.contains("双面")) {
|
||||
prices = new double[][]{
|
||||
{233, 277, 454, 838, 1472, 3543, 6929, 33115, 63272},
|
||||
{316, 293, 530, 985, 1758, 4229, 8272, 39543, 75558},
|
||||
{325, 333, 568, 1058, 1901, 4572, 8943, 42758, 81700},
|
||||
{333, 355, 628, 1161, 2100, 5043, 9872, 47258, 90300},
|
||||
{366, 406, 740, 1397, 2558, 6143, 12029, 57543, 109958},
|
||||
};
|
||||
}
|
||||
double baseRate = 0;
|
||||
if (craft_list.contains("全彩")) {
|
||||
baseRate = 1;
|
||||
counts = new int[]{5000, 10000, 20000, 30000, 50000, 100000, 200000};
|
||||
prices = new double[][]{
|
||||
{3584, 6350, 11400, 16607, 27239, 51377, 98215},
|
||||
{4184, 7493, 13631, 19970, 32911, 62276, 119243},
|
||||
{4767, 8270, 15031, 22001, 36224, 68537, 131200},
|
||||
{5250, 9683, 17600, 25773, 42433, 80290, 153715},
|
||||
{6867, 12254, 22216, 32501, 53478, 101116, 193529},
|
||||
};
|
||||
}
|
||||
double[] ban_price = {350, 270, 310, 350, 470};
|
||||
for (int i = 0; i < counts.length; i++) {
|
||||
if (priceList.size() > 2) {
|
||||
break;
|
||||
}
|
||||
int item_count = counts[i];
|
||||
|
||||
if (item_count < count) {
|
||||
continue;
|
||||
}
|
||||
double price = 0;
|
||||
if (priceList.size() == 0) {
|
||||
if (count != item_count) {
|
||||
price = new PriceUtils().TableCountCenterPrice(count, prices[Integer.parseInt(dto.getKind2Value())], counts);
|
||||
Product pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(price));
|
||||
priceList.add(pro);
|
||||
}
|
||||
}
|
||||
price = new PriceUtils().TableCountCenterPrice(item_count, prices[Integer.parseInt(dto.getKind2Value())], counts);
|
||||
|
||||
Product pro = new Product();
|
||||
pro.setCount(item_count);
|
||||
pro.setPrice(Math.ceil(price));
|
||||
priceList.add(pro);
|
||||
}
|
||||
if (priceList.size() == 0) {
|
||||
Product pro = new Product();
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(prices[Integer.parseInt(dto.getKind2Value())][prices[Integer.parseInt(dto.getKind2Value())].length - 1] / counts[counts.length - 1] * count));
|
||||
priceList.add(pro);
|
||||
}
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(Math.ceil(product.getPrice() * number + baseRate * ban_price[Integer.parseInt(dto.getKind2Value())] * dto.getCo_number()));
|
||||
}
|
||||
return priceList;
|
||||
}
|
||||
double sizeLength = 0.0;
|
||||
double sizeWidth = 0.0;
|
||||
// 厘米转成毫米
|
||||
sizeLength = length = length * 10;
|
||||
sizeWidth = width = width * 10;
|
||||
height = height * 10;
|
||||
length = (length + width) * 2 + 20;
|
||||
height = (height + (width / 2 + 20)) + 40;
|
||||
double price = 0.0;
|
||||
int ikai = 0;
|
||||
String kai = "";
|
||||
String kaiDa = PriceUtils.getDa(length, height);
|
||||
String kaiZheng = PriceUtils.getZheng(length, height);
|
||||
int intDa = Integer.parseInt(kaiDa);
|
||||
int intZheng = Integer.parseInt(kaiZheng);
|
||||
int maxDa = intDa > intZheng ? intDa : intZheng;
|
||||
if (intZheng >= intDa) {
|
||||
kai = "+" + maxDa;
|
||||
}
|
||||
if (kai.contains("+")) {
|
||||
kai = kai.replaceAll("[^(0-9)]", "");
|
||||
ikai = Integer.parseInt(kai);
|
||||
// 140克牛皮纸
|
||||
if ("0".equals(kind)) {
|
||||
price = 1.2;
|
||||
// 250克牛皮纸
|
||||
} else {
|
||||
price = 2.2;
|
||||
}
|
||||
} else {
|
||||
ikai = maxDa;
|
||||
if ("0".equals(kind)) {
|
||||
price = 1.4;
|
||||
} else {
|
||||
price = 2.8;
|
||||
}
|
||||
}
|
||||
// !福袋/礼品袋
|
||||
if (!"2".equals(dto.getK())) {
|
||||
if (length >= 1000 || height >= 700) {
|
||||
ikai = 1;
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 2);
|
||||
} else {
|
||||
// 系数 5千-1万的*1.6 5千以下的*1.7
|
||||
if (count <= 5000) {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.7);
|
||||
} else {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (length >= 1000 || height >= 700) {
|
||||
ikai = 1;
|
||||
}
|
||||
// 数量超过1万个,系数*1.6
|
||||
if (count > 10000) {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.6);
|
||||
} else {
|
||||
priceList = new PriceUtils().getPriceHanding(count, ikai, price, 1.8);
|
||||
}
|
||||
}
|
||||
// 给产品加上重量
|
||||
if ("0".equals(kind)) {
|
||||
for (Product product : priceList) {
|
||||
product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.14 * 1.25));
|
||||
}
|
||||
} else {
|
||||
for (Product product : priceList) {
|
||||
double craft_price = 0.0;
|
||||
if (craft_list.contains("烫金")) {
|
||||
craft_price = Math.ceil(300 + 0.5 * product.getCount());
|
||||
//craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number), 200);
|
||||
}
|
||||
if (craft_list.contains("双面")) {
|
||||
craft_price = Math.ceil(300 + 0.5 * product.getCount()) * 2;
|
||||
//craft_price = Math.max(Math.ceil((sizeWidth + 2) * (sizeLength + 2) * 0.00015 * (product.getCount() + 50) * number * 2), 200);
|
||||
}
|
||||
product.setPrice(Math.ceil(product.getPrice() + craft_price));
|
||||
product.setWeight(df.format(number * length / 1000 * height / 1000 * product.getCount() * 0.25 * 1.25));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据款数重新算价格
|
||||
for (Product product : priceList) {
|
||||
product.setPrice(Math.floor(product.getPrice() * number));
|
||||
}
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private List<Product> getWorkPermitPrice(Product dto, Double width, Double length) {
|
||||
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<input type="radio" name="k" class="k" lay-filter="k" value="2" title="礼品袋 / 福袋">
|
||||
<!-- <input type="radio" name="k" class="k" lay-filter="k" value="3" title="特价白卡手提袋"> -->
|
||||
<input type="radio" name="k" class="k" lay-filter="k" value="4" title="牛皮纸手提袋">
|
||||
<input type="radio" name="k" class="k" lay-filter="k" value="5" title="铝箔手提袋">
|
||||
</div>
|
||||
</form>
|
||||
<form class="layui-form" id="bagForm">
|
||||
@@ -109,6 +110,47 @@
|
||||
<input type="checkbox" name="zheye" lay-filter="zheye" value="1" title="四杯托">
|
||||
</div>
|
||||
</div>
|
||||
<div class="lbstd">
|
||||
<p>材质</p>
|
||||
<div class="">
|
||||
<select name="kindValue" class="select " lay-filter="kindValue">
|
||||
<option value="1">铝箔手提袋</option>
|
||||
</select>
|
||||
</div>
|
||||
<p>规格(CM/厘米) <span style="font-size:14px;color:red">格式: 长 * 宽 * 高</span></p>
|
||||
<div class="layui-form-item ">
|
||||
<select name="kind2Value" class="select kind2Value" lay-filter="kind2Value">
|
||||
<option value="0">12*28*10CM</option>
|
||||
<option value="1">21*27*11CM</option>
|
||||
<option value="2">24*24*15CM</option>
|
||||
<option value="3">26*26*17CM</option>
|
||||
</select>
|
||||
</div>
|
||||
<p>
|
||||
数量(个)
|
||||
<span style="font-size:10px;color:green">自定义数量</span>
|
||||
<input type="checkbox" class="layui-form-checkbox diyCount5" lay-filter="diyCount">
|
||||
</p>
|
||||
<div class="layui-form-item count">
|
||||
<select name="count" class="select">
|
||||
<option value="100">100</option>
|
||||
<option value="200">200</option>
|
||||
<option value="300">300</option>
|
||||
<option value="500">500</option>
|
||||
<option value="1000">1000</option>
|
||||
<option value="2000">2000</option>
|
||||
<option value="5000">5000</option>
|
||||
<option value="10000">10000</option>
|
||||
<option value="50000">50000</option>
|
||||
<option value="100000">100000</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="diyCount" style="display: none">
|
||||
<div class="layui-form-item">
|
||||
<input type="text" name="count" placeholder="请输入整数" class="layui-input" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
款数
|
||||
</p>
|
||||
@@ -133,6 +175,39 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lbstd" style="display: none">
|
||||
<p>工艺</p>
|
||||
<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="彩色">
|
||||
<div class="layui-inline color-print" style="width: 200px">
|
||||
<select 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>
|
||||
</select>
|
||||
</div>
|
||||
<input type="checkbox" name="craft" lay-filter="ui_craft" value="全彩" title="全彩">
|
||||
<div class="layui-inline color-print-count" style="display: none;width: 200px">
|
||||
<div style="display: flex;align-items: center">
|
||||
<input name="co_number" type="text" class="layui-input" value="1" disabled/><span>色</span>
|
||||
</div>
|
||||
</div>
|
||||
</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">
|
||||
@@ -215,6 +290,8 @@
|
||||
var continuedPrice = 0;
|
||||
// 价格
|
||||
var expressPrice = 0;
|
||||
|
||||
var level = 1;
|
||||
// 监听选择的快递
|
||||
form.on('select(changeExpress)', function (data) {
|
||||
changeExpress = data.value
|
||||
@@ -409,13 +486,73 @@
|
||||
form.on('checkbox(ui_craft)', function (data) {
|
||||
let craft_list = [];
|
||||
let kindValue = $('input[name="kindValue"]:checked').val();
|
||||
craft_list.push($("select[name='craft'] option:selected").val());
|
||||
craft_list.push($("select[name='craft']:not(:disabled) option:selected").val());
|
||||
$("input[name='craft']:checked").each(function () {
|
||||
if (!$(this).is(':disabled')) {
|
||||
craft_list.push($(this).val());
|
||||
}
|
||||
});
|
||||
const 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;
|
||||
}
|
||||
|
||||
const 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;
|
||||
}
|
||||
$(".color-print-count").hide();
|
||||
$(".color-print-count").find("select").attr("disabled", true);
|
||||
$(".color-print").hide();
|
||||
$(".color-print").find("select").attr("disabled", true);
|
||||
if (craft_list.includes("单色") || craft_list.includes("彩色")) {
|
||||
$(".color-print").show();
|
||||
$(".color-print").find("select").attr("disabled", false);
|
||||
}
|
||||
let sizeHtml = `<option value="0">12*28*10CM</option>
|
||||
<option value="1">21*27*11CM</option>
|
||||
<option value="2">24*24*15CM</option>
|
||||
<option value="3">26*26*17CM</option>
|
||||
<option value="4">30*30*20CM</option>`;
|
||||
let html = `<option value="100">100</option>
|
||||
<option value="200">200</option>
|
||||
<option value="300">300</option>
|
||||
<option value="500">500</option>
|
||||
<option value="1000">1000</option>
|
||||
<option value="2000">2000</option>
|
||||
<option value="5000">5000</option>
|
||||
<option value="10000">10000</option>
|
||||
<option value="50000">50000</option>
|
||||
<option value="100000">100000</option>`
|
||||
if (craft_list.includes("全彩")) {
|
||||
$(".color-print-count").show();
|
||||
$(".color-print-count").find("select").attr("disabled", false);
|
||||
html = `<option value="5000">5000</option>
|
||||
<option value="10000">10000</option>
|
||||
<option value="20000">20000</option>
|
||||
<option value="30000">30000</option>
|
||||
<option value="50000">50000</option>
|
||||
<option value="100000">100000</option>
|
||||
<option value="200000">200000</option>`
|
||||
}
|
||||
if (craft_list.includes("单面") && !craft_list.includes("全彩")) {
|
||||
sizeHtml = `<option value="0">12*28*10CM</option>
|
||||
<option value="1">21*27*11CM</option>
|
||||
<option value="2">24*24*15CM</option>
|
||||
<option value="3">26*26*17CM</option>`;
|
||||
}
|
||||
if (data.value == '抠图') {
|
||||
$(".crop").hide();
|
||||
$(".crop").find("input").prop("disabled", true)
|
||||
@@ -424,26 +561,26 @@
|
||||
$(".crop").find("input").prop("disabled", false)
|
||||
}
|
||||
}
|
||||
$(".lbstd select[name='count']").empty().append(html)
|
||||
$(".lbstd select[name='kind2Value']").empty().append(sizeHtml)
|
||||
form.render();
|
||||
})
|
||||
// 自定义数量
|
||||
form.on('checkbox(diyCount)', function (data) {
|
||||
//判断当前多选框是选中还是取消选中
|
||||
|
||||
if (data.elem.checked) {
|
||||
$(".diyCount").show();
|
||||
$(".count").hide();
|
||||
$(".diyCount").find(":input").attr("disabled", false);
|
||||
$(".count").find(":input").attr("disabled", true);
|
||||
$(data.elem).parents("div:first").find(".diyCount").show();
|
||||
$(data.elem).parents("div:first").find(".count").hide();
|
||||
$(data.elem).parents("div:first").find(".diyCount").find(":input").attr("disabled", false);
|
||||
$(data.elem).parents("div:first").find(".count").find(":input").attr("disabled", true);
|
||||
} else {
|
||||
// 恢复标准数量的时候会被禁用,需要重置一下表单
|
||||
//$("#kindValueForm")[0].reset();
|
||||
$(".count").show();
|
||||
$(".diyCount").hide();
|
||||
$(".count").find(":input").attr("disabled", false);
|
||||
$(".diyCount").find(":input").attr("disabled", true);
|
||||
// 恢复标准数量的时候会被禁用,加这个解决
|
||||
form.render();
|
||||
$(data.elem).parents("div:first").find(".count").show();
|
||||
$(data.elem).parents("div:first").find(".diyCount").hide();
|
||||
$(data.elem).parents("div:first").find(".count").find(":input").attr("disabled", false);
|
||||
$(data.elem).parents("div:first").find(".diyCount").find(":input").attr("disabled", true);
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
// 选择是常规还是自定义
|
||||
form.on('radio(k)', function (data) {
|
||||
@@ -487,68 +624,53 @@
|
||||
$("#tang_type").hide();
|
||||
$("#tang_type select").prop("disabled", true);
|
||||
$("#bagForm")[0].reset();
|
||||
var level = data.value;//被点击的radio的value值
|
||||
level = data.value;//被点击的radio的value值
|
||||
$("#craft_layout").hide();
|
||||
$("#craft_layout").find(":input").attr("disabled", true);
|
||||
$(".cg").hide();
|
||||
$(".cg").find(":input").attr("disabled", true);
|
||||
$(".tj").hide();
|
||||
$(".tj").find(":input").attr("disabled", true);
|
||||
$(".dz").hide();
|
||||
$(".dz").find(":input").attr("disabled", true);
|
||||
$(".zdy").hide();
|
||||
$(".zdy").find(":input").attr("disabled", true);
|
||||
$(".npzd").hide();
|
||||
$(".npzd").find(":input").attr("disabled", true);
|
||||
$(".npzd").find("select").attr("disabled", true);
|
||||
$(".lbstd").hide();
|
||||
$(".lbstd").find(":input").attr("disabled", true);
|
||||
$(".lbstd").find("select").attr("disabled", true);
|
||||
$(".aaa").hide();
|
||||
$(".aaa").find(":input").attr("disabled", true);
|
||||
if (level == 0) {
|
||||
$(".cg").show();
|
||||
$(".zdy").hide();
|
||||
$(".tj").hide();
|
||||
$(".npzd").hide();
|
||||
$(".cg").find(":input").attr("disabled", false);
|
||||
$(".zdy").find(":input").attr("disabled", true);
|
||||
$(".tj").find(":input").attr("disabled", true);
|
||||
$(".npzd").find(":input").attr("disabled", true);
|
||||
} else if (level == 1) {
|
||||
$(".cg").hide();
|
||||
$(".tj").hide();
|
||||
/* $(".dz").hide(); */
|
||||
$(".zdy").show();
|
||||
$(".npzd").hide();
|
||||
$(".zdy").find(":input").attr("disabled", false);
|
||||
$(".cg").find(":input").attr("disabled", true);
|
||||
$(".tj").find(":input").attr("disabled", true);
|
||||
$(".dz").find(":input").attr("disabled", true);
|
||||
$(".npzd").find(":input").attr("disabled", true);
|
||||
$("#craft_layout").show();
|
||||
$("#craft_layout").find(":input").attr("disabled", false);
|
||||
} else if (level == 2) {
|
||||
$(".cg").hide();
|
||||
$(".tj").hide();
|
||||
$(".zdy").show();
|
||||
$(".aaa").hide();
|
||||
$(".npzd").hide();
|
||||
/* $(".dz").show(); */
|
||||
$(".zdy").find(":input").attr("disabled", false);
|
||||
$(".cg").find(":input").attr("disabled", true);
|
||||
$(".tj").find(":input").attr("disabled", true);
|
||||
$(".aaa").find(":input").attr("disabled", true);
|
||||
$(".npzd").find(":input").attr("disabled", true);
|
||||
} else if (level == 4) {
|
||||
$(".cg").hide();
|
||||
$(".tj").hide();
|
||||
$(".zdy").hide();
|
||||
$(".aaa").hide();
|
||||
$(".npzd").show();
|
||||
/* $(".dz").show(); */
|
||||
$(".zdy").find(":input").attr("disabled", true);
|
||||
$(".cg").find(":input").attr("disabled", true);
|
||||
$(".tj").find(":input").attr("disabled", true);
|
||||
$(".aaa").find(":input").attr("disabled", true);
|
||||
$(".npzd").find(":input").attr("disabled", false);
|
||||
$(".npzd").find("select").attr("disabled", false);
|
||||
$(".npzd .diyCount").find(":input").attr("disabled", true);
|
||||
} else if (level == 5) {
|
||||
$(".lbstd").show();
|
||||
$(".lbstd").find(":input").attr("disabled", false);
|
||||
$(".lbstd").find("select").attr("disabled", false);
|
||||
$(".lbstd .diyCount").find(":input").attr("disabled", true);
|
||||
} else {
|
||||
$(".cg").hide();
|
||||
$(".zdy").hide();
|
||||
$(".npzd").hide();
|
||||
/* $(".dz").hide(); */
|
||||
$(".tj").show();
|
||||
$(".tj").find(":input").attr("disabled", false);
|
||||
$(".cg").find(":input").attr("disabled", true);
|
||||
$(".zdy").find(":input").attr("disabled", true);
|
||||
$(".dz").find(":input").attr("disabled", true);
|
||||
$(".npzd").find(":input").attr("disabled", true);
|
||||
}
|
||||
// 点击计算,计算价格
|
||||
form.render()
|
||||
});
|
||||
|
||||
form.on('submit(acount_btn)', function (data) {
|
||||
var diyCount = $('input[name="diyCount"]:checked').val();
|
||||
// 勾了少数量
|
||||
@@ -559,7 +681,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (level != 0 && level != 3) {
|
||||
if (level != 0 && level != 3 && level != 5) {
|
||||
if (level != 4) {
|
||||
var size = $("#size").val();
|
||||
if (!size) {
|
||||
@@ -607,17 +729,7 @@
|
||||
} else {
|
||||
$("#proTypeValue").val(11)
|
||||
}
|
||||
form.render();
|
||||
|
||||
$.ajax({
|
||||
url: "${pageContext.request.contextPath}/getThanSum",
|
||||
type: "GET",
|
||||
data: $(".big_box form").serialize(),
|
||||
success: function (result) {
|
||||
if (result.code != 200) {
|
||||
layer.msg(result.msg, {offset: ['300px', '300px']}, {icon: 5, time: 1000});
|
||||
return false;
|
||||
}
|
||||
let arr = [];
|
||||
$("input:checkbox[name='craft']:checked").each(function (i) {
|
||||
if (!$(this).is(':disabled')) {
|
||||
@@ -631,6 +743,42 @@
|
||||
arr.push($(this).val());
|
||||
}
|
||||
});
|
||||
if (level == 5) {
|
||||
let count = $("select[name='count']:not(:disabled) option:selected").val();
|
||||
if ($(".diyCount5:is(:checked)").val()) {
|
||||
count = $("input[name='count']:not(:disabled)").val()
|
||||
}
|
||||
if (count != 0 && count % 100 !== 0) {
|
||||
layer.msg('数量必须为100的倍数!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (arr.includes("全彩")) {
|
||||
if (!$("input[name='co_number']").val() || $("input[name='co_number']").val() == 0) {
|
||||
layer.msg('请填写色数!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (count < 5000) {
|
||||
layer.msg('全彩数量需要五千以上!', {offset: ['300px', '300px']}, function () {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
form.render();
|
||||
|
||||
$.ajax({
|
||||
url: "${pageContext.request.contextPath}/getThanSum",
|
||||
type: "GET",
|
||||
data: $(".big_box form").serialize(),
|
||||
success: function (result) {
|
||||
if (result.code != 200) {
|
||||
layer.msg(result.msg, {offset: ['300px', '300px']}, {icon: 5, time: 1000});
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = result.data.proList;
|
||||
var number = $("#number").val();
|
||||
if (level == 0) {
|
||||
@@ -644,7 +792,7 @@
|
||||
2: "23*15*25CM"
|
||||
}
|
||||
var kind = kindData[$(".kindValueCG").val()];
|
||||
var kind2 = kind2Data[$(".kind2Value").val()];
|
||||
var kind2 = kind2Data[$(".kind2Value:not(:disabled)").val()];
|
||||
var count = $(".countCG").val();
|
||||
|
||||
// textarea
|
||||
@@ -738,6 +886,38 @@
|
||||
data[i].number = number;
|
||||
}
|
||||
}
|
||||
} else if (level == 5) {
|
||||
|
||||
let kind2Data = {
|
||||
0: "12*28*10CM",
|
||||
1: "21*27*11CM",
|
||||
2: "24*24*15CM",
|
||||
3: "26*26*17CM",
|
||||
4: "30*30*20CM",
|
||||
}
|
||||
|
||||
var span_result = "铝箔手提袋-" + kind2Data[$(".kind2Value:not(:disabled)").val()] + '\n';
|
||||
if (arr.includes("单色") || arr.includes("彩色")) {
|
||||
arr.push($(".color-print select option:selected").val());
|
||||
}
|
||||
if (arr.includes("全彩")) {
|
||||
arr.push($("input[name='co_number']").val() + "色");
|
||||
}
|
||||
|
||||
span_result += "工艺:" + arr.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;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
var size = $(".size").val();
|
||||
var count = $(".countZDY").val();
|
||||
@@ -831,7 +1011,6 @@
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user