merge release/dyn-243_elt

This commit is contained in:
Chika 2021-09-09 13:15:39 +03:00
parent 81c60bd90e
commit 4b004f0573
4 changed files with 50 additions and 4 deletions

View File

@ -45,7 +45,8 @@ export default function (this: ICalculationStore) {
const region = this.getOption('selectLegalClientRegion');
const city = this.getOption('selectLegalClientTown');
const kladr = get(city, 'evo_kladr_id') || get(region, 'evo_kladr_id');
const brandId = this.getOption('selectBrand')?.evo_id;
const brand = this.getOption('selectBrand');
const brandId = brand?.evo_id;
const modelId = this.getOption('selectModel')?.evo_id;
const isNew = !this.getValue('leaseObjectUsed');
@ -53,6 +54,13 @@ export default function (this: ICalculationStore) {
const power = this.getValue('leaseObjectMotorPower');
const powerSpecified = getSpecified(power);
let country = 0,
countrySpecified = false;
if (brand?.evo_brand_owner === 100000001) {
country = 1;
countrySpecified = true;
}
let engineType = '5';
const engineTypeValue = this.getValue('engineType');
if (engineTypeValue) {
@ -66,6 +74,26 @@ export default function (this: ICalculationStore) {
const cost =
this.getValue('leaseObjectPrice') - this.getValue('supplierDiscountRub');
const leaseObjectCategory = this.getValue('leaseObjectCategory');
let notConfirmedGlassesDamages,
notConfirmedGlassesDamagesSpecified = false,
notConfirmedDamages,
notConfirmedDamagesSpecified = false,
selfIgnition = false,
selfIgnitionSpecified = false,
outsideRoads,
outsideRoadsSpecified = false;
if (leaseObjectCategory === 100000002) {
notConfirmedGlassesDamages = 3;
notConfirmedGlassesDamagesSpecified = true;
notConfirmedDamages = 2;
notConfirmedDamagesSpecified = true;
// selfIgnition = true;
selfIgnitionSpecified = true;
outsideRoads = true;
outsideRoadsSpecified = true;
}
const franchise = parseInt(this.getValue('insFranchise') || 0);
const franchiseSpecified = getSpecified(franchise);
const puuMark = this.getOption('selectGPSBrand')?.evo_id;
@ -141,6 +169,8 @@ export default function (this: ICalculationStore) {
engineVolumeSpecified: true,
KPPTypeId: 1,
BodyType: 9,
country,
countrySpecified,
},
duration,
bankId: '245',
@ -151,6 +181,14 @@ export default function (this: ICalculationStore) {
STOA: '0',
OfficialDealerSpecified: true,
OfficialDealer: true,
notConfirmedGlassesDamages,
notConfirmedGlassesDamagesSpecified,
notConfirmedDamages,
notConfirmedDamagesSpecified,
selfIgnition,
selfIgnitionSpecified,
outsideRoads,
outsideRoadsSpecified,
PUUs: puuMark && [
{
mark: puuMark,

View File

@ -22,17 +22,23 @@ export const requiredFields: ElementsNames[] = [
export const conditions: TElements<ValidationCondition> = {
selectLeaseObjectType: calculationStore => {
const leaseObjectType = calculationStore.getOption('selectLeaseObjectType');
if (['9', '11'].includes(leaseObjectType?.evo_id || '')) {
if (
leaseObjectType?.evo_id &&
['9', '11'].includes(leaseObjectType?.evo_id)
) {
return {
isValid: false,
message: `По данному Типу предмета лизинга возможен только индивидуальный запрос тарифов КАСКО и ОСАГО. Просьба обратиться на адрес strakhovka@evoleasing.ru`,
};
}
if (leaseObjectType?.evo_id !== '1') {
if (
leaseObjectType?.evo_id &&
!['1', '2', '3', '7'].includes(leaseObjectType?.evo_id)
) {
return {
isValid: false,
message: `Для выбранной категории ТС расчет в ЭЛТ временно недоступен`,
message: `Для выбранной категории ТС расчет в ЭЛТ недоступен`,
};
}
return {

View File

@ -81,6 +81,7 @@ const query = gql`
evo_id
evo_name
evo_brandid
evo_brand_owner
evo_importer_reward_perc
evo_importer_reward_rub
evo_vehicle_type

View File

@ -158,6 +158,7 @@ export interface IEvoLeasingObjectType {
export interface IEvoBrand {
evo_name?: string;
evo_brandid?: string;
evo_brand_owner?: number;
evo_importer_reward_perc?: number;
evo_importer_reward_rub?: number;
statecode?: number;