Merge branch 'development'
This commit is contained in:
commit
287c94d92f
@ -62,10 +62,27 @@ export default function (this: ICalculationStore) {
|
||||
const model = this.getOption('selectModel');
|
||||
let modelId = model?.evo_id;
|
||||
|
||||
const isNew = !this.getValue('leaseObjectUsed');
|
||||
const leaseObjectUsed = this.getValue('leaseObjectUsed');
|
||||
const product = this.getOption('selectProduct');
|
||||
const leaseObjectYear = this.getValue('leaseObjectYear');
|
||||
let isNew = true;
|
||||
if (
|
||||
leaseObjectUsed === true ||
|
||||
(leaseObjectUsed === false &&
|
||||
product?.evo_sale_without_nds === true &&
|
||||
leaseObjectYear !== currentDate.getFullYear())
|
||||
) {
|
||||
isNew = false;
|
||||
}
|
||||
|
||||
const vehicleYear = this.getValue('leaseObjectYear');
|
||||
let vehicleDate;
|
||||
if (this.getValue('leaseObjectUsed')) {
|
||||
if (
|
||||
leaseObjectUsed === true ||
|
||||
(leaseObjectUsed === false &&
|
||||
product?.evo_sale_without_nds === true &&
|
||||
leaseObjectYear !== currentDate.getFullYear())
|
||||
) {
|
||||
vehicleDate = new Date(`${vehicleYear}-01-01`);
|
||||
}
|
||||
let vehicleDateSpecified = getSpecified(vehicleDate);
|
||||
@ -78,7 +95,7 @@ export default function (this: ICalculationStore) {
|
||||
if (
|
||||
leaseObjectCategory === 100000002 ||
|
||||
(leaseObjectType?.evo_id &&
|
||||
['6', '9', '10'].includes(leaseObjectType?.evo_id))
|
||||
['6', '9', '10', '8'].includes(leaseObjectType?.evo_id))
|
||||
)
|
||||
if (brand?.evo_brand_owner === 100000001) {
|
||||
country = 1;
|
||||
@ -96,10 +113,12 @@ export default function (this: ICalculationStore) {
|
||||
duration = 12;
|
||||
}
|
||||
const cost =
|
||||
this.getValue('leaseObjectPrice') -
|
||||
this.getValue('supplierDiscountRub') -
|
||||
//@ts-ignore
|
||||
this.importProgramSum();
|
||||
(this.plPriceRub() || 0) -
|
||||
(this.getValue('supplierDiscountRub') || 0) -
|
||||
//@ts-ignore
|
||||
(this.importProgramSum() || 0) +
|
||||
(this.getValue('addEquipmentPrice') || 0);
|
||||
|
||||
let notConfirmedGlassesDamages,
|
||||
notConfirmedGlassesDamagesSpecified = false,
|
||||
@ -155,9 +174,18 @@ export default function (this: ICalculationStore) {
|
||||
const maxAllowedMassSpecified = getSpecified(maxAllowedMass);
|
||||
|
||||
let mileage = 0;
|
||||
if (this.getValue('leaseObjectUsed')) {
|
||||
if (leaseObjectUsed === true) {
|
||||
mileage = this.getValue('mileage');
|
||||
}
|
||||
|
||||
if (
|
||||
leaseObjectUsed === false &&
|
||||
product?.evo_sale_without_nds === true &&
|
||||
leaseObjectYear !== currentDate.getFullYear()
|
||||
) {
|
||||
mileage = 0;
|
||||
}
|
||||
|
||||
const mileageSpecified = getSpecified(mileage);
|
||||
|
||||
let vehicleUsage = 0;
|
||||
|
||||
@ -19,6 +19,7 @@ export const requiredFields: ElementsNames[] = [
|
||||
export const conditions: Partial<Record<ElementsNames, ValidationCondition>> = {
|
||||
selectLeaseObjectType: calculationStore => {
|
||||
const leaseObjectType = calculationStore.getOption('selectLeaseObjectType');
|
||||
// Проверяем на мотоцикл
|
||||
if (leaseObjectType?.evo_id && ['11'].includes(leaseObjectType?.evo_id)) {
|
||||
return {
|
||||
isValid: false,
|
||||
@ -28,7 +29,9 @@ export const conditions: Partial<Record<ElementsNames, ValidationCondition>> = {
|
||||
|
||||
if (
|
||||
leaseObjectType?.evo_id &&
|
||||
!['1', '2', '3', '6', '7', '9', '10'].includes(leaseObjectType?.evo_id)
|
||||
!['1', '2', '3', '6', '7', '8', '9', '10'].includes(
|
||||
leaseObjectType?.evo_id,
|
||||
)
|
||||
) {
|
||||
return {
|
||||
isValid: false,
|
||||
@ -93,24 +96,7 @@ export const conditions: Partial<Record<ElementsNames, ValidationCondition>> = {
|
||||
isValid: true,
|
||||
};
|
||||
},
|
||||
selectEngineType: calculationStore => {
|
||||
const engineType = calculationStore.getValue('engineType');
|
||||
|
||||
if (!engineType) {
|
||||
if (['8'].includes(engineType?.evo_id || ''))
|
||||
return {
|
||||
isValid: true,
|
||||
};
|
||||
else
|
||||
return {
|
||||
isValid: false,
|
||||
message: 'Не указан тип двигателя',
|
||||
};
|
||||
}
|
||||
return {
|
||||
isValid: true,
|
||||
};
|
||||
},
|
||||
cbxInsDecentral: calculationStore => {
|
||||
const insDecentral = calculationStore.getValue('insDecentral');
|
||||
if (insDecentral) {
|
||||
|
||||
Reference in New Issue
Block a user