Merge branch 'bx-1047-main' of https://git.svs-tech.pro/ksenia_mikhailova/mns-mini-zabor into bx-1047-main

This commit is contained in:
commit 26140aca6c
2 changed files with 17 additions and 12 deletions

View File

@ -15,6 +15,12 @@ const extra_section = use_extra_section()
const total_length = use_total_length()
const min_length = use_min_length()
if (!pillar_color.value) {
const r = Math.floor(Math.random() * predefPillarColors.length)
pillar_color.value = predefPillarColors[r] as ralTypes
lamelle_color.value = predefLamelleColors[r] as ralTypes
}
const parametric = reactive({
length: {
min: min_length.value,
@ -51,7 +57,7 @@ const form_refs = {
}
const changeParametres = () => {
// console.log(form_state.total_length * 1000, copy_form_state.total_length * 1000)
// console.log('form', form_state.total_length * 1000, 'copy', copy_form_state.total_length * 1000)
const lamelles = Math.floor(form_state.height / parametric.height.step)
@ -67,9 +73,6 @@ const changeParametres = () => {
}
}
if (!form_state.auto_length && (form_state.length > form_state.total_length_mm)) {
form_state.length = form_state.total_length_mm
}
form_state.total_length_mm = form_state.total_length * 1000
let { fence_length, total_length_mm, auto_length, length, full_sections } = form_state
@ -107,8 +110,8 @@ const changeParametres = () => {
}
form_state.full_sections = full_sections
form_state.length = length
form_state.fence_length = fence_length
form_state.length = typeof length == 'string' ? parseFloat(length) : length
form_state.fence_length = typeof fence_length == 'string' ? parseFloat(fence_length) : fence_length
copy_form_state = Object.assign({}, form_state)
@ -133,7 +136,7 @@ watch(() => form_state, changeParametres, { deep: true })
const isModalOpen = useState('modal_open', () => false)
const toggleModal = () => {
isModalOpen.value = !isModalOpen.value
if(isModalOpen.value == true) {
if (isModalOpen.value == true) {
document.body.classList.add('modal-opened')
} else {
document.body.classList.remove('modal-opened')
@ -159,7 +162,7 @@ const goal = (target: string, params: object) => {
</div>
<div class="form-item w-full">
<label for="height">Высота забора, мм</label>
<input disabled :value="`${form_state.height.toFixed(0)} мм`" class="w-28" />
<input disabled :value="`${form_state.height} мм`" class="w-28" />
<input id="height" type="range" class="xl:w-full" v-bind="parametric.height"
v-model="form_state.height" :ref="form_refs.height" />
</div>
@ -185,12 +188,13 @@ const goal = (target: string, params: object) => {
<div class="form-row">
<div class="form-item">
<label for="total_length">Общая длина забора, м</label>
<input type="number" id="total_length" v-bind="parametric.total_length"
<input type="number" id="total_length" v-bind="parametric.total_length" min=0
v-model="form_state.total_length" :ref="form_refs.total_length" />
</div>
<div class="form-item xl:w-2/4 text-sm xl:text-base">
<p v-if="form_state.total_length_mm < parametric.length.min" class="text-ioprim">
Выбранный размер забора слишком мал для расчета стоимости. Пожалуйста, выберите больший размер, чтобы продолжить.
Выбранный размер забора слишком мал для расчета стоимости. Пожалуйста, выберите больший
размер, чтобы продолжить.
</p>
<p v-if="form_state.extra_section" class="text-ioprim">
Внимание! Дополнительная секция приводит к увеличению стоимости.

View File

@ -5,12 +5,13 @@ export const predefLamelleColors = ['3009', '9003', '6027', '5024', '9001', '101
const n = 2
const min = 1300
export const use_lamelle_height = () => useState<number>('lamelle_height', () => 0.115)
export const use_lamelles_count = () => useState('lamelles_count', () => 14)
export const use_fence_section = () => useState<number>('fence_section', () => min * 0.001)
export const use_remove_pillar = () => useState<boolean>('remove_pillar', () => false)
export const use_pillar_color = () => useState<ralTypes>('pillar_color', () => predefPillarColors[Math.floor(Math.random() * predefPillarColors.length)] as ralTypes)
export const use_lamelle_color = () => useState<ralTypes>('lamelle_color', () => predefLamelleColors[Math.floor(Math.random() * predefLamelleColors.length)] as ralTypes)
export const use_pillar_color = () => useState<ralTypes>('pillar_color')
export const use_lamelle_color = () => useState<ralTypes>('lamelle_color')
export const use_section_count = () => useState('section_count', () => n)
export const use_extra_section = () => useState('extra_section', () => 0)
export const use_total_length = () => useState('total_length', () => (((min + 104) * n) + 104) * 0.001)