修改撕撕乐价格

This commit is contained in:
2026-06-29 09:58:49 +08:00
parent b55d238e5d
commit 49e691eb9d
2 changed files with 117 additions and 74 deletions
@@ -5651,61 +5651,93 @@ public class ProductService {
int count = dto.getCount();
int number = dto.getNumber();
int awards = dto.getAwards();
int[][] prices = {
{900, 900, 1000, 1000},
{950, 950, 1100, 1100},
{1022, 1023, 1200, 1200},
{1591, 1591, 1628, 1744},
{1932, 1932, 1977, 2093},
{2273, 2273, 2326, 2558},
{3409, 3409, 3488, 3953},
{5682, 5682, 5814, 6512},
{11818, 11818, 12791, 13721},
};
double mini_price = 1000;
int[] prices = {80, 80, 75, 70, 65, 60, 55, 50, 45};
if (craft_list.contains("单面哑膜")) {
prices = new int[][]{
{1000, 1000, 1050, 1050},
{1110, 1110, 1110, 1110},
{1222, 1222, 1550, 1650},
{1778, 1778, 1778, 1889},
{2111, 2111, 2111, 2222},
{2444, 2444, 2444, 2667},
{3778, 3778, 3778, 4222},
{6222, 6222, 6222, 6889},
{13333, 13333, 13778, 15333},
};
prices = new int[]{85, 85, 80, 75, 70, 65, 60, 55, 50};
mini_price = 1100;
}
int price_index = 0;
if ((width > 4.0 || length > 6.0) && (length > 4.0 || width > 6.0)) {
price_index = 1;
if (craft_list.contains("异形模切")) {
mini_price += 300;
}
if ((width > 9.0 || length > 5.4) && (length > 9.0 || width > 5.4)) {
price_index = 2;
}
if ((width > 6.0 || length > 7.0) && (length > 6.0 || width > 7.0)) {
price_index = 3;
if (craft_list.contains("打码")) {
mini_price += 250;
}
int[] counts = {200, 500, 1000, 2000, 3000, 5000, 10000, 20000, 50000};
for (int i = 0; i < counts.length; i++) {
int itemCount = counts[i];
if (count > itemCount) {
continue;
}
if (priceList.size() > 2) {
break;
}
if (count > counts[counts.length - 1]) {
double awards_price = 0;
if (itemCount <= 10000) {
if (awards > 5) {
awards_price = 30 * Math.max((awards - 5), 0);
if (awards > 5) {
awards_price = 30 * Math.max((awards - 5), 0);
}
double craft_price = 0;
double craft_base = 0;
if (craft_list.contains("异形模切")) {
craft_base = 0.02;
if (count >= 100000) {
craft_base = 0.015;
}
craft_price += craft_base * count;
}
if (craft_list.contains("打码")) {
craft_base = 0.02;
if (count >= 100000) {
craft_base = 0.015;
}
craft_price += craft_base * count;
}
Product pro = new Product();
pro.setCount(itemCount);
pro.setCount(count);
pro.setNumber(number);
pro.setPrice(Math.ceil((prices[i][price_index] + awards_price) * number));
pro.setPrice(Math.ceil(Math.max((prices[prices.length - 1] * count * width * length / 10000 + awards_price + craft_price), mini_price) * number));
priceList.add(pro);
} else {
for (int i = 0; i < counts.length; i++) {
int itemCount = counts[i];
if (count > itemCount) {
continue;
}
if (priceList.size() > 2) {
break;
}
double awards_price = 0;
if (itemCount <= 10000) {
if (awards > 5) {
awards_price = 30 * Math.max((awards - 5), 0);
}
}
double craft_price = 0;
double craft_base = 0;
if (craft_list.contains("异形模切")) {
craft_base = 0.025;
if (itemCount >= 50000) {
craft_base = 0.02;
}
craft_price += craft_base * itemCount;
}
if (craft_list.contains("打码")) {
craft_base = 0.03;
if (itemCount >= 50000) {
craft_base = 0.02;
}
craft_price += craft_base * itemCount;
}
Product pro = new Product();
pro.setCount(itemCount);
pro.setNumber(number);
pro.setPrice(Math.ceil(Math.max((prices[i] * itemCount * width * length / 10000 + awards_price + craft_price), mini_price) * number));
priceList.add(pro);
}
}
return priceList;
}
+42 -31
View File
@@ -35,7 +35,9 @@
<input type="text" placeholder="格式:长*宽" name="size" id="size" class="layui-input">
</div>
<p>
数量
数量<span>
<input type="checkbox" name="switchCount" lay-filter="switchCount" title="自定义数量">
</span>
</p>
<div class="layui-form-item">
<select name="count" id="count" class="layui-form-select" lay-filter="pcount_filter">
@@ -50,6 +52,10 @@
<option value="50000">50000</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>
@@ -61,18 +67,7 @@
奖项
</p>
<div class="layui-form-item">
<select class="layui-form-select" name="awards">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<input type="text" placeholder="请输入整数" autocomplete="off" name="awards" id="awards" value="1" class="layui-input">
</div>
<p>
客户旺旺
@@ -87,15 +82,17 @@
<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 readonly>
<input type="checkbox" name="craft" lay-filter="ui_craft" value="双面印刷" title="双面印刷" checked>
</div>
<div class="layui-input-block">
裁切工艺:
<input type="checkbox" name="craft" lay-filter="ui_craft" value="直角裁切" title="直角裁切" checked readonly>
<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 fumo">
常见工艺:
<input type="checkbox" name="craft" lay-filter="ui_craft" value="手撕线" title="手撕线" checked readonly>
<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 fumo">
覆膜工艺:
@@ -150,6 +147,7 @@
var html = " ";
var remark = " ";
const carft_list1 = ["不覆膜", "单面哑膜"];
const carft_list2 = ["直角裁切", "异形模切"];
// 清空轮播图
$("#carousel").empty();
@@ -188,7 +186,20 @@
}
}
});
form.on('checkbox(switchCount)', function (data) {
$("#diyCount").parent().hide()
$("#count").parent().show()
$("#count").attr("disabled", false);
$("#diyCount").attr("disabled", true);
if (data.elem.checked) {
$("#diyCount").parent().show()
$("#count").parent().hide()
$("#count").attr("disabled", true);
$("#diyCount").attr("disabled", false);
}
form.render();
})
form.on('checkbox(ui_craft)', function (data) {
let craft_list = [];
@@ -208,17 +219,9 @@
return false;
}
if (!craft_list.includes("直角裁切")) {
$(data.elem).prop("checked", true);
layer.msg("裁切工艺不能取消选择", {offset: ['300px', '300px']}, function () {
});
form.render();
return false;
}
if (!craft_list.includes("手撕线")) {
$(data.elem).prop("checked", true);
layer.msg("常见工艺不能取消选择", {offset: ['300px', '300px']}, function () {
layer.msg("手撕线工艺不能取消选择", {offset: ['300px', '300px']}, function () {
});
form.render();
return false;
@@ -232,6 +235,14 @@
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;
}
if (data.value == '抠图') {
$(".crop").hide();
@@ -263,12 +274,12 @@
});
return false;
}
if ((size.split("*")[0] > 11 || size.split("*")[1] > 9) && (size.split("*")[1] > 11 || size.split("*")[0] > 9)) {
layer.msg('撕撕乐最大尺寸11*9cm', {offset: ['300px', '300px']}, function () {
if ((size.split("*")[0] > 42 || size.split("*")[1] > 28.5) && (size.split("*")[1] > 42 || size.split("*")[0] > 28.5)) {
layer.msg('撕撕乐最大尺寸42*28.5cm', {offset: ['300px', '300px']}, function () {
});
return false;
}
craft.push($("select[name='awards'] option:selected").val() + "个奖项");
craft.push($("input[name='awards']").val() + "个奖项");
$("input:checkbox[name='craft']:checked").each(function (i) {
// 没有被禁用的工艺加到arr中
if (!$(this).is(':disabled')) {
@@ -309,9 +320,9 @@
}
span_result += '包邮,免费设计呢~(偏远地区需补邮费)'
if(window.parent.system_isGai){
span_result +="\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!"
}
if (window.parent.system_isGai) {
span_result += "\n\n亲 现在下单可以参加淘宝活动8.5折折扣哦!"
}
addLog(span_result);
$("#span_result").val(span_result);