修改条幅价格
This commit is contained in:
@@ -1767,24 +1767,20 @@ public class PriceUtils {
|
||||
}
|
||||
|
||||
} else {
|
||||
double[] areas = null;
|
||||
int[] prices = null;
|
||||
double last_price = 0;
|
||||
double min_price = 0;
|
||||
if ((width == 0.5 && length == 3 && count == 1) || (width == 3 && length == 0.5 && count == 1)) {
|
||||
price = 24 * area;
|
||||
} else if (area <= 1) {
|
||||
price = 35;
|
||||
} else if (area <= 2) {
|
||||
price = 30 * area;
|
||||
} else if (area <= 3) {
|
||||
price = 24 * area;
|
||||
} else if (area <= 4) {
|
||||
price = 21 * area;
|
||||
} else if (area <= 5) {
|
||||
price = 18 * area;
|
||||
} else if (area <= 10) {
|
||||
price = 16 * area;
|
||||
} else {
|
||||
price = 13 * area;
|
||||
areas = new double[]{1, 2, 3, 4, 5, 10};
|
||||
prices = new int[]{35, 30, 24, 21, 18, 16};
|
||||
last_price = 13;
|
||||
min_price += 40;
|
||||
price = Math.max(TableUnitPrice(area, prices, areas, last_price), min_price);
|
||||
|
||||
}
|
||||
price = price > 40 ? price : 40;
|
||||
}
|
||||
pro.setCount(count);
|
||||
pro.setPrice(Math.ceil(price));
|
||||
@@ -3428,7 +3424,7 @@ public class PriceUtils {
|
||||
endIndex = Math.min(i + 1, areas.length - 1);
|
||||
}
|
||||
}
|
||||
if (startIndex == 0) {
|
||||
if (startIndex == endIndex && startIndex == 0) {
|
||||
price = price_list[endIndex];
|
||||
} else if (startIndex == endIndex) {
|
||||
price = (price_list[endIndex] / areas[endIndex]) * area;
|
||||
@@ -3438,6 +3434,35 @@ public class PriceUtils {
|
||||
return price;
|
||||
}
|
||||
|
||||
public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) {
|
||||
double price = 0;
|
||||
int startIndex = 0;
|
||||
int endIndex = 0;
|
||||
boolean islast = false;
|
||||
for (int i = 0; i < areas.length; i++) {
|
||||
if (area > areas[i]) {
|
||||
startIndex = endIndex;
|
||||
endIndex = Math.min(i + 1, areas.length - 1);
|
||||
}
|
||||
if (area == areas[i]) {
|
||||
endIndex = startIndex = i;
|
||||
}
|
||||
if (area > areas[i] && i == areas.length - 1) {
|
||||
islast = true;
|
||||
}
|
||||
}
|
||||
if (startIndex == endIndex && startIndex == 0) {
|
||||
price = price_list[endIndex];
|
||||
} else if (startIndex == endIndex) {
|
||||
price = (price_list[endIndex] * areas[endIndex] / areas[endIndex]) * area;
|
||||
} else {
|
||||
price = (price_list[startIndex] * areas[startIndex] + price_list[endIndex] * areas[endIndex]) / (areas[startIndex] + areas[endIndex]) * area;
|
||||
}
|
||||
price = islast ? last_price * area : price;
|
||||
return Math.ceil(price);
|
||||
}
|
||||
|
||||
|
||||
public double CalculatePrice(List<String> craft_list, double count, int coNumber, double countNum) {
|
||||
if (craft_list.contains("烫画")) {
|
||||
return (int) count * 120;
|
||||
|
||||
Referens i nytt ärende
Block a user