|
@@ -104,13 +104,16 @@ function needUpgrade(newBuyset, oldBuyset) {
|
|
|
|
|
|
if (p_Diff > 0 || p_Diff + c_2_diff > 0 || (p_Diff + c_2_diff === 0 && p_Diff > 1) || p_Diff + c_2_diff + c_1_diff > 0 || (p_Diff + c_2_diff + c_1_diff === 0 && c_2_diff > 1)) {//需要升级
|
|
if (p_Diff > 0 || p_Diff + c_2_diff > 0 || (p_Diff + c_2_diff === 0 && p_Diff > 1) || p_Diff + c_2_diff + c_1_diff > 0 || (p_Diff + c_2_diff + c_1_diff === 0 && c_2_diff > 1)) {//需要升级
|
|
//有多余未使用名额保留
|
|
//有多余未使用名额保留
|
|
- if (p_Diff + c_2_diff + c_1_diff < 0 && c_1_diff < 0) {
|
|
|
|
- c_1_diff = -(p_Diff + c_2_diff)
|
|
|
|
- }
|
|
|
|
- if (p_Diff + c_2_diff < 0 && c_2_diff < 0) {
|
|
|
|
- c_2_diff = -p_Diff
|
|
|
|
|
|
+ if (p_Diff + c_2_diff + c_1_diff < 0) {
|
|
|
|
+ if (c_1_diff < 0 && p_Diff + c_2_diff >= 0) {
|
|
|
|
+ c_1_diff = -(p_Diff + c_2_diff)
|
|
|
|
+ }
|
|
|
|
+ if (c_2_diff < 0 && p_Diff + c_1_diff >= 0) {
|
|
|
|
+ c_2_diff = -(p_Diff + c_1_diff)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
AreaNeedUpgrade = true;
|
|
AreaNeedUpgrade = true;
|
|
//计算升级后的buySet
|
|
//计算升级后的buySet
|
|
if (p_Diff < 0) { //有剩余省份未使用
|
|
if (p_Diff < 0) { //有剩余省份未使用
|
|
@@ -169,7 +172,7 @@ function needUpgrade(newBuyset, oldBuyset) {
|
|
var index_flag = 0;
|
|
var index_flag = 0;
|
|
for (; del_2_flag > 0 || del_1_flag > 0;) {
|
|
for (; del_2_flag > 0 || del_1_flag > 0;) {
|
|
var valueFlag = UpgradeBuyset.citys[index_flag];
|
|
var valueFlag = UpgradeBuyset.citys[index_flag];
|
|
- console.log(del_2_flag, del_1_flag, UpgradeBuyset.citys);
|
|
|
|
|
|
+ //console.log(del_2_flag, del_1_flag, UpgradeBuyset.citys);
|
|
if (del_2_flag > 0 && valueFlag === 2) {
|
|
if (del_2_flag > 0 && valueFlag === 2) {
|
|
//UpgradeBuyset.citys = append(UpgradeBuyset.citys[:index_flag], UpgradeBuyset.citys[index_flag+1:]...)
|
|
//UpgradeBuyset.citys = append(UpgradeBuyset.citys[:index_flag], UpgradeBuyset.citys[index_flag+1:]...)
|
|
UpgradeBuyset.citys.splice(index_flag, 1);
|
|
UpgradeBuyset.citys.splice(index_flag, 1);
|
|
@@ -330,13 +333,13 @@ function getSubPrice(oldBuyset, newBuyset, start, end) {
|
|
newPrice = numAdd(newPrice, getsubVipOrderPriceBybuyset(newBuyset, [t[0], 1]))
|
|
newPrice = numAdd(newPrice, getsubVipOrderPriceBybuyset(newBuyset, [t[0], 1]))
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- console.log("old ", oldBuyset, " \n new ", newBuyset, " \n 相差", t[0], "年 ", t[1], "个月\n price:", newPrice, "-", beforePrice, "=", (newPrice * 1000 - beforePrice * 1000) / 1000);
|
|
|
|
- return (newPrice * 1000 - beforePrice * 1000) / 1000
|
|
|
|
|
|
+ console.log("old ", oldBuyset, " \n new ", newBuyset, " \n 相差", t[0], "年 ", t[1], "个月\n price:", newPrice, "-", beforePrice, "=", (newPrice * 10000 - beforePrice * 10000) / 10000);
|
|
|
|
+ return (newPrice * 10000 - beforePrice * 10000) / 10000
|
|
}
|
|
}
|
|
|
|
|
|
//小数相加
|
|
//小数相加
|
|
function numAdd(num1, num2) {
|
|
function numAdd(num1, num2) {
|
|
- return (num1 * 1000 + num2 * 1000) / 1000
|
|
|
|
|
|
+ return (num1 * 10000 + num2 * 10000) / 10000
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|