Есть условие, но оно громоздко, как вы можете уменьшить это?Или напишите функцию, к которой можно обратиться.
if (obj.Language.code == "ru") {
if (obj.Tariff.typeCalc != 1) {
if (obj.Price.Discount) {
t = t + getText(obj.Language.code, 'PriceWithDiscount', [Round(obj.Price.Itog), final_currency]);
}
else {
t = t + getText(obj.Language.code, 'PriceNoDiscount', [Round(obj.Price.Itog), final_currency]);
}
}
else {
if (obj.Price.Discount) {
t = t + getText(obj.Language.code, 'PriceWithDiscount', [Round(obj.Price.Itog), obj.Currency.symbol]);
}
else {
t = t + getText(obj.Language.code, 'PriceNoDiscount', [Round(obj.Price.Itog), obj.Currency.symbol]);
}
}
дизайн
if (obj.Language.code == "ru") {
}
else {
}
будут часто встречаться, не хотят накапливаться
if (obj.Language.code == "ru") {
if (obj.Price.Discount) {
t = t + getText(obj.Language.code, 'PriceWithDicountOutCity', [obj.Price.Itog, final_currency, Round(obj.Len.value, final_currency), nextkmprice]);
}
else {
t = t + getText(obj.Language.code, 'PriceOutCity', [obj.Price.Itog, final_currency, Round(obj.Len.value, final_currency), nextkmprice]);
}
}
else {
if (obj.Price.Discount) {
t = t + getText(obj.Language.code, 'PriceWithDicountOutCity', [obj.Price.Itog, obj.Currency.symbol, Round(obj.Len.value, obj.Currency.symbol), nextkmprice]);
}
else {
t = t + getText(obj.Language.code, 'PriceOutCity', [obj.Price.Itog, obj.Currency.symbol, Round(obj.Len.value, obj.Currency.symbol), nextkmprice]);
}
}