Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
Журнал изменений История Git Файлы Tilda MCP Каталог файловtilda-cart-1.1.js Следить за файлом 5801 /**5802 * Синхронизирует способы оплаты с disablePaySys текущей доставки.5803 *5804 * Контракт publish (t706 / tpl_forms_inputs):5805 * - 0 ПС — нет data-payment-system, нет radio5806 * - 1 ПС — только data-payment-system5807 * - >=2 ПС — data-payment-system + radio-блок5808 *5809 * `card` в disablePaySys — скрыть все ПС кроме cash.5810 * Если для доставки нет доступных ПС — system = 'none' и force_none = 15811 * (чтобы формы не подменяли none на другую ПС).5812 История файла и сравнение версий * Предпочтительная ПС для доставки хранится в data-selected-pay-sys на radio доставки.
5814 * @param {string[]} [disabledPaySystems] - явный список; если не передан, берётся из выбранной доставки5817 function tcart__syncPaymentMethodsForDelivery(disabledPaySystems) {5818 const paymentWrapper = document.querySelector('.t706 .t-form .t-radio__wrapper-payment');5819 const paymentGroup = document.querySelector('.t706 .t-input-group_pm');5820 const selectedDelivery = document.querySelector('.t706 .t-form .t-radio__wrapper-delivery input:checked');5821 const cartRoot = tcart__getCartBlock();5822 const projectPaymentSystem = (cartRoot && cartRoot.getAttribute('data-payment-system')) || '';5823 const hasProjectPaymentSystem = !!projectPaymentSystem && projectPaymentSystem !== 'none';5824 const paymentInputs = paymentWrapper5825 ? Array.prototype.slice.call(paymentWrapper.querySelectorAll('input[data-payment-variant-system]'))5828 let paySystemsToDisable = disabledPaySystems;5829 if (typeof paySystemsToDisable === 'undefined') {5830 if (selectedDelivery) {5831 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)5832 // @ts-expect-error ST-2949_55833 paySystemsToDisable = tcart__getDisablePaySysByDelivery(selectedDelivery);5834 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)5835 // @ts-expect-error ST-2949_15836 } else if (Array.isArray(window.tcart.delivery?.disablePaySys)) {5837 // @ts-expect-error ST-2949_15838 paySystemsToDisable = window.tcart.delivery.disablePaySys;5840 paySystemsToDisable = [];5843 if (!Array.isArray(paySystemsToDisable)) {5844 paySystemsToDisable = [];5848 * Пишет runtime-выбор ПС. force_none — только когда ПС в проекте есть,5849 * но для выбранной доставки все недоступны (гибкие настройки ПС для доставки).5851 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)5852 // @ts-expect-error ST-2949_25853 function setPaymentSystem(system, options) {5854 const forceNone = options && options.forceNone === true;5857 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)5858 // @ts-expect-error ST-2949_15859 window.tcart.force_none = 1;5861 // @ts-expect-error ST-2949_15862 delete window.tcart.force_none;5863 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)5864 // @ts-expect-error ST-2949_55865 tcart__rememberSelectedPaySys(selectedDelivery, system);5868 if (cartRoot) cartRoot.setAttribute('data-payment-variant-system', system);5869 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)5870 // @ts-expect-error ST-2949_15871 window.tcart.system = system;5874 /** Снимает checked до disabled — иначе radio может остаться :checked */5875 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)5876 // @ts-expect-error ST-2949_25877 function uncheckPaymentInput(paymentInput) {5878 paymentInput.disabled = false;5879 paymentInput.checked = false;5880 paymentInput.removeAttribute('checked');5883 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)5884 // @ts-expect-error ST-2949_25885 function setPaymentInputAvailability(paymentInput, isAvailable) {5886 const paymentControl = paymentInput.closest('.t-radio__control');5889 paymentInput.disabled = false;5890 if (paymentControl) paymentControl.style.display = '';5894 uncheckPaymentInput(paymentInput);5895 paymentInput.disabled = true;5896 if (paymentControl) paymentControl.style.display = 'none';5899 function applyNonePaymentSystem() {5900 paymentInputs.forEach(function (paymentInput) {